@a-t-h-i/bot-lobby 0.7.7 → 0.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/prompts/global.md +12 -0
- package/prompts/planner.md +1 -0
- package/src/index.ts +0 -2
- package/src/lobby/feed.ts +0 -17
- package/src/lobby/prompts.ts +2 -1
- package/src/lobby/service.ts +8 -6
- package/src/lobby/session-files.ts +1 -3
- package/src/pi/auto-compaction.ts +2 -7
- package/src/pi/events.ts +2 -4
- package/src/pi/start-task-tool.ts +2 -2
- package/src/pi/start-task.ts +0 -3
- package/src/schemas/configuration.ts +2 -4
- package/src/webui/dev/fake-service.ts +1 -0
- package/src/webui/uploads.ts +4 -1
- package/webui/dist/assets/{CodeSurface-Bdwcvvjq.js → CodeSurface-BXKTcTX4.js} +3 -3
- package/webui/dist/assets/{TerminalView-C_s6eMHt.js → TerminalView-G0U6azdh.js} +2 -2
- package/webui/dist/assets/abnfDiagram-WEYOIA3C-CQfUv7tM.js +1 -0
- package/webui/dist/assets/architecture-WOLXFQ4H-CBUDmRkZ.js +1 -0
- package/webui/dist/assets/architectureDiagram-ZHVYKT53-3iqQiZUb.js +36 -0
- package/webui/dist/assets/{astro-p42oEArs.js → astro-uzna3x9Z.js} +1 -1
- package/webui/dist/assets/blockDiagram-RJAE7QA3-1mrw9txr.js +140 -0
- package/webui/dist/assets/c4Diagram-XDPPPE54-GZX2Pj4O.js +38 -0
- package/webui/dist/assets/{ccount-DQxSH8e6.js → ccount-BNWSQYgZ.js} +1 -1
- package/webui/dist/assets/channel-Cazmyqkd.js +1 -0
- package/webui/dist/assets/chunk-2E7WHVMD-Ckcfmn2X.js +88 -0
- package/webui/dist/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/webui/dist/assets/chunk-4EMNKR2T-Bid3Vhb0.js +1 -0
- package/webui/dist/assets/chunk-55XCU76K-DDQEIeDL.js +1 -0
- package/webui/dist/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/webui/dist/assets/chunk-7S6XSTFO-DOTZgLib.js +2 -0
- package/webui/dist/assets/chunk-AQDTSKZB-BTnoxm9G.js +72 -0
- package/webui/dist/assets/chunk-DSNLSHJZ-DR5vMcU3.js +129 -0
- package/webui/dist/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
- package/webui/dist/assets/chunk-HAGFOTED-CfuDcCGk.js +62 -0
- package/webui/dist/assets/chunk-HNE4Q36P-dbbEe03H.js +1 -0
- package/webui/dist/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
- package/webui/dist/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/webui/dist/assets/chunk-NGNAAXSQ-DqoPQk1a.js +136 -0
- package/webui/dist/assets/chunk-NQOKRVIF-HEDkgMZO.js +213 -0
- package/webui/dist/assets/chunk-UHW7PFBP-cpfwtf_y.js +1 -0
- package/webui/dist/assets/chunk-VQ5W62QI-D0Z4cL9v.js +1 -0
- package/webui/dist/assets/chunk-WQQL4CDK-D8fyjSMI.js +10 -0
- package/webui/dist/assets/chunk-XXDRQBXY-xL-zOTs1.js +1 -0
- package/webui/dist/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/webui/dist/assets/chunk-YZO67HFG-9_EURdb9.js +1 -0
- package/webui/dist/assets/chunk-ZAUX2LTX-DEYBt1LH.js +1 -0
- package/webui/dist/assets/chunk-ZCHMQSOR-DqJDVE3V.js +2 -0
- package/webui/dist/assets/classDiagram-v2-4MYWR3UA-BikaVYDw.js +217 -0
- package/webui/dist/assets/cose-bilkent-JH36ORCC-8ARP9UzL.js +1 -0
- package/webui/dist/assets/cynefin-EF2NZ3EQ-C5gVCNYs.js +1 -0
- package/webui/dist/assets/cynefinDiagram-WF24UDRP-Km8vvYV4.js +62 -0
- package/webui/dist/assets/cytoscape.esm-ZKjJ8woK.js +321 -0
- package/webui/dist/assets/d3-scale-lXtN6-Od.js +1 -0
- package/webui/dist/assets/d3-selection-CVV6NVH0.js +1 -0
- package/webui/dist/assets/dagre-NK4GIZVX-D-pbPIWH.js +4 -0
- package/webui/dist/assets/diagram-CBK3MWTC-BEq3Rl3Q.js +24 -0
- package/webui/dist/assets/diagram-I5XIIV2D-BE06Euj9.js +24 -0
- package/webui/dist/assets/diagram-ODIL2UCW-CRDWuxY1.js +30 -0
- package/webui/dist/assets/diagram-PFBEJUXE-oQ5_hzyZ.js +3 -0
- package/webui/dist/assets/diagram-RJA3I4VV-7rP9gMdO.js +41 -0
- package/webui/dist/assets/diagram-TYUNFSNR-VoDAzp17.js +200 -0
- package/webui/dist/assets/dist-niafR-rj.js +1 -0
- package/webui/dist/assets/ebnfDiagram-V4P3TTPT-D5O4cio9.js +1 -0
- package/webui/dist/assets/elk-QONTBCTQ-DyuKZPfr.js +27 -0
- package/webui/dist/assets/erDiagram-KYQIGQAA-D_oY5CqK.js +99 -0
- package/webui/dist/assets/eventmodeling-K75KTNOO-DMksVX5f.js +1 -0
- package/webui/dist/assets/flowDiagram-IUGLLWBU-CxrqOxSt.js +1 -0
- package/webui/dist/assets/ganttDiagram-R7GPNTJY-VgTwTWO_.js +292 -0
- package/webui/dist/assets/gitGraph-VSP46ZUC-B9yFvx8R.js +1 -0
- package/webui/dist/assets/gitGraphDiagram-PDYL7XHY-Cf5fOMDg.js +106 -0
- package/webui/dist/assets/graphlib-DS17s2tU.js +1 -0
- package/webui/dist/assets/{graphql-AVu4aKQX.js → graphql-Dq_Q6ac9.js} +1 -1
- package/webui/dist/assets/index-CYLwFdIb.css +2 -0
- package/webui/dist/assets/{index-CaiRu5B-.js → index-CZxOM0me.js} +35 -29
- package/webui/dist/assets/info-OHQRW6UA-BGbdAFK4.js +1 -0
- package/webui/dist/assets/infoDiagram-MVDRKAX5-CjhZsDTY.js +2 -0
- package/webui/dist/assets/ishikawaDiagram-HPEHV2GE-DlFL4TOg.js +70 -0
- package/webui/dist/assets/{java-DdHNQ9hk.js → java-D7h0NA_A.js} +1 -1
- package/webui/dist/assets/journeyDiagram-BOSHW7O7-DhRduHbx.js +139 -0
- package/webui/dist/assets/{jsx-gTgmArGx.js → jsx-BUUYi3qs.js} +1 -1
- package/webui/dist/assets/kanban-definition-FNSA4HC5-BhwgmH6x.js +89 -0
- package/webui/dist/assets/katex-BXIx1Jgr.js +257 -0
- package/webui/dist/assets/mermaid-parser.core-P9u-eurS.js +7 -0
- package/webui/dist/assets/mermaid.core-C5MgBA3Z.js +44 -0
- package/webui/dist/assets/mindmap-definition-6OY57UG3-BwaUq1Ie.js +98 -0
- package/webui/dist/assets/packet-JDAUHWVQ-Wky7HHl9.js +1 -0
- package/webui/dist/assets/pegDiagram-ECIUJNBX-B7V4rTNg.js +1 -0
- package/webui/dist/assets/{php-C6PDnbTe.js → php-lW4PUsGw.js} +1 -1
- package/webui/dist/assets/pie-XZMESJXO-C5hQ3mq7.js +1 -0
- package/webui/dist/assets/pieDiagram-GNMPY74T-BcHc2Ha9.js +39 -0
- package/webui/dist/assets/quadrantDiagram-D57K4MC3-CEIxAWHV.js +7 -0
- package/webui/dist/assets/radar-ABXABTNO-TmScQcyf.js +1 -0
- package/webui/dist/assets/railroad-I3PHUGI6-BPcOBH5E.js +1 -0
- package/webui/dist/assets/railroad-abnf-LNEFI6M7-BNZDB5i-.js +1 -0
- package/webui/dist/assets/railroad-ebnf-DWYD2UWJ-gSMHjx4R.js +1 -0
- package/webui/dist/assets/railroad-peg-JR7BVNR7-D1a37S4d.js +1 -0
- package/webui/dist/assets/railroadDiagram-Y72NRBL7-C4v5Gnnf.js +1 -0
- package/webui/dist/assets/requirementDiagram-EQYSW5RA-B2fvPiXr.js +84 -0
- package/webui/dist/assets/{rolldown-runtime-hePW80VL.js → rolldown-runtime-Dd_uD5pT.js} +1 -1
- package/webui/dist/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/webui/dist/assets/{ruby-CPL7DL0w.js → ruby-DDU-xGaZ.js} +1 -1
- package/webui/dist/assets/sankeyDiagram-SY24JHO5-BIFti2Z0.js +40 -0
- package/webui/dist/assets/sequenceDiagram-BLEHNHQU-BBJIc0_a.js +169 -0
- package/webui/dist/assets/sizeCapture-INFHLROL-3uHXrFqA.js +1 -0
- package/webui/dist/assets/stateDiagram-v2-A6IESKWZ-Df02feyE.js +291 -0
- package/webui/dist/assets/{svelte-DKhxH1PN.js → svelte-BwxZAPCy.js} +1 -1
- package/webui/dist/assets/swimlanes-B3ENRKFQ-D2TlHhuO.js +1 -0
- package/webui/dist/assets/swimlanesDiagram-AYQRV4AK-rDRGaRKR.js +8 -0
- package/webui/dist/assets/timeline-definition-JXYKGLGB-CA-nQFYZ.js +120 -0
- package/webui/dist/assets/treeView-D4JQ5SDB-BEwiN4Ac.js +1 -0
- package/webui/dist/assets/treemap-SAJKECNS-BhLeisJJ.js +1 -0
- package/webui/dist/assets/{tsx-CUOciP0b.js → tsx-DvWhG4dC.js} +1 -1
- package/webui/dist/assets/{typescript-BydbNFcO.js → typescript-BTGs5etX.js} +1 -1
- package/webui/dist/assets/usecaseDiagram-WPOLBNNX-Dxi6OA4_.js +328 -0
- package/webui/dist/assets/vennDiagram-Q3Y3IDCW-CFhp5_Tq.js +34 -0
- package/webui/dist/assets/{vue-kBwcnTZb.js → vue-B-rnT8WY.js} +1 -1
- package/webui/dist/assets/wardley-7MLQ67FV-BT_BVSUx.js +1 -0
- package/webui/dist/assets/wardleyDiagram-IVAIDKWA-C4J7EEnb.js +78 -0
- package/webui/dist/assets/{xml-CeXJrFlG.js → xml-BsprbK0m.js} +1 -1
- package/webui/dist/assets/xychartDiagram-4URNHDU4-DYpsaMf8.js +7 -0
- package/webui/dist/build.json +19 -11
- package/webui/dist/index.html +4 -4
- package/src/pi/fresh-context.ts +0 -136
- package/webui/dist/assets/index-Cixi6slz.css +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a-t-h-i/bot-lobby",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.8",
|
|
4
4
|
"description": "Structured multi-agent software engineering orchestrator for Pi",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
"class-variance-authority": "0.7.1",
|
|
91
91
|
"clsx": "2.1.1",
|
|
92
92
|
"lucide-react": "1.49.0",
|
|
93
|
+
"mermaid": "12.2.0",
|
|
93
94
|
"motion": "14.0.0",
|
|
94
95
|
"radix-ui": "1.6.7",
|
|
95
96
|
"react": "19.3.0",
|
package/prompts/global.md
CHANGED
|
@@ -28,6 +28,18 @@ Write to the user the way a person would in chat: short, direct, plain words.
|
|
|
28
28
|
make, a risk or something that failed. Then say what you need from them.
|
|
29
29
|
- Required report formats still apply; keep each section brief within them.
|
|
30
30
|
|
|
31
|
+
## Visuals
|
|
32
|
+
|
|
33
|
+
When a picture explains better than words, draw one in your reply; the chat
|
|
34
|
+
renders it and the user can expand it.
|
|
35
|
+
|
|
36
|
+
- Flows, UML (class, sequence, state), ER, timelines: a fenced `mermaid` block.
|
|
37
|
+
- Screens and layouts: a fenced `mockup` block of static HTML with one
|
|
38
|
+
`<style>` (no scripts, images, fonts, links or `url()`), laid out about
|
|
39
|
+
1200px wide, in the project's own design language.
|
|
40
|
+
- Before a full visual design, ask the user about style first (look, sizes,
|
|
41
|
+
elements, motion). A quick sketch to explain something needs no asking.
|
|
42
|
+
|
|
31
43
|
## Following your brief
|
|
32
44
|
|
|
33
45
|
The Master that instructs you plans the work and knows the whole task; you may
|
package/prompts/planner.md
CHANGED
|
@@ -59,6 +59,7 @@ below.
|
|
|
59
59
|
30,000 characters. Show the real content and proportions of the thing being
|
|
60
60
|
decided, not grey boxes. The user
|
|
61
61
|
expands the mockups and scrolls through the options side by side.
|
|
62
|
+
A flow or structure can go in your prose as a fenced `mermaid` diagram.
|
|
62
63
|
- The conversation may carry an **Already settled with the user** list:
|
|
63
64
|
questions the user answered (or left for you to decide). They are closed in
|
|
64
65
|
any wording, so never ask one again, not even rephrased; fold the answer
|
package/src/index.ts
CHANGED
|
@@ -18,7 +18,6 @@ import { registerLobbyEvents } from "./lobby/runtime.ts";
|
|
|
18
18
|
import { registerOwner } from "./pi/owner.ts";
|
|
19
19
|
import { registerClassifier } from "./classifier/instance.ts";
|
|
20
20
|
import { registerClassifierTools } from "./classifier/tools.ts";
|
|
21
|
-
import { registerFreshContext } from "./pi/fresh-context.ts";
|
|
22
21
|
import { registerAskTool } from "./ask/tool.ts";
|
|
23
22
|
import { registerWebTools } from "./web/tools.ts";
|
|
24
23
|
import { registerToolBudget } from "./pi/tool-budget.ts";
|
|
@@ -36,7 +35,6 @@ export default function (pi: ExtensionAPI): void {
|
|
|
36
35
|
// First, so every session_start handler below finds the classifier bound to this session's keys.
|
|
37
36
|
registerClassifier(pi, CONFIG_DIR_NAME);
|
|
38
37
|
// Before the lifecycle, so a task that ended while the oracle was idle is closed before it builds the next turn's prompt.
|
|
39
|
-
registerFreshContext(pi, CONFIG_DIR_NAME);
|
|
40
38
|
registerLifecycle(pi, CONFIG_DIR_NAME);
|
|
41
39
|
// After the lifecycle, so the lobby opens over a task the status already knows.
|
|
42
40
|
registerLobbyEvents(pi, CONFIG_DIR_NAME);
|
package/src/lobby/feed.ts
CHANGED
|
@@ -380,18 +380,6 @@ export function chatText(role: "user" | "assistant", text: string): Array<{ role
|
|
|
380
380
|
/** What the conversation shows where auto mode kept the oracle going. */
|
|
381
381
|
export const AUTO_NOTE = "auto mode";
|
|
382
382
|
|
|
383
|
-
/** The session entry bot-lobby leaves where the oracle's context starts over (see pi/fresh-context.ts). */
|
|
384
|
-
export const CONTEXT_MARK = "bot-lobby-context";
|
|
385
|
-
|
|
386
|
-
/** What the conversation shows where a task's end cleared the oracle's context. */
|
|
387
|
-
export const CLEARED_NOTE = "context cleared · the next request starts fresh";
|
|
388
|
-
|
|
389
|
-
/** Whether a session entry is where a finished task cleared the oracle's context. */
|
|
390
|
-
export function isClearedMark(entry: unknown): boolean {
|
|
391
|
-
const record = entry as { type?: string; customType?: string; data?: { kind?: unknown } } | undefined;
|
|
392
|
-
return record?.type === "custom" && record.customType === CONTEXT_MARK && record.data?.kind === "end";
|
|
393
|
-
}
|
|
394
|
-
|
|
395
383
|
/** The session entry that keeps one line of the lobby chat an agent other than the oracle took part in. */
|
|
396
384
|
export const CHAT_MARK = "bot-lobby-chat";
|
|
397
385
|
|
|
@@ -422,11 +410,6 @@ export function chatFromEntries(entries: readonly unknown[], max = MAX_CHAT): Ch
|
|
|
422
410
|
const chat: ChatLine[] = [];
|
|
423
411
|
for (const entry of entries) {
|
|
424
412
|
const record = entry as { type?: string; timestamp?: string; message?: { role?: string; content?: unknown } };
|
|
425
|
-
if (isClearedMark(entry)) {
|
|
426
|
-
const at = record.timestamp ? Date.parse(record.timestamp) : Number.NaN;
|
|
427
|
-
chat.push({ role: "note", text: CLEARED_NOTE, ...(Number.isFinite(at) ? { at } : {}) });
|
|
428
|
-
continue;
|
|
429
|
-
}
|
|
430
413
|
const marked = chatMarkLine(entry);
|
|
431
414
|
if (marked) {
|
|
432
415
|
const at = record.timestamp ? Date.parse(record.timestamp) : Number.NaN;
|
package/src/lobby/prompts.ts
CHANGED
|
@@ -59,10 +59,11 @@ export function parseMention(text: string): { agent: ChatAgent; rest: string } |
|
|
|
59
59
|
return agent ? { agent, rest: text.slice(match[0].length) } : undefined;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
/** The lobby's slash commands: the chat does the work until you ask for a plan or a task. */
|
|
62
|
+
/** The lobby's slash commands: the chat does the work until you ask for a plan or a task, and keeps its context until you /clear it. */
|
|
63
63
|
export const LOBBY_COMMANDS = [
|
|
64
64
|
{ name: "plan", args: "what to plan", hint: "Plan it with the panel on the Plan tab" },
|
|
65
65
|
{ name: "task", args: "what to do", hint: "Start it as a task for the team" },
|
|
66
|
+
{ name: "clear", args: "", hint: "Clear the context: start a new session" },
|
|
66
67
|
] as const;
|
|
67
68
|
export type LobbyCommand = (typeof LOBBY_COMMANDS)[number]["name"];
|
|
68
69
|
|
package/src/lobby/service.ts
CHANGED
|
@@ -37,7 +37,7 @@ import { modelLookup } from "../pi/tools.ts";
|
|
|
37
37
|
import { startPlannedTask, startTask } from "../pi/start-task.ts";
|
|
38
38
|
import { deliverComments, pauseOwner, setAuto } from "../pi/owner.ts";
|
|
39
39
|
import { switchLanded, switchPending } from "../pi/switch-pending.ts";
|
|
40
|
-
import { CHAT_MARK, chatFromEntries, chatMarkContent,
|
|
40
|
+
import { CHAT_MARK, chatFromEntries, chatMarkContent, lobbyFeed, type ChatEntry, type ChatMarkDetails } from "./feed.ts";
|
|
41
41
|
import { CHAT_AGENT_SOURCES, parseLobbyCommand, parseMention, type LobbyCommand } from "./prompts.ts";
|
|
42
42
|
import type { ChatJob, ChatWorker } from "./chat-agents.ts";
|
|
43
43
|
import { routeChatMessage } from "../classifier/lobby.ts";
|
|
@@ -197,11 +197,9 @@ function chatLine(entry: ChatEntry): string {
|
|
|
197
197
|
return `${entry.agent ?? "MASTER"}: ${entry.text}`;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
/** The conversation
|
|
200
|
+
/** The lobby conversation, as lines. */
|
|
201
201
|
export function chatHistoryLines(): string[] {
|
|
202
|
-
|
|
203
|
-
const cleared = chat.map((entry) => entry.text).lastIndexOf(CLEARED_NOTE);
|
|
204
|
-
return chat.slice(cleared + 1).map(chatLine);
|
|
202
|
+
return lobbyFeed.chat.map(chatLine);
|
|
205
203
|
}
|
|
206
204
|
|
|
207
205
|
/** Who answers a message nobody was named in: the classifier's pick when it is sure, else the Master. */
|
|
@@ -270,8 +268,12 @@ function fromConversation(): string | undefined {
|
|
|
270
268
|
return `From the lobby chat:\n\n${lines.slice(-12).join("\n\n")}`;
|
|
271
269
|
}
|
|
272
270
|
|
|
273
|
-
/** `/plan` and `/task`: plan the work with the panel on the Plan tab, or start it as a task. */
|
|
271
|
+
/** `/plan` and `/task`: plan the work with the panel on the Plan tab, or start it as a task. `/clear`: a new session, the only way the orchestrator's context is cleared. */
|
|
274
272
|
function lobbyCommand(state: Runtime, command: LobbyCommand, rest: string): LobbySendResult {
|
|
273
|
+
if (command === "clear") {
|
|
274
|
+
const result = newSession(state);
|
|
275
|
+
return result.notice ?? (result.opened ? undefined : "nothing to clear: this session is already empty");
|
|
276
|
+
}
|
|
275
277
|
const request = rest.trim() || fromConversation();
|
|
276
278
|
if (!request) return `type what to ${command === "plan" ? "plan" : "do"} after /${command}`;
|
|
277
279
|
if (command === "task") {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* parent, and the text of user and assistant messages (never tool output).
|
|
8
8
|
*/
|
|
9
9
|
import { closeSync, openSync, readSync, statSync } from "node:fs";
|
|
10
|
-
import { chatMarkLine, chatText,
|
|
10
|
+
import { chatMarkLine, chatText, MAX_CHAT, textOf, type ChatEntry } from "./feed.ts";
|
|
11
11
|
|
|
12
12
|
/** What a session log keeps of one entry: its parent, and its conversation lines if it is a message. */
|
|
13
13
|
interface LogNode {
|
|
@@ -94,8 +94,6 @@ export class SessionLog {
|
|
|
94
94
|
if (entry.type === "message" && (role === "user" || role === "assistant")) {
|
|
95
95
|
const chat = chatText(role, textOf(entry.message?.content)).map((part) => ({ id: ++logIds, at, role: part.role, text: part.text }));
|
|
96
96
|
if (chat.length > 0) node.chat = chat;
|
|
97
|
-
} else if (isClearedMark(entry)) {
|
|
98
|
-
node.chat = [{ id: ++logIds, at, role: "note", text: CLEARED_NOTE }];
|
|
99
97
|
} else {
|
|
100
98
|
const marked = chatMarkLine(entry);
|
|
101
99
|
if (marked) node.chat = [{ ...marked, id: ++logIds, at }];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { compact, CONFIG_DIR_NAME, DEFAULT_COMPACTION_SETTINGS, estimateTokens, findCutPoint, type ExtensionAPI, type ExtensionContext, type TurnEndEvent } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { contextMarks, freshContextOn, staleCompaction } from "./fresh-context.ts";
|
|
3
2
|
import { AUTO_COMPACT_ENV, COMPACT_AT_ENV, isSubagentProcess } from "./quiet.ts";
|
|
4
3
|
import { dataRoot, detectProjectRoot, loadConfig } from "../state/project.ts";
|
|
5
4
|
import { normalizeCompactAt } from "../schemas/configuration.ts";
|
|
@@ -75,11 +74,7 @@ export function registerAutoCompaction(pi: ExtensionAPI, summarize: typeof compa
|
|
|
75
74
|
const estimate = event.context.contextMessages.reduce((total, message) => total + estimateTokens(message), 0) + Math.ceil(ctx.getSystemPrompt().length / 4);
|
|
76
75
|
const usage = ctx.getContextUsage();
|
|
77
76
|
if (Math.max(estimate, usage?.tokens ?? 0) < threshold) return;
|
|
78
|
-
|
|
79
|
-
if (!isSubagentProcess() && freshContextOn()) {
|
|
80
|
-
const boundary = contextMarks(ctx.sessionManager.getBranch()).at(-1)?.at;
|
|
81
|
-
if (boundary !== undefined) entries = entries.filter((entry) => Date.parse(entry.timestamp) >= boundary);
|
|
82
|
-
}
|
|
77
|
+
const entries = ctx.sessionManager.buildContextEntries();
|
|
83
78
|
if (entries.length < 2) return;
|
|
84
79
|
const keepRecentTokens = Math.min(16_000, override?.keepRecentTokens ?? configured?.keepRecentTokens ?? DEFAULT_COMPACTION_SETTINGS.keepRecentTokens, Math.floor(threshold / 4));
|
|
85
80
|
const cut = findCutPoint(entries, 0, entries.length, keepRecentTokens);
|
|
@@ -118,7 +113,7 @@ export function registerAutoCompaction(pi: ExtensionAPI, summarize: typeof compa
|
|
|
118
113
|
// pi's own compactions (its context threshold, overflow recovery, /compact) write the same checkpoint from pi's
|
|
119
114
|
// preparation, so every summary an agent continues from has the same shape and the oracle's still feeds knowledge.
|
|
120
115
|
pi.on("session_before_compact", async (event, ctx) => {
|
|
121
|
-
if (
|
|
116
|
+
if (!ctx.model) return undefined;
|
|
122
117
|
try {
|
|
123
118
|
const compaction = await checkpoint(event.preparation, ctx, event.signal, event.customInstructions);
|
|
124
119
|
learn(compaction.summary, ctx);
|
package/src/pi/events.ts
CHANGED
|
@@ -22,7 +22,6 @@ import { requestBesidePlan } from "../state/backlog.ts";
|
|
|
22
22
|
import { isAutoMode } from "../state/auto.ts";
|
|
23
23
|
import { triageContext } from "../classifier/triage.ts";
|
|
24
24
|
import { qaStillDue, rosterWords } from "../workflow/track.ts";
|
|
25
|
-
import { previousTaskNote } from "./fresh-context.ts";
|
|
26
25
|
import { skippedStepsNote } from "./plan-checklist.ts";
|
|
27
26
|
import { clockTask, pauseClocks, resumeClocks, startClock, stopClocks, turnStarted } from "../state/work-clock.ts";
|
|
28
27
|
|
|
@@ -67,6 +66,7 @@ export const LOBBY_CHAT_NOTE = [
|
|
|
67
66
|
"You are the orchestrator, so judge each request before you act. Questions, explanations and small, clear changes (a few files in one area) you do yourself, right here.",
|
|
68
67
|
"Work that is large, risky or spans several areas (a new feature, frontend and backend together, an architecture change, anything that needs tests and review) goes to the team: call start_task with the request written in full, say in one line that you started a task, and end your turn. Effort decides its track, and the task's kickoff follows. Do not ask first.",
|
|
69
68
|
"If the request is unclear, ask one short question before starting a task. The user can also type /plan (plan it with the panel) or /task (start a task) themselves.",
|
|
69
|
+
"This conversation carries on across tasks: finished tasks stay in your context, and the user may keep chatting or start more tasks here. It is cleared only when the user starts a new session or compacts it.",
|
|
70
70
|
].join("\n");
|
|
71
71
|
|
|
72
72
|
/**
|
|
@@ -155,10 +155,8 @@ export function registerLifecycle(pi: ExtensionAPI, configDir: string): void {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
if (!task) {
|
|
158
|
-
// The lobby chat, and after a task ended and cleared the context, a line on where its record is, in case the user refers back to it.
|
|
159
|
-
const previous = hidden ? undefined : previousTaskNote(ctx, configDir);
|
|
160
158
|
if (isSubagentProcess() || hidden) delete event.systemPromptOptions.sections["bot-lobby"];
|
|
161
|
-
else event.systemPromptOptions.sections["bot-lobby"] =
|
|
159
|
+
else event.systemPromptOptions.sections["bot-lobby"] = LOBBY_CHAT_NOTE;
|
|
162
160
|
return;
|
|
163
161
|
}
|
|
164
162
|
const dataRoots = readDataRoots(root, configDir);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* does itself; work that is large, risky or spans several areas it hands to
|
|
5
5
|
* the team by starting a task here, the same as the user typing `/task`.
|
|
6
6
|
* The task's track (fast or full) still comes from the effort and triage
|
|
7
|
-
* reads, and the kickoff follows the current turn
|
|
7
|
+
* reads, and the kickoff follows the current turn in this same conversation.
|
|
8
8
|
* While it drives a task, a message that is separate work starts its task in
|
|
9
9
|
* a new background session instead, and the current task carries on.
|
|
10
10
|
*/
|
|
@@ -24,7 +24,7 @@ import type { TrackPath } from "../schemas/task.ts";
|
|
|
24
24
|
export const START_TASK_TOOL = "start_task";
|
|
25
25
|
|
|
26
26
|
const Params = Type.Object({
|
|
27
|
-
request: Type.String({ minLength: 1, maxLength: 8000, description: "The work, written in full for the team: what the user wants, the files or areas you already know it touches, and any constraint they gave. The
|
|
27
|
+
request: Type.String({ minLength: 1, maxLength: 8000, description: "The work, written in full for the team: what the user wants, the files or areas you already know it touches, and any constraint they gave. The team's agents do not see this chat, so this must stand on its own." }),
|
|
28
28
|
title: Type.Optional(Type.String({ maxLength: 80, description: "A short title (3-8 words); derived from the request when absent." })),
|
|
29
29
|
track: Type.Optional(Type.Union([Type.Literal("fast"), Type.Literal("full")], { description: "Only when you are sure: fast (small and clear, straight to the agents) or full (scouts, proposal, QA). Left out, the effort read picks." })),
|
|
30
30
|
auto: Type.Optional(Type.Boolean({ description: "true only when the user asked for it to run without them (no proposal approval or questions)." })),
|
package/src/pi/start-task.ts
CHANGED
|
@@ -21,7 +21,6 @@ import { applyMasterModel } from "./model-settings.ts";
|
|
|
21
21
|
import { setAutoMode } from "../state/auto.ts";
|
|
22
22
|
import { listPlannedTasks, loadPlannedTask, markPlannedTaskStarted, plannedTaskRequest, type PlannedTask } from "../state/backlog.ts";
|
|
23
23
|
import { triageFor } from "../classifier/instance.ts";
|
|
24
|
-
import { freshContextOn, markContext } from "./fresh-context.ts";
|
|
25
24
|
import { createWorkspace, gitLine, taskCwd } from "../execution/workspace.ts";
|
|
26
25
|
import { draftAssignments, draftAssignmentsNote } from "../workflow/draft-assignments.ts";
|
|
27
26
|
import type { GitIsolation } from "../schemas/configuration.ts";
|
|
@@ -181,8 +180,6 @@ export async function startTask(pi: ExtensionAPI, ctx: ExtensionContext, configD
|
|
|
181
180
|
applyStatus(ctx, root, configDir);
|
|
182
181
|
await applyMasterModel(pi, ctx, loadConfig());
|
|
183
182
|
ctx.ui.notify(`bot-lobby ${task.id} started`, "info");
|
|
184
|
-
// The oracle takes the task on with a clean context: nothing said before the kickoff is sent to its model.
|
|
185
|
-
if (freshContextOn()) markContext(pi, { kind: "start", taskId: task.id, at: Date.now() });
|
|
186
183
|
// The full workflow scouts first: start it now, so the findings are on their way while the orchestrator reads the request.
|
|
187
184
|
// It is only a head start: anything that stops it leaves the oracle to scout as before.
|
|
188
185
|
let scouting: Domain[] = [];
|
|
@@ -87,8 +87,6 @@ export interface WorkflowConfig {
|
|
|
87
87
|
toolStallTimeoutMs: number;
|
|
88
88
|
/** Workers that may run at once when the Master delegates several domains together. */
|
|
89
89
|
maxParallelWorkers: number;
|
|
90
|
-
/** The oracle starts each task with a clean context: its model is sent only the conversation since the task started, or since the last one ended. */
|
|
91
|
-
freshContext: boolean;
|
|
92
90
|
/** Small, clear, low-risk requests take the fast track (no scouts, proposal or plan; QA only when tests are needed); false puts every task on the full workflow. */
|
|
93
91
|
fastTrack: boolean;
|
|
94
92
|
/** A delegation that names nothing concrete, or is long without done criteria, is sent back to the oracle once for a fuller brief (sending it again unchanged goes through). */
|
|
@@ -282,7 +280,6 @@ export const DEFAULT_CONFIG: BotLobbyConfig = {
|
|
|
282
280
|
stallTimeoutMs: 5 * 60 * 1000,
|
|
283
281
|
toolStallTimeoutMs: 10 * 60 * 1000,
|
|
284
282
|
maxParallelWorkers: 3,
|
|
285
|
-
freshContext: true,
|
|
286
283
|
fastTrack: true,
|
|
287
284
|
briefCheck: true,
|
|
288
285
|
gitIsolation: "off",
|
|
@@ -521,7 +518,8 @@ function normalizeClassifier(value: unknown): ClassifierConfig {
|
|
|
521
518
|
export function resolveConfig(partial: unknown): BotLobbyConfig {
|
|
522
519
|
const src = (partial ?? {}) as Record<string, unknown>;
|
|
523
520
|
const workflow = { ...DEFAULT_CONFIG.workflow, ...(src.workflow as Partial<WorkflowConfig> | undefined) };
|
|
524
|
-
|
|
521
|
+
// Retired: the oracle no longer clears its own context when a task starts or ends.
|
|
522
|
+
delete (workflow as Partial<WorkflowConfig> & { freshContext?: unknown }).freshContext;
|
|
525
523
|
workflow.fastTrack = workflow.fastTrack !== false;
|
|
526
524
|
workflow.briefCheck = workflow.briefCheck !== false;
|
|
527
525
|
workflow.repoMap = workflow.repoMap !== false;
|
|
@@ -299,6 +299,7 @@ export function createFixtureService(name: string, feed = new LobbyFeed()): Lobb
|
|
|
299
299
|
toOracle: (text: string) => {
|
|
300
300
|
const command = parseLobbyCommand(text);
|
|
301
301
|
if (command?.command === "plan") return { notice: "planning on the Plan tab", open: "plan" as const };
|
|
302
|
+
if (command?.command === "clear") return "started a new session";
|
|
302
303
|
if (command) return "starting a task — the orchestrator takes it from here";
|
|
303
304
|
const mention = parseMention(text);
|
|
304
305
|
if (mention && mention.agent !== "master") {
|
package/src/webui/uploads.ts
CHANGED
|
@@ -34,9 +34,12 @@ function safeName(name: string): string {
|
|
|
34
34
|
return trimmed || "file";
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/** Plain text the agents read as it is, such as a long paste the composer sent as a `.txt` file. */
|
|
38
|
+
const TEXT_TYPES: Record<string, string> = { ".txt": "text/plain", ".md": "text/markdown" };
|
|
39
|
+
|
|
37
40
|
function mimeOf(name: string, claimed: string): string {
|
|
38
41
|
const ext = extname(name).toLowerCase();
|
|
39
|
-
return IMAGE_TYPES[ext] ?? (ext === ".pdf" ? "application/pdf" : claimed.trim() && /^[\w.+-]+\/[\w.+-]+$/.test(claimed.trim()) ? claimed.trim() : "application/octet-stream");
|
|
42
|
+
return IMAGE_TYPES[ext] ?? TEXT_TYPES[ext] ?? (ext === ".pdf" ? "application/pdf" : claimed.trim() && /^[\w.+-]+\/[\w.+-]+$/.test(claimed.trim()) ? claimed.trim() : "application/octet-stream");
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
function kindOf(mime: string): UploadKind {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/astro-
|
|
2
|
-
import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/astro-uzna3x9Z.js","assets/json-qhed-kSA.js","assets/javascript-BgS3c2Ky.js","assets/typescript-BTGs5etX.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/css-C8fQr_0Q.js","assets/postcss-D_Wz94rJ.js","assets/tsx-DvWhG4dC.js","assets/graphql-Dq_Q6ac9.js","assets/jsx-BUUYi3qs.js","assets/html-wSbaAAK3.js","assets/java-D7h0NA_A.js","assets/kts-DFAlwc6n.js","assets/kotlin-DhhofPvG.js","assets/lua-xZcbXUE9.js","assets/c-DaO8xguW.js","assets/php-lW4PUsGw.js","assets/xml-BsprbK0m.js","assets/sql-CEbI0hMM.js","assets/properties-CxAuzHS9.js","assets/ini-B5eOa1yu.js","assets/ruby-DDU-xGaZ.js","assets/shellscript-CLZ0U2zV.js","assets/yaml-rwi0_p6S.js","assets/scss-CHVQqdPx.js","assets/svelte-BwxZAPCy.js","assets/vue-B-rnT8WY.js","assets/yml-s9iVJXCw.js","assets/zsh-B7CDPTg5.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{a as n,c as r,i,l as a,n as o,o as s,r as c,s as l,t as u}from"./ccount-BNWSQYgZ.js";import{n as d}from"./index-CZxOM0me.js";var f={}.hasOwnProperty;function p(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&f.call(t,e)){let n=String(t[e]);i=f.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var m=10,h=13,g=4,_=40;function v(e){let t=[0],n=e.indexOf(`\r`),r=e.indexOf(`
|
|
3
3
|
`),i=0,a=0;for(;n!==-1||r!==-1;){let o;if(n!==-1&&(r===-1||n<r)?r===n+1?(o=r+1,n=e.indexOf(`\r`,o),r=e.indexOf(`
|
|
4
4
|
`,o)):(o=n+1,n=e.indexOf(`\r`,o)):(o=r+1,r=e.indexOf(`
|
|
5
5
|
`,o)),t.push(o),++a===g){if(o-i<=_){for(let n=o;n<e.length;n++){let r=e.charCodeAt(n);(r===m||r===h)&&(r===h&&n+1<e.length&&e.charCodeAt(n+1)===m&&n++,t.push(n+1))}return t}i=o,a=0}}return t}function y(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);(r===m||r===h)&&(r===h&&n+1<e.length&&e.charCodeAt(n+1)===m&&n++,t++)}return t}function b(e){let t=v(e);return Array.from({length:t.length},(n,r)=>{let i=t[r],a=t[r+1]??e.length;return e.slice(i,a)})}var x=100,S=`insert`,C=`backspace`,w=`delete`,T=class e{#e=[];#t=[];#n;#r=!1;constructor(e){this.#n=Math.max(1,e?.maxEntries??x)}get canUndo(){return this.#e.length>0}get canRedo(){return this.#t.length>0}getState(){return{undoStack:this.#e.map(ee),redoStack:this.#t.map(ee),maxEntries:this.#n,canCoalesce:this.#r}}getLiveState(){return Object.defineProperties({},{undoStack:{enumerable:!0,get:()=>this.#e},redoStack:{enumerable:!0,get:()=>this.#t},maxEntries:{enumerable:!0,get:()=>this.#n},canCoalesce:{enumerable:!0,get:()=>this.#r}})}static fromState(t){let n=new e({maxEntries:t.maxEntries});return n.#e=t.undoStack,n.#t=t.redoStack,n.#r=t.canCoalesce,n}clear(){this.#e.length=0,this.#t.length=0,this.#r=!1}clearRedo(){this.#t.length=0}push(e){this.#e.push(e),this.clearRedo(),this.#r=!0,this.#e.length>this.#n&&this.#e.shift()}setLastUndoSelectionsAfter(e){let t=this.#e[this.#e.length-1];t!==void 0&&(t.selectionsAfter=e.map(e=>({...e})))}setLastUndoLineAnnotations(e,t){let n=this.#e[this.#e.length-1];n!==void 0&&(n.lineAnnotationsBefore=e.slice(),n.lineAnnotationsAfter=t.slice())}peekUndo(){return this.#e[this.#e.length-1]}peekUndoForCoalescing(){return this.#r?this.peekUndo():void 0}replaceLastUndo(e){if(this.#e.length===0){this.push(e);return}this.#e[this.#e.length-1]=e,this.clearRedo(),this.#r=!0}popUndoToRedo(){let e=this.#e.pop();if(e!==void 0)return this.#t.push(e),this.#r=!1,e}popRedoToUndo(){let e=this.#t.pop();if(e!==void 0)return this.#e.push(e),this.#r=!1,e}};function E(e){return{...e,forwardEdits:e.forwardEdits.map(e=>({...e})),inverseEdits:e.inverseEdits.map(e=>({...e})),selectionsBefore:e.selectionsBefore?.map(D),selectionsAfter:e.selectionsAfter?.map(D),lineAnnotationsBefore:e.lineAnnotationsBefore?.slice(),lineAnnotationsAfter:e.lineAnnotationsAfter?.slice()}}function ee(e){return{...E(e),lineAnnotationsBefore:e.lineAnnotationsBefore?.map(e=>({...e})),lineAnnotationsAfter:e.lineAnnotationsAfter?.map(e=>({...e}))}}function D(e){return{...e,start:{...e.start},end:{...e.end}}}function O(e,t,n,r,i,a,o,s){let c=[...t].sort((e,t)=>e.start-t.start),l=[],u;if(i?.length===c.length){let t=[];for(let n of i){if(n.start.line!==n.end.line||n.start.character!==n.end.character)break;t.push(e.offsetAt(n.start))}if(t.length===c.length){t.sort((e,t)=>e-t);let e=!0,n=!0;for(let r=0;r<c.length;r++){let i=c[r];if(i.text.length>0||i.start===i.end){e=!1,n=!1;break}e&&=t[r]===i.end,n&&=t[r]===i.start}u=e?C:n?w:void 0}}for(let t=0,n=0;t<c.length;t++){let r=c[t],i=e.getTextSlice(r.start,r.end),a=r.start+n;l.push({start:a,end:a+r.text.length,text:i}),n+=r.text.length-(r.end-r.start)}return{forwardEdits:c.map(e=>({...e})),inverseEdits:l,versionBefore:n,versionAfter:r,selectionsBefore:i?.map(e=>({...e})),selectionsAfter:a?.map(e=>({...e})),lineAnnotationsBefore:o?.slice(),lineAnnotationsAfter:s?.slice(),coalescingMode:u}}function k(e,t){if(e===void 0||e.undoBoundary===!0||t.undoBoundary===!0||e.forwardEdits.length===0||e.forwardEdits.length!==e.inverseEdits.length||e.forwardEdits.length!==t.forwardEdits.length||t.forwardEdits.length!==t.inverseEdits.length)return!1;let n;for(let r=0;r<e.forwardEdits.length;r++){let i=e.forwardEdits[r],a=e.inverseEdits[r],o=t.forwardEdits[r],s=t.inverseEdits[r],c=ne(o.start,e.forwardEdits),l=i.start<=i.end&&i.text.length>0&&!i.text.includes(`
|
|
@@ -217,7 +217,7 @@ XID_Continue XIDC
|
|
|
217
217
|
XID_Start XIDS`.split(/\s/).map(e=>[zf(e),e])),jp=new Map([[`s`,q(383)],[q(383),`s`]]),Mp=new Map([[q(223),q(7838)],[q(107),q(8490)],[q(229),q(8491)],[q(969),q(8486)]]),Np=new Map([Ip(453),Ip(456),Ip(459),Ip(498),...Lp(8072,8079),...Lp(8088,8095),...Lp(8104,8111),Ip(8124),Ip(8140),Ip(8188)]),Pp=new Map([[`alnum`,J`[\p{Alpha}\p{Nd}]`],[`alpha`,J`\p{Alpha}`],[`ascii`,J`\p{ASCII}`],[`blank`,J`[\p{Zs}\t]`],[`cntrl`,J`\p{Cc}`],[`digit`,J`\p{Nd}`],[`graph`,J`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,J`\p{Lower}`],[`print`,J`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,J`[\p{P}\p{S}]`],[`space`,J`\p{space}`],[`upper`,J`\p{Upper}`],[`word`,J`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,J`\p{AHex}`]]);function Fp(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function Ip(e){let t=q(e);return[t.toLowerCase(),t]}function Lp(e,t){return Fp(e,t).map(e=>Ip(e))}var Rp=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function zp(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};Up(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:xp(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Hf(e,Bp,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return Hf(e,Vp,a),Hf(e,Hp,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var Bp={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=wf();e.body[0].body.push(Tf({negate:!0,body:r}),jf(`Any`));let i=wf();i.body[0].body.push(Of(`greedy`,0,1/0,e)),n(Y(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];bp(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=Xp(t.get(e));if(n){let t=wf({flags:n});t.body[0].body=e.body,e.body=[Y(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(Y(Tf({body:[mf({body:[hf(`string_end`)]}),mf({body:[vf(10)]})]}),t));else if(c===`line_start`)o(Y(am(J`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&nm(e))o(Y(Tf({negate:!0}),t));else if(d)throw Error(J`Uses "\G" in a way that requires a subclass`);else o(sm(hf(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(Y(am(J`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${Op})(?!${Op})|(?<!${Op})(?=${Op}))`,n=`(?:(?<=${Op})(?=${Op})|(?<!${Op})(?!${Op}))`;o(Y(am(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!im(n)&&(n=Yp(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!im(r)&&(r=Yp(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(Y(yf({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(sm(xf(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(Y(om(am(Ep),l),t));return}if(s&&(c===`word`||u===`word`)){n(sm(xf(`word`,{negate:l}),t));return}if(c===`any`)n(sm(jf(`Any`),t));else if(c===`digit`)n(sm(jf(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(J`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=J`\p{RI}{2}|${e}(?:\u200D${e})*`;n(Y(am(J`(?>\r\n|${i?J`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(sm(jf(`AHex`,{negate:l}),t));else if(c===`newline`)n(Y(am(l?`[^
|
|
218
218
|
]`:`(?>\r
|
|
219
219
|
?|[
|
|
220
|
-
\v\f
\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${q(e.codePointAt(0)-1)}${q(e.codePointAt(2)+1)}-\u{10FFFF}`),n(Y(am(`[${e}]`),t))}else n(Y(om(am(Pp.get(u)),l),t))}else if(c===`property`)Ap.has(zf(u))||(e.key=`sc`);else if(c===`space`)n(sm(jf(`space`,{negate:l}),t));else if(c===`word`)n(Y(om(am(Op),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=wf({flags:c});e.body[0].body=o(),i(Y(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&ef(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(J`Uses "\K" in a way that's unsupported`);let o=Tf({behind:!0});o.body[0].body=a(),i(Y(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(Y(Tf({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=wf();t.body[0].body.push(e.body),e.body=Y(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=$p(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(J`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!im(n)&&(n=Yp(n,t),e.ref=n)}},Vp={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=sm(qp(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&bp(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=bp(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=yp(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?qp(0):Kp(o,r.groupOriginByCopy,null),l=c;if(!s){let e=Xp(Jp(o,e=>e.type===`Group`&&!!e.flags)),t=e?yp(r.globalFlags,e):r.globalFlags;Wp(t,r.currentFlags)||(l=wf({flags:Zp(t)}),l.body[0].body.push(c))}n(Y(l,t),{traverse:!s})}},Hp={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>Gp(t,e));i.length?i.length>1?n(Y(wf({atomic:!0,body:i.reverse().map(e=>mf({body:[gf(e.number)]}))}),t)):e.ref=i[0].number:n(Y(Tf({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=_f();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&e.ref!==0&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Up(e){Hf(e,{"*"({node:e,parent:t}){e.parent=t}})}function Wp(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function Gp(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=Qp(n.parent);for(let r of t){if(r===n)break;if(r===e||em(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function Kp(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=Kp(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function qp(e){let t=Af(e);return t.isRecursive=!0,t}function Jp(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function Yp(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function Xp(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Zp({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Qp(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function $p(e){let t=e.find(e=>e.kind===`search_start`||rm(e,{negate:!1})||!tm(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=$p(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function em(e,t){let n=Qp(e)??[];for(let e of n)if(e===t||em(e,t))return!0;return!1}function tm({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function nm(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function rm(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&ef(e.body[0],{type:`Assertion`,kind:`search_start`})}function im(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function am(e,t){let n=rf(e,{...t,unicodePropertyMap:Ap}).body;return n.length>1||n[0].body.length>1?wf({body:n}):n[0].body[0]}function om(e,t){return e.negate=t,e}function sm(e,t){return e.parent=t,e}function Y(e,t){return Up(e),e.parent=t,e}function cm(e,t){let n=Tp(t),r=xp(n.target,`ES2024`),i=xp(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];Hf(e,lm,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!(!e.flags.ignoreCase&&!o||s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,Sp(um[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&bp(f._captureTransfers,e.transferTo,[]).push(t)}),f}var lm={"*":{enter({node:e},t){if(Sm(e)){let n=t.getCurrentModI();t.pushModI(e.flags?yp({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){Sm(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){gm(q(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),_m(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&Rp.has(e.value)&&t.setHasCasedChar()}},um={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?J`\B`:J`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=q(e),r=vm(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&gm(n)){let e=kp(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);_p.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(wm)&&(o=[vf(45),...o.filter(e=>!wm(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||_p.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=wf(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=mf({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(_p.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=vm(n,i),o=vm(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&ym(_m(e)).forEach(e=>{s.add(Array.isArray(e)?`${vm(e[0],i)}-${vm(e[1],i)}`:vm(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:J`[^\n]`;if(e===`digit`)return t?J`\D`:J`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&Rp.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?J`\P`:J`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?J`\W`:J`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=yp(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${bm(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+xm(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:J`\g<${t}&R=${r}>`}},dm=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),fm=new Set([`-`,`\\`,`]`,`^`,`[`]),pm=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),mm=new Map([[9,J`\t`],[10,J`\n`],[11,J`\v`],[12,J`\f`],[13,J`\r`],[8232,J`\u2028`],[8233,J`\u2029`],[65279,J`\uFEFF`]]),hm=/^\p{Cased}$/u;function gm(e){return hm.test(e)}function _m(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=q(e);if(!gm(t))continue;let o=kp(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function vm(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(mm.has(e))return mm.get(e);if(e<32||e>126&&e<160||e>262143||t&&Cm(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?pm:fm:dm,a=q(e);return(i.has(a)?`\\`:``)+a}function ym(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function bm(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function xm({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function Sm({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function Cm(e){return e>47&&e<58}function wm({type:e,value:t}){return e===`Character`&&t===45}var Tm=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=Dm(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(Em(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=Om(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function Em(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function Dm(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)bp(n,t,{}).transferTo=e;return n}function Om(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function km(e,t){let n=Am(e,t);return n.options?new Tm(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function Am(e,t){let n=Tp(t),r=zp(rf(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Ap}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=cm(r,n),a=dp(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=tp(ip(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function jm(e,t){return km(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function Mm(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>jm(e,{target:t.target}),{createScanner(e){return new cd(e,t)},createString:ud}}var Nm={astro:()=>d(()=>import(`./astro-p42oEArs.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),c:()=>d(()=>import(`./c-DaO8xguW.js`),[]),csharp:()=>d(()=>import(`./csharp-dmMxLVLW.js`),[]),css:()=>d(()=>import(`./css-C8fQr_0Q.js`),[]),diff:()=>d(()=>import(`./diff-woXpYk--.js`),[]),dockerfile:()=>d(()=>import(`./dockerfile-IyjqRm3v.js`),[]),dotenv:()=>d(()=>import(`./dotenv-CuH5my32.js`),[]),fish:()=>d(()=>import(`./fish-BJitypiv.js`),[]),go:()=>d(()=>import(`./go-rLFTqkRN.js`),[]),graphql:()=>d(()=>import(`./graphql-AVu4aKQX.js`),__vite__mapDeps([8,2,3,4,7,9])),html:()=>d(()=>import(`./html-wSbaAAK3.js`),__vite__mapDeps([10,2,5])),ini:()=>d(()=>import(`./ini-B5eOa1yu.js`),[]),java:()=>d(()=>import(`./java-DdHNQ9hk.js`).then(e=>e.n),__vite__mapDeps([11,4])),javascript:()=>d(()=>import(`./javascript-BgS3c2Ky.js`),[]),json:()=>d(()=>import(`./json-qhed-kSA.js`),[]),json5:()=>d(()=>import(`./json5-BR5RXkoi.js`),[]),jsonc:()=>d(()=>import(`./jsonc-CYpm1nAK.js`),[]),jsonl:()=>d(()=>import(`./jsonl-CmCQp5Yx.js`),[]),jsx:()=>d(()=>import(`./jsx-gTgmArGx.js`).then(e=>e.n),__vite__mapDeps([9,4])),kotlin:()=>d(()=>import(`./kotlin-DhhofPvG.js`),[]),kts:()=>d(()=>import(`./kts-DFAlwc6n.js`),__vite__mapDeps([12,13])),less:()=>d(()=>import(`./less-DVTAwKKz.js`),[]),lua:()=>d(()=>import(`./lua-xZcbXUE9.js`),__vite__mapDeps([14,15])),makefile:()=>d(()=>import(`./makefile-Dixweg8N.js`),[]),markdown:()=>d(()=>import(`./markdown-BYOwaDjH.js`),[]),php:()=>d(()=>import(`./php-C6PDnbTe.js`),__vite__mapDeps([16,1,2,5,10,17,11,4,18])),powershell:()=>d(()=>import(`./powershell-QtSnmXcu.js`),[]),prisma:()=>d(()=>import(`./prisma-DMgNhnYS.js`),[]),properties:()=>d(()=>import(`./properties-CxAuzHS9.js`),__vite__mapDeps([19,20])),python:()=>d(()=>import(`./python-gzcpVVnB.js`),[]),ruby:()=>d(()=>import(`./ruby-CPL7DL0w.js`),__vite__mapDeps([21,2,5,15,8,3,4,7,9,10,14,17,11,18,22,23])),rust:()=>d(()=>import(`./rust-DpiIf5JO.js`),[]),sass:()=>d(()=>import(`./sass-DXrisJhu.js`),[]),scss:()=>d(()=>import(`./scss-CHVQqdPx.js`),__vite__mapDeps([24,5])),shellscript:()=>d(()=>import(`./shellscript-CLZ0U2zV.js`),[]),sql:()=>d(()=>import(`./sql-CEbI0hMM.js`),[]),svelte:()=>d(()=>import(`./svelte-DKhxH1PN.js`),__vite__mapDeps([25,2,3,4,5,6])),swift:()=>d(()=>import(`./swift-CyEgAFGc.js`),[]),toml:()=>d(()=>import(`./toml-CcmNWLt0.js`),[]),tsx:()=>d(()=>import(`./tsx-CUOciP0b.js`).then(e=>e.n),__vite__mapDeps([7,4])),typescript:()=>d(()=>import(`./typescript-BydbNFcO.js`).then(e=>e.n),__vite__mapDeps([3,4])),vue:()=>d(()=>import(`./vue-kBwcnTZb.js`),__vite__mapDeps([26,1,2,3,4,5,10])),xml:()=>d(()=>import(`./xml-CeXJrFlG.js`),__vite__mapDeps([17,11,4])),yaml:()=>d(()=>import(`./yaml-rwi0_p6S.js`),[]),yml:()=>d(()=>import(`./yml-s9iVJXCw.js`),__vite__mapDeps([27,23])),zsh:()=>d(()=>import(`./zsh-B7CDPTg5.js`),__vite__mapDeps([28,22]))},Pm=Nu({langs:Nm,themes:{},engine:()=>Mm()}),{codeToHtml:Fm,codeToHast:Im,codeToTokens:Lm,codeToTokensBase:Rm,codeToTokensWithThemes:zm,getSingletonHighlighter:Bm,getLastGrammarState:Vm}=Fu(Pm);async function Hm(e){if(zs())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=bs.get(e);if(t!=null)return t;try{let t=xs.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Nm,e)&&(t=Nm[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return ys.has(e)||ys.set(e,n),n});return bs.set(e,n),await n}finally{bs.delete(e)}}function Um(e){return ys.get(e)??Hm(e)}function Wm(e){for(let t of ws(e))if(!Ts.has(t))return!1;return!0}function Gm({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:Km(t)}}function Km(e){return async()=>$s(js(await e()))}var qm=`pierre`,Jm=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],Ym=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],Xm=[...Ym,...Jm],Zm=new Set(Ym);function Qm(e){return Zm.has(e)?`light`:`dark`}var $m={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},eh={"pierre-dark":()=>d(()=>import(`./pierre-dark-CpLgRqie.js`),[]),"pierre-dark-soft":()=>d(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>d(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>d(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>d(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[]),"pierre-light":()=>d(()=>import(`./pierre-light-CoaEpmwp.js`),[]),"pierre-light-soft":()=>d(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>d(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>d(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[]),"pierre-light-tritanopia":()=>d(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[])};function th(e){return Gm({name:e,collection:qm,colorScheme:Qm(e),displayName:$m[e],load:eh[e]})}var nh=Es({themes:Xm.map(e=>th(e))}),rh={getTheme:e=>void 0};function ih(e){if(zs())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(Is.hasRegisteredTheme(e))return;let t=rh.getTheme(e);if(t!=null){Is.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function ah(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function oh(e){ih(e);let t=await Is.resolveTheme(e);return ah(e,t),t}function sh(e){return Is.getResolvedTheme(e)??oh(e)}var ch;async function lh({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){ch??=Pm({themes:[],langs:[`text`],engine:n===`shiki-wasm`?id(d(()=>import(`./wasm-BnjxR4X6.js`),[])):Mm()});let r=dh(ch)?await ch:ch;ch=r;let i=[];for(let e of Array.from(new Set(t))){if(e===`text`||e===`ansi`)continue;let t=Um(e);`then`in t?i.push(t):Rs(t,r)}let a=[];for(let t of e){let e=sh(t);`then`in e?a.push(e):Ls(e,ch)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{Rs(e,r)}),Promise.all(a).then(e=>{Ls(e,r)})]),r}function uh(e){if(!(ch==null||`then`in ch)&&(e==null||Wm(e.theme)&&Cs(e.lang)))return ch}function dh(e=ch){return e!=null&&`then`in e}for(let e of nh.getThemes())Is.registerThemeIfAbsent(e.name,e.load);function fh(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function ph(e){return Is.hasResolvedThemes(e)}function mh(e,t){return fh(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function hh(e){return(e.lang??L(e.name))===`text`}function gh(e,t){for(let n of t)e.push(n)}function _h(e){return{type:`text`,value:e}}function X({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function vh({name:e,width:t=16,height:n=16,properties:r}){return X({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[X({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function yh(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function bh(e){return X({tagName:`div`,properties:{"data-gutter":``},children:e})}function xh(e,t,n,r={}){return X({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[X({tagName:`span`,properties:{"data-line-number-content":``},children:[_h(`${t}`)]})]})}function Sh(e,t,n){return X({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function Ch(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(_h(`
|
|
220
|
+
\v\f
\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${q(e.codePointAt(0)-1)}${q(e.codePointAt(2)+1)}-\u{10FFFF}`),n(Y(am(`[${e}]`),t))}else n(Y(om(am(Pp.get(u)),l),t))}else if(c===`property`)Ap.has(zf(u))||(e.key=`sc`);else if(c===`space`)n(sm(jf(`space`,{negate:l}),t));else if(c===`word`)n(Y(om(am(Op),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=wf({flags:c});e.body[0].body=o(),i(Y(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&ef(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(J`Uses "\K" in a way that's unsupported`);let o=Tf({behind:!0});o.body[0].body=a(),i(Y(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(Y(Tf({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=wf();t.body[0].body.push(e.body),e.body=Y(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=$p(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(J`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!im(n)&&(n=Yp(n,t),e.ref=n)}},Vp={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=sm(qp(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&bp(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=bp(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=yp(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?qp(0):Kp(o,r.groupOriginByCopy,null),l=c;if(!s){let e=Xp(Jp(o,e=>e.type===`Group`&&!!e.flags)),t=e?yp(r.globalFlags,e):r.globalFlags;Wp(t,r.currentFlags)||(l=wf({flags:Zp(t)}),l.body[0].body.push(c))}n(Y(l,t),{traverse:!s})}},Hp={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>Gp(t,e));i.length?i.length>1?n(Y(wf({atomic:!0,body:i.reverse().map(e=>mf({body:[gf(e.number)]}))}),t)):e.ref=i[0].number:n(Y(Tf({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=_f();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&e.ref!==0&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Up(e){Hf(e,{"*"({node:e,parent:t}){e.parent=t}})}function Wp(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function Gp(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=Qp(n.parent);for(let r of t){if(r===n)break;if(r===e||em(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function Kp(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=Kp(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function qp(e){let t=Af(e);return t.isRecursive=!0,t}function Jp(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function Yp(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function Xp(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Zp({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Qp(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function $p(e){let t=e.find(e=>e.kind===`search_start`||rm(e,{negate:!1})||!tm(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=$p(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function em(e,t){let n=Qp(e)??[];for(let e of n)if(e===t||em(e,t))return!0;return!1}function tm({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function nm(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function rm(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&ef(e.body[0],{type:`Assertion`,kind:`search_start`})}function im(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function am(e,t){let n=rf(e,{...t,unicodePropertyMap:Ap}).body;return n.length>1||n[0].body.length>1?wf({body:n}):n[0].body[0]}function om(e,t){return e.negate=t,e}function sm(e,t){return e.parent=t,e}function Y(e,t){return Up(e),e.parent=t,e}function cm(e,t){let n=Tp(t),r=xp(n.target,`ES2024`),i=xp(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];Hf(e,lm,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!(!e.flags.ignoreCase&&!o||s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,Sp(um[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&bp(f._captureTransfers,e.transferTo,[]).push(t)}),f}var lm={"*":{enter({node:e},t){if(Sm(e)){let n=t.getCurrentModI();t.pushModI(e.flags?yp({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){Sm(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){gm(q(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),_m(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&Rp.has(e.value)&&t.setHasCasedChar()}},um={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?J`\B`:J`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=q(e),r=vm(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&gm(n)){let e=kp(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);_p.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(wm)&&(o=[vf(45),...o.filter(e=>!wm(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||_p.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=wf(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=mf({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(_p.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=vm(n,i),o=vm(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&ym(_m(e)).forEach(e=>{s.add(Array.isArray(e)?`${vm(e[0],i)}-${vm(e[1],i)}`:vm(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:J`[^\n]`;if(e===`digit`)return t?J`\D`:J`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&Rp.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?J`\P`:J`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?J`\W`:J`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=yp(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${bm(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+xm(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:J`\g<${t}&R=${r}>`}},dm=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),fm=new Set([`-`,`\\`,`]`,`^`,`[`]),pm=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),mm=new Map([[9,J`\t`],[10,J`\n`],[11,J`\v`],[12,J`\f`],[13,J`\r`],[8232,J`\u2028`],[8233,J`\u2029`],[65279,J`\uFEFF`]]),hm=/^\p{Cased}$/u;function gm(e){return hm.test(e)}function _m(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=q(e);if(!gm(t))continue;let o=kp(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function vm(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(mm.has(e))return mm.get(e);if(e<32||e>126&&e<160||e>262143||t&&Cm(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?pm:fm:dm,a=q(e);return(i.has(a)?`\\`:``)+a}function ym(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function bm(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function xm({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function Sm({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function Cm(e){return e>47&&e<58}function wm({type:e,value:t}){return e===`Character`&&t===45}var Tm=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=Dm(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(Em(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=Om(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function Em(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function Dm(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)bp(n,t,{}).transferTo=e;return n}function Om(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function km(e,t){let n=Am(e,t);return n.options?new Tm(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function Am(e,t){let n=Tp(t),r=zp(rf(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Ap}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=cm(r,n),a=dp(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=tp(ip(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function jm(e,t){return km(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function Mm(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>jm(e,{target:t.target}),{createScanner(e){return new cd(e,t)},createString:ud}}var Nm={astro:()=>d(()=>import(`./astro-uzna3x9Z.js`),__vite__mapDeps([0,1,2,3,4,5,6,7])),c:()=>d(()=>import(`./c-DaO8xguW.js`),[]),csharp:()=>d(()=>import(`./csharp-dmMxLVLW.js`),[]),css:()=>d(()=>import(`./css-C8fQr_0Q.js`),[]),diff:()=>d(()=>import(`./diff-woXpYk--.js`),[]),dockerfile:()=>d(()=>import(`./dockerfile-IyjqRm3v.js`),[]),dotenv:()=>d(()=>import(`./dotenv-CuH5my32.js`),[]),fish:()=>d(()=>import(`./fish-BJitypiv.js`),[]),go:()=>d(()=>import(`./go-rLFTqkRN.js`),[]),graphql:()=>d(()=>import(`./graphql-Dq_Q6ac9.js`),__vite__mapDeps([8,2,3,4,7,9])),html:()=>d(()=>import(`./html-wSbaAAK3.js`),__vite__mapDeps([10,2,5])),ini:()=>d(()=>import(`./ini-B5eOa1yu.js`),[]),java:()=>d(()=>import(`./java-D7h0NA_A.js`).then(e=>e.n),__vite__mapDeps([11,4])),javascript:()=>d(()=>import(`./javascript-BgS3c2Ky.js`),[]),json:()=>d(()=>import(`./json-qhed-kSA.js`),[]),json5:()=>d(()=>import(`./json5-BR5RXkoi.js`),[]),jsonc:()=>d(()=>import(`./jsonc-CYpm1nAK.js`),[]),jsonl:()=>d(()=>import(`./jsonl-CmCQp5Yx.js`),[]),jsx:()=>d(()=>import(`./jsx-BUUYi3qs.js`).then(e=>e.n),__vite__mapDeps([9,4])),kotlin:()=>d(()=>import(`./kotlin-DhhofPvG.js`),[]),kts:()=>d(()=>import(`./kts-DFAlwc6n.js`),__vite__mapDeps([12,13])),less:()=>d(()=>import(`./less-DVTAwKKz.js`),[]),lua:()=>d(()=>import(`./lua-xZcbXUE9.js`),__vite__mapDeps([14,15])),makefile:()=>d(()=>import(`./makefile-Dixweg8N.js`),[]),markdown:()=>d(()=>import(`./markdown-BYOwaDjH.js`),[]),php:()=>d(()=>import(`./php-lW4PUsGw.js`),__vite__mapDeps([16,1,2,5,10,17,11,4,18])),powershell:()=>d(()=>import(`./powershell-QtSnmXcu.js`),[]),prisma:()=>d(()=>import(`./prisma-DMgNhnYS.js`),[]),properties:()=>d(()=>import(`./properties-CxAuzHS9.js`),__vite__mapDeps([19,20])),python:()=>d(()=>import(`./python-gzcpVVnB.js`),[]),ruby:()=>d(()=>import(`./ruby-DDU-xGaZ.js`),__vite__mapDeps([21,2,5,15,8,3,4,7,9,10,14,17,11,18,22,23])),rust:()=>d(()=>import(`./rust-DpiIf5JO.js`),[]),sass:()=>d(()=>import(`./sass-DXrisJhu.js`),[]),scss:()=>d(()=>import(`./scss-CHVQqdPx.js`),__vite__mapDeps([24,5])),shellscript:()=>d(()=>import(`./shellscript-CLZ0U2zV.js`),[]),sql:()=>d(()=>import(`./sql-CEbI0hMM.js`),[]),svelte:()=>d(()=>import(`./svelte-BwxZAPCy.js`),__vite__mapDeps([25,2,3,4,5,6])),swift:()=>d(()=>import(`./swift-CyEgAFGc.js`),[]),toml:()=>d(()=>import(`./toml-CcmNWLt0.js`),[]),tsx:()=>d(()=>import(`./tsx-DvWhG4dC.js`).then(e=>e.n),__vite__mapDeps([7,4])),typescript:()=>d(()=>import(`./typescript-BTGs5etX.js`).then(e=>e.n),__vite__mapDeps([3,4])),vue:()=>d(()=>import(`./vue-B-rnT8WY.js`),__vite__mapDeps([26,1,2,3,4,5,10])),xml:()=>d(()=>import(`./xml-BsprbK0m.js`),__vite__mapDeps([17,11,4])),yaml:()=>d(()=>import(`./yaml-rwi0_p6S.js`),[]),yml:()=>d(()=>import(`./yml-s9iVJXCw.js`),__vite__mapDeps([27,23])),zsh:()=>d(()=>import(`./zsh-B7CDPTg5.js`),__vite__mapDeps([28,22]))},Pm=Nu({langs:Nm,themes:{},engine:()=>Mm()}),{codeToHtml:Fm,codeToHast:Im,codeToTokens:Lm,codeToTokensBase:Rm,codeToTokensWithThemes:zm,getSingletonHighlighter:Bm,getLastGrammarState:Vm}=Fu(Pm);async function Hm(e){if(zs())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=bs.get(e);if(t!=null)return t;try{let t=xs.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(Nm,e)&&(t=Nm[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return ys.has(e)||ys.set(e,n),n});return bs.set(e,n),await n}finally{bs.delete(e)}}function Um(e){return ys.get(e)??Hm(e)}function Wm(e){for(let t of ws(e))if(!Ts.has(t))return!1;return!0}function Gm({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:Km(t)}}function Km(e){return async()=>$s(js(await e()))}var qm=`pierre`,Jm=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],Ym=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],Xm=[...Ym,...Jm],Zm=new Set(Ym);function Qm(e){return Zm.has(e)?`light`:`dark`}var $m={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},eh={"pierre-dark":()=>d(()=>import(`./pierre-dark-CpLgRqie.js`),[]),"pierre-dark-soft":()=>d(()=>import(`./pierre-dark-soft-kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>d(()=>import(`./pierre-dark-vibrant-CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>d(()=>import(`./pierre-dark-protanopia-deuteranopia-B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>d(()=>import(`./pierre-dark-tritanopia-CpjhbsIL.js`),[]),"pierre-light":()=>d(()=>import(`./pierre-light-CoaEpmwp.js`),[]),"pierre-light-soft":()=>d(()=>import(`./pierre-light-soft-lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>d(()=>import(`./pierre-light-vibrant-D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>d(()=>import(`./pierre-light-protanopia-deuteranopia-0fSaH845.js`),[]),"pierre-light-tritanopia":()=>d(()=>import(`./pierre-light-tritanopia-CEbqgOJL.js`),[])};function th(e){return Gm({name:e,collection:qm,colorScheme:Qm(e),displayName:$m[e],load:eh[e]})}var nh=Es({themes:Xm.map(e=>th(e))}),rh={getTheme:e=>void 0};function ih(e){if(zs())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(Is.hasRegisteredTheme(e))return;let t=rh.getTheme(e);if(t!=null){Is.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function ah(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function oh(e){ih(e);let t=await Is.resolveTheme(e);return ah(e,t),t}function sh(e){return Is.getResolvedTheme(e)??oh(e)}var ch;async function lh({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){ch??=Pm({themes:[],langs:[`text`],engine:n===`shiki-wasm`?id(d(()=>import(`./wasm-BnjxR4X6.js`),[])):Mm()});let r=dh(ch)?await ch:ch;ch=r;let i=[];for(let e of Array.from(new Set(t))){if(e===`text`||e===`ansi`)continue;let t=Um(e);`then`in t?i.push(t):Rs(t,r)}let a=[];for(let t of e){let e=sh(t);`then`in e?a.push(e):Ls(e,ch)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{Rs(e,r)}),Promise.all(a).then(e=>{Ls(e,r)})]),r}function uh(e){if(!(ch==null||`then`in ch)&&(e==null||Wm(e.theme)&&Cs(e.lang)))return ch}function dh(e=ch){return e!=null&&`then`in e}for(let e of nh.getThemes())Is.registerThemeIfAbsent(e.name,e.load);function fh(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function ph(e){return Is.hasResolvedThemes(e)}function mh(e,t){return fh(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function hh(e){return(e.lang??L(e.name))===`text`}function gh(e,t){for(let n of t)e.push(n)}function _h(e){return{type:`text`,value:e}}function X({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function vh({name:e,width:t=16,height:n=16,properties:r}){return X({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[X({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function yh(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function bh(e){return X({tagName:`div`,properties:{"data-gutter":``},children:e})}function xh(e,t,n,r={}){return X({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[X({tagName:`span`,properties:{"data-line-number-content":``},children:[_h(`${t}`)]})]})}function Sh(e,t,n){return X({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function Ch(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(_h(`
|
|
221
221
|
`)),e}var wh=Symbol(`no-token`),Th=Symbol(`multiple-tokens`);function Eh(e){let t=Dh(e);if(t!=null)return t;let n=wh,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){kh(e,a);for(let t of e.children)Oh(t)}else Oh(e);r.push(e),i=[],a=void 0;return}for(let e of i)Oh(e);r.push(X({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==wh){if(e===Th){n=Th;return}if(n===wh){n=e;return}n!==e&&(n=Th)}};for(let t of e.children){let e=t.type===`element`?Eh(t):wh;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function Dh(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function Oh(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)Oh(t)}}function kh(e,t){e.properties[`data-char`]=t}function Ah(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+jh(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function jh(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function Mh(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=yh(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&Eh(a),i.push(Ch(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push(Ph,Nh),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:Nh}}var Nh=Ah({classPrefix:`hl-`}),Ph={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function Fh(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}function Ih({theme:e=R,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=Xi(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${Fh(`global`)}fg:${a.fg};`,r+=`${Fh(`global`)}bg:${a.bg};`,r+=Lh(i,n)}else{let n=t.getTheme(e.dark),i=Xi(n);r+=`${Fh(`global`)}dark:${i.fg};`,r+=`${Fh(`global`)}dark-bg:${i.bg};`,r+=Lh(n,`dark`),n=t.getTheme(e.light),i=Xi(n),r+=`${Fh(`global`)}light:${i.fg};`,r+=`${Fh(`global`)}light-bg:${i.bg};`,r+=Lh(n,`light`)}return r}function Lh(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${Fh(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${Fh(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${Fh(`global`)}${t}modified-color:${a};`),n}function Rh(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}var zh={forcePlainText:!1};function Bh(e,t,{theme:n,tokenizeMaxLineLength:r,useTokenTransformer:i},{forcePlainText:a,startingLine:o,totalLines:s,lines:c}=zh){a?(o??=0,s??=1/0):(o=0,s=1/0);let l=o>0||s<1/0,{state:u,transformers:d}=Mh(i),f=a?`text`:e.lang??L(e.name),p=typeof n==`string`?t.getTheme(n).type:void 0,m=Ih({theme:n,highlighter:t});u.lineInfo=e=>({type:`context`,lineIndex:e-1+o,lineNumber:e+o});let h=typeof n==`string`?{lang:f,theme:n,transformers:d,defaultColor:!1,cssVariablePrefix:Fh(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:f,themes:n,transformers:d,defaultColor:!1,cssVariablePrefix:Fh(`token`),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},g=Rh(t.codeToHast(Vh(l?Hh(c??b(e.contents),o,s):e.contents),h)),_=l?Array(o):g;return l&&gh(_,g),{code:_,themeStyles:m,baseThemeType:p}}function Vh(e){return e.replace(/\r(?!\n)/g,`
|
|
222
222
|
`)}function Hh(e,t,n){if(e.length===0)return``;let r=Math.min(t+n,e.length);return e.slice(t,r).join(``)}var Uh=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled because the pool terminated`),this.name=`WorkerPoolTerminatedError`}},Wh=class extends Error{constructor(){super(`WorkerPoolManager: operation canceled before the task completed`),this.name=`WorkerPoolTaskCanceledError`}},Gh=class extends Error{constructor(e,t){super(e,t),this.name=`WorkerPoolWorkerError`}},Kh=new WeakSet;function qh(e){return e instanceof Uh||e instanceof Wh}function Jh(e){return qh(e)||e instanceof Gh&&Kh.has(e)}function Z(e,t){return e?.cacheKey!=null||t?.cacheKey!=null?e?.cacheKey===t?.cacheKey:e===t}function Yh(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Xh(e,t){return fh(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function Zh(e){let t=e.lang??L(e.name),n=e.lang??(e.prevName==null?`text`:L(e.prevName));return t===`text`&&n===`text`}function Qh(e){return{...Mi,...e}}function $h(e,t){return eg(e,t)+tg(e,t)}function eg(e,t){return t?0:e.diffHeaderHeight}function tg(e,t){return e.paddingTop??(t?e.spacing:0)}function ng(e){return e.paddingBottom??e.spacing}function rg(e){switch(e){case`simple`:return 4;case`metadata`:case`line-info`:case`line-info-basic`:case`custom`:return 32}}function ig(e){return[fs(e.additionStart,e.additionCount)+1,ps(e.additionStart,e.additionCount)+1]}function ag({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function og(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-ps(t.additionStart,t.additionCount),r=e.deletionLines.length-ps(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function sg({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-ps(n.additionStart,n.additionCount),i=e.deletionLines.length-ps(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function cg({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=sg({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function lg({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=ig(a);if(t<o){let s=ag({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=cg({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=ig(a);return t<o+i.fromStart||t>=o+i.rangeSize}function ug({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=ig(n),l=ag({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=cg({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function dg({type:e,metrics:t}){return t.hunkSeparatorHeight??rg(e)}function fg({type:e,metrics:t}){return e===`simple`||e===`metadata`||e===`line-info-basic`?0:t.spacing}function pg({type:e,hunkIndex:t,hunkSpecs:n}){switch(e){case`simple`:return t>0;case`metadata`:return n!=null;case`line-info`:case`line-info-basic`:case`custom`:return!0}}function mg(e){return e!==`simple`&&e!==`metadata`}function hg({type:e,metrics:t,hunkIndex:n,hunkSpecs:r}){if(!pg({type:e,hunkIndex:n,hunkSpecs:r}))return;let i=dg({type:e,metrics:t}),a=fg({type:e,metrics:t}),o=n>0?a:0,s=a;return{height:i,gapBefore:o,gapAfter:s,totalHeight:o+i+s}}function gg({type:e,metrics:t}){if(!mg(e))return;let n=dg({type:e,metrics:t}),r=fg({type:e,metrics:t});return{height:n,gapBefore:r,gapAfter:0,totalHeight:r+n}}function _g({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=vg({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=fs(r.deletionStart,r.deletionCount),s=fs(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=ag({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?cg({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(xg(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,xg(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(xg(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=Sg(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(Cg({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(xg(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function vg({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=yg({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function yg({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=ag({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?cg({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function bg(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function xg(e,t,n,r,i,a){let[o,s]=bg(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function Sg(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function Cg({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,w=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,T=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,E=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:w}:void 0;if(T==null&&E!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:E};if(T!=null&&E==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:void 0};if(T==null||E==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:T,additionLine:E}}function wg(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var Tg=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},Eg=new class extends Tg{};function Dg(e,t,n){return Eg.diff(e,t,n)}function Og(e,t){let n=0;for(;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function kg(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Ag(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function jg(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Mg(e,t){return Ag(e,t,``)}function Ng(e,t){return jg(e,t,``)}function Pg(e,t){return t.slice(0,Fg(e,t))}function Fg(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Ig(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function Lg(e,t){if(t)return zg(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Rg(e,t){if(t)return zg(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function zg(e,t){if(!t)return[Rg(e),Lg(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Ig(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Bg=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Vg=RegExp(`[${Bg}]+|\\s+|[^${Bg}]`,`ug`);new class extends Tg{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Ig(e,r)}else n=e.match(Vg)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Hg(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Hg(n,i,r,null,t.intlSegmenter),e}};function Hg(e,t,n,r,i){if(t&&n){let[a,o]=zg(t.value,i),[s,c]=zg(n.value,i);if(e){let r=Og(a,s);e.value=jg(e.value,s,r),t.value=Mg(t.value,r),n.value=Mg(n.value,r)}if(r){let e=kg(o,c);r.value=Ag(r.value,c,e),t.value=Ng(t.value,e),n.value=Ng(n.value,e)}}else if(n){if(e){let e=Rg(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Rg(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Rg(r.value,i),[a,o]=zg(t.value,i),s=Og(n,a);t.value=Mg(t.value,s);let c=kg(Mg(n,s),o);t.value=Ng(t.value,c),r.value=Ag(r.value,n,c),e.value=jg(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Rg(r.value,i),n=Pg(Lg(t.value,i),e);t.value=Ng(t.value,n)}else if(e){let n=Pg(Lg(e.value,i),Rg(t.value,i));t.value=Mg(t.value,n)}}var Ug=new class extends Tg{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Bg}]+|[^\\S\\n\\r]+|[^${Bg}]`,`ug`);return e.match(t)||[]}};function Wg(e,t,n){return Ug.diff(e,t,n)}var Gg=new class extends Tg{constructor(){super(...arguments),this.tokenize=qg}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
223
223
|
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|