diff --git a/docs/research/WEB_EVIDENCE_TERMINAL_STRINGS_2026-10-07.md b/docs/research/WEB_EVIDENCE_TERMINAL_STRINGS_2026-10-07.md new file mode 100644 index 00000000..6436cd9e --- /dev/null +++ b/docs/research/WEB_EVIDENCE_TERMINAL_STRINGS_2026-10-07.md @@ -0,0 +1,18 @@ +# Terminal strings in Web evidence + +- Status: validated source and regression evidence +- Created / verified: 2026-10-07 +- Source: origin/main at 3cb2ecfe1bfbb98252651885311d309f83749428 +- Issue: [#700](https://github.com/openpi-dev/openpi/issues/700) +- Supersedes: none + +## Verified facts + +Web evidence stripped escape introducers while retaining hidden DCS, PM, APC and SOS payloads. It now uses the canonical shared terminal sanitizer on its bounded candidate. Tests cover ESC/C1 introducers, terminators, unterminated strings and actual tool projections. + +## Verification boundary + +Eight evidence tests pass. Unicode and tab behavior follows the shared sanitizer. Canonical execution and persisted evidence are unchanged. + +Full repository validation results and CI are recorded on the linked PR. Local +Windows failures are retained separately and are not reported as passing. diff --git a/tests/web/evidence-view.spec.ts b/tests/web/evidence-view.spec.ts index 8bd90966..291f8ce0 100644 --- a/tests/web/evidence-view.spec.ts +++ b/tests/web/evidence-view.spec.ts @@ -239,6 +239,7 @@ it.each(["failed", "cancelled", "unknown", "running"] as const)( it("expands a file summary without nested controls and opens the resolved file through the active artifact context", () => { const open = vi.fn(); + const identity = "/workspace/a\u200bb.md"; const { container } = render( createElement( ArtifactContext.Provider, @@ -249,8 +250,8 @@ it("expands a file summary without nested controls and opens the resolved file t name: "read", arguments: JSON.stringify({ path: "report.md" }), evidenceArguments: { - path: "report.md", - resolvedPath: "/workspace/report.md", + path: "a\u200bb.md", + resolvedPath: identity, }, }, result: { content: "report", isError: false }, @@ -259,12 +260,12 @@ it("expands a file summary without nested controls and opens the resolved file t ); const summary = container.querySelector(".tool-evidence-card > summary")!; - expect(summary.textContent).toContain("report.md"); + expect(summary.textContent).toContain("ab.md"); expect(summary.querySelector("button, a, input, [tabindex]")).toBeNull(); fireEvent.click(summary); expect(open).not.toHaveBeenCalled(); - fireEvent.click(screen.getByRole("button", { name: "/workspace/report.md" })); - expect(open).toHaveBeenCalledWith("/workspace/report.md"); + fireEvent.click(screen.getByRole("button", { name: "/workspace/ab.md" })); + expect(open).toHaveBeenCalledWith(identity); }); it("opens local links using authenticated API and stops preview reads on close", async () => { @@ -521,3 +522,56 @@ it("polls metadata with backoff, retains changed text until refresh, and stops o vi.useRealTimers(); } }); + +it("keeps oversized evidence references non-actionable in projected and legacy calls", () => { + const huge = "x".repeat(1024 * 1024); + const open = vi.fn(); + for (const evidenceArguments of [ + undefined, + { path: huge, resolvedPath: "small.txt" }, + { path: "small.txt", resolvedPath: huge }, + ]) { + const { container, unmount } = render( + createElement( + ArtifactContext.Provider, + { value: { open } }, + createElement(ToolEvidence, { + call: { + type: "toolCall", + name: "read", + arguments: JSON.stringify({ path: huge }), + evidenceArguments, + }, + defaultOpen: true, + }), + ), + ); + expect(screen.queryByRole("button")).toBeNull(); + expect( + screen.getByText("File reference exceeds the evidence byte limit."), + ).toBeTruthy(); + expect(container.textContent!.length).toBeLessThan(64 * 1024); + expect(open).not.toHaveBeenCalled(); + unmount(); + } +}); + +it("opens admitted exact identities even when their display label is empty", () => { + const open = vi.fn(); + render( + createElement( + ArtifactContext.Provider, + { value: { open } }, + createElement(ToolEvidence, { + call: { + type: "toolCall", + name: "read", + arguments: JSON.stringify({ path: "\u200b" }), + }, + defaultOpen: true, + }), + ), + ); + fireEvent.click(screen.getByRole("button", { name: "File reference" })); + expect(open).toHaveBeenCalledWith("\u200b"); +}); diff --git a/tests/web/evidence.test.ts b/tests/web/evidence.test.ts index cef62bbe..2d475aa6 100644 --- a/tests/web/evidence.test.ts +++ b/tests/web/evidence.test.ts @@ -1,4 +1,7 @@ import assert from "node:assert/strict"; +import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; import test from "node:test"; import { evidenceText, @@ -8,6 +11,7 @@ import { } from "../../web/protocol/evidence.ts"; import { projectMessage } from "../../web/protocol/types.ts"; import { reduceLiveTools } from "../../web/protocol/live-tools.ts"; +import { ArtifactReader } from "../../web/host/artifacts.ts"; function call(name: string, args: Record = {}) { const part = projectMessage({ @@ -17,6 +21,36 @@ function call(name: string, args: Record = {}) { return part; } +test("Web evidence strips terminal-owned hidden strings rather than exposing their payloads", () => { + for (const start of [ + "\x1bP", + "\x1bX", + "\x1b^", + "\x1b_", + "\u0090", + "\u0098", + "\u009e", + "\u009f", + ]) { + for (const end of ["\x1b\\", "\u009c"]) { + assert.equal( + evidenceText(`before${start}hidden${end}after`).text, + "beforeafter", + ); + } + assert.equal(evidenceText(`before${start}unterminated`).text, "before"); + } + assert.equal( + evidenceText("中文\t👩‍💻\x1b[31mvisible\x1b[0m").text, + "中文 👩‍💻visible", + ); + const result = projectToolEvidence(call("bash"), { + content: "before\x1bPhidden\x1b\\after", + isError: false, + }); + assert.equal(result.output, "beforeafter"); +}); + test("bounded messages preserve final bash receipts before output truncation", () => { const message = projectMessage({ role: "toolResult", @@ -84,6 +118,61 @@ test("file evidence preserves requested range after oversized arguments and neve ); }); +test("file evidence keeps artifact identities separate from sanitized display labels", async () => { + const root = await mkdtemp(join(tmpdir(), "openpi-evidence-path-")); + const identity = "a\u200bb.txt"; + const resolvedPath = join(root, identity); + const reader = new ArtifactReader(() => ({ sessionId: "s", cwd: root })); + try { + await writeFile(resolvedPath, "zero-width identity"); + await writeFile(join(root, "ab.txt"), "different file"); + const message = projectMessage( + { + content: [ + { + type: "toolCall", + id: "call", + name: "read", + arguments: { path: identity }, + }, + ], + }, + (path) => join(root, path), + ); + const part = message.parts?.[0]; + assert.ok(part?.type === "toolCall"); + const view = projectToolEvidence(part); + assert.equal(view.path, identity); + assert.equal(view.displayPath, "ab.txt"); + assert.equal(view.resolvedPath, resolvedPath); + const handle = await reader.resolveFile("s", view.resolvedPath!); + assert.equal( + (await reader.read(handle, "s")).preview.text, + "zero-width identity", + ); + + const tabView = projectToolEvidence(call("read", { path: "a\tb.txt" })); + assert.equal(tabView.path, "a\tb.txt"); + assert.equal(tabView.displayPath, "a b.txt"); + if (process.platform !== "win32") { + // Windows filenames cannot contain tab characters. + await writeFile(join(root, "a\tb.txt"), "tab identity"); + assert.equal( + await readFile(join(root, tabView.path!), "utf8"), + "tab identity", + ); + } + // Artifact policy still rejects controls; evidence must not silently retarget + // the sanitized label to another real file to bypass that boundary. + await assert.rejects(reader.resolveFile("s", tabView.path!), { + code: "ARTIFACT_DENIED", + }); + } finally { + reader.dispose(); + await rm(root, { recursive: true, force: true }); + } +}); + test("terminal receipts, TAP observations, and tool returns remain separate", () => { const bash = call("bash", { command: "node --test" }); const output = @@ -262,3 +351,119 @@ test("background process outcomes require literal status identities and integral ); } }); + +test("evidence admits exact UTF-8 path bytes and rejects oversized identities without fallback", () => { + const budget = 4096; + for (const exact of [ + "x".repeat(budget), + "中".repeat(1365) + "x", + "😀".repeat(1024), + ]) { + for (const path of [exact.slice(0, -2), exact]) { + assert.equal(projectToolEvidence(call("read", { path })).path, path); + } + const path = exact + "x"; + const view = projectToolEvidence(call("read", { path })); + assert.equal(view.path, undefined); + assert.equal(view.resolvedPath, undefined); + assert.equal( + view.pathUnavailable, + "File reference exceeds the evidence byte limit.", + ); + assert.equal(view.truncated, true); + for (const legacy of [ + { + type: "toolCall" as const, + name: "read", + arguments: JSON.stringify({ path }), + }, + { + type: "toolCall" as const, + name: "read", + arguments: "{}", + evidenceArguments: { path, resolvedPath: "short.txt" }, + }, + { + type: "toolCall" as const, + name: "read", + arguments: "{}", + evidenceArguments: { path: "short.txt", resolvedPath: path }, + }, + ]) { + const projected = projectToolEvidence(legacy); + assert.equal(projected.path, undefined); + assert.equal(projected.resolvedPath, undefined); + } + } +}); + +test("production evidence serialization bounds raw and resolved 1 MiB paths", () => { + const huge = "x".repeat(1024 * 1024); + let resolutions = 0; + for (const path of [huge, "short.txt"]) { + const message = projectMessage( + { content: [{ type: "toolCall", name: "read", arguments: { path } }] }, + () => { + resolutions++; + return huge; + }, + ); + const part = message.parts?.[0]; + assert.ok(part?.type === "toolCall"); + const view = projectToolEvidence(part); + assert.equal(view.path, undefined); + assert.equal(view.resolvedPath, undefined); + assert.ok(view.pathUnavailable); + assert.ok(Buffer.byteLength(JSON.stringify(message)) < 64 * 1024); + assert.ok(Buffer.byteLength(JSON.stringify(view)) < 64 * 1024); + assert.ok(Buffer.byteLength(view.displayPath ?? "") <= 12 * 1024); + } + assert.equal(resolutions, 1); + const exact = "中".repeat(1365) + "x"; + const projected = projectMessage( + { + content: [{ type: "toolCall", name: "read", arguments: { path: "ok" } }], + }, + () => exact, + ); + const part = projected.parts?.[0]; + assert.ok(part?.type === "toolCall"); + assert.equal(projectToolEvidence(part).resolvedPath, exact); +}); + +test("raw tool arguments cannot supply the trusted resolved evidence identity", () => { + for (const path of ["~/.note", "@named/path", "report.md"]) { + let resolverCalls = 0; + const message = projectMessage( + { + content: [ + { + type: "toolCall", + name: "read", + arguments: { path, resolvedPath: "different.txt" }, + }, + ], + }, + () => { + resolverCalls++; + return "/workspace/report.md"; + }, + ); + const part = message.parts?.[0]; + assert.ok(part?.type === "toolCall"); + const view = projectToolEvidence(part); + assert.equal(view.path, path); + assert.equal( + view.resolvedPath, + path === "report.md" ? "/workspace/report.md" : undefined, + ); + assert.equal(resolverCalls, path === "report.md" ? 1 : 0); + const legacy = projectToolEvidence({ + type: "toolCall", + name: "read", + arguments: JSON.stringify({ path, resolvedPath: "different.txt" }), + }); + assert.equal(legacy.path, path); + assert.equal(legacy.resolvedPath, undefined); + } +}); diff --git a/web/dist/app.js b/web/dist/app.js index cbbb16d6..9cf18e9f 100644 --- a/web/dist/app.js +++ b/web/dist/app.js @@ -47,95 +47,96 @@ Try polyfilling it using "@formatjs/intl-pluralrules" `)}\n}`);let o=``;t.length>0&&(o=`@scope (${r}) to (${i}) {\n${t.join(` -`)}\n}`);let s=Dl(e);return s&&(o=o?`${o}\n\n${s}`:s),{prose:a,component:o}}var Al={...Lr,...zr,...Vr,...Hr,...Ur,...Gr,...Kr,...qr,...Yr,...Zr,...Qr,...$r,...ei,...el};function jl(e){return`var(${e})`}Object.fromEntries(Object.keys(Al).map(e=>[e,jl(e)]));function Ml(e){let t=0,n=null,r=!1;for(let i=0;if*e*s.a+p*t*c.a,_=g(s.r,c.r),v=g(s.g,c.g),y=g(s.b,c.b);return Ia({...h===0?{r:0,g:0,b:0}:{r:_/h,g:v/h,b:y/h},a:h*m})}function Rl(e){let t=e.indexOf(`color-mix(`);if(t===-1)return e;let n=t+9,r=Fl(e,n);if(r===-1)return e;let i=Rl(e.slice(n+1,r)),a=Ll(i)??`color-mix(${i})`;return e.slice(0,t)+a+Rl(e.slice(r+1))}function zl(e,t,n,r){let i=e.indexOf(`var(`);if(i===-1)return e;let a=i+3,o=Fl(e,a);if(o===-1)return e;let s=e.slice(a+1,o),c=Ml(s),l=(c?c[0]:s).trim(),u=c?c[1]:null,d;r.has(l)?d=e.slice(i,o+1):l in t?(r.add(l),d=Vl(l,t,n,r),r.delete(l)):d=u===null?e.slice(i,o+1):zl(u.trim(),t,n,r);let f=zl(e.slice(o+1),t,n,r);return e.slice(0,i)+d+f}function Bl(e,t,n,r){return!e.includes(`var(`)&&!e.includes(`color-mix(`)?e:Rl(zl(e,t,n,r))}function Vl(e,t,n,r){if(e in n)return n[e];let i=t[e];if(i===void 0)return``;let a=Bl(i,t,n,r);return n[e]=a,a}function Hl(e){let t={};for(let n of Object.keys(e))Vl(n,e,t,new Set);return t}function Ul(e,t){let{mode:n}=t,r={};for(let[e,t]of Object.entries(Al))r[e]=Pl(t,n);if(e==null)return Hl(r);for(let[t,i]of Object.entries(e.tokens))r[t]=Pl(i,n);if(e.__inputTokens)for(let[t,i]of Object.entries(e.__inputTokens))i!==void 0&&(r[t]=Pl(i,n));return Hl(r)}function Wl(e,t=!1){let n=(0,_.useCallback)(t=>{let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},[e]),r=(0,_.useCallback)(()=>window.matchMedia(e).matches,[e]),i=(0,_.useCallback)(()=>t,[t]);return(0,_.useSyncExternalStore)(n,r,i)}var Gl=(0,_.createContext)(null);Gl.displayName=`ThemeContext`;function Kl(){if(typeof document>`u`)return null;let e=document.documentElement.getAttribute(`data-theme`);return e===`light`||e===`dark`?e:null}function ql(){return null}function Jl(){return typeof document>`u`?null:document.documentElement.getAttribute(ma(`theme`))}function Yl(){return null}function Xl(){return null}var Zl=new Set,Ql=null,$l=new Set,eu=null;function tu(){for(let e of Zl)e()}function nu(e){return Zl.add(e),Zl.size===1&&typeof MutationObserver<`u`&&(Ql=new MutationObserver(tu),Ql.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})),()=>{Zl.delete(e),Zl.size===0&&Ql&&(Ql.disconnect(),Ql=null)}}function ru(){for(let e of $l)e()}function iu(e){return $l.add(e),$l.size===1&&typeof MutationObserver<`u`&&(eu=new MutationObserver(ru),eu.observe(document.documentElement,{attributes:!0,attributeFilter:[ma(`theme`)]})),()=>{$l.delete(e),$l.size===0&&eu&&(eu.disconnect(),eu=null)}}function au(){return()=>{}}function ou(e){return(0,_.useSyncExternalStore)(e?au:nu,e?Xl:Kl,ql)}function su(e){return(0,_.useSyncExternalStore)(e?au:iu,e?Xl:Jl,Yl)}function cu(){let e=(0,_.use)(Gl),t=su(e!=null);return e?.theme.name??t}function lu(){let e=(0,_.use)(Gl),t=e!=null,n=ou(t),r=su(t),i=Wl(`(prefers-color-scheme: dark)`),a=e?.mode??n??`system`,o=e?.theme??rl(r),s=a===`system`?i?`dark`:`light`:a,c=(0,_.useMemo)(()=>Ul(o,{mode:s}),[o,s]),l=(0,_.useCallback)(e=>c[e]??``,[c]),u=o?.name??`default`;return(0,_.useMemo)(()=>({name:u,mode:s,token:l,tokens:c}),[u,s,l,c])}var uu={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,width:`1em`,height:`1em`,"aria-hidden":!0},du={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,width:`1em`,height:`1em`,"aria-hidden":!0},fu={close:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M6 6l12 12M6 18L18 6`})}),chevronDown:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M6 9l6 6 6-6`})}),"numberInput:stepperDown":(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M7.5 9.75l4.5 4.5 4.5-4.5`})}),chevronLeft:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M15 6l-6 6 6 6`})}),chevronRight:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M9 6l6 6-6 6`})}),chevronsLeft:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M18 6l-6 6 6 6M11 6l-6 6 6 6`})}),chevronsRight:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M6 6l6 6-6 6M13 6l6 6-6 6`})}),check:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M5 13l4 4L19 7`})}),success:(0,K.jsx)(`svg`,{...du,children:(0,K.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3a9 9 0 100 18 9 9 0 000-18zm4.06 6.56a.75.75 0 00-1.12-1l-3.94 4.4-1.94-1.94a.75.75 0 00-1.06 1.06l2.5 2.5a.75.75 0 001.09-.03l4.47-5z`})}),error:(0,K.jsx)(`svg`,{...du,children:(0,K.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3a9 9 0 100 18 9 9 0 000-18zm-2.47 5.47a.75.75 0 00-1.06 1.06L10.94 12l-2.47 2.47a.75.75 0 101.06 1.06L12 13.06l2.47 2.47a.75.75 0 101.06-1.06L13.06 12l2.47-2.47a.75.75 0 00-1.06-1.06L12 10.94l-2.47-2.47z`})}),warning:(0,K.jsx)(`svg`,{...du,children:(0,K.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.29 3.86L2.07 19.05A2 2 0 003.78 22h16.44a2 2 0 001.71-2.95L13.71 3.86a2 2 0 00-3.42 0zM12 9a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0112 9zm0 9a1 1 0 100-2 1 1 0 000 2z`})}),info:(0,K.jsx)(`svg`,{...du,children:(0,K.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3a9 9 0 100 18 9 9 0 000-18zm0 4a1 1 0 100 2 1 1 0 000-2zm-.75 3.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5z`})}),calendar:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`}),(0,K.jsx)(`path`,{d:`M16 2v4M8 2v4M3 10h18`})]}),clock:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,K.jsx)(`path`,{d:`M12 7v5l3 3`})]}),externalLink:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`path`,{d:`M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6`}),(0,K.jsx)(`path`,{d:`M15 3h6v6`}),(0,K.jsx)(`path`,{d:`M10 14L21 3`})]}),menu:(0,K.jsx)(`svg`,{...uu,strokeWidth:2,children:(0,K.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h16`})}),moreHorizontal:(0,K.jsxs)(`svg`,{...du,children:[(0,K.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.5`}),(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.5`}),(0,K.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.5`})]}),search:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,K.jsx)(`path`,{d:`M21 21l-4.35-4.35`})]}),arrowUp:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M12 19V5m0 0l-7 7m7-7l7 7`})}),arrowDown:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M12 5v14m0 0l7-7m-7 7l-7-7`})}),arrowsUpDown:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M3 7.5L7.5 3m0 0L12 7.5M7.5 3v13.5m13.5 0L16.5 21m0 0L12 16.5m4.5 4.5V7.5`})}),funnel:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z`})}),eyeSlash:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M3.98 8.223A10.477 10.477 0 001.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88`})}),viewColumns:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M9 4.5v15m6-15v15m-10.875 0h15.75c.621 0 1.125-.504 1.125-1.125V5.625c0-.621-.504-1.125-1.125-1.125H4.125C3.504 4.5 3 5.004 3 5.625v12.75c0 .621.504 1.125 1.125 1.125z`})}),copy:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`path`,{d:`M8 4v12a2 2 0 002 2h8a2 2 0 002-2V7.242a2 2 0 00-.602-1.43L16.083 2.57A2 2 0 0014.685 2H10a2 2 0 00-2 2z`}),(0,K.jsx)(`path`,{d:`M16 18v2a2 2 0 01-2 2H6a2 2 0 01-2-2V9a2 2 0 012-2h2`})]}),checkDouble:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`path`,{d:`M2 13l4 4L14 7`}),(0,K.jsx)(`path`,{d:`M9 13l4 4L21 7`})]}),wrench:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`})}),stop:(0,K.jsx)(`svg`,{...du,children:(0,K.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`2`})}),microphone:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`path`,{d:`M12 2a3 3 0 00-3 3v6a3 3 0 006 0V5a3 3 0 00-3-3z`}),(0,K.jsx)(`path`,{d:`M19 10v1a7 7 0 01-14 0v-1`}),(0,K.jsx)(`path`,{d:`M12 18v4m-4 0h8`})]})},pu={};function mu(e){return e==null?null:typeof e==`string`?rl(e)?.icons??null:e.icons??null}function hu(e,t){return mu(t)?.[e]??pu[e]??fu[e]}var gu={root:{kmuXW:`x2lah0s`,$$css:!0},span:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,$$css:!0}},_u={primary:{kMwMTN:`xtbr613`,$$css:!0},secondary:{kMwMTN:`xv9yike`,$$css:!0},tertiary:{kMwMTN:`xv9yike`,$$css:!0},disabled:{kMwMTN:`xqa6c3m`,$$css:!0},accent:{kMwMTN:`xqwr325`,$$css:!0},success:{kMwMTN:`xtjic6`,$$css:!0},error:{kMwMTN:`xjt36v0`,$$css:!0},warning:{kMwMTN:`xs3pv69`,$$css:!0},inherit:{kMwMTN:`x1heor9g`,$$css:!0},blue:{kMwMTN:`x1fns2mt`,$$css:!0},red:{kMwMTN:`xeffzf7`,$$css:!0},green:{kMwMTN:`xmxeech`,$$css:!0},gray:{kMwMTN:`x1eyinzz`,$$css:!0},cyan:{kMwMTN:`x157w0xa`,$$css:!0},teal:{kMwMTN:`x1f3zxcb`,$$css:!0},yellow:{kMwMTN:`x1g6zdft`,$$css:!0},orange:{kMwMTN:`xxu74a4`,$$css:!0},pink:{kMwMTN:`x1kxxfg5`,$$css:!0},purple:{kMwMTN:`xzdw94u`,$$css:!0}},vu={xsm:{kzqmXN:`x1jw3ynk`,kZKoxP:`xvle69y`,$$css:!0},sm:{kzqmXN:`xcdlrvm`,kZKoxP:`x1l36t39`,$$css:!0},md:{kzqmXN:`xwqq7k2`,kZKoxP:`xmll18r`,$$css:!0},lg:{kzqmXN:`xp8d6y2`,kZKoxP:`xam5rvr`,$$css:!0}},yu={xsm:{kzqmXN:`x1jw3ynk`,kZKoxP:`xvle69y`,kGuDYH:`xboafo0`,$$css:!0},sm:{kzqmXN:`xcdlrvm`,kZKoxP:`x1l36t39`,kGuDYH:`x1jchvi3`,$$css:!0},md:{kzqmXN:`xwqq7k2`,kZKoxP:`xmll18r`,kGuDYH:`x1603h9y`,$$css:!0},lg:{kzqmXN:`xp8d6y2`,kZKoxP:`xam5rvr`,kGuDYH:`xngnso2`,$$css:!0}};function bu(e){return e!=null&&e!==``?{role:`img`,"aria-label":e}:{"aria-hidden":`true`}}function xu({icon:e,color:t=`inherit`,size:n=`md`,label:r,ref:i,className:a,style:o,xstyle:s,...c}){let l=bu(r);return typeof e==`string`?(0,K.jsx)(Su,{name:e,color:t,size:n,a11yProps:l,className:a,style:o,xstyle:s,spanProps:c}):(0,K.jsx)(e,{ref:i,...l,...oa(ba(`icon`,{size:n,color:t}),Sr(gu.root,_u[t],vu[n],s),a??void 0,o),...c})}xu.displayName=`Icon`;function Su({name:e,color:t,size:n,a11yProps:r,className:i,style:a,xstyle:o,spanProps:s}){let c=hu(e,cu());if(c==null)return null;let l=s??{};return(0,K.jsx)(`span`,{...r,...l,...oa(ba(`icon`,{size:n,color:t}),Sr(gu.span,_u[t],yu[n],o),i??void 0,a),children:c})}function Cu(e,t){return typeof e==`string`||typeof e==`function`||typeof e==`object`&&e&&`render`in e?(0,K.jsx)(xu,{icon:e,...t}):e}var wu=typeof window<`u`?_.useLayoutEffect:_.useEffect,Tu={base:{k1xSpc:`xjp7ctv`,kMwMTN:`x1tgivj0`,kMv6JI:`x9ynric`,$$css:!0},light:{kQNsl9:`x19aimcq`,$$css:!0},dark:{kQNsl9:`xntwwlm`,$$css:!0},system:{kQNsl9:`x108lcm5`,$$css:!0}},Eu=_.createContext(!1);Eu.displayName=`ThemeNestingContext`;var Du=new Set,Ou=0;function ku(e){let t=(0,_.useId)();(0,_.useInsertionEffect)(()=>{if(e.__built)return;let n=`astryx-theme-${e.name}`;if(Du.has(n))return;`${e.name}`,`${e.name}${e.name}${e.name}${e.name}`;let{prose:r,component:i}=kl(e),a=Ol();Du.add(n);let o=[()=>Du.delete(n)];if(a){if(Ou++===0){let e=document.createElement(`style`);e.setAttribute(ma(`theme-base`),``),e.textContent=`@layer astryx-base {\n${a}\n}`,document.head.appendChild(e)}o.push(()=>{--Ou===0&&document.querySelector(`style[${ma(`theme-base`)}]`)?.remove()})}if(r){let n=document.createElement(`style`);n.setAttribute(ma(`theme-prose`),e.name),n.setAttribute(ma(`id`),t),n.textContent=`@layer reset {\n${r}\n}`,document.head.appendChild(n)}if(i){let n=document.createElement(`style`);n.setAttribute(ma(`theme`),e.name),n.setAttribute(ma(`id`),t),n.textContent=`@layer astryx-theme {\n${i}\n}`,document.head.appendChild(n)}return(r||i)&&o.push(()=>{let n=document.querySelector(`style[${ma(`theme-prose`)}="${e.name}"][${ma(`id`)}="${t}"]`),r=document.querySelector(`style[${ma(`theme`)}="${e.name}"][${ma(`id`)}="${t}"]`);n?.remove(),r?.remove()}),()=>{for(let e of o)e()}},[e,t])}function Au(e,t,n){wu(()=>{if(!e&&!(typeof document>`u`))return t===`light`||t===`dark`?document.documentElement.setAttribute(`data-theme`,t):document.documentElement.removeAttribute(`data-theme`),document.documentElement.setAttribute(ma(`theme`),n),()=>{document.documentElement.removeAttribute(`data-theme`),document.documentElement.removeAttribute(ma(`theme`))}},[e,t,n])}function ju({theme:e,mode:t=`system`,children:n}){let r=(0,_.use)(Eu);nl(e),ku(e),Au(r,t,e.name);let i=t===`dark`?Tu.dark:t===`light`?Tu.light:Tu.system,a=(0,_.useMemo)(()=>({theme:e,mode:t}),[e,t]);return(0,K.jsx)(Gl,{value:a,children:(0,K.jsx)(Eu,{value:!0,children:(0,K.jsx)(`div`,{...Sr(Tu.base,i),"data-astryx-theme":e.name,"data-theme":t===`system`?void 0:t,children:n})})})}ju.displayName=`Theme`;function Mu(e,t){let n=document.createElement(`span`);n.style.display=`none`,e.appendChild(n);try{return t.map(e=>(n.style.color=`var(${e})`,Pa(getComputedStyle(n).color)))}finally{n.remove()}}function Nu(e){let t=[],n=e;for(;n!==null;){let e=getComputedStyle(n);if(e.backgroundImage!==`none`)return null;let r=Pa(e.backgroundColor);if(r!==null&&r.a>0&&(t.push(r),r.a>=1))break;n=n.parentElement}let r=t.pop();return r===void 0||r.a<1?null:t.reduceRight((e,t)=>Yc(t,e),r)}var Pu=3;function Fu(e,t,n,r){return n===null||r===null?null:t!==null&&Zc(t,e)>=Pu?`off`:Zc(n,e)>=Zc(r,e)?`dark`:`light`}function Iu(e,t){let[n,r]=(0,_.useState)(null),{tokens:i}=lu(),a=(0,_.useRef)(null);return wu(()=>{let n=e.current?.parentElement??null;if(!t||n===null)return;let o=Nu(n);if(o===null)return;let s=Ia(o),c=a.current;if(c!==null&&c.background===s&&c.tokens===i)return;a.current={background:s,tokens:i};let[l,u,d]=Mu(n,[`--color-text-primary`,`--color-on-dark`,`--color-on-light`]),f=Fu(o,l,u,d);f!==null&&r(e=>e===f?e:f)}),t?n:null}function Lu({mode:e,fallback:t=`dark`,children:n}){let r=(0,_.useRef)(null),i=Iu(r,e===`auto`),a=e===`auto`?i??t:e;return(0,K.jsx)(`div`,{ref:r,...a===`off`?null:{[ma(`media`)]:a},...{0:{className:`xjp7ctv`},1:{className:`xjp7ctv x1tgivj0`}}[(a!==`off`)<<0],children:n})}Lu.displayName=`MediaTheme`;var Ru=8,zu=.4,Bu=48,Vu=1.2,Hu=1.2,Uu=`120%`,Wu=.4,Gu=.02;function Ku(e,t){return Math.min(Math.max(e/t,0),1)}function qu(e){e.style.removeProperty(`transition-duration`),e.style.removeProperty(`--_toast-swipe-y`),e.style.removeProperty(`--_toast-swipe-exit-y`),e.style.removeProperty(`--_toast-swipe-opacity`),e.style.removeProperty(`--_toast-swipe-scale`)}function Ju({direction:e,enabled:t,canPauseTimer:n,isTimerPaused:r,pauseTimer:i,resumeTimer:a,dismiss:o,shouldIgnoreTarget:s}){let c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useCallback)(e=>{let t=c.current,n=l.current;l.current=null,t&&qu(t),e&&n?.pausedTimer&&a()},[a]),d=(0,_.useCallback)((a,o)=>{let u=c.current;if(!u||!t||l.current!=null||s(o,u))return!1;let d=n&&!r();d&&i();let f=Math.max(u.getBoundingClientRect().height,1);return l.current={pointerId:a.pointerId,startX:a.clientX,startY:a.clientY,startTime:Date.now(),direction:e,intent:`pending`,pausedTimer:d,surfaceSize:f,dismissThreshold:Math.max(f*zu,Bu)},!0},[n,e,t,r,i,s]),f=(0,_.useCallback)((e,t,n)=>{let r=l.current,i=c.current;if(!r||!i||e.pointerId!==r.pointerId)return;let a=e.clientX-r.startX,o=e.clientY-r.startY,s=Math.abs(a),d=Math.abs(o);if(r.intent===`pending`){if(s>Ru&&s>d){n?.(),u(!0);return}if(d<=Ru||d<=s*Hu)return;if(r.intent=o*r.direction>0?`vertical`:`opposite`,r.intent===`opposite`){n?.(),u(!0);return}i.style.setProperty(`transition-duration`,`0s`)}t();let f=Math.max(0,o*r.direction),p=Ku(f,r.surfaceSize);i.style.setProperty(`--_toast-swipe-y`,`${f*r.direction}px`),i.style.setProperty(`--_toast-swipe-opacity`,(1-p*Wu).toFixed(3)),i.style.setProperty(`--_toast-swipe-scale`,(1-p*Gu).toFixed(3))},[u]),p=(0,_.useCallback)(e=>{let t=l.current,n=c.current;if(!t||!n||e.pointerId!==t.pointerId)return;let r=Math.max(0,(e.clientY-t.startY)*t.direction),i=Math.max(1,Date.now()-t.startTime),s=t.intent===`vertical`&&(r>=t.dismissThreshold||r>=Bu&&r/i>Vu);if(l.current=null,n.style.removeProperty(`transition-duration`),s){n.style.setProperty(`--_toast-swipe-exit-y`,t.direction===1?Uu:`calc(-1 * ${Uu})`),o();return}qu(n),t.pausedTimer&&a()},[o,a]),m=(0,_.useCallback)(e=>{e.pointerType===`pen`&&(e.button==null||e.button===0)&&d(e,e.target)&&c.current?.setPointerCapture?.(e.pointerId)},[d]),h=(0,_.useCallback)(e=>{e.pointerType===`pen`&&f(e,()=>e.preventDefault(),()=>c.current?.releasePointerCapture?.(e.pointerId))},[f]),g=(0,_.useCallback)(e=>{e.pointerType===`pen`&&(c.current?.releasePointerCapture?.(e.pointerId),p(e))},[p]),v=(0,_.useCallback)(e=>{e.pointerType===`pen`&&l.current?.pointerId===e.pointerId&&u(!0)},[u]);return(0,_.useEffect)(()=>{let e=c.current;if(!e||!t)return;let n=e=>({pointerId:e.identifier,clientX:e.clientX,clientY:e.clientY}),r=e=>{let t=l.current?.pointerId;return t==null?void 0:[...e.changedTouches].find(e=>e.identifier===t)},i=e=>{let t=e.touches.length===1?e.changedTouches[0]:null;t&&d(n(t),e.target)},a=e=>{let t=r(e);t&&f(n(t),()=>{e.cancelable&&e.preventDefault()})},o=e=>{let t=r(e);t?p(n(t)):e.touches.length===0&&u(!0)},s=()=>u(!0);return e.addEventListener(`touchstart`,i,{passive:!0}),e.addEventListener(`touchmove`,a,{passive:!1}),e.addEventListener(`touchend`,o,{passive:!0}),e.addEventListener(`touchcancel`,s,{passive:!0}),()=>{e.removeEventListener(`touchstart`,i),e.removeEventListener(`touchmove`,a),e.removeEventListener(`touchend`,o),e.removeEventListener(`touchcancel`,s)}},[d,t,p,f,u]),{rootRef:c,bindings:{onPointerDown:m,onPointerMove:h,onPointerUp:g,onPointerCancel:v,onLostPointerCapture:v}}}var Yu=`${Ga},[tabindex],[contenteditable]:not([contenteditable="false"])`;function Xu(e,t){if(!(e instanceof Element))return!1;let n=e;for(;n!=null&&n!==t&&n!==document.body;){if(n.matches(Yu))return!0;n=n.parentElement}return!1}Br[`--spacing-2`];function Zu(e){return(0,K.jsx)(Qu,{...e,gestureDirection:1})}function Qu({type:e,body:t,endContent:n,isAutoHide:r,autoHideDuration:i,isExiting:a=!1,onDismiss:o,renderContent:s,gestureDirection:c}){let l=Rc(),u=(0,_.useRef)(null),d=(0,_.useRef)(!1),f=(0,_.useRef)(i),p=(0,_.useRef)(null),m=(0,_.useRef)(o);m.current=o;let h=(0,_.useCallback)(()=>{!r||d.current||(u.current&&clearTimeout(u.current),p.current=Date.now(),u.current=setTimeout(()=>{m.current(`auto`)},f.current))},[r]),g=(0,_.useCallback)(()=>{if(!(!r||d.current)&&(d.current=!0,u.current&&=(clearTimeout(u.current),null),p.current!=null)){let e=Date.now()-p.current;f.current=Math.max(f.current-e,1e3)}},[r]),v=(0,_.useCallback)(()=>{!r||!d.current||(d.current=!1,h())},[r,h]);(0,_.useEffect)(()=>(f.current=i,h(),()=>{u.current&&clearTimeout(u.current)}),[i,h]),(0,_.useEffect)(()=>{if(r)return window.addEventListener(`blur`,g),window.addEventListener(`focus`,v),()=>{window.removeEventListener(`blur`,g),window.removeEventListener(`focus`,v)}},[r,g,v]);let y=(0,_.useCallback)(()=>d.current,[]),b=(0,_.useCallback)(()=>{m.current(`manual`)},[]),{rootRef:x,bindings:S}=Ju({direction:c,enabled:!a,canPauseTimer:r,isTimerPaused:y,pauseTimer:g,resumeTimer:v,dismiss:b,shouldIgnoreTarget:Xu}),C=(0,_.useCallback)(()=>{o(`manual`)},[o]),w=e===`error`,{mode:T}=lu(),E=w||T===`light`?`dark`:`light`;return(0,K.jsx)(`div`,{ref:x,role:w?`alert`:`status`,"aria-live":w?`assertive`:`polite`,"aria-atomic":`true`,onMouseEnter:g,onMouseLeave:v,onFocusCapture:g,onBlurCapture:v,...S,...oa(ba(`toast`,{type:e}),{0:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x1i7u4iq x9ynric xjm74w1 xw6l6zx x1qk3xlt x6o7n8i xuedmi6 xsagj69 xlr8y92 x4itv7f x6s140c xenstv7`},2:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x1i7u4iq x9ynric xjm74w1 xw6l6zx x1qk3xlt x6o7n8i xuedmi6 xsagj69 xlr8y92 x4itv7f x6s140c x1l5t2a3`},1:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x9ynric xjm74w1 xw6l6zx x6o7n8i xuedmi6 xsagj69 xlr8y92 x4itv7f x6s140c xenstv7 xg01cxk x149p1fo`},3:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x9ynric xjm74w1 xw6l6zx x6o7n8i xuedmi6 xsagj69 xlr8y92 x4itv7f x6s140c x1l5t2a3 xg01cxk x149p1fo`}}[!!w<<1|!!a<<0]),children:(0,K.jsx)(Lu,{mode:`auto`,fallback:E,children:s?s({body:t,endContent:n,type:e,isAutoHide:r,autoHideDuration:i,dismiss:C}):(0,K.jsxs)(`div`,{className:`x78zum5 x1cy8zhl xozqiw3 xjcht0a xh8yej3`,children:[(0,K.jsx)(`div`,{className:`x98rzlu xeuugli xj0a0fe`,children:t}),(0,K.jsxs)(`div`,{className:`x2lah0s x78zum5 x6s0dn4 x1txdalj x1q370uo xmequkd`,children:[n,(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,icon:(0,K.jsx)(xu,{icon:`close`,size:`sm`,color:`inherit`}),label:l(`@astryx.toast.dismiss`),onClick:C,isIconOnly:!0})]})]})})})}Zu.displayName=`Toast`,Qu.displayName=`ToastSurface`;var $u=`button:not([disabled]), a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), [contenteditable]:not([contenteditable="false"]), audio[controls], video[controls], iframe, details > summary:first-child`,ed=0;function td(e){if(e.hasAttribute(`inert`)||e.closest(`[inert]`)||e.hidden||e.closest(`[hidden]`)||e.closest(`[aria-hidden="true"]`))return!1;if(typeof window<`u`&&window.getComputedStyle){let t=window.getComputedStyle(e);if(t.visibility===`hidden`||t.display===`none`)return!1}return!0}function nd(e){return Array.from(e.querySelectorAll($u)).filter(td)}function rd(e){try{e.focus()}catch{}return document.activeElement===e}function id(e){let t=nd(e);for(let e of t)if(rd(e))return!0;return!1}function ad(e){let t=nd(e);for(let e=t.length-1;e>=0;e--)if(rd(t[e]))return!0;return!1}function od(e){let{isActive:t,onEscape:n}=e,r=(0,_.useRef)(null),i=(0,_.useRef)(null),a=(0,_.useRef)(!1),o=t&&n!=null;Ki({isActive:o,onDismiss:()=>{n?.()},getContainer:()=>r.current}),(0,_.useEffect)(()=>{if(o)return ed+=1,()=>{--ed}},[o]);let s=(0,_.useCallback)(()=>{r.current&&id(r.current)},[]);return(0,_.useEffect)(()=>{if(!t)return;let e=document.activeElement,n=r.current;return()=>{let t=document.activeElement;(t==null||t===document.body||t===document.documentElement||n!=null&&n.contains(t))&&e!=null&&e.isConnected&&typeof e.focus==`function`&&e.focus()}},[t]),(0,_.useEffect)(()=>{if(!t)return;let e=e=>{let t=r.current;if(!t)return;let n=e.target;if(t.contains(n))i.current=n;else if(a.current){let e=id(t);e&&i.current===document.activeElement?ad(t):!e&&i.current instanceof HTMLElement&&t.contains(i.current)&&rd(i.current),i.current=document.activeElement}a.current=!1};return document.addEventListener(`focus`,e,!0),()=>{document.removeEventListener(`focus`,e,!0)}},[t]),(0,_.useEffect)(()=>{if(!t)return;let e=e=>{let t=r.current;if(t&&e.key===`Tab`){a.current=!0;let n=nd(t);if(n.length===0){let n=document.activeElement;if(!(n instanceof HTMLElement)||!t.contains(n))return;e.preventDefault(),i.current=n,a.current=!1;return}let r=n[0],o=n[n.length-1];e.shiftKey?document.activeElement===r&&(e.preventDefault(),o.focus()):document.activeElement===o&&(e.preventDefault(),r.focus())}};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[t,n]),{containerRef:r,focusFirst:s}}function sd(e,t,n=!0){let r=(0,_.useRef)(!1);(0,_.useEffect)(()=>{n&&!r.current&&(r.current=!0)},[e,t,n])}var cd={surface:{kWkggS:`x1prclbq`,"--_popover-radius":`xiki222`,kaIpWk:`x11m9jtl`,kGVxlE:`x1i5ehqx`,$$css:!0},contentWrapper:{kVAEAm:`x1n2onr6`,$$css:!0},closeButtonWrapper:{kVAEAm:`x10l6tqk`,krVfgx:`x1ey2m1c`,kY2c9j:`x1vjfegm`,kzqmXN:`x1i1rx1s x10okhzq`,kZKoxP:`xjm9jq1 x132qfvm`,kVQacm:`xb3r6kr x1dordxg`,kz4h6p:`x1hyvwdk x10wafsz`,kfzvcC:`x47corl xbt4iw`,kLKAdn:`xexx8yu x1kw28su`,$$css:!0}};function ld(e={}){let{onShow:t,onHide:n,xstyle:r,className:i,style:a,hasLightDismiss:o=!0,hasEscapeDismiss:s=!0,hasAutoFocus:c=!0,hasSurface:l=!0,surfaceTarget:u,hasCloseButton:d=!0,closeButtonLabel:f,dialogLabel:p,role:m=`dialog`,isModal:h=!0}=e,g=Rc(),v=f??g(`@astryx.popover.close`),y=(0,_.useRef)(null),b=(0,_.useRef)(!1),x=Si({mode:`context`,lightDismiss:o,onShow:t,onHide:n}),{containerRef:S,focusFirst:C}=od({isActive:x.isOpen,onEscape:s||o?x.hide:void 0});(0,_.useEffect)(()=>{x.isOpen&&c&&!b.current&&requestAnimationFrame(()=>{C()}),x.isOpen||(b.current=!1)},[x.isOpen,c,C]);let w=(0,_.useCallback)(e=>{y.current=e,x.ref(e)},[x]),T=(0,_.useCallback)(e=>{b.current=e?.skipAutoFocus??!1,x.show()},[x]),E=(0,_.useCallback)(()=>{x.wasJustDismissed()||(x.isOpen?x.hide():T())},[x,T]),D={"aria-haspopup":m===`dialog`?`dialog`:`true`,"aria-expanded":x.isOpen,"aria-controls":x.id};sd(`usePopover`,'role="dialog" without a `dialogLabel` renders an unnamed dialog. Pass `dialogLabel`, or use `role: "none"` for listbox/menu popups whose content already carries its own role.',m===`dialog`&&!p);let O=(0,_.useCallback)((e,t)=>{let n=ba(`popover-surface`),o=u==null?n.className:`${n.className} ${pa(u)}`;return x.render((0,K.jsx)(Ti,{children:(0,K.jsxs)(`div`,{ref:S,role:m===`dialog`?`dialog`:void 0,"aria-modal":m===`dialog`&&h?!0:void 0,"aria-label":m===`dialog`?p:void 0,...oa({...n,className:o},Sr(cd.contentWrapper,l&&cd.surface,r),i,a),children:[e,d&&(0,K.jsx)(`div`,{...Sr(cd.closeButtonWrapper,Ra.centerInline(`100%`)),children:(0,K.jsx)(qc,{variant:`secondary`,label:v,onClick:x.hide})})]})}),{...t,xstyle:t?.xstyle})},[x,d,l,u,i,a,v,S,p,m,h,r]);return{triggerRef:w,contentRef:S,anchorId:x.anchorId,show:T,hide:x.hide,toggle:E,wasJustDismissed:x.wasJustDismissed,isOpen:x.isOpen,id:x.id,render:O,triggerProps:D}}function ud(e={}){let{wasJustDismissed:t,...n}=ld(e);return n}function dd(e={}){return ld(e)}var fd=(0,_.createContext)(null);fd.displayName=`InteractiveRoleContext`;var pd=`button, [role="button"]`;function md(e){return e.matches(pd)?e:e.querySelector(pd)}var hd={contentPadding:{kLKAdn:`x1vlblms`,kGO01o:`xvmdzux`,kZCmMZ:`x126nfab`,kwRFfy:`x1t818jl`,$$css:!0},customWidth:e=>[{kzqmXN:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e)}],matchTrigger:{k7Eaqz:`xrzjruh`,$$css:!0}};function gd({children:e,anchorRef:t,content:n,placement:r=`below`,alignment:i=`start`,isOpen:a,onOpenChange:o,isEnabled:s=!0,width:c,label:l,role:u=`dialog`,isModal:d,hasCloseButton:f,closeButtonLabel:p,hasAutoFocus:m,hasLightDismiss:h=!0,hasEscapeDismiss:g=!0,xstyle:v,className:y,style:b,"data-testid":x}){let S=(0,_.useRef)(null),C=a!==void 0,w=(0,_.useCallback)(()=>{o?.(!0)},[o]),T=(0,_.useCallback)(()=>{o?.(!1)},[o]),E=ud({dialogLabel:l,role:u,isModal:d,hasLightDismiss:h,hasEscapeDismiss:g,hasCloseButton:f,closeButtonLabel:p,hasAutoFocus:m,surfaceTarget:`popover`,xstyle:[hd.contentPadding,v],className:y,style:b,onShow:w,onHide:T}),D=(0,_.useCallback)(()=>{s&&E.toggle()},[s,E]),O=(0,_.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),D())},[D]),k=(0,_.useCallback)(e=>{e.setAttribute(`aria-haspopup`,E.triggerProps[`aria-haspopup`]),e.setAttribute(`aria-expanded`,String(E.triggerProps[`aria-expanded`])),e.setAttribute(`aria-controls`,E.triggerProps[`aria-controls`]),e.addEventListener(`click`,D);let t=e.tagName!==`BUTTON`&&e.getAttribute(`role`)===`button`;return t&&e.addEventListener(`keydown`,O),()=>{e.removeAttribute(`aria-haspopup`),e.removeAttribute(`aria-expanded`),e.removeAttribute(`aria-controls`),e.removeEventListener(`click`,D),t&&e.removeEventListener(`keydown`,O)}},[E,D,O]);wu(()=>{if(!t)return;let e=t.current;if(!e)return;let n=md(e);if(!n)return;E.triggerRef(e);let r=k(n);return()=>{E.triggerRef(null),r()}},[t,E,k]),wu(()=>{if(t||typeof e==`function`)return;let n=S.current;if(!n)return;E.triggerRef(n);let r=md(n);if(!r)return;let i=k(r);return()=>{E.triggerRef(null),i()}},[t,E,k]),wu(()=>{C&&(a&&!E.isOpen?E.show():!a&&E.isOpen&&E.hide())},[a,C,E]);let A=c?hd.customWidth(c):hd.matchTrigger;if(t&&e==null)return(0,K.jsx)(K.Fragment,{children:E.render((0,K.jsx)(`div`,{"data-testid":x,children:n}),{placement:r,alignment:i,offset:Br[`--spacing-1`],xstyle:[A,co[r]]})});if(typeof e==`function`){let t={ref:E.triggerRef,onClick:D,"aria-haspopup":`dialog`,"aria-expanded":E.isOpen,"aria-controls":E.id};return(0,K.jsxs)(K.Fragment,{children:[e(t),E.render((0,K.jsx)(`div`,{"data-testid":x,children:n}),{placement:r,alignment:i,offset:Br[`--spacing-1`],xstyle:[A,co[r]]})]})}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(fd,{value:`button`,children:(0,K.jsx)(`div`,{ref:S,className:`x3nfvp2`,children:e})}),E.render((0,K.jsx)(`div`,{"data-testid":x,children:n}),{placement:r,alignment:i,offset:Br[`--spacing-1`],xstyle:[A,co[r]]})]})}gd.displayName=`Popover`;var _d={container:{kWkggS:`x10xzikg`,"--_hovercard-radius":`xqwz7mz`,kaIpWk:`x7a53xk`,kGVxlE:`x14hfi27`,$$css:!0}};function vd(e){return e.hasAttribute(`tabindex`)?e.tabIndex>=0:[`A`,`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`].includes(e.tagName)?!e.disabled:!!e.isContentEditable}function yd(e={}){let{placement:t=`above`,alignment:n=`center`,delay:r=300,hideDelay:i=200,focusTrigger:a=`auto`,touchTrigger:o=`auto`,isEnabled:s=!0,label:c,isOpen:l,isDefaultOpen:u=!1,onShow:d,onHide:f}=e,p=xi({mode:`context`,lazyMount:!0,onShow:d,onHide:f}),m=_d.container,h=(0,_.useRef)(null),g=(0,_.useRef)(null),v=(0,_.useRef)(null),y=(0,_.useRef)(!1),b=(0,_.useRef)(!1),x=(0,_.useCallback)(()=>{h.current&&=(clearTimeout(h.current),null),g.current&&=(clearTimeout(g.current),null)},[]),S=(0,_.useCallback)(()=>{x(),p.show()},[x,p]),C=(0,_.useCallback)(()=>{x(),y.current=!1,p.hide()},[x,p]),w=ra({touchTrigger:o,isEnabled:s,isControlled:l!==void 0,isOpen:p.isOpen,layerId:p.id,triggerRef:v,show:S,hide:C}),T=(0,_.useCallback)(()=>{!s||l===!1||(x(),h.current=setTimeout(()=>{p.show()},r))},[s,l,x,p,r]),E=(0,_.useCallback)(()=>{l!==!0&&(x(),g.current=setTimeout(()=>{y.current||p.hide()},i))},[l,x,p,i]),D=(0,_.useCallback)(()=>{w.isTouchPointerRef.current||T()},[w,T]),O=(0,_.useCallback)(()=>{w.isTouchPointerRef.current||E()},[w,E]),k=(0,_.useCallback)(e=>{w.handlePointerDown(e)},[w]),A=(0,_.useCallback)(()=>{if(s&&!w.isTouchInteraction()){if(b.current){b.current=!1;return}x(),p.show()}},[s,w,x,p]),j=(0,_.useCallback)(e=>{let t=e.relatedTarget;document.getElementById(p.id)?.contains(t)||E()},[p.id,E]);Ki({isActive:!0,isPresent:()=>{let e=typeof document>`u`?null:document.getElementById(p.id);if(e==null)return!1;try{return e.matches(`:popover-open`)}catch{return p.isOpen}},onDismiss:()=>{if(x(),w.clearTapOpen(),l!==void 0){f?.();return}let e=(typeof document>`u`?null:document.getElementById(p.id))?.contains(document.activeElement)??!1;p.hide(),e&&(b.current=!0,v.current?.focus())}});let{handlePointerEnter:M}=w,N=(0,_.useCallback)(e=>{v.current&&(v.current.removeEventListener(`mouseenter`,D),v.current.removeEventListener(`mouseleave`,O),v.current.removeEventListener(`focusin`,A),v.current.removeEventListener(`focusout`,j),v.current.removeEventListener(`pointerenter`,M),v.current.removeEventListener(`pointerdown`,k)),e&&(e.addEventListener(`pointerenter`,M),e.addEventListener(`mouseenter`,D),e.addEventListener(`mouseleave`,O),e.addEventListener(`pointerdown`,k),(a===`always`||a===`auto`&&vd(e))&&(e.addEventListener(`focusin`,A),e.addEventListener(`focusout`,j))),v.current=e},[a,D,O,A,j,M,k]),P=(0,_.useCallback)(e=>{p.ref(e),N(e)},[p,N]);(0,_.useEffect)(()=>()=>{x()},[x]),(0,_.useEffect)(()=>{u&&p.show()},[]),(0,_.useEffect)(()=>{if(l!==void 0)if(l)x(),p.show();else{x();let e=(typeof document>`u`?null:document.getElementById(p.id))?.contains(document.activeElement)??!1;p.hide(),e&&(b.current=!0,v.current?.focus())}},[l,x,p]);let F=(0,_.useCallback)((e,r)=>{let i=r?.placement??t,a=ba(`hover-card`,void 0,{legacyNames:[`hovercard`]}).className,o={placement:i,alignment:r?.alignment??n,offset:Br[`--spacing-1`],role:c?`dialog`:`group`,"aria-label":c||void 0,xstyle:[m,co[i],r?.xstyle],className:r?.className?`${a} ${r.className}`:a,style:r?.style,as:`div`};return p.render((0,K.jsx)(`div`,{className:`x1lliihq x1vlblms xvmdzux x126nfab x1t818jl`,onMouseEnter:()=>{w.isTouchPointerRef.current||(y.current=!0,x())},onMouseLeave:()=>{w.isTouchPointerRef.current||(y.current=!1,E())},onBlur:e=>{let t=e.relatedTarget;e.currentTarget.contains(t)||v.current?.contains(t)||E()},children:e}),o)},[p,t,n,c,x,E,m,w]);return{ref:P,positionRef:p.ref,interactionRef:N,anchorId:p.anchorId,id:p.id,describedBy:p.id,isOpen:p.isOpen,renderHoverCard:F,show:p.show,hide:p.hide}}var bd=t({Tooltip:()=>Cd});function xd(e){return typeof e==`string`||typeof e==`number`}function Sd(...e){let t=e.filter(Boolean);return t.length>0?t.join(` `):void 0}function Cd({children:e,anchorRef:t,content:n,placement:r=`above`,alignment:i=`center`,delay:a=200,hideDelay:o=0,focusTrigger:s=`auto`,touchTrigger:c=`auto`,isEnabled:l=!0,onOpenChange:u,hasHoverIndication:d=`auto`,isOpen:f,isDefaultOpen:p}){let m=(0,_.useRef)(null),h=e!=null&&xd(e),g=d===!0||d===`auto`&&h,v=po({placement:r,alignment:i,delay:a,hideDelay:o,focusTrigger:s,touchTrigger:c,isEnabled:l,isOpen:f,isDefaultOpen:p,onShow:(0,_.useCallback)(()=>{u?.(!0)},[u]),onHide:(0,_.useCallback)(()=>{u?.(!1)},[u])});return wu(()=>{if(!t)return;let e=t.current;if(!e)return;v.ref(e);let n=e.getAttribute(`aria-describedby`);return e.setAttribute(`aria-describedby`,Sd(n,v.describedBy)??``),()=>{v.ref(null),n?e.setAttribute(`aria-describedby`,n):e.removeAttribute(`aria-describedby`)}},[t,v.ref,v.describedBy]),wu(()=>{if(t||h)return;let e=m.current;if(!e)return;let n=e.firstElementChild;if(!n)return;v.ref(n);let r=n.getAttribute(`aria-describedby`);return n.setAttribute(`aria-describedby`,Sd(r,v.describedBy)??``),()=>{v.ref(null),r?n.setAttribute(`aria-describedby`,r):n.removeAttribute(`aria-describedby`)}},[t,h,v.ref,v.describedBy]),t&&e==null?(0,K.jsx)(K.Fragment,{children:v.renderTooltip(n)}):h?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{ref:v.ref,tabIndex:0,"aria-describedby":v.describedBy,...{0:{className:`xt0psk2`},1:{className:`xt0psk2 xujl8zx xev0dqp xycaml9 xrys4gj`}}[!!g<<0],children:e}),v.renderTooltip(n)]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{ref:m,className:`xjp7ctv`,children:e}),v.renderTooltip(n)]})}Cd.displayName=`Tooltip`;async function wd(e,t=n){let n=t,r=t.defaultView??globalThis.window,{HTMLInputElement:i,HTMLTextAreaElement:a,HTMLElement:o}=r;try{return await r.navigator.clipboard.writeText(e),!0}catch{}let s=n.activeElement,c=r.getSelection(),l=c?Array.from({length:c.rangeCount},(e,t)=>c.getRangeAt(t).cloneRange()):[],u=s instanceof i||s instanceof a?{start:s.selectionStart,end:s.selectionEnd,direction:s.selectionDirection}:null,d=n.createElement(`textarea`);d.value=e,d.readOnly=!0,d.style.cssText=`position:fixed;opacity:0;pointer-events:none`;try{return n.body.append(d),d.focus({preventScroll:!0}),d.select(),n.execCommand(`copy`)}catch{return!1}finally{if(d.remove(),s instanceof o&&s.isConnected&&(s.focus({preventScroll:!0}),u&&u.start!==null&&u.end!==null&&(s instanceof i||s instanceof a)&&s.setSelectionRange(u.start,u.end,u.direction??void 0)),c){c.removeAllRanges();for(let e of l)e.startContainer.isConnected&&e.endContainer.isConnected&&c.addRange(e)}}}function Td(e){return!!e.trim()&&!e.startsWith(`#`)&&!e.startsWith(`//`)&&(!/^[a-z][a-z\d+.-]*:/iu.test(e)||/^[a-z]:(?:[\\/]|%5c)/iu.test(e))}var Ed=8e3;function Dd(e,t){let n=0;for(let r of e){let e=r.codePointAt(0);if(n+=e<=127?1:e<=2047?2:e<=65535?3:4,n>t)return}return n}function Od(e){return Dd(e,1/0)}function kd(e){return Dd(e,Ed)!==void 0}function Ad(e){return typeof e==`string`&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu.test(e)}var jd=Symbol.for(`@tt-a1i/openpi/web-command-feedback/v1`),Md=Reflect.get(globalThis,jd);if(Md!==void 0&&!(Md instanceof WeakMap))throw Error(`Incompatible Web feedback bridge`);Md===void 0&&Object.defineProperty(globalThis,jd,{value:Md??new WeakMap});var Nd=12288;function Pd(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Fd(e,t=!1){let n=t?e.slice(-24576):e.slice(0,Nd*2),r=n.replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\|$)/gu,``).replace(/(?:\x1b\[|\x9b)[0-?]*[ -/]*[@-~]/gu,``).replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/gu,``).split(` +`)}\n}`);let s=Dl(e);return s&&(o=o?`${o}\n\n${s}`:s),{prose:a,component:o}}var Al={...Lr,...zr,...Vr,...Hr,...Ur,...Gr,...Kr,...qr,...Yr,...Zr,...Qr,...$r,...ei,...el};function jl(e){return`var(${e})`}Object.fromEntries(Object.keys(Al).map(e=>[e,jl(e)]));function Ml(e){let t=0,n=null,r=!1;for(let i=0;if*e*s.a+p*t*c.a,_=g(s.r,c.r),v=g(s.g,c.g),y=g(s.b,c.b);return Ia({...h===0?{r:0,g:0,b:0}:{r:_/h,g:v/h,b:y/h},a:h*m})}function Rl(e){let t=e.indexOf(`color-mix(`);if(t===-1)return e;let n=t+9,r=Fl(e,n);if(r===-1)return e;let i=Rl(e.slice(n+1,r)),a=Ll(i)??`color-mix(${i})`;return e.slice(0,t)+a+Rl(e.slice(r+1))}function zl(e,t,n,r){let i=e.indexOf(`var(`);if(i===-1)return e;let a=i+3,o=Fl(e,a);if(o===-1)return e;let s=e.slice(a+1,o),c=Ml(s),l=(c?c[0]:s).trim(),u=c?c[1]:null,d;r.has(l)?d=e.slice(i,o+1):l in t?(r.add(l),d=Vl(l,t,n,r),r.delete(l)):d=u===null?e.slice(i,o+1):zl(u.trim(),t,n,r);let f=zl(e.slice(o+1),t,n,r);return e.slice(0,i)+d+f}function Bl(e,t,n,r){return!e.includes(`var(`)&&!e.includes(`color-mix(`)?e:Rl(zl(e,t,n,r))}function Vl(e,t,n,r){if(e in n)return n[e];let i=t[e];if(i===void 0)return``;let a=Bl(i,t,n,r);return n[e]=a,a}function Hl(e){let t={};for(let n of Object.keys(e))Vl(n,e,t,new Set);return t}function Ul(e,t){let{mode:n}=t,r={};for(let[e,t]of Object.entries(Al))r[e]=Pl(t,n);if(e==null)return Hl(r);for(let[t,i]of Object.entries(e.tokens))r[t]=Pl(i,n);if(e.__inputTokens)for(let[t,i]of Object.entries(e.__inputTokens))i!==void 0&&(r[t]=Pl(i,n));return Hl(r)}function Wl(e,t=!1){let n=(0,_.useCallback)(t=>{let n=window.matchMedia(e);return n.addEventListener(`change`,t),()=>n.removeEventListener(`change`,t)},[e]),r=(0,_.useCallback)(()=>window.matchMedia(e).matches,[e]),i=(0,_.useCallback)(()=>t,[t]);return(0,_.useSyncExternalStore)(n,r,i)}var Gl=(0,_.createContext)(null);Gl.displayName=`ThemeContext`;function Kl(){if(typeof document>`u`)return null;let e=document.documentElement.getAttribute(`data-theme`);return e===`light`||e===`dark`?e:null}function ql(){return null}function Jl(){return typeof document>`u`?null:document.documentElement.getAttribute(ma(`theme`))}function Yl(){return null}function Xl(){return null}var Zl=new Set,Ql=null,$l=new Set,eu=null;function tu(){for(let e of Zl)e()}function nu(e){return Zl.add(e),Zl.size===1&&typeof MutationObserver<`u`&&(Ql=new MutationObserver(tu),Ql.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})),()=>{Zl.delete(e),Zl.size===0&&Ql&&(Ql.disconnect(),Ql=null)}}function ru(){for(let e of $l)e()}function iu(e){return $l.add(e),$l.size===1&&typeof MutationObserver<`u`&&(eu=new MutationObserver(ru),eu.observe(document.documentElement,{attributes:!0,attributeFilter:[ma(`theme`)]})),()=>{$l.delete(e),$l.size===0&&eu&&(eu.disconnect(),eu=null)}}function au(){return()=>{}}function ou(e){return(0,_.useSyncExternalStore)(e?au:nu,e?Xl:Kl,ql)}function su(e){return(0,_.useSyncExternalStore)(e?au:iu,e?Xl:Jl,Yl)}function cu(){let e=(0,_.use)(Gl),t=su(e!=null);return e?.theme.name??t}function lu(){let e=(0,_.use)(Gl),t=e!=null,n=ou(t),r=su(t),i=Wl(`(prefers-color-scheme: dark)`),a=e?.mode??n??`system`,o=e?.theme??rl(r),s=a===`system`?i?`dark`:`light`:a,c=(0,_.useMemo)(()=>Ul(o,{mode:s}),[o,s]),l=(0,_.useCallback)(e=>c[e]??``,[c]),u=o?.name??`default`;return(0,_.useMemo)(()=>({name:u,mode:s,token:l,tokens:c}),[u,s,l,c])}var uu={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,width:`1em`,height:`1em`,"aria-hidden":!0},du={xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,width:`1em`,height:`1em`,"aria-hidden":!0},fu={close:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M6 6l12 12M6 18L18 6`})}),chevronDown:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M6 9l6 6 6-6`})}),"numberInput:stepperDown":(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M7.5 9.75l4.5 4.5 4.5-4.5`})}),chevronLeft:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M15 6l-6 6 6 6`})}),chevronRight:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M9 6l6 6-6 6`})}),chevronsLeft:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M18 6l-6 6 6 6M11 6l-6 6 6 6`})}),chevronsRight:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M6 6l6 6-6 6M13 6l6 6-6 6`})}),check:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M5 13l4 4L19 7`})}),success:(0,K.jsx)(`svg`,{...du,children:(0,K.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3a9 9 0 100 18 9 9 0 000-18zm4.06 6.56a.75.75 0 00-1.12-1l-3.94 4.4-1.94-1.94a.75.75 0 00-1.06 1.06l2.5 2.5a.75.75 0 001.09-.03l4.47-5z`})}),error:(0,K.jsx)(`svg`,{...du,children:(0,K.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3a9 9 0 100 18 9 9 0 000-18zm-2.47 5.47a.75.75 0 00-1.06 1.06L10.94 12l-2.47 2.47a.75.75 0 101.06 1.06L12 13.06l2.47 2.47a.75.75 0 101.06-1.06L13.06 12l2.47-2.47a.75.75 0 00-1.06-1.06L12 10.94l-2.47-2.47z`})}),warning:(0,K.jsx)(`svg`,{...du,children:(0,K.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.29 3.86L2.07 19.05A2 2 0 003.78 22h16.44a2 2 0 001.71-2.95L13.71 3.86a2 2 0 00-3.42 0zM12 9a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0112 9zm0 9a1 1 0 100-2 1 1 0 000 2z`})}),info:(0,K.jsx)(`svg`,{...du,children:(0,K.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 3a9 9 0 100 18 9 9 0 000-18zm0 4a1 1 0 100 2 1 1 0 000-2zm-.75 3.75a.75.75 0 011.5 0v5.5a.75.75 0 01-1.5 0v-5.5z`})}),calendar:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`}),(0,K.jsx)(`path`,{d:`M16 2v4M8 2v4M3 10h18`})]}),clock:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,K.jsx)(`path`,{d:`M12 7v5l3 3`})]}),externalLink:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`path`,{d:`M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6`}),(0,K.jsx)(`path`,{d:`M15 3h6v6`}),(0,K.jsx)(`path`,{d:`M10 14L21 3`})]}),menu:(0,K.jsx)(`svg`,{...uu,strokeWidth:2,children:(0,K.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h16`})}),moreHorizontal:(0,K.jsxs)(`svg`,{...du,children:[(0,K.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.5`}),(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.5`}),(0,K.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.5`})]}),search:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,K.jsx)(`path`,{d:`M21 21l-4.35-4.35`})]}),arrowUp:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M12 19V5m0 0l-7 7m7-7l7 7`})}),arrowDown:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M12 5v14m0 0l7-7m-7 7l-7-7`})}),arrowsUpDown:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M3 7.5L7.5 3m0 0L12 7.5M7.5 3v13.5m13.5 0L16.5 21m0 0L12 16.5m4.5 4.5V7.5`})}),funnel:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z`})}),eyeSlash:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M3.98 8.223A10.477 10.477 0 001.934 12c1.292 4.338 5.31 7.5 10.066 7.5.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88`})}),viewColumns:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M9 4.5v15m6-15v15m-10.875 0h15.75c.621 0 1.125-.504 1.125-1.125V5.625c0-.621-.504-1.125-1.125-1.125H4.125C3.504 4.5 3 5.004 3 5.625v12.75c0 .621.504 1.125 1.125 1.125z`})}),copy:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`path`,{d:`M8 4v12a2 2 0 002 2h8a2 2 0 002-2V7.242a2 2 0 00-.602-1.43L16.083 2.57A2 2 0 0014.685 2H10a2 2 0 00-2 2z`}),(0,K.jsx)(`path`,{d:`M16 18v2a2 2 0 01-2 2H6a2 2 0 01-2-2V9a2 2 0 012-2h2`})]}),checkDouble:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`path`,{d:`M2 13l4 4L14 7`}),(0,K.jsx)(`path`,{d:`M9 13l4 4L21 7`})]}),wrench:(0,K.jsx)(`svg`,{...uu,children:(0,K.jsx)(`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`})}),stop:(0,K.jsx)(`svg`,{...du,children:(0,K.jsx)(`rect`,{x:`6`,y:`6`,width:`12`,height:`12`,rx:`2`})}),microphone:(0,K.jsxs)(`svg`,{...uu,children:[(0,K.jsx)(`path`,{d:`M12 2a3 3 0 00-3 3v6a3 3 0 006 0V5a3 3 0 00-3-3z`}),(0,K.jsx)(`path`,{d:`M19 10v1a7 7 0 01-14 0v-1`}),(0,K.jsx)(`path`,{d:`M12 18v4m-4 0h8`})]})},pu={};function mu(e){return e==null?null:typeof e==`string`?rl(e)?.icons??null:e.icons??null}function hu(e,t){return mu(t)?.[e]??pu[e]??fu[e]}var gu={root:{kmuXW:`x2lah0s`,$$css:!0},span:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,$$css:!0}},_u={primary:{kMwMTN:`xtbr613`,$$css:!0},secondary:{kMwMTN:`xv9yike`,$$css:!0},tertiary:{kMwMTN:`xv9yike`,$$css:!0},disabled:{kMwMTN:`xqa6c3m`,$$css:!0},accent:{kMwMTN:`xqwr325`,$$css:!0},success:{kMwMTN:`xtjic6`,$$css:!0},error:{kMwMTN:`xjt36v0`,$$css:!0},warning:{kMwMTN:`xs3pv69`,$$css:!0},inherit:{kMwMTN:`x1heor9g`,$$css:!0},blue:{kMwMTN:`x1fns2mt`,$$css:!0},red:{kMwMTN:`xeffzf7`,$$css:!0},green:{kMwMTN:`xmxeech`,$$css:!0},gray:{kMwMTN:`x1eyinzz`,$$css:!0},cyan:{kMwMTN:`x157w0xa`,$$css:!0},teal:{kMwMTN:`x1f3zxcb`,$$css:!0},yellow:{kMwMTN:`x1g6zdft`,$$css:!0},orange:{kMwMTN:`xxu74a4`,$$css:!0},pink:{kMwMTN:`x1kxxfg5`,$$css:!0},purple:{kMwMTN:`xzdw94u`,$$css:!0}},vu={xsm:{kzqmXN:`x1jw3ynk`,kZKoxP:`xvle69y`,$$css:!0},sm:{kzqmXN:`xcdlrvm`,kZKoxP:`x1l36t39`,$$css:!0},md:{kzqmXN:`xwqq7k2`,kZKoxP:`xmll18r`,$$css:!0},lg:{kzqmXN:`xp8d6y2`,kZKoxP:`xam5rvr`,$$css:!0}},yu={xsm:{kzqmXN:`x1jw3ynk`,kZKoxP:`xvle69y`,kGuDYH:`xboafo0`,$$css:!0},sm:{kzqmXN:`xcdlrvm`,kZKoxP:`x1l36t39`,kGuDYH:`x1jchvi3`,$$css:!0},md:{kzqmXN:`xwqq7k2`,kZKoxP:`xmll18r`,kGuDYH:`x1603h9y`,$$css:!0},lg:{kzqmXN:`xp8d6y2`,kZKoxP:`xam5rvr`,kGuDYH:`xngnso2`,$$css:!0}};function bu(e){return e!=null&&e!==``?{role:`img`,"aria-label":e}:{"aria-hidden":`true`}}function xu({icon:e,color:t=`inherit`,size:n=`md`,label:r,ref:i,className:a,style:o,xstyle:s,...c}){let l=bu(r);return typeof e==`string`?(0,K.jsx)(Su,{name:e,color:t,size:n,a11yProps:l,className:a,style:o,xstyle:s,spanProps:c}):(0,K.jsx)(e,{ref:i,...l,...oa(ba(`icon`,{size:n,color:t}),Sr(gu.root,_u[t],vu[n],s),a??void 0,o),...c})}xu.displayName=`Icon`;function Su({name:e,color:t,size:n,a11yProps:r,className:i,style:a,xstyle:o,spanProps:s}){let c=hu(e,cu());if(c==null)return null;let l=s??{};return(0,K.jsx)(`span`,{...r,...l,...oa(ba(`icon`,{size:n,color:t}),Sr(gu.span,_u[t],yu[n],o),i??void 0,a),children:c})}function Cu(e,t){return typeof e==`string`||typeof e==`function`||typeof e==`object`&&e&&`render`in e?(0,K.jsx)(xu,{icon:e,...t}):e}var wu=typeof window<`u`?_.useLayoutEffect:_.useEffect,Tu={base:{k1xSpc:`xjp7ctv`,kMwMTN:`x1tgivj0`,kMv6JI:`x9ynric`,$$css:!0},light:{kQNsl9:`x19aimcq`,$$css:!0},dark:{kQNsl9:`xntwwlm`,$$css:!0},system:{kQNsl9:`x108lcm5`,$$css:!0}},Eu=_.createContext(!1);Eu.displayName=`ThemeNestingContext`;var Du=new Set,Ou=0;function ku(e){let t=(0,_.useId)();(0,_.useInsertionEffect)(()=>{if(e.__built)return;let n=`astryx-theme-${e.name}`;if(Du.has(n))return;`${e.name}`,`${e.name}${e.name}${e.name}${e.name}`;let{prose:r,component:i}=kl(e),a=Ol();Du.add(n);let o=[()=>Du.delete(n)];if(a){if(Ou++===0){let e=document.createElement(`style`);e.setAttribute(ma(`theme-base`),``),e.textContent=`@layer astryx-base {\n${a}\n}`,document.head.appendChild(e)}o.push(()=>{--Ou===0&&document.querySelector(`style[${ma(`theme-base`)}]`)?.remove()})}if(r){let n=document.createElement(`style`);n.setAttribute(ma(`theme-prose`),e.name),n.setAttribute(ma(`id`),t),n.textContent=`@layer reset {\n${r}\n}`,document.head.appendChild(n)}if(i){let n=document.createElement(`style`);n.setAttribute(ma(`theme`),e.name),n.setAttribute(ma(`id`),t),n.textContent=`@layer astryx-theme {\n${i}\n}`,document.head.appendChild(n)}return(r||i)&&o.push(()=>{let n=document.querySelector(`style[${ma(`theme-prose`)}="${e.name}"][${ma(`id`)}="${t}"]`),r=document.querySelector(`style[${ma(`theme`)}="${e.name}"][${ma(`id`)}="${t}"]`);n?.remove(),r?.remove()}),()=>{for(let e of o)e()}},[e,t])}function Au(e,t,n){wu(()=>{if(!e&&!(typeof document>`u`))return t===`light`||t===`dark`?document.documentElement.setAttribute(`data-theme`,t):document.documentElement.removeAttribute(`data-theme`),document.documentElement.setAttribute(ma(`theme`),n),()=>{document.documentElement.removeAttribute(`data-theme`),document.documentElement.removeAttribute(ma(`theme`))}},[e,t,n])}function ju({theme:e,mode:t=`system`,children:n}){let r=(0,_.use)(Eu);nl(e),ku(e),Au(r,t,e.name);let i=t===`dark`?Tu.dark:t===`light`?Tu.light:Tu.system,a=(0,_.useMemo)(()=>({theme:e,mode:t}),[e,t]);return(0,K.jsx)(Gl,{value:a,children:(0,K.jsx)(Eu,{value:!0,children:(0,K.jsx)(`div`,{...Sr(Tu.base,i),"data-astryx-theme":e.name,"data-theme":t===`system`?void 0:t,children:n})})})}ju.displayName=`Theme`;function Mu(e,t){let n=document.createElement(`span`);n.style.display=`none`,e.appendChild(n);try{return t.map(e=>(n.style.color=`var(${e})`,Pa(getComputedStyle(n).color)))}finally{n.remove()}}function Nu(e){let t=[],n=e;for(;n!==null;){let e=getComputedStyle(n);if(e.backgroundImage!==`none`)return null;let r=Pa(e.backgroundColor);if(r!==null&&r.a>0&&(t.push(r),r.a>=1))break;n=n.parentElement}let r=t.pop();return r===void 0||r.a<1?null:t.reduceRight((e,t)=>Yc(t,e),r)}var Pu=3;function Fu(e,t,n,r){return n===null||r===null?null:t!==null&&Zc(t,e)>=Pu?`off`:Zc(n,e)>=Zc(r,e)?`dark`:`light`}function Iu(e,t){let[n,r]=(0,_.useState)(null),{tokens:i}=lu(),a=(0,_.useRef)(null);return wu(()=>{let n=e.current?.parentElement??null;if(!t||n===null)return;let o=Nu(n);if(o===null)return;let s=Ia(o),c=a.current;if(c!==null&&c.background===s&&c.tokens===i)return;a.current={background:s,tokens:i};let[l,u,d]=Mu(n,[`--color-text-primary`,`--color-on-dark`,`--color-on-light`]),f=Fu(o,l,u,d);f!==null&&r(e=>e===f?e:f)}),t?n:null}function Lu({mode:e,fallback:t=`dark`,children:n}){let r=(0,_.useRef)(null),i=Iu(r,e===`auto`),a=e===`auto`?i??t:e;return(0,K.jsx)(`div`,{ref:r,...a===`off`?null:{[ma(`media`)]:a},...{0:{className:`xjp7ctv`},1:{className:`xjp7ctv x1tgivj0`}}[(a!==`off`)<<0],children:n})}Lu.displayName=`MediaTheme`;var Ru=8,zu=.4,Bu=48,Vu=1.2,Hu=1.2,Uu=`120%`,Wu=.4,Gu=.02;function Ku(e,t){return Math.min(Math.max(e/t,0),1)}function qu(e){e.style.removeProperty(`transition-duration`),e.style.removeProperty(`--_toast-swipe-y`),e.style.removeProperty(`--_toast-swipe-exit-y`),e.style.removeProperty(`--_toast-swipe-opacity`),e.style.removeProperty(`--_toast-swipe-scale`)}function Ju({direction:e,enabled:t,canPauseTimer:n,isTimerPaused:r,pauseTimer:i,resumeTimer:a,dismiss:o,shouldIgnoreTarget:s}){let c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useCallback)(e=>{let t=c.current,n=l.current;l.current=null,t&&qu(t),e&&n?.pausedTimer&&a()},[a]),d=(0,_.useCallback)((a,o)=>{let u=c.current;if(!u||!t||l.current!=null||s(o,u))return!1;let d=n&&!r();d&&i();let f=Math.max(u.getBoundingClientRect().height,1);return l.current={pointerId:a.pointerId,startX:a.clientX,startY:a.clientY,startTime:Date.now(),direction:e,intent:`pending`,pausedTimer:d,surfaceSize:f,dismissThreshold:Math.max(f*zu,Bu)},!0},[n,e,t,r,i,s]),f=(0,_.useCallback)((e,t,n)=>{let r=l.current,i=c.current;if(!r||!i||e.pointerId!==r.pointerId)return;let a=e.clientX-r.startX,o=e.clientY-r.startY,s=Math.abs(a),d=Math.abs(o);if(r.intent===`pending`){if(s>Ru&&s>d){n?.(),u(!0);return}if(d<=Ru||d<=s*Hu)return;if(r.intent=o*r.direction>0?`vertical`:`opposite`,r.intent===`opposite`){n?.(),u(!0);return}i.style.setProperty(`transition-duration`,`0s`)}t();let f=Math.max(0,o*r.direction),p=Ku(f,r.surfaceSize);i.style.setProperty(`--_toast-swipe-y`,`${f*r.direction}px`),i.style.setProperty(`--_toast-swipe-opacity`,(1-p*Wu).toFixed(3)),i.style.setProperty(`--_toast-swipe-scale`,(1-p*Gu).toFixed(3))},[u]),p=(0,_.useCallback)(e=>{let t=l.current,n=c.current;if(!t||!n||e.pointerId!==t.pointerId)return;let r=Math.max(0,(e.clientY-t.startY)*t.direction),i=Math.max(1,Date.now()-t.startTime),s=t.intent===`vertical`&&(r>=t.dismissThreshold||r>=Bu&&r/i>Vu);if(l.current=null,n.style.removeProperty(`transition-duration`),s){n.style.setProperty(`--_toast-swipe-exit-y`,t.direction===1?Uu:`calc(-1 * ${Uu})`),o();return}qu(n),t.pausedTimer&&a()},[o,a]),m=(0,_.useCallback)(e=>{e.pointerType===`pen`&&(e.button==null||e.button===0)&&d(e,e.target)&&c.current?.setPointerCapture?.(e.pointerId)},[d]),h=(0,_.useCallback)(e=>{e.pointerType===`pen`&&f(e,()=>e.preventDefault(),()=>c.current?.releasePointerCapture?.(e.pointerId))},[f]),g=(0,_.useCallback)(e=>{e.pointerType===`pen`&&(c.current?.releasePointerCapture?.(e.pointerId),p(e))},[p]),v=(0,_.useCallback)(e=>{e.pointerType===`pen`&&l.current?.pointerId===e.pointerId&&u(!0)},[u]);return(0,_.useEffect)(()=>{let e=c.current;if(!e||!t)return;let n=e=>({pointerId:e.identifier,clientX:e.clientX,clientY:e.clientY}),r=e=>{let t=l.current?.pointerId;return t==null?void 0:[...e.changedTouches].find(e=>e.identifier===t)},i=e=>{let t=e.touches.length===1?e.changedTouches[0]:null;t&&d(n(t),e.target)},a=e=>{let t=r(e);t&&f(n(t),()=>{e.cancelable&&e.preventDefault()})},o=e=>{let t=r(e);t?p(n(t)):e.touches.length===0&&u(!0)},s=()=>u(!0);return e.addEventListener(`touchstart`,i,{passive:!0}),e.addEventListener(`touchmove`,a,{passive:!1}),e.addEventListener(`touchend`,o,{passive:!0}),e.addEventListener(`touchcancel`,s,{passive:!0}),()=>{e.removeEventListener(`touchstart`,i),e.removeEventListener(`touchmove`,a),e.removeEventListener(`touchend`,o),e.removeEventListener(`touchcancel`,s)}},[d,t,p,f,u]),{rootRef:c,bindings:{onPointerDown:m,onPointerMove:h,onPointerUp:g,onPointerCancel:v,onLostPointerCapture:v}}}var Yu=`${Ga},[tabindex],[contenteditable]:not([contenteditable="false"])`;function Xu(e,t){if(!(e instanceof Element))return!1;let n=e;for(;n!=null&&n!==t&&n!==document.body;){if(n.matches(Yu))return!0;n=n.parentElement}return!1}Br[`--spacing-2`];function Zu(e){return(0,K.jsx)(Qu,{...e,gestureDirection:1})}function Qu({type:e,body:t,endContent:n,isAutoHide:r,autoHideDuration:i,isExiting:a=!1,onDismiss:o,renderContent:s,gestureDirection:c}){let l=Rc(),u=(0,_.useRef)(null),d=(0,_.useRef)(!1),f=(0,_.useRef)(i),p=(0,_.useRef)(null),m=(0,_.useRef)(o);m.current=o;let h=(0,_.useCallback)(()=>{!r||d.current||(u.current&&clearTimeout(u.current),p.current=Date.now(),u.current=setTimeout(()=>{m.current(`auto`)},f.current))},[r]),g=(0,_.useCallback)(()=>{if(!(!r||d.current)&&(d.current=!0,u.current&&=(clearTimeout(u.current),null),p.current!=null)){let e=Date.now()-p.current;f.current=Math.max(f.current-e,1e3)}},[r]),v=(0,_.useCallback)(()=>{!r||!d.current||(d.current=!1,h())},[r,h]);(0,_.useEffect)(()=>(f.current=i,h(),()=>{u.current&&clearTimeout(u.current)}),[i,h]),(0,_.useEffect)(()=>{if(r)return window.addEventListener(`blur`,g),window.addEventListener(`focus`,v),()=>{window.removeEventListener(`blur`,g),window.removeEventListener(`focus`,v)}},[r,g,v]);let y=(0,_.useCallback)(()=>d.current,[]),b=(0,_.useCallback)(()=>{m.current(`manual`)},[]),{rootRef:x,bindings:S}=Ju({direction:c,enabled:!a,canPauseTimer:r,isTimerPaused:y,pauseTimer:g,resumeTimer:v,dismiss:b,shouldIgnoreTarget:Xu}),C=(0,_.useCallback)(()=>{o(`manual`)},[o]),w=e===`error`,{mode:T}=lu(),E=w||T===`light`?`dark`:`light`;return(0,K.jsx)(`div`,{ref:x,role:w?`alert`:`status`,"aria-live":w?`assertive`:`polite`,"aria-atomic":`true`,onMouseEnter:g,onMouseLeave:v,onFocusCapture:g,onBlurCapture:v,...S,...oa(ba(`toast`,{type:e}),{0:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x1i7u4iq x9ynric xjm74w1 xw6l6zx x1qk3xlt x6o7n8i xuedmi6 xsagj69 xlr8y92 x4itv7f x6s140c xenstv7`},2:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x1i7u4iq x9ynric xjm74w1 xw6l6zx x1qk3xlt x6o7n8i xuedmi6 xsagj69 xlr8y92 x4itv7f x6s140c x1l5t2a3`},1:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x9ynric xjm74w1 xw6l6zx x6o7n8i xuedmi6 xsagj69 xlr8y92 x4itv7f x6s140c xenstv7 xg01cxk x149p1fo`},3:{className:`x1na6nto x1pzlopt x1hviunn x9f619 x1l2rt3b x193iq5w x14hfi27 x9ynric xjm74w1 xw6l6zx x6o7n8i xuedmi6 xsagj69 xlr8y92 x4itv7f x6s140c x1l5t2a3 xg01cxk x149p1fo`}}[!!w<<1|!!a<<0]),children:(0,K.jsx)(Lu,{mode:`auto`,fallback:E,children:s?s({body:t,endContent:n,type:e,isAutoHide:r,autoHideDuration:i,dismiss:C}):(0,K.jsxs)(`div`,{className:`x78zum5 x1cy8zhl xozqiw3 xjcht0a xh8yej3`,children:[(0,K.jsx)(`div`,{className:`x98rzlu xeuugli xj0a0fe`,children:t}),(0,K.jsxs)(`div`,{className:`x2lah0s x78zum5 x6s0dn4 x1txdalj x1q370uo xmequkd`,children:[n,(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,icon:(0,K.jsx)(xu,{icon:`close`,size:`sm`,color:`inherit`}),label:l(`@astryx.toast.dismiss`),onClick:C,isIconOnly:!0})]})]})})})}Zu.displayName=`Toast`,Qu.displayName=`ToastSurface`;var $u=`button:not([disabled]), a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled]), [contenteditable]:not([contenteditable="false"]), audio[controls], video[controls], iframe, details > summary:first-child`,ed=0;function td(e){if(e.hasAttribute(`inert`)||e.closest(`[inert]`)||e.hidden||e.closest(`[hidden]`)||e.closest(`[aria-hidden="true"]`))return!1;if(typeof window<`u`&&window.getComputedStyle){let t=window.getComputedStyle(e);if(t.visibility===`hidden`||t.display===`none`)return!1}return!0}function nd(e){return Array.from(e.querySelectorAll($u)).filter(td)}function rd(e){try{e.focus()}catch{}return document.activeElement===e}function id(e){let t=nd(e);for(let e of t)if(rd(e))return!0;return!1}function ad(e){let t=nd(e);for(let e=t.length-1;e>=0;e--)if(rd(t[e]))return!0;return!1}function od(e){let{isActive:t,onEscape:n}=e,r=(0,_.useRef)(null),i=(0,_.useRef)(null),a=(0,_.useRef)(!1),o=t&&n!=null;Ki({isActive:o,onDismiss:()=>{n?.()},getContainer:()=>r.current}),(0,_.useEffect)(()=>{if(o)return ed+=1,()=>{--ed}},[o]);let s=(0,_.useCallback)(()=>{r.current&&id(r.current)},[]);return(0,_.useEffect)(()=>{if(!t)return;let e=document.activeElement,n=r.current;return()=>{let t=document.activeElement;(t==null||t===document.body||t===document.documentElement||n!=null&&n.contains(t))&&e!=null&&e.isConnected&&typeof e.focus==`function`&&e.focus()}},[t]),(0,_.useEffect)(()=>{if(!t)return;let e=e=>{let t=r.current;if(!t)return;let n=e.target;if(t.contains(n))i.current=n;else if(a.current){let e=id(t);e&&i.current===document.activeElement?ad(t):!e&&i.current instanceof HTMLElement&&t.contains(i.current)&&rd(i.current),i.current=document.activeElement}a.current=!1};return document.addEventListener(`focus`,e,!0),()=>{document.removeEventListener(`focus`,e,!0)}},[t]),(0,_.useEffect)(()=>{if(!t)return;let e=e=>{let t=r.current;if(t&&e.key===`Tab`){a.current=!0;let n=nd(t);if(n.length===0){let n=document.activeElement;if(!(n instanceof HTMLElement)||!t.contains(n))return;e.preventDefault(),i.current=n,a.current=!1;return}let r=n[0],o=n[n.length-1];e.shiftKey?document.activeElement===r&&(e.preventDefault(),o.focus()):document.activeElement===o&&(e.preventDefault(),r.focus())}};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[t,n]),{containerRef:r,focusFirst:s}}function sd(e,t,n=!0){let r=(0,_.useRef)(!1);(0,_.useEffect)(()=>{n&&!r.current&&(r.current=!0)},[e,t,n])}var cd={surface:{kWkggS:`x1prclbq`,"--_popover-radius":`xiki222`,kaIpWk:`x11m9jtl`,kGVxlE:`x1i5ehqx`,$$css:!0},contentWrapper:{kVAEAm:`x1n2onr6`,$$css:!0},closeButtonWrapper:{kVAEAm:`x10l6tqk`,krVfgx:`x1ey2m1c`,kY2c9j:`x1vjfegm`,kzqmXN:`x1i1rx1s x10okhzq`,kZKoxP:`xjm9jq1 x132qfvm`,kVQacm:`xb3r6kr x1dordxg`,kz4h6p:`x1hyvwdk x10wafsz`,kfzvcC:`x47corl xbt4iw`,kLKAdn:`xexx8yu x1kw28su`,$$css:!0}};function ld(e={}){let{onShow:t,onHide:n,xstyle:r,className:i,style:a,hasLightDismiss:o=!0,hasEscapeDismiss:s=!0,hasAutoFocus:c=!0,hasSurface:l=!0,surfaceTarget:u,hasCloseButton:d=!0,closeButtonLabel:f,dialogLabel:p,role:m=`dialog`,isModal:h=!0}=e,g=Rc(),v=f??g(`@astryx.popover.close`),y=(0,_.useRef)(null),b=(0,_.useRef)(!1),x=Si({mode:`context`,lightDismiss:o,onShow:t,onHide:n}),{containerRef:S,focusFirst:C}=od({isActive:x.isOpen,onEscape:s||o?x.hide:void 0});(0,_.useEffect)(()=>{x.isOpen&&c&&!b.current&&requestAnimationFrame(()=>{C()}),x.isOpen||(b.current=!1)},[x.isOpen,c,C]);let w=(0,_.useCallback)(e=>{y.current=e,x.ref(e)},[x]),T=(0,_.useCallback)(e=>{b.current=e?.skipAutoFocus??!1,x.show()},[x]),E=(0,_.useCallback)(()=>{x.wasJustDismissed()||(x.isOpen?x.hide():T())},[x,T]),D={"aria-haspopup":m===`dialog`?`dialog`:`true`,"aria-expanded":x.isOpen,"aria-controls":x.id};sd(`usePopover`,'role="dialog" without a `dialogLabel` renders an unnamed dialog. Pass `dialogLabel`, or use `role: "none"` for listbox/menu popups whose content already carries its own role.',m===`dialog`&&!p);let O=(0,_.useCallback)((e,t)=>{let n=ba(`popover-surface`),o=u==null?n.className:`${n.className} ${pa(u)}`;return x.render((0,K.jsx)(Ti,{children:(0,K.jsxs)(`div`,{ref:S,role:m===`dialog`?`dialog`:void 0,"aria-modal":m===`dialog`&&h?!0:void 0,"aria-label":m===`dialog`?p:void 0,...oa({...n,className:o},Sr(cd.contentWrapper,l&&cd.surface,r),i,a),children:[e,d&&(0,K.jsx)(`div`,{...Sr(cd.closeButtonWrapper,Ra.centerInline(`100%`)),children:(0,K.jsx)(qc,{variant:`secondary`,label:v,onClick:x.hide})})]})}),{...t,xstyle:t?.xstyle})},[x,d,l,u,i,a,v,S,p,m,h,r]);return{triggerRef:w,contentRef:S,anchorId:x.anchorId,show:T,hide:x.hide,toggle:E,wasJustDismissed:x.wasJustDismissed,isOpen:x.isOpen,id:x.id,render:O,triggerProps:D}}function ud(e={}){let{wasJustDismissed:t,...n}=ld(e);return n}function dd(e={}){return ld(e)}var fd=(0,_.createContext)(null);fd.displayName=`InteractiveRoleContext`;var pd=`button, [role="button"]`;function md(e){return e.matches(pd)?e:e.querySelector(pd)}var hd={contentPadding:{kLKAdn:`x1vlblms`,kGO01o:`xvmdzux`,kZCmMZ:`x126nfab`,kwRFfy:`x1t818jl`,$$css:!0},customWidth:e=>[{kzqmXN:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e)}],matchTrigger:{k7Eaqz:`xrzjruh`,$$css:!0}};function gd({children:e,anchorRef:t,content:n,placement:r=`below`,alignment:i=`start`,isOpen:a,onOpenChange:o,isEnabled:s=!0,width:c,label:l,role:u=`dialog`,isModal:d,hasCloseButton:f,closeButtonLabel:p,hasAutoFocus:m,hasLightDismiss:h=!0,hasEscapeDismiss:g=!0,xstyle:v,className:y,style:b,"data-testid":x}){let S=(0,_.useRef)(null),C=a!==void 0,w=(0,_.useCallback)(()=>{o?.(!0)},[o]),T=(0,_.useCallback)(()=>{o?.(!1)},[o]),E=ud({dialogLabel:l,role:u,isModal:d,hasLightDismiss:h,hasEscapeDismiss:g,hasCloseButton:f,closeButtonLabel:p,hasAutoFocus:m,surfaceTarget:`popover`,xstyle:[hd.contentPadding,v],className:y,style:b,onShow:w,onHide:T}),D=(0,_.useCallback)(()=>{s&&E.toggle()},[s,E]),O=(0,_.useCallback)(e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),D())},[D]),k=(0,_.useCallback)(e=>{e.setAttribute(`aria-haspopup`,E.triggerProps[`aria-haspopup`]),e.setAttribute(`aria-expanded`,String(E.triggerProps[`aria-expanded`])),e.setAttribute(`aria-controls`,E.triggerProps[`aria-controls`]),e.addEventListener(`click`,D);let t=e.tagName!==`BUTTON`&&e.getAttribute(`role`)===`button`;return t&&e.addEventListener(`keydown`,O),()=>{e.removeAttribute(`aria-haspopup`),e.removeAttribute(`aria-expanded`),e.removeAttribute(`aria-controls`),e.removeEventListener(`click`,D),t&&e.removeEventListener(`keydown`,O)}},[E,D,O]);wu(()=>{if(!t)return;let e=t.current;if(!e)return;let n=md(e);if(!n)return;E.triggerRef(e);let r=k(n);return()=>{E.triggerRef(null),r()}},[t,E,k]),wu(()=>{if(t||typeof e==`function`)return;let n=S.current;if(!n)return;E.triggerRef(n);let r=md(n);if(!r)return;let i=k(r);return()=>{E.triggerRef(null),i()}},[t,E,k]),wu(()=>{C&&(a&&!E.isOpen?E.show():!a&&E.isOpen&&E.hide())},[a,C,E]);let A=c?hd.customWidth(c):hd.matchTrigger;if(t&&e==null)return(0,K.jsx)(K.Fragment,{children:E.render((0,K.jsx)(`div`,{"data-testid":x,children:n}),{placement:r,alignment:i,offset:Br[`--spacing-1`],xstyle:[A,co[r]]})});if(typeof e==`function`){let t={ref:E.triggerRef,onClick:D,"aria-haspopup":`dialog`,"aria-expanded":E.isOpen,"aria-controls":E.id};return(0,K.jsxs)(K.Fragment,{children:[e(t),E.render((0,K.jsx)(`div`,{"data-testid":x,children:n}),{placement:r,alignment:i,offset:Br[`--spacing-1`],xstyle:[A,co[r]]})]})}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(fd,{value:`button`,children:(0,K.jsx)(`div`,{ref:S,className:`x3nfvp2`,children:e})}),E.render((0,K.jsx)(`div`,{"data-testid":x,children:n}),{placement:r,alignment:i,offset:Br[`--spacing-1`],xstyle:[A,co[r]]})]})}gd.displayName=`Popover`;var _d={container:{kWkggS:`x10xzikg`,"--_hovercard-radius":`xqwz7mz`,kaIpWk:`x7a53xk`,kGVxlE:`x14hfi27`,$$css:!0}};function vd(e){return e.hasAttribute(`tabindex`)?e.tabIndex>=0:[`A`,`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`].includes(e.tagName)?!e.disabled:!!e.isContentEditable}function yd(e={}){let{placement:t=`above`,alignment:n=`center`,delay:r=300,hideDelay:i=200,focusTrigger:a=`auto`,touchTrigger:o=`auto`,isEnabled:s=!0,label:c,isOpen:l,isDefaultOpen:u=!1,onShow:d,onHide:f}=e,p=xi({mode:`context`,lazyMount:!0,onShow:d,onHide:f}),m=_d.container,h=(0,_.useRef)(null),g=(0,_.useRef)(null),v=(0,_.useRef)(null),y=(0,_.useRef)(!1),b=(0,_.useRef)(!1),x=(0,_.useCallback)(()=>{h.current&&=(clearTimeout(h.current),null),g.current&&=(clearTimeout(g.current),null)},[]),S=(0,_.useCallback)(()=>{x(),p.show()},[x,p]),C=(0,_.useCallback)(()=>{x(),y.current=!1,p.hide()},[x,p]),w=ra({touchTrigger:o,isEnabled:s,isControlled:l!==void 0,isOpen:p.isOpen,layerId:p.id,triggerRef:v,show:S,hide:C}),T=(0,_.useCallback)(()=>{!s||l===!1||(x(),h.current=setTimeout(()=>{p.show()},r))},[s,l,x,p,r]),E=(0,_.useCallback)(()=>{l!==!0&&(x(),g.current=setTimeout(()=>{y.current||p.hide()},i))},[l,x,p,i]),D=(0,_.useCallback)(()=>{w.isTouchPointerRef.current||T()},[w,T]),O=(0,_.useCallback)(()=>{w.isTouchPointerRef.current||E()},[w,E]),k=(0,_.useCallback)(e=>{w.handlePointerDown(e)},[w]),A=(0,_.useCallback)(()=>{if(s&&!w.isTouchInteraction()){if(b.current){b.current=!1;return}x(),p.show()}},[s,w,x,p]),j=(0,_.useCallback)(e=>{let t=e.relatedTarget;document.getElementById(p.id)?.contains(t)||E()},[p.id,E]);Ki({isActive:!0,isPresent:()=>{let e=typeof document>`u`?null:document.getElementById(p.id);if(e==null)return!1;try{return e.matches(`:popover-open`)}catch{return p.isOpen}},onDismiss:()=>{if(x(),w.clearTapOpen(),l!==void 0){f?.();return}let e=(typeof document>`u`?null:document.getElementById(p.id))?.contains(document.activeElement)??!1;p.hide(),e&&(b.current=!0,v.current?.focus())}});let{handlePointerEnter:M}=w,N=(0,_.useCallback)(e=>{v.current&&(v.current.removeEventListener(`mouseenter`,D),v.current.removeEventListener(`mouseleave`,O),v.current.removeEventListener(`focusin`,A),v.current.removeEventListener(`focusout`,j),v.current.removeEventListener(`pointerenter`,M),v.current.removeEventListener(`pointerdown`,k)),e&&(e.addEventListener(`pointerenter`,M),e.addEventListener(`mouseenter`,D),e.addEventListener(`mouseleave`,O),e.addEventListener(`pointerdown`,k),(a===`always`||a===`auto`&&vd(e))&&(e.addEventListener(`focusin`,A),e.addEventListener(`focusout`,j))),v.current=e},[a,D,O,A,j,M,k]),P=(0,_.useCallback)(e=>{p.ref(e),N(e)},[p,N]);(0,_.useEffect)(()=>()=>{x()},[x]),(0,_.useEffect)(()=>{u&&p.show()},[]),(0,_.useEffect)(()=>{if(l!==void 0)if(l)x(),p.show();else{x();let e=(typeof document>`u`?null:document.getElementById(p.id))?.contains(document.activeElement)??!1;p.hide(),e&&(b.current=!0,v.current?.focus())}},[l,x,p]);let F=(0,_.useCallback)((e,r)=>{let i=r?.placement??t,a=ba(`hover-card`,void 0,{legacyNames:[`hovercard`]}).className,o={placement:i,alignment:r?.alignment??n,offset:Br[`--spacing-1`],role:c?`dialog`:`group`,"aria-label":c||void 0,xstyle:[m,co[i],r?.xstyle],className:r?.className?`${a} ${r.className}`:a,style:r?.style,as:`div`};return p.render((0,K.jsx)(`div`,{className:`x1lliihq x1vlblms xvmdzux x126nfab x1t818jl`,onMouseEnter:()=>{w.isTouchPointerRef.current||(y.current=!0,x())},onMouseLeave:()=>{w.isTouchPointerRef.current||(y.current=!1,E())},onBlur:e=>{let t=e.relatedTarget;e.currentTarget.contains(t)||v.current?.contains(t)||E()},children:e}),o)},[p,t,n,c,x,E,m,w]);return{ref:P,positionRef:p.ref,interactionRef:N,anchorId:p.anchorId,id:p.id,describedBy:p.id,isOpen:p.isOpen,renderHoverCard:F,show:p.show,hide:p.hide}}var bd=t({Tooltip:()=>Cd});function xd(e){return typeof e==`string`||typeof e==`number`}function Sd(...e){let t=e.filter(Boolean);return t.length>0?t.join(` `):void 0}function Cd({children:e,anchorRef:t,content:n,placement:r=`above`,alignment:i=`center`,delay:a=200,hideDelay:o=0,focusTrigger:s=`auto`,touchTrigger:c=`auto`,isEnabled:l=!0,onOpenChange:u,hasHoverIndication:d=`auto`,isOpen:f,isDefaultOpen:p}){let m=(0,_.useRef)(null),h=e!=null&&xd(e),g=d===!0||d===`auto`&&h,v=po({placement:r,alignment:i,delay:a,hideDelay:o,focusTrigger:s,touchTrigger:c,isEnabled:l,isOpen:f,isDefaultOpen:p,onShow:(0,_.useCallback)(()=>{u?.(!0)},[u]),onHide:(0,_.useCallback)(()=>{u?.(!1)},[u])});return wu(()=>{if(!t)return;let e=t.current;if(!e)return;v.ref(e);let n=e.getAttribute(`aria-describedby`);return e.setAttribute(`aria-describedby`,Sd(n,v.describedBy)??``),()=>{v.ref(null),n?e.setAttribute(`aria-describedby`,n):e.removeAttribute(`aria-describedby`)}},[t,v.ref,v.describedBy]),wu(()=>{if(t||h)return;let e=m.current;if(!e)return;let n=e.firstElementChild;if(!n)return;v.ref(n);let r=n.getAttribute(`aria-describedby`);return n.setAttribute(`aria-describedby`,Sd(r,v.describedBy)??``),()=>{v.ref(null),r?n.setAttribute(`aria-describedby`,r):n.removeAttribute(`aria-describedby`)}},[t,h,v.ref,v.describedBy]),t&&e==null?(0,K.jsx)(K.Fragment,{children:v.renderTooltip(n)}):h?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{ref:v.ref,tabIndex:0,"aria-describedby":v.describedBy,...{0:{className:`xt0psk2`},1:{className:`xt0psk2 xujl8zx xev0dqp xycaml9 xrys4gj`}}[!!g<<0],children:e}),v.renderTooltip(n)]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{ref:m,className:`xjp7ctv`,children:e}),v.renderTooltip(n)]})}Cd.displayName=`Tooltip`;async function wd(e,t=n){let n=t,r=t.defaultView??globalThis.window,{HTMLInputElement:i,HTMLTextAreaElement:a,HTMLElement:o}=r;try{return await r.navigator.clipboard.writeText(e),!0}catch{}let s=n.activeElement,c=r.getSelection(),l=c?Array.from({length:c.rangeCount},(e,t)=>c.getRangeAt(t).cloneRange()):[],u=s instanceof i||s instanceof a?{start:s.selectionStart,end:s.selectionEnd,direction:s.selectionDirection}:null,d=n.createElement(`textarea`);d.value=e,d.readOnly=!0,d.style.cssText=`position:fixed;opacity:0;pointer-events:none`;try{return n.body.append(d),d.focus({preventScroll:!0}),d.select(),n.execCommand(`copy`)}catch{return!1}finally{if(d.remove(),s instanceof o&&s.isConnected&&(s.focus({preventScroll:!0}),u&&u.start!==null&&u.end!==null&&(s instanceof i||s instanceof a)&&s.setSelectionRange(u.start,u.end,u.direction??void 0)),c){c.removeAllRanges();for(let e of l)e.startContainer.isConnected&&e.endContainer.isConnected&&c.addRange(e)}}}function Td(e){return!!e.trim()&&!e.startsWith(`#`)&&!e.startsWith(`//`)&&(!/^[a-z][a-z\d+.-]*:/iu.test(e)||/^[a-z]:(?:[\\/]|%5c)/iu.test(e))}var Ed=/\p{Cf}/u,Dd=class{state=`text`;stringEscape=!1;push(e){let t=``;for(let n of e){let e=n.codePointAt(0);if(this.state===`osc`||this.state===`st_string`){n===`œ`||this.state===`osc`&&n===`\x07`||this.stringEscape&&n===`\\`?(this.state=`text`,this.stringEscape=!1):this.stringEscape=n===`\x1B`;continue}if(this.state===`csi`){e>=64&&e<=126?this.state=`text`:(e<32||e>63)&&(this.state=`text`,t+=this.safeCharacter(n,e));continue}if(this.state===`escape`||this.state===`escape_intermediate`){if(this.state===`escape`){if(n===`[`){this.state=`csi`;continue}if(n===`]`){this.state=`osc`;continue}if(n===`P`||n===`X`||n===`^`||n===`_`){this.state=`st_string`;continue}}e>=32&&e<=47?this.state=`escape_intermediate`:e>=48&&e<=126?this.state=`text`:(this.state=`text`,t+=this.safeCharacter(n,e));continue}n===`\x1B`?this.state=`escape`:n===`›`?this.state=`csi`:n===``?this.state=`osc`:n===``||n===`˜`||n===`ž`||n===`Ÿ`?this.state=`st_string`:t+=this.safeCharacter(n,e)}return t}safeCharacter(e,t){return e===` `?` `:e===` +`||e===`‌`||e===`‍`?e:t<=31||t>=127&&t<=159||Ed.test(e)?``:e}};function Od(e){return new Dd().push(e)}var kd=8e3;function Ad(e,t){let n=0;for(let r of e){let e=r.codePointAt(0);if(n+=e<=127?1:e<=2047?2:e<=65535?3:4,n>t)return}return n}function jd(e){return Ad(e,1/0)}function Md(e){return Ad(e,kd)!==void 0}function Nd(e){return typeof e==`string`&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu.test(e)}var Pd=Symbol.for(`@tt-a1i/openpi/web-command-feedback/v1`),Fd=Reflect.get(globalThis,Pd);if(Fd!==void 0&&!(Fd instanceof WeakMap))throw Error(`Incompatible Web feedback bridge`);Fd===void 0&&Object.defineProperty(globalThis,Pd,{value:Fd??new WeakMap});var Id=12288,Ld=4096;function Rd(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function zd(e,t=!1){let n=Rd(e),r={},i=e=>Object.getOwnPropertyDescriptor(n,e)?.value,a=t&&typeof i(`pathUnavailable`)==`string`;for(let e of t?[`path`,`resolvedPath`]:[`path`]){let n=i(e),o=e===`path`?`displayPath`:`displayResolvedPath`,s=typeof n==`string`?n:t?i(o):void 0;typeof s==`string`&&(r[o]=Bd(s).text),typeof n==`string`&&(n.length>Ld||new TextEncoder().encode(n).length>Ld?a=!0:r[e]=n)}a&&(delete r.path,delete r.resolvedPath,r.pathUnavailable=`File reference exceeds the evidence byte limit.`);for(let e of[`command`,`offset`,`limit`,`id`]){let t=i(e);typeof t==`string`?r[e]=Bd(t).text:typeof t==`number`&&Number.isSafeInteger(t)&&(r[e]=t)}return r}function Bd(e,t=!1){let n=t?e.slice(-24576):e.slice(0,Id*2),r=Od(n).split(` `),i=(t?r.slice(-300):r.slice(0,300)).join(` -`),a=new TextEncoder().encode(i),o=t?Math.max(0,a.length-Nd):0,s=t?a.length:Math.min(a.length,Nd);for(;oo&&(a[s]&192)==128;)s--;return{text:new TextDecoder().decode(a.subarray(o,s)),truncated:e.length>n.length||r.length>300||a.length>12288}}function Id(e){if(e.evidenceArguments)return e.evidenceArguments;try{return Pd(JSON.parse(e.arguments))}catch{return{}}}function Ld(e){return[`read`,`write`,`edit`,`bash`,`bg_start`,`bg_status`].includes(e)}function Rd(e,t){if(t?.forkSnapshotToolResult)return{state:`unknown`};if(e===`bash`&&t?.terminalReceipt)return t.terminalReceipt;let n=Pd(t?.details);if(e.startsWith(`bg_`)){let e=n.status;if(e===`running`)return{state:`running`};if(typeof e==`string`&&[`done`,`failed`,`killed`,`timed_out`].includes(e))return{state:e===`killed`?`cancelled`:e===`timed_out`?`timed_out`:e===`failed`?`failed`:`returned`,exitCode:typeof n.exitCode==`number`&&Number.isSafeInteger(n.exitCode)?n.exitCode:void 0,signal:typeof n.signal==`string`?Fd(n.signal).text:void 0}}if(e===`bash`&&t?.isError===!0&&!t.truncation){let e=t.content.trimEnd().split(` -`).at(-1);if(e===`Command aborted`)return{state:`cancelled`};if(/^Command timed out after \d+(?:\.\d+)? seconds$/u.test(e??``))return{state:`timed_out`};let n=/^Command exited with code (-?\d+)$/u.exec(e??``);if(n)return{state:`failed`,exitCode:Number(n[1])}}}function zd(e){let t=/^\s*Tests\s+((?:\d+ (?:passed|failed|skipped|todo)(?:\s*\|\s*)?)+)\s*\((\d+)\)\s*$/mu.exec(e);if(t){let n=Number(/(\d+) passed/u.exec(t[1])?.[1]??0),r=Number(/(\d+) failed/u.exec(t[1])?.[1]??0),i=Number(t[2]);if(Number.isSafeInteger(i)&&n+r<=i)return{format:`Vitest`,tests:i,passed:n,failed:r,cancelled:0,failures:Bd(e,/^\s*(?:FAIL\s|×\s)/u)}}let n=/^Ran (\d+) tests? across \d+ files?\./mu.exec(e),r=/^\s*(\d+) pass\s*$/mu.exec(e),i=/^\s*(\d+) fail\s*$/mu.exec(e);if(n&&r&&i){let t=Number(n[1]),a=Number(r[1]),o=Number(i[1]);if(Number.isSafeInteger(t)&&a+o<=t)return{format:`Bun`,tests:t,passed:a,failed:o,cancelled:0,failures:Bd(e,/^\s*\(fail\) /u)}}let a=t=>{let n=RegExp(`^[#ℹ] ${t} (\\d+)$`,`mu`).exec(e),r=n?Number(n[1]):void 0;return r!==void 0&&Number.isSafeInteger(r)?r:void 0},o=a(`tests`),s=a(`pass`),c=a(`fail`),l=a(`cancelled`)??0;if(o===void 0||s===void 0||c===void 0||s+c+l>o)return;let u=Bd(e,/^(?:\s*not ok \d+\b|✖ )/u);return{format:/^ℹ tests /mu.test(e)?`Node`:`TAP`,tests:o,passed:s,failed:c,cancelled:l,failures:u}}function Bd(e,t){return e.split(` +`),a=new TextEncoder().encode(i),o=t?Math.max(0,a.length-Id):0,s=t?a.length:Math.min(a.length,Id);for(;oo&&(a[s]&192)==128;)s--;return{text:new TextDecoder().decode(a.subarray(o,s)),truncated:e.length>n.length||r.length>300||a.length>12288}}function Vd(e){if(e.evidenceArguments)return zd(e.evidenceArguments,!0);try{return zd(JSON.parse(e.arguments))}catch{return{}}}function Hd(e){return[`read`,`write`,`edit`,`bash`,`bg_start`,`bg_status`].includes(e)}function Ud(e,t){if(t?.forkSnapshotToolResult)return{state:`unknown`};if(e===`bash`&&t?.terminalReceipt)return t.terminalReceipt;let n=Rd(t?.details);if(e.startsWith(`bg_`)){let e=n.status;if(e===`running`)return{state:`running`};if(typeof e==`string`&&[`done`,`failed`,`killed`,`timed_out`].includes(e))return{state:e===`killed`?`cancelled`:e===`timed_out`?`timed_out`:e===`failed`?`failed`:`returned`,exitCode:typeof n.exitCode==`number`&&Number.isSafeInteger(n.exitCode)?n.exitCode:void 0,signal:typeof n.signal==`string`?Bd(n.signal).text:void 0}}if(e===`bash`&&t?.isError===!0&&!t.truncation){let e=t.content.trimEnd().split(` +`).at(-1);if(e===`Command aborted`)return{state:`cancelled`};if(/^Command timed out after \d+(?:\.\d+)? seconds$/u.test(e??``))return{state:`timed_out`};let n=/^Command exited with code (-?\d+)$/u.exec(e??``);if(n)return{state:`failed`,exitCode:Number(n[1])}}}function Wd(e){let t=/^\s*Tests\s+((?:\d+ (?:passed|failed|skipped|todo)(?:\s*\|\s*)?)+)\s*\((\d+)\)\s*$/mu.exec(e);if(t){let n=Number(/(\d+) passed/u.exec(t[1])?.[1]??0),r=Number(/(\d+) failed/u.exec(t[1])?.[1]??0),i=Number(t[2]);if(Number.isSafeInteger(i)&&n+r<=i)return{format:`Vitest`,tests:i,passed:n,failed:r,cancelled:0,failures:Gd(e,/^\s*(?:FAIL\s|×\s)/u)}}let n=/^Ran (\d+) tests? across \d+ files?\./mu.exec(e),r=/^\s*(\d+) pass\s*$/mu.exec(e),i=/^\s*(\d+) fail\s*$/mu.exec(e);if(n&&r&&i){let t=Number(n[1]),a=Number(r[1]),o=Number(i[1]);if(Number.isSafeInteger(t)&&a+o<=t)return{format:`Bun`,tests:t,passed:a,failed:o,cancelled:0,failures:Gd(e,/^\s*\(fail\) /u)}}let a=t=>{let n=RegExp(`^[#ℹ] ${t} (\\d+)$`,`mu`).exec(e),r=n?Number(n[1]):void 0;return r!==void 0&&Number.isSafeInteger(r)?r:void 0},o=a(`tests`),s=a(`pass`),c=a(`fail`),l=a(`cancelled`)??0;if(o===void 0||s===void 0||c===void 0||s+c+l>o)return;let u=Gd(e,/^(?:\s*not ok \d+\b|✖ )/u);return{format:/^ℹ tests /mu.test(e)?`Node`:`TAP`,tests:o,passed:s,failed:c,cancelled:l,failures:u}}function Gd(e,t){return e.split(` `).flatMap((e,n,r)=>t.test(e)?[r.slice(n,n+8).join(` -`)]:[]).slice(0,20)}function Vd(e,t,n){let r=Id(e),i=Pd(t?.details),a=Rd(e.name,t),o=a?.state??(n===`running`||n===`cancelled`||n===`timed_out`?n:t?.isError===!0?`failed`:t?.isError===!1?`returned`:`unknown`),s=[`bash`,`bg_start`,`bg_status`].includes(e.name),c=Fd(t?.content??``,s),l=e.name===`read`?/\n\n(\[(?:\d+ more lines in file\. Use offset=\d+ to continue\.|Showing lines [^\n]+)\])$/u.exec(c.text):null,u=c.truncated||!!t?.truncation||Pd(i.truncation).truncated===!0||e.evidenceTruncated===!0,d=s&&!t?.forkSnapshotToolResult?zd(c.text):void 0,f=e.name===`read`?`file`:[`write`,`edit`].includes(e.name)?`change`:d?`test`:`terminal`,p=[`write`,`edit`].includes(e.name)&&o===`returned`&&t?.isError===!1&&typeof i.diff==`string`?Fd(i.diff):void 0,m=typeof r.offset==`number`&&Number.isSafeInteger(r.offset)&&r.offset>0?r.offset:1;return{kind:f,state:o,processState:a?.state??(e.name===`bash`&&t?.isError===!1?`returned`:e.name===`bash`&&n===`running`?`running`:`unknown`),output:l?c.text.slice(0,l.index):c.text,truncated:u||p?.truncated===!0,readRecovery:l?.[1],numberLines:e.name===`read`&&t?.isError===!1&&Pd(i.truncation).firstLineExceedsLimit!==!0&&!!c.text,path:typeof r.path==`string`?Fd(r.path).text:void 0,resolvedPath:typeof r.resolvedPath==`string`?Fd(r.resolvedPath).text:void 0,command:typeof r.command==`string`?Fd(r.command).text:void 0,offset:m,diff:p?.text,tests:d,change:o===`returned`&&t?.isError===!1&&[`created`,`overwritten`,`unchanged`].includes(String(i.change))?String(i.change):void 0,evidenceUnavailable:typeof i.evidenceUnavailable==`string`?Fd(i.evidenceUnavailable).text:void 0,exitCode:a&&`exitCode`in a?a.exitCode:void 0,signal:a&&`signal`in a?a.signal:void 0,recovery:typeof i.fullOutputPath==`string`?Fd(i.fullOutputPath).text:void 0,rawArguments:Fd(e.arguments).text,rawResult:Fd(JSON.stringify({content:t?.content,details:t?.details,isError:t?.isError})).text}}var Hd=12e3,Ud=13981016,Wd=2097152,Gd=new TextEncoder;function Kd(e){return Gd.encode(JSON.stringify(e)).byteLength}var qd=`openpi.web.controller`,Jd,Yd,Xd=0;function Zd(e){try{window.sessionStorage.setItem(qd,e)}catch{}return e}async function Qd(){let e=Xd;if(!window.navigator.locks)return Zd(window.crypto.randomUUID());let t=null;try{t=window.sessionStorage.getItem(qd)}catch{}let n=Ad(t)?t:window.crypto.randomUUID();for(;;){let t=n,r=await new Promise(n=>{window.navigator.locks.request(`openpi.web.controller:${t}`,{ifAvailable:!0},async t=>{if(e!==Xd){n(null);return}if(!t){n(!1);return}await new Promise(e=>{Yd=e,n(!0)})}).catch(()=>n(null))});if(e!==Xd)throw new DOMException(`Page was suspended`,`AbortError`);if(r===null)return Zd(window.crypto.randomUUID());if(r)return Zd(t);n=window.crypto.randomUUID()}}function $d(){return Jd??=Qd()}window.addEventListener(`pagehide`,()=>{Xd++,Yd?.(),Yd=void 0,Jd=void 0}),window.addEventListener(`pageshow`,e=>{e.persisted&&$d().catch(()=>{})});var ef=`openpi.web.token`,tf=class extends Error{status;code;constructor(e,t,n){super(e),this.status=t,this.code=n,this.name=`WebApiError`}};function nf(){let e=document.querySelector(`meta[name="openpi-web-token"]`)?.content,t=new URLSearchParams(location.hash.slice(1)).get(`token`),n=e&&/^[a-f0-9]{64}$/i.test(e)?e:t;if(t&&history.replaceState(null,``,`${location.pathname}${location.search}`),n){try{window.sessionStorage.setItem(ef,n)}catch{}return n}try{return window.sessionStorage.getItem(ef)}catch{return null}}var rf=class{token=nf();async headers(e=!1){return{Authorization:`Bearer ${this.token??``}`,"X-OpenPI-Web-Controller":await $d(),...e?{"Content-Type":`application/json`}:{}}}async request(e,t={}){let{timeoutMs:n=15e3,timeoutMessage:r=`Request timed out. Please try again.`,...i}=t,a=new AbortController,o=!1,s=()=>a.abort();t.signal?.aborted&&s(),t.signal?.addEventListener(`abort`,s,{once:!0});let c=window.setTimeout(()=>{o=!0,a.abort()},n);try{let n=await fetch(e,{...i,signal:a.signal,headers:{...await this.headers(!!t.body),...t.headers}}),r=await n.json();if(a.signal.aborted)throw Error(`Request aborted`);if(!n.ok)throw new tf(r.error||`Request failed (${n.status})`,n.status,r.code);return r}catch(e){throw o?Error(r):e}finally{window.clearTimeout(c),t.signal?.removeEventListener(`abort`,s)}}snapshot(e,t,n){let r=new URLSearchParams;e&&r.set(`path`,e),n&&r.set(`sessionId`,n),t&&t.sessionPath===e&&(r.set(`historyAnchor`,t.entryId),r.set(`historySessionId`,t.sessionId));let i=r.size?`?${r}`:``;return this.request(`/api/snapshot${i}`)}searchTranscripts(e,t={}){let n=new URLSearchParams({q:e});return t.includeArchived&&n.set(`includeArchived`,`1`),this.request(`/api/sessions/search?${n}`,{signal:t.signal})}async sessionMessageWindow(e,t){return(await this.request(`/api/session/message-window?${new URLSearchParams({sessionId:e.sessionId,path:e.sessionPath,entryId:e.entryId})}`,{signal:t})).session}async sessionHistory(e,t,n){return(await this.request(`/api/session/history?${new URLSearchParams({sessionId:e.sessionId,path:e.sessionPath,anchorEntryId:e.entryId,beforeEntryId:t})}`,{signal:n,timeoutMessage:`History request timed out. Please retry.`})).session}sessionPromptHistory(e,t,n){return this.request(`/api/session/prompt-history?${new URLSearchParams({sessionId:e.sessionId,path:e.sessionPath,anchorEntryId:e.entryId,...t===null?{}:{beforeEntryId:t}})}`,{signal:n,timeoutMessage:`Prompt history request timed out. Please retry.`})}sessionPromptPreview(e,t,n){return this.request(`/api/session/prompt-preview?${new URLSearchParams({sessionId:e.sessionId,path:e.sessionPath,anchorEntryId:e.entryId,entryId:t})}`,{signal:n,timeoutMessage:`Prompt preview request timed out. Please retry.`})}sessionItem(e,t,n,r,i,a,o){return this.request(`/api/session/item?${new URLSearchParams({sessionId:e,sessionPath:t,entryId:n,cursor:String(r),...a?{purpose:a}:{},...o===void 0?{}:{partIndex:String(o)}})}`,{signal:i,timeoutMessage:`Message request timed out. Please retry.`})}turnChanges(e,t,n,r,i){return this.request(`/api/turn-changes?${new URLSearchParams({sessionId:e,sessionPath:t,promptEntryId:n,...i?{filePath:i}:{}})}`,{signal:r,timeoutMessage:`Turn changes request timed out. Please retry.`})}gitReview(e,t,n,r){return this.request(`/api/git-review?${new URLSearchParams({sessionId:e,path:t,...r})}`,{signal:n,timeoutMessage:`Git review timed out. Please retry.`})}workspaceFiles(e,t,n,r,i,a){return this.request(`/api/artifacts/files?${new URLSearchParams({sessionId:e,sessionPath:t,path:encodeURI(n),query:r,...a?{cursor:a}:{}})}`,{signal:i})}releaseFileListing(e){return this.request(`/api/artifacts/files?${new URLSearchParams({cursor:e})}`,{method:`DELETE`})}mutateWorkspaceFile(e,t,n){return this.request(`/api/files/mutate`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t,access:`write-workspace-file`,kind:n.kind,...n.kind===`restore`?{id:n.id,identity:n.identity}:n.kind===`trash`?{path:encodeURI(n.path),identity:n.identity}:{directory:encodeURI(n.directory),name:n.name,...n.kind===`move`?{path:encodeURI(n.path),identity:n.identity}:{},...n.kind===`import-file`?{data:n.data,...n.createParents?{createParents:!0}:{}}:{}}})})}workspaceTrash(e,t,n,r){return this.request(`/api/artifacts/trash?${new URLSearchParams({sessionId:e,sessionPath:t,...r?{cursor:r}:{}})}`,{signal:n})}resolveArtifact(e,t,n,r){return this.request(`/api/artifacts/resolve`,{method:`POST`,body:JSON.stringify({sessionId:e,reference:t,parent:n,access:`read-file`}),signal:r})}artifactMetadata(e,t,n){return this.request(`/api/artifacts/content?${new URLSearchParams({sessionId:e,handle:t,metadata:`1`})}`,{signal:n})}artifactPreview(e,t,n,r){return this.request(`/api/artifacts/content?${new URLSearchParams({sessionId:e,handle:t,...r?{offset:String(r.offset),revision:r.revision}:{}})}`,{signal:n})}authorizeArtifact(e,t,n){return this.request(`/api/artifacts/authorize-file`,{method:`POST`,body:JSON.stringify({sessionId:e,reference:t,access:`read-external-file`}),signal:n})}releaseArtifact(e,t){return this.request(`/api/artifacts/content?`+new URLSearchParams({sessionId:e,handle:t}),{method:`DELETE`})}saveArtifact(e,t,n){return this.request(`/api/artifacts/save`,{method:`POST`,body:JSON.stringify({sessionId:e.sessionId,handle:e.handle,revision:t,text:n,access:`write-workspace-file`})})}async downloadArtifact(e,t){let n=new AbortController,r=()=>n.abort();t.addEventListener(`abort`,r,{once:!0}),t.aborted&&r();let i=window.setTimeout(r,15e3);try{let t=await fetch(`/api/artifacts/content?${new URLSearchParams({sessionId:e.sessionId,handle:e.handle,revision:e.revision,download:`1`})}`,{headers:await this.headers(),signal:n.signal});if(!t.ok){let e=await t.json();throw new tf(e.error||`Download failed`,t.status,e.code)}let r=t.body?.getReader();if(!r)throw Error(`Download body unavailable`);let i=[],a=0;try{for(;;){let{value:e,done:t}=await r.read();if(t)break;if(a+=e.byteLength,a>20971520)throw Error(`Download exceeds the 20 MiB limit`);i.push(new Uint8Array(e))}}finally{await r.cancel()}return new Blob(i,{type:`application/octet-stream`})}finally{window.clearTimeout(i),t.removeEventListener(`abort`,r)}}chooseWorkspace(){return this.request(`/api/workspaces/select`,{method:`POST`})}createInteractiveTerminal(e,t,n,r,i){return this.request(`/api/terminal`,{method:`POST`,body:JSON.stringify({sessionId:e,cols:t,rows:n,...i?{createKey:i}:{}}),signal:r})}interactiveTerminal(e,t,n){return this.request(`/api/terminal?${new URLSearchParams({sessionId:e,id:t})}`,{signal:n})}closeInteractiveTerminal(e,t){return this.request(`/api/terminal?${new URLSearchParams({sessionId:e,id:t})}`,{method:`DELETE`})}writeInteractiveTerminal(e,t,n){return this.request(`/api/terminal/input`,{method:`POST`,body:JSON.stringify({sessionId:e,id:t,data:n})})}resizeInteractiveTerminal(e,t,n,r){return this.request(`/api/terminal/resize`,{method:`POST`,body:JSON.stringify({sessionId:e,id:t,cols:n,rows:r})})}async streamInteractiveTerminal(e,t,n,r,i){let a=new URLSearchParams({sessionId:e,id:t});n!==void 0&&a.set(`after`,String(n));let o=await fetch(`/api/terminal/events?${a}`,{headers:await this.headers(),signal:r});if(!o.ok){let e=await o.json().catch(()=>({}));throw new tf(e.error||`Terminal stream failed (${o.status})`,o.status,e.code)}let s=o.body?.getReader();if(!s)throw Error(`Terminal stream is unavailable`);let c=new TextDecoder,l=``;try{for(;!r.aborted;){let{value:e,done:t}=await s.read();if(t)break;for(l+=c.decode(e,{stream:!0});;){let e=l.search(/\r?\n\r?\n/u);if(e<0)break;let t=l.slice(0,e),n=l.startsWith(`\r +`)]:[]).slice(0,20)}function Kd(e,t,n){let r=Vd(e),i=Rd(t?.details),a=Ud(e.name,t),o=a?.state??(n===`running`||n===`cancelled`||n===`timed_out`?n:t?.isError===!0?`failed`:t?.isError===!1?`returned`:`unknown`),s=[`bash`,`bg_start`,`bg_status`].includes(e.name),c=Bd(t?.content??``,s),l=e.name===`read`?/\n\n(\[(?:\d+ more lines in file\. Use offset=\d+ to continue\.|Showing lines [^\n]+)\])$/u.exec(c.text):null,u=c.truncated||!!t?.truncation||Rd(i.truncation).truncated===!0||e.evidenceTruncated===!0||typeof r.pathUnavailable==`string`,d=s&&!t?.forkSnapshotToolResult?Wd(c.text):void 0,f=e.name===`read`?`file`:[`write`,`edit`].includes(e.name)?`change`:d?`test`:`terminal`,p=[`write`,`edit`].includes(e.name)&&o===`returned`&&t?.isError===!1&&typeof i.diff==`string`?Bd(i.diff):void 0,m=typeof r.offset==`number`&&Number.isSafeInteger(r.offset)&&r.offset>0?r.offset:1;return{kind:f,state:o,processState:a?.state??(e.name===`bash`&&t?.isError===!1?`returned`:e.name===`bash`&&n===`running`?`running`:`unknown`),output:l?c.text.slice(0,l.index):c.text,truncated:u||p?.truncated===!0,readRecovery:l?.[1],numberLines:e.name===`read`&&t?.isError===!1&&Rd(i.truncation).firstLineExceedsLimit!==!0&&!!c.text,path:typeof r.path==`string`?r.path:void 0,displayPath:typeof r.displayPath==`string`?r.displayPath:void 0,resolvedPath:typeof r.resolvedPath==`string`?r.resolvedPath:void 0,displayResolvedPath:typeof r.displayResolvedPath==`string`?r.displayResolvedPath:void 0,pathUnavailable:typeof r.pathUnavailable==`string`?r.pathUnavailable:void 0,command:typeof r.command==`string`?Bd(r.command).text:void 0,offset:m,diff:p?.text,tests:d,change:o===`returned`&&t?.isError===!1&&[`created`,`overwritten`,`unchanged`].includes(String(i.change))?String(i.change):void 0,evidenceUnavailable:typeof i.evidenceUnavailable==`string`?Bd(i.evidenceUnavailable).text:void 0,exitCode:a&&`exitCode`in a?a.exitCode:void 0,signal:a&&`signal`in a?a.signal:void 0,recovery:typeof i.fullOutputPath==`string`?Bd(i.fullOutputPath).text:void 0,rawArguments:Bd(e.arguments).text,rawResult:Bd(JSON.stringify({content:t?.content,details:t?.details,isError:t?.isError})).text}}var qd=12e3,Jd=13981016,Yd=2097152,Xd=new TextEncoder;function Zd(e){return Xd.encode(JSON.stringify(e)).byteLength}var Qd=`openpi.web.controller`,$d,ef,tf=0;function nf(e){try{window.sessionStorage.setItem(Qd,e)}catch{}return e}async function rf(){let e=tf;if(!window.navigator.locks)return nf(window.crypto.randomUUID());let t=null;try{t=window.sessionStorage.getItem(Qd)}catch{}let n=Nd(t)?t:window.crypto.randomUUID();for(;;){let t=n,r=await new Promise(n=>{window.navigator.locks.request(`openpi.web.controller:${t}`,{ifAvailable:!0},async t=>{if(e!==tf){n(null);return}if(!t){n(!1);return}await new Promise(e=>{ef=e,n(!0)})}).catch(()=>n(null))});if(e!==tf)throw new DOMException(`Page was suspended`,`AbortError`);if(r===null)return nf(window.crypto.randomUUID());if(r)return nf(t);n=window.crypto.randomUUID()}}function af(){return $d??=rf()}window.addEventListener(`pagehide`,()=>{tf++,ef?.(),ef=void 0,$d=void 0}),window.addEventListener(`pageshow`,e=>{e.persisted&&af().catch(()=>{})});var of=`openpi.web.token`,sf=class extends Error{status;code;constructor(e,t,n){super(e),this.status=t,this.code=n,this.name=`WebApiError`}};function cf(){let e=document.querySelector(`meta[name="openpi-web-token"]`)?.content,t=new URLSearchParams(location.hash.slice(1)).get(`token`),n=e&&/^[a-f0-9]{64}$/i.test(e)?e:t;if(t&&history.replaceState(null,``,`${location.pathname}${location.search}`),n){try{window.sessionStorage.setItem(of,n)}catch{}return n}try{return window.sessionStorage.getItem(of)}catch{return null}}var lf=class{token=cf();async headers(e=!1){return{Authorization:`Bearer ${this.token??``}`,"X-OpenPI-Web-Controller":await af(),...e?{"Content-Type":`application/json`}:{}}}async request(e,t={}){let{timeoutMs:n=15e3,timeoutMessage:r=`Request timed out. Please try again.`,...i}=t,a=new AbortController,o=!1,s=()=>a.abort();t.signal?.aborted&&s(),t.signal?.addEventListener(`abort`,s,{once:!0});let c=window.setTimeout(()=>{o=!0,a.abort()},n);try{let n=await fetch(e,{...i,signal:a.signal,headers:{...await this.headers(!!t.body),...t.headers}}),r=await n.json();if(a.signal.aborted)throw Error(`Request aborted`);if(!n.ok)throw new sf(r.error||`Request failed (${n.status})`,n.status,r.code);return r}catch(e){throw o?Error(r):e}finally{window.clearTimeout(c),t.signal?.removeEventListener(`abort`,s)}}snapshot(e,t,n){let r=new URLSearchParams;e&&r.set(`path`,e),n&&r.set(`sessionId`,n),t&&t.sessionPath===e&&(r.set(`historyAnchor`,t.entryId),r.set(`historySessionId`,t.sessionId));let i=r.size?`?${r}`:``;return this.request(`/api/snapshot${i}`)}searchTranscripts(e,t={}){let n=new URLSearchParams({q:e});return t.includeArchived&&n.set(`includeArchived`,`1`),this.request(`/api/sessions/search?${n}`,{signal:t.signal})}async sessionMessageWindow(e,t){return(await this.request(`/api/session/message-window?${new URLSearchParams({sessionId:e.sessionId,path:e.sessionPath,entryId:e.entryId})}`,{signal:t})).session}async sessionHistory(e,t,n){return(await this.request(`/api/session/history?${new URLSearchParams({sessionId:e.sessionId,path:e.sessionPath,anchorEntryId:e.entryId,beforeEntryId:t})}`,{signal:n,timeoutMessage:`History request timed out. Please retry.`})).session}sessionPromptHistory(e,t,n){return this.request(`/api/session/prompt-history?${new URLSearchParams({sessionId:e.sessionId,path:e.sessionPath,anchorEntryId:e.entryId,...t===null?{}:{beforeEntryId:t}})}`,{signal:n,timeoutMessage:`Prompt history request timed out. Please retry.`})}sessionPromptPreview(e,t,n){return this.request(`/api/session/prompt-preview?${new URLSearchParams({sessionId:e.sessionId,path:e.sessionPath,anchorEntryId:e.entryId,entryId:t})}`,{signal:n,timeoutMessage:`Prompt preview request timed out. Please retry.`})}sessionItem(e,t,n,r,i,a,o){return this.request(`/api/session/item?${new URLSearchParams({sessionId:e,sessionPath:t,entryId:n,cursor:String(r),...a?{purpose:a}:{},...o===void 0?{}:{partIndex:String(o)}})}`,{signal:i,timeoutMessage:`Message request timed out. Please retry.`})}turnChanges(e,t,n,r,i){return this.request(`/api/turn-changes?${new URLSearchParams({sessionId:e,sessionPath:t,promptEntryId:n,...i?{filePath:i}:{}})}`,{signal:r,timeoutMessage:`Turn changes request timed out. Please retry.`})}gitReview(e,t,n,r){return this.request(`/api/git-review?${new URLSearchParams({sessionId:e,path:t,...r})}`,{signal:n,timeoutMessage:`Git review timed out. Please retry.`})}workspaceFiles(e,t,n,r,i,a){return this.request(`/api/artifacts/files?${new URLSearchParams({sessionId:e,sessionPath:t,path:encodeURI(n),query:r,...a?{cursor:a}:{}})}`,{signal:i})}releaseFileListing(e){return this.request(`/api/artifacts/files?${new URLSearchParams({cursor:e})}`,{method:`DELETE`})}mutateWorkspaceFile(e,t,n){return this.request(`/api/files/mutate`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t,access:`write-workspace-file`,kind:n.kind,...n.kind===`restore`?{id:n.id,identity:n.identity}:n.kind===`trash`?{path:encodeURI(n.path),identity:n.identity}:{directory:encodeURI(n.directory),name:n.name,...n.kind===`move`?{path:encodeURI(n.path),identity:n.identity}:{},...n.kind===`import-file`?{data:n.data,...n.createParents?{createParents:!0}:{}}:{}}})})}workspaceTrash(e,t,n,r){return this.request(`/api/artifacts/trash?${new URLSearchParams({sessionId:e,sessionPath:t,...r?{cursor:r}:{}})}`,{signal:n})}resolveArtifact(e,t,n,r){return this.request(`/api/artifacts/resolve`,{method:`POST`,body:JSON.stringify({sessionId:e,reference:t,parent:n,access:`read-file`}),signal:r})}artifactMetadata(e,t,n){return this.request(`/api/artifacts/content?${new URLSearchParams({sessionId:e,handle:t,metadata:`1`})}`,{signal:n})}artifactPreview(e,t,n,r){return this.request(`/api/artifacts/content?${new URLSearchParams({sessionId:e,handle:t,...r?{offset:String(r.offset),revision:r.revision}:{}})}`,{signal:n})}authorizeArtifact(e,t,n){return this.request(`/api/artifacts/authorize-file`,{method:`POST`,body:JSON.stringify({sessionId:e,reference:t,access:`read-external-file`}),signal:n})}releaseArtifact(e,t){return this.request(`/api/artifacts/content?`+new URLSearchParams({sessionId:e,handle:t}),{method:`DELETE`})}saveArtifact(e,t,n){return this.request(`/api/artifacts/save`,{method:`POST`,body:JSON.stringify({sessionId:e.sessionId,handle:e.handle,revision:t,text:n,access:`write-workspace-file`})})}async downloadArtifact(e,t){let n=new AbortController,r=()=>n.abort();t.addEventListener(`abort`,r,{once:!0}),t.aborted&&r();let i=window.setTimeout(r,15e3);try{let t=await fetch(`/api/artifacts/content?${new URLSearchParams({sessionId:e.sessionId,handle:e.handle,revision:e.revision,download:`1`})}`,{headers:await this.headers(),signal:n.signal});if(!t.ok){let e=await t.json();throw new sf(e.error||`Download failed`,t.status,e.code)}let r=t.body?.getReader();if(!r)throw Error(`Download body unavailable`);let i=[],a=0;try{for(;;){let{value:e,done:t}=await r.read();if(t)break;if(a+=e.byteLength,a>20971520)throw Error(`Download exceeds the 20 MiB limit`);i.push(new Uint8Array(e))}}finally{await r.cancel()}return new Blob(i,{type:`application/octet-stream`})}finally{window.clearTimeout(i),t.removeEventListener(`abort`,r)}}chooseWorkspace(){return this.request(`/api/workspaces/select`,{method:`POST`})}createInteractiveTerminal(e,t,n,r,i){return this.request(`/api/terminal`,{method:`POST`,body:JSON.stringify({sessionId:e,cols:t,rows:n,...i?{createKey:i}:{}}),signal:r})}interactiveTerminal(e,t,n){return this.request(`/api/terminal?${new URLSearchParams({sessionId:e,id:t})}`,{signal:n})}closeInteractiveTerminal(e,t){return this.request(`/api/terminal?${new URLSearchParams({sessionId:e,id:t})}`,{method:`DELETE`})}writeInteractiveTerminal(e,t,n){return this.request(`/api/terminal/input`,{method:`POST`,body:JSON.stringify({sessionId:e,id:t,data:n})})}resizeInteractiveTerminal(e,t,n,r){return this.request(`/api/terminal/resize`,{method:`POST`,body:JSON.stringify({sessionId:e,id:t,cols:n,rows:r})})}async streamInteractiveTerminal(e,t,n,r,i){let a=new URLSearchParams({sessionId:e,id:t});n!==void 0&&a.set(`after`,String(n));let o=await fetch(`/api/terminal/events?${a}`,{headers:await this.headers(),signal:r});if(!o.ok){let e=await o.json().catch(()=>({}));throw new sf(e.error||`Terminal stream failed (${o.status})`,o.status,e.code)}let s=o.body?.getReader();if(!s)throw Error(`Terminal stream is unavailable`);let c=new TextDecoder,l=``;try{for(;!r.aborted;){let{value:e,done:t}=await s.read();if(t)break;for(l+=c.decode(e,{stream:!0});;){let e=l.search(/\r?\n\r?\n/u);if(e<0)break;let t=l.slice(0,e),n=l.startsWith(`\r `,e)?4:2;l=l.slice(e+n);let r=t.split(/\r?\n/u).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(` -`);r&&i(JSON.parse(r))}}}finally{await s.cancel().catch(()=>void 0)}}renameWorkspace(e,t){return this.request(`/api/workspaces`,{method:`PATCH`,body:JSON.stringify({path:e,name:t})})}removeWorkspace(e){return this.request(`/api/workspaces?path=${encodeURIComponent(e)}`,{method:`DELETE`})}createSession(e,t){return this.request(`/api/sessions`,{method:`POST`,body:JSON.stringify({workspacePath:e,commandId:t})})}selectSession(e,t){return this.request(`/api/sessions/select`,{method:`POST`,body:JSON.stringify({path:e,...t?{expectedSessionId:t}:{}})})}forkSession(e){return this.request(`/api/session/fork`,{method:`POST`,body:JSON.stringify(e)})}deleteSession(e){return this.request(`/api/sessions/delete`,{method:`POST`,body:JSON.stringify(e)})}workspaceWorktrees(e,t){let n=new URLSearchParams({path:e});return t!==void 0&&n.set(`cursor`,t),this.request(`/api/workspaces/worktrees?${n}`)}releaseSessionWorktree(e){return this.request(`/api/sessions/worktree-release`,{method:`POST`,body:JSON.stringify(e)})}sessionMarkdown(e,t){return this.request(`/api/sessions/markdown?${new URLSearchParams({sessionPath:e,sessionId:t})}`)}sessionOpenTargets(e,t){return this.request(`/api/sessions/open-targets?${new URLSearchParams({sessionPath:e,sessionId:t})}`)}sessionForkOptions(e,t){return this.request(`/api/sessions/fork-options?${new URLSearchParams({sessionPath:e,sessionId:t})}`)}cancelSessionFork(e){return this.request(`/api/session/fork/cancel`,{method:`POST`,body:JSON.stringify(e)})}openSessionIn(e,t,n){return this.request(`/api/sessions/open`,{method:`POST`,body:JSON.stringify({sessionPath:e,sessionId:t,target:n})})}renameSession(e,t){return this.request(`/api/sessions`,{method:`PATCH`,body:JSON.stringify({path:e,name:t})})}setSessionPin(e,t,n,r){return this.request(`/api/sessions/pin`,{method:`POST`,body:JSON.stringify({path:e,id:t,pinned:n,before:r})})}setSidebarPin(e,t,n){return this.request(`/api/sidebar/pin`,{method:`POST`,body:JSON.stringify({target:e,pinned:t,before:n})})}setWorkspaceOrder(e,t){return this.request(`/api/workspaces/order`,{method:`POST`,body:JSON.stringify({path:e,before:t})})}setSessionOrder(e,t,n){return this.request(`/api/sessions/order`,{method:`POST`,body:JSON.stringify({path:e,id:t,before:n})})}setSessionRead(e,t,n,r){return this.request(`/api/sessions/read`,{method:`POST`,body:JSON.stringify({path:e,id:t,read:n,expectedRevision:r})})}archiveSession(e){return this.request(`/api/sessions/archive?path=${encodeURIComponent(e)}`,{method:`POST`})}unarchiveSession(e){return this.request(`/api/sessions/unarchive?path=${encodeURIComponent(e)}`,{method:`POST`})}listArchivedSessions(e={},t){let n=new URLSearchParams;return e.query!==void 0&&n.set(`q`,e.query),e.cursor!==void 0&&n.set(`cursor`,e.cursor),e.limit!==void 0&&n.set(`limit`,String(e.limit)),e.sort!==void 0&&n.set(`sort`,e.sort),e.cwd!==void 0&&n.set(`cwd`,e.cwd),this.request(`/api/sessions/archived?${n}`,{signal:t})}thinking(e,t){return this.request(`/api/thinking?sessionId=${encodeURIComponent(e)}`,{signal:t})}setThinkingLevel(e,t,n){return this.request(`/api/thinking`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:n,level:t})})}setPlanMode(e,t,n,r){return this.request(`/api/plan`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t,enabled:n,expectedRevision:r})})}compactSession(e,t){return this.request(`/api/compact`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t}),timeoutMs:3e5})}updatePromptQueue(e,t,n){return this.request(`/api/prompt-queue`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t,action:n})})}preparePlanImplementation(e,t,n){return this.request(`/api/plan/implement`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t,expectedRevision:n})})}trust(e,t){return this.request(`/api/trust?sessionId=${encodeURIComponent(e)}`,{signal:t})}providerAuth(e,t){return this.request(`/api/providers/auth-status?sessionId=${encodeURIComponent(e)}`,{signal:t})}saveProviderKey(e,t,n,r){return this.request(`/api/providers/api-key`,{method:`POST`,body:JSON.stringify({sessionId:e,provider:t,apiKey:n}),signal:r})}providerLogin(e,t,n){let r=new URLSearchParams({sessionId:e,...t?{id:t}:{}});return this.request(`/api/providers/login?${r}`,{signal:n})}startProviderLogin(e,t){return this.request(`/api/providers/login`,{method:`POST`,body:JSON.stringify({sessionId:e,provider:t})})}respondProviderLogin(e,t,n,r){return this.request(`/api/providers/login/respond`,{method:`POST`,body:JSON.stringify({sessionId:e,id:t,promptId:n,value:r})})}cancelProviderLogin(e,t){return this.request(`/api/providers/login/cancel`,{method:`POST`,body:JSON.stringify({sessionId:e,id:t})})}logoutProvider(e,t){return this.request(`/api/providers/logout`,{method:`POST`,body:JSON.stringify({sessionId:e,provider:t})})}modelConfigurations(e,t){return this.request(`/api/models/configuration?sessionId=${encodeURIComponent(e)}`,{signal:t})}saveModelConfiguration(e,t,n,r){return this.request(`/api/models/configuration`,{method:`POST`,body:JSON.stringify({sessionId:e,revision:t,model:n}),signal:r})}changeProviderConfiguration(e,t,n,r){return this.request(`/api/providers/configuration`,{method:`POST`,body:JSON.stringify({sessionId:e,revision:t,change:n}),signal:r})}commands(e,t){return this.request(`/api/commands?sessionId=${encodeURIComponent(e)}`,{signal:t})}settingsCatalog(e,t){return this.request(`/api/settings/catalog?sessionId=${encodeURIComponent(e)}`,{signal:t})}reloadSettingsResources(e,t){return this.request(`/api/settings/reload`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t})})}savePreferences(e){return this.request(`/api/settings/preferences`,{method:`POST`,body:JSON.stringify(e)})}discoverProviderModels(e,t,n){return this.request(`/api/models/discover`,{method:`POST`,body:JSON.stringify({sessionId:e,connection:t}),signal:n})}saveModelConfigurations(e,t,n,r){return this.request(`/api/models/configurations`,{method:`POST`,body:JSON.stringify({sessionId:e,revision:t,models:n}),signal:r})}terminalDetail(e,t,n){return this.request(`/api/capabilities/detail?kind=background-terminals&id=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(e)}`,{signal:n})}subagentDetail(e,t,n){return this.request(`/api/capabilities/detail?kind=subagents&id=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(e)}`,{signal:n})}workflowAgentDetail(e,t,n){return this.request(`/api/capabilities/detail?kind=workflows&id=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(e)}`,{signal:n})}subagentAction(e,t,n){return this.request(`/api/capabilities/action`,{method:`POST`,body:JSON.stringify({sessionId:e,...t}),signal:n})}modelDefaults(e,t){return this.request(`/api/models/default?sessionId=${encodeURIComponent(e)}`,{signal:t})}saveModelDefault(e,t,n,r){return this.request(`/api/models/default`,{method:`POST`,body:JSON.stringify({provider:e,modelId:t,sessionId:n,sessionPath:r})})}selectModel(e,t,n,r){return this.request(`/api/model`,{method:`POST`,body:JSON.stringify({provider:e,modelId:t,sessionId:n,sessionPath:r})})}searchModels(e,t,n,r){let i=new URLSearchParams({query:e,limit:`50`});return t&&i.set(`sessionId`,t),r&&i.set(`provider`,r),this.request(`/api/models?${i}`,{signal:n})}cancelActiveTurn(e){return this.request(`/api/turns/cancel`,{method:`POST`,body:JSON.stringify({sessionId:e.sessionId,commandId:e.commandId,epoch:e.epoch})})}pendingQuestions(e,t){return this.request(`/api/questions/pending?sessionId=${encodeURIComponent(e)}`,{signal:t})}async answerQuestions(e,t,n){try{return await this.request(`/api/questions/answer`,{method:`POST`,body:JSON.stringify({sessionId:e.sessionId,requestId:e.requestId,action:t===null?`dismiss`:`answer`,...t===null?{}:{answers:t}}),signal:n})}catch(e){if(e instanceof tf&&e.code===`STALE_QUESTION`)return{state:`stale`};throw e}}async sessionSources(e,t,n,r=0,i){let a=new URLSearchParams({sessionId:e,path:t,offset:String(r),...i?{revision:i}:{}});return this.request(`/api/session-sources?${a}`,{signal:n})}async sourceImage(e,t,n,r,i){let a=new URLSearchParams({sessionId:e,path:t,entryId:n,part:String(r)});return this.request(`/api/session-sources/image?${a}`,{signal:i})}uploadPromptFiles(e,t,n,r){return this.request(`/api/prompt-files`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t,files:n}),signal:r,timeoutMs:6e4,timeoutMessage:`File upload timed out. Keep the attachments and retry; an identical upload safely recovers its original paths.`})}async prompt(e,t,n,r,i=!1,a=[],o,s){let c=await this.request(`/api/prompt`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:r,content:t,commandId:n,retry:i,images:a,...o===void 0?{}:{planRevision:o},...s,controllerId:await $d()}),timeoutMs:3e4,timeoutMessage:`Request timed out; admission may still be pending. Retry the same message to recover its receipt.`});if(typeof c.id!=`string`||!c.id||c.accepted!==!0)throw Error(`Invalid prompt receipt; retry the same message to recover its admission.`);return c}};function af(e,t){return t.every((t,n)=>e[n]===t)}function of(e){if(af(e,[137,80,78,71,13,10,26,10]))return`image/png`;if(af(e,[255,216,255]))return`image/jpeg`;let t=new TextDecoder(`ascii`).decode(e.subarray(0,12));return t.startsWith(`GIF87a`)||t.startsWith(`GIF89a`)?`image/gif`:t.startsWith(`RIFF`)&&t.slice(8,12)===`WEBP`?`image/webp`:null}function sf(e){let t=``,n=32768;for(let r=0;r10485760)throw Error(`image-size`);let t=await e.arrayBuffer().catch(()=>{throw Error(`image-read`)}),n=new Uint8Array(t),r=of(n);if(!r)throw Error(`image-type`);let i=sf(n);return{id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${e.name}`,name:e.name||`image`,size:n.length,mimeType:r,data:i,previewUrl:`data:${r};base64,${i}`}}function lf(e,t){this.v=e,this.k=t}function uf(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`?null:Jf(BigInt.prototype.toString),Uf=typeof Symbol>`u`?null:Jf(Symbol.prototype.toString),Wf=Jf(Object.prototype.hasOwnProperty),Gf=Jf(Object.prototype.toString),Kf=Jf(RegExp.prototype.test),qf=Yf(TypeError);function Jf(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Ef(e,t,n)}}function Yf(e){return function(){return Df(e,[...arguments])}}function Xf(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Pf;if(vf&&vf(e,null),!Nf(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(yf(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Zf(e){for(let t=0;t/g),hp=Cf(/\${[\w\W]*/g),gp=Cf(/^data-[\-\w.\u00B7-\uFFFF]+$/),_p=Cf(/^aria-[\-\w]+$/),vp=Cf(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yp=Cf(/^(?:\w+script|data):/i),bp=Cf(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xp=Cf(/^html$/i),Sp=Cf(/^[a-z][.\w]*(-[.\w]+)+$/i),Cp=Cf(/<[/\w!]/g),wp=Cf(/<[/\w]/g),Tp=Cf(/<\/no(script|embed|frames)/i),Ep=Cf(/\/>/i),Dp={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Op=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],kp=Sf(Xf({},Op)),Ap=function(){let e={};return Of(Op,t=>{e[t]=Cf(RegExp(`])`,`i`))}),Sf(e)}(),jp=function(){return typeof window>`u`?null:window},Mp=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Np=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Pp=function(e,t,n,r){return Wf(e,t)&&Nf(e[t])?Xf(r.base?Qf(r.base):{},e[t],r.transform):n},Fp=function(e,t,n){let r=Wf(e,t)?e[t]:void 0;return r&&typeof r==`object`?Qf(r):n()};function Ip(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jp(),t=e=>Ip(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==Dp.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=ep(d,`cloneNode`),p=ep(d,`remove`),m=ep(d,`removeAttributeNode`),h=ep(d,`nextSibling`),g=ep(d,`childNodes`),_=ep(d,`parentNode`),v=ep(d,`shadowRoot`),y=ep(d,`attributes`),b=o&&o.prototype?ep(o.prototype,`nodeType`):null,x=o&&o.prototype?ep(o.prototype,`nodeName`):null,S=o&&o.prototype?ep(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let T,E=``,D,O=!1,k=0,A=function(){if(k>0)throw qf(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},j=function(e){A(),k++;try{return T.createHTML(e)}finally{k--}},M=function(e){A(),k++;try{return T.createScriptURL(e)}finally{k--}},N=function(){return O||=(D=Mp(u,i),!0),D},P=n,F=P.implementation,I=P.createNodeIterator,L=P.createDocumentFragment,R=P.getElementsByTagName,ee=r.importNode,z=Np();t.isSupported=typeof _f==`function`&&typeof _==`function`&&F&&F.createHTMLDocument!==void 0;let B=pp,V=mp,H=hp,te=gp,ne=_p,re=yp,ie=bp,ae=Sp,U=vp,oe=null,se=Xf({},[...np,...rp,...ip,...op,...cp]),ce=null,le=Xf({},[...lp,...up,...dp,...fp]),ue=Object.seal(wf(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),de=null,fe=null,pe=Object.seal(wf(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),me=!0,W=!0,he=!1,ge=!0,_e=!1,ve=!0,ye=!1,be=!1,xe=null,Se=null,Ce=!1,we=!1,Te=!1,G=!1,Ee=!0,De=!1,Oe=`user-content-`,ke=!0,Ae=!1,je={},Me=null,Ne=Xf({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Pe=null,Fe=Xf({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ie=null,Le=Xf({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Re=`http://www.w3.org/1998/Math/MathML`,ze=`http://www.w3.org/2000/svg`,Be=`http://www.w3.org/1999/xhtml`,Ve=Be,He=!1,Ue=null,We=Xf({},[Re,ze,Be],Ff),Ge=Sf([`mi`,`mo`,`mn`,`ms`,`mtext`]),Ke=Xf({},Ge),qe=Sf([`annotation-xml`]),Je=Xf({},qe),Ye=Xf({},[`title`,`style`,`font`,`a`,`script`]),Xe=null,Ze=[`application/xhtml+xml`,`text/html`],Qe=null,$e=null,et=n.createElement(`form`),tt=function(e){return e instanceof RegExp||e instanceof Function},nt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if($e&&$e===e)return;(!e||typeof e!=`object`)&&(e={}),e=Qf(e),Xe=Ze.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Qe=Xe===`application/xhtml+xml`?Ff:Pf,oe=Pp(e,`ALLOWED_TAGS`,se,{transform:Qe}),ce=Pp(e,`ALLOWED_ATTR`,le,{transform:Qe}),Ue=Pp(e,`ALLOWED_NAMESPACES`,We,{transform:Ff}),Ie=Pp(e,`ADD_URI_SAFE_ATTR`,Le,{transform:Qe,base:Le}),Pe=Pp(e,`ADD_DATA_URI_TAGS`,Fe,{transform:Qe,base:Fe}),Me=Pp(e,`FORBID_CONTENTS`,Ne,{transform:Qe}),de=Pp(e,`FORBID_TAGS`,Qf({}),{transform:Qe}),fe=Pp(e,`FORBID_ATTR`,Qf({}),{transform:Qe}),je=Wf(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Qf(e.USE_PROFILES):e.USE_PROFILES:!1,me=e.ALLOW_ARIA_ATTR!==!1,W=e.ALLOW_DATA_ATTR!==!1,he=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ge=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,_e=e.SAFE_FOR_TEMPLATES||!1,ve=e.SAFE_FOR_XML!==!1,ye=e.WHOLE_DOCUMENT||!1,we=e.RETURN_DOM||!1,Te=e.RETURN_DOM_FRAGMENT||!1,G=e.RETURN_TRUSTED_TYPE||!1,Ce=e.FORCE_BODY||!1,Ee=e.SANITIZE_DOM!==!1,De=e.SANITIZE_NAMED_PROPS||!1,ke=e.KEEP_CONTENT!==!1,Ae=e.IN_PLACE||!1,U=tp(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:vp,Ve=typeof e.NAMESPACE==`string`?e.NAMESPACE:Be,Ke=Fp(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Xf({},Ge)),Je=Fp(e,`HTML_INTEGRATION_POINTS`,()=>Xf({},qe));let t=Fp(e,`CUSTOM_ELEMENT_HANDLING`,()=>wf(null));if(ue=wf(null),Wf(t,`tagNameCheck`)&&tt(t.tagNameCheck)&&(ue.tagNameCheck=t.tagNameCheck),Wf(t,`attributeNameCheck`)&&tt(t.attributeNameCheck)&&(ue.attributeNameCheck=t.attributeNameCheck),Wf(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(ue.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Cf(ue),_e&&(W=!1),Te&&(we=!0),je&&(oe=Xf({},cp),ce=wf(null),je.html===!0&&(Xf(oe,np),Xf(ce,lp)),je.svg===!0&&(Xf(oe,rp),Xf(ce,up),Xf(ce,fp)),je.svgFilters===!0&&(Xf(oe,ip),Xf(ce,up),Xf(ce,fp)),je.mathMl===!0&&(Xf(oe,op),Xf(ce,dp),Xf(ce,fp))),pe.tagCheck=null,pe.attributeCheck=null,Wf(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?pe.tagCheck=e.ADD_TAGS:Nf(e.ADD_TAGS)&&(oe===se&&(oe=Qf(oe)),Xf(oe,e.ADD_TAGS,Qe))),Wf(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?pe.attributeCheck=e.ADD_ATTR:Nf(e.ADD_ATTR)&&(ce===le&&(ce=Qf(ce)),Xf(ce,e.ADD_ATTR,Qe))),Wf(e,`ADD_FORBID_CONTENTS`)&&Nf(e.ADD_FORBID_CONTENTS)&&(Me===Ne&&(Me=Qf(Me)),Xf(Me,e.ADD_FORBID_CONTENTS,Qe)),ke&&(oe[`#text`]=!0),ye&&Xf(oe,[`html`,`head`,`body`]),oe.table&&(Xf(oe,[`tbody`]),delete de.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw qf(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw qf(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=T;T=e.TRUSTED_TYPES_POLICY;try{E=j(``)}catch(e){throw T=t,e}}else e.TRUSTED_TYPES_POLICY===null?(T=void 0,E=``):(T===void 0&&(T=N()),T&&typeof E==`string`&&(E=j(``)));Sf&&Sf(e),$e=e},rt=Xf({},[...rp,...ip,...ap]),it=Xf({},[...op,...sp]),at=function(e,t,n){return t.namespaceURI===Be?e===`svg`:t.namespaceURI===Re?e===`svg`&&(n===`annotation-xml`||Ke[n]):!!rt[e]},ot=function(e,t,n){return t.namespaceURI===Be?e===`math`:t.namespaceURI===ze?e===`math`&&Je[n]:!!it[e]},st=function(e,t,n){return t.namespaceURI===ze&&!Je[n]||t.namespaceURI===Re&&!Ke[n]?!1:!it[e]&&(Ye[e]||!rt[e])},ct=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:Ve,tagName:`template`});let n=Pf(e.tagName),r=Pf(t.tagName);return Ue[e.namespaceURI]?e.namespaceURI===ze?at(n,t,r):e.namespaceURI===Re?ot(n,t,r):e.namespaceURI===Be?st(n,t,r):!!(Xe===`application/xhtml+xml`&&Ue[e.namespaceURI]):!1},lt=function(e){jf(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw qf(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},ut=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},dt=function(e){mt(e);let t=g(e);if(t){let e=[];Of(t,t=>{jf(e,t)}),Of(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&ut(e,r,i)}},ft=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}jf(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`)if(we||Te)try{lt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},pt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||ce[Qe(i)]||ut(e,r,i)}},mt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===Dp.element&&pt(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},ht=function(e,t){return ve?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},gt=function(e){if(!ve)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===Dp.processingInstruction||n===Dp.comment&&Kf(wp,e.data)){try{p(e)}catch{}continue}if(n===Dp.element){let t=e,n=Qe(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&ht(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},_t=function(e){let t=null,r=null;if(Ce)e=``+e;else{let t=If(e,/^[\r\n\t ]+/);r=t&&t[0]}Xe===`application/xhtml+xml`&&Ve===Be&&(e=``+e+``);let i=T?j(e):e;if(Ve===Be)try{t=new l().parseFromString(i,Xe)}catch{}if(!t||!t.documentElement){t=F.createDocument(Ve,`template`,null);try{t.documentElement.innerHTML=He?E:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ve===Be?R.call(t,ye?`html`:`body`)[0]:ye?t.documentElement:a},vt=function(e){let t=S?S(e):e.ownerDocument;return I.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},yt=function(e){return e=Lf(e,B,` `),e=Lf(e,V,` `),e=Lf(e,H,` `),e},bt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=I.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=yt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&Of(i,e=>{St(e.content)&&bt(e.content)})},xt=function(e){let t=x?x(e):null;return typeof t!=`string`||Qe(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},St=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===Dp.documentFragment}catch{return!1}},Ct=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function wt(e,n,r){e.length!==0&&Of(e,e=>{e.call(t,n,r,$e)})}let Tt=function(e,t){return!!(ve&&e.hasChildNodes()&&!Ct(e.firstElementChild)&&Kf(Cp,e.textContent)&&Kf(Cp,e.innerHTML)||ve&&e.namespaceURI===Be&&kp[t]&&(Ct(e.firstElementChild)||typeof e.textContent==`string`&&Kf(Ap[t],e.textContent))||e.nodeType===Dp.processingInstruction||ve&&e.nodeType===Dp.comment&&Kf(wp,e.data))},Et=function(e,t){return e instanceof RegExp?Kf(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Dt=function(e,t,n){if(!de[t]&&Nt(t)&&Et(ue.tagNameCheck,t))return!1;if(ke&&!Me[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return lt(e),!0},Ot=function(e,t,n,r){return e.length===0?t:t===n||t===r?Qf(t):t},kt=function(e,t){return e===t||_(e)!==null?!1:(Ae&&mt(e),!0)},At=function(e,n){if(wt(z.beforeSanitizeElements,e,null),kt(e,n))return!0;if(xt(e))return lt(e),!0;let r=Qe(w(e));if(oe=Ot(z.uponSanitizeElement,oe,se,xe),wt(z.uponSanitizeElement,e,{tagName:r,allowedTags:oe}),kt(e,n))return!0;if(Tt(e,r))return lt(e),!0;if(de[r]||!(pe.tagCheck instanceof Function&&pe.tagCheck(r))&&!oe[r]){let t=Dt(e,r,n);return t===!1&&(wt(z.afterSanitizeElements,e,null),kt(e,n))?!0:t}if(C(e)===Dp.element&&!ct(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Kf(Tp,e.innerHTML))return lt(e),!0;if(_e&&e.nodeType===Dp.text){let n=yt(e.textContent);e.textContent!==n&&(jf(t.removed,{element:e.cloneNode()}),e.textContent=n)}return wt(z.afterSanitizeElements,e,null),kt(e,n)},jt=function(e,t,r){if(fe[t]||ht(t,e)||Ee&&(t===`id`||t===`name`)&&(r in n||r in et))return!1;let i=ce[t]||pe.attributeCheck instanceof Function&&pe.attributeCheck(t,e);return W&&Kf(te,t)||me&&Kf(ne,t)?!0:i?Ie[t]||Kf(U,Lf(r,ie,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Rf(r,`data:`)===0&&Pe[e]||he&&!Kf(re,Lf(r,ie,``))?!0:!r:Nt(e)&&Et(ue.tagNameCheck,e)&&Et(ue.attributeNameCheck,t,e)||t===`is`&&ue.allowCustomizedBuiltInElements&&Et(ue.tagNameCheck,r)},Mt=Xf({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Nt=function(e){return!Mt[Pf(e)]&&Kf(ae,e)},Pt=function(e,t,n,r){if(T&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return j(r);case`TrustedScriptURL`:return M(r)}return r},Ft=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!xt(e)||(lt(e),!1)}catch{return ft(t,e),!1}},It=function(e,n){if(wt(z.beforeSanitizeAttributes,e,null),kt(e,n))return;let r=e.attributes;if(!r||xt(e))return;ce=Ot(z.uponSanitizeAttribute,ce,le,Se);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:ce,forceKeepAttr:void 0},a=r.length,o=Qe(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=Qe(s),d=l,f=s===`value`?d:zf(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,wt(z.uponSanitizeAttribute,e,i),f=i.attrValue,De&&(u===`id`||u===`name`)&&Rf(f,Oe)!==0&&(ft(s,e,n),f=Oe+f,p=!0),ve&&Kf(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){ft(s,e,n);continue}if(u===`attributename`&&If(f,`href`)){ft(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){ft(s,e,n);continue}if(!ge&&Kf(Ep,f)){ft(s,e,n);continue}if(_e&&(f=yt(f)),!jt(o,u,f)){ft(s,e,n);continue}f=Pt(o,u,c,f),f!==d&&Ft(e,s,c,f)&&p&&Af(t.removed)}}wt(z.afterSanitizeAttributes,e,null),kt(e,n)},Lt=function(e){let t=null,n=vt(e);for(wt(z.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(wt(z.uponSanitizeShadowNode,t,null),At(t,e),It(t,e),St(t.content)&&Lt(t.content),C(t)===Dp.element){let e=v(t);St(e)&&(Rt(e),Lt(e))}wt(z.afterSanitizeShadowDOM,e,null)},Rt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Lt(e.shadow);continue}let n=e.node,r=C(n)===Dp.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&Qe(e)===`template`){let e=n.content;St(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);St(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(He=!e,He&&(e=``),typeof e!=`string`&&!Ct(e)&&(e=$f(e),typeof e!=`string`))throw qf(`dirty is not a string, aborting`);if(!t.isSupported)return e;be?(oe=xe,ce=Se):nt(n),(z.uponSanitizeElement.length>0||z.uponSanitizeAttribute.length>0)&&(oe=Qf(oe)),z.uponSanitizeAttribute.length>0&&(ce=Qf(ce)),t.removed=[];let c=Ae&&typeof e!=`string`&&Ct(e);if(c){gt(e);let t=w(e);if(typeof t==`string`){let n=Qe(t);if(!oe[n]||de[n])throw dt(e),qf(`root node is forbidden and cannot be sanitized in-place`)}if(xt(e))throw dt(e),qf(`root node is clobbered and cannot be sanitized in-place`);try{Rt(e)}catch(t){throw dt(e),t}}else if(Ct(e))i=_t(``),a=i.ownerDocument.importNode(e,!0),a.nodeType===Dp.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Rt(i);else{if(!we&&!_e&&!ye&&e.indexOf(`<`)===-1)return T&&G?j(e):e;if(i=_t(e),!i)return we?null:G?E:``}i&&Ce&<(i.firstChild);let l=c?e:i;try{let e=vt(l);for(;o=e.nextNode();)At(o,l),It(o,l),St(o.content)&&Lt(o.content)}catch(n){throw c&&(dt(e),Of(t.removed,e=>{e.element&&mt(e.element)})),n}if(c){let n=!1;if(Of(t.removed,t=>{t.element&&(t.element===e&&(n=!0),mt(t.element))}),n)throw qf(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return _e&&bt(e),e}if(we){if(_e&&bt(i),Te)for(s=L.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(ce.shadowroot||ce.shadowrootmode)&&(s=ee.call(r,s,!0)),s}let u=ye?i.outerHTML:i.innerHTML;return ye&&oe[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Kf(xp,i.ownerDocument.doctype.name)&&(u=` -`+u),_e&&(u=yt(u)),T&&G?j(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};nt(e),be=!0,xe=oe,Se=ce},t.clearConfig=function(){$e=null,be=!1,xe=null,Se=null,T=D,E=``},t.isValidAttribute=function(e,t,n){$e||nt({});let r=Qe(e),i=Qe(t);return jt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Wf(z,e)&&jf(z[e],t)},t.removeHook=function(e,t){if(Wf(z,e)){if(t!==void 0){let n=kf(z[e],t);return n===-1?void 0:Mf(z[e],n,1)[0]}return Af(z[e])}},t.removeHooks=function(e){Wf(z,e)&&(z[e]=[])},t.removeAllHooks=function(){z=Np()},t}var Lp=Ip();function Rp(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function zp(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Bp=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Vp=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Hp={};function Up(e,t){return((t||Hp).jsx?Vp:Bp).test(e)}var Wp=/[ \t\n\f\r]/g;function Gp(e){return typeof e==`object`?e.type===`text`&&Kp(e.value):Kp(e)}function Kp(e){return e.replace(Wp,``)===``}var qp=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};qp.prototype.normal={},qp.prototype.property={},qp.prototype.space=void 0;function Jp(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new qp(n,r,t)}function Yp(e){return e.toLowerCase()}var Xp=class{constructor(e,t){this.attribute=t,this.property=e}};Xp.prototype.attribute=``,Xp.prototype.booleanish=!1,Xp.prototype.boolean=!1,Xp.prototype.commaOrSpaceSeparated=!1,Xp.prototype.commaSeparated=!1,Xp.prototype.defined=!1,Xp.prototype.mustUseProperty=!1,Xp.prototype.number=!1,Xp.prototype.overloadedBoolean=!1,Xp.prototype.property=``,Xp.prototype.spaceSeparated=!1,Xp.prototype.space=void 0;var Zp=t({boolean:()=>$p,booleanish:()=>em,commaOrSpaceSeparated:()=>am,commaSeparated:()=>im,number:()=>nm,overloadedBoolean:()=>tm,spaceSeparated:()=>rm}),Qp=0,$p=om(),em=om(),tm=om(),nm=om(),rm=om(),im=om(),am=om();function om(){return 2**++Qp}var sm=Object.keys(Zp),cm=class extends Xp{constructor(e,t,n,r){let i=-1;if(super(e,t),lm(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&Sm.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(xm,Tm);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!xm.test(e)){let n=e.replace(bm,wm);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=cm}return new i(r,t)}function wm(e){return`-`+e.toLowerCase()}function Tm(e){return e.charAt(1).toUpperCase()}var Em=Jp([dm,mm,gm,_m,vm],`html`),Dm=Jp([dm,hm,gm,_m,vm],`svg`);function Om(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function km(e){return e.join(` `).trim()}var Am=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` -`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),jm=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Am());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Mm=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Nm=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(jm()),r=Mm();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Pm=Im(`end`),Fm=Im(`start`);function Im(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Lm(e){let t=Fm(e),n=Pm(e);if(t&&n)return{start:t,end:n}}function Rm(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Bm(e.position):`start`in e||`end`in e?Bm(e):`line`in e||`column`in e?zm(e):``}function zm(e){return Vm(e&&e.line)+`:`+Vm(e&&e.column)}function Bm(e){return zm(e&&e.start)+`-`+zm(e&&e.end)}function Vm(e){return e&&typeof e==`number`?e:1}var Hm=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Rm(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Hm.prototype.file=``,Hm.prototype.name=``,Hm.prototype.reason=``,Hm.prototype.message=``,Hm.prototype.stack=``,Hm.prototype.column=void 0,Hm.prototype.line=void 0,Hm.prototype.ancestors=void 0,Hm.prototype.cause=void 0,Hm.prototype.fatal=void 0,Hm.prototype.place=void 0,Hm.prototype.ruleId=void 0,Hm.prototype.source=void 0;var Um=e(Nm(),1),Wm={}.hasOwnProperty,Gm=new Map,Km=/[A-Z]/g,qm=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Jm=new Set([`td`,`th`]);function Ym(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=oh(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=ah(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Dm:Em,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Xm(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Xm(e,t,n){if(t.type===`element`)return Zm(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Qm(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return eh(e,t,n);if(t.type===`mdxjsEsm`)return $m(e,t);if(t.type===`root`)return th(e,t,n);if(t.type===`text`)return nh(e,t)}function Zm(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Dm,e.schema=i),e.ancestors.push(t);let a=fh(e,t.tagName,!1),o=sh(e,t),s=lh(e,t);return qm.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Gp(e)})),rh(e,o,a,t),ih(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Qm(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}ph(e,t.position)}function $m(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ph(e,t.position)}function eh(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Dm,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:fh(e,t.name,!0),o=ch(e,t),s=lh(e,t);return rh(e,o,a,t),ih(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function th(e,t,n){let r={};return ih(r,lh(e,t)),e.create(t,e.Fragment,r,n)}function nh(e,t){return t.value}function rh(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ih(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function ah(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function oh(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Fm(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function sh(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Wm.call(t.properties,i)){let a=uh(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Jm.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function ch(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else ph(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else ph(e,t.position);else a=r.value===null||r.value;n[i]=a}return n}function lh(e,t){let n=[],r=-1,i=e.passKeys?new Map:Gm;for(;++ri?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(Th(e,e.length,0,t),e):t}var Dh={}.hasOwnProperty;function Oh(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Mh(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Nh=Gh(/[A-Za-z]/),Ph=Gh(/[\dA-Za-z]/),Fh=Gh(/[#-'*+\--9=?A-Z^-~]/);function Ih(e){return e!==null&&(e<32||e===127)}var Lh=Gh(/\d/),Rh=Gh(/[\dA-Fa-f]/),zh=Gh(/[!-/:-@[-`{-~]/);function Bh(e){return e!==null&&e<-2}function Vh(e){return e!==null&&(e<0||e===32)}function Hh(e){return e===-2||e===-1||e===32}var Uh=Gh(/\p{P}|\p{S}/u),Wh=Gh(/\s/);function Gh(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Kh(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function qh(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Hh(r)?(e.enter(n),s(r)):t(r)}function s(r){return Hh(r)&&a++o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;er;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function $h(e,t,n){return qh(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function eg(e){if(e===null||Vh(e)||Wh(e))return 1;if(Uh(e))return 2}function tg(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};ag(d,-c),ag(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Eh(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Eh(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Eh(l,tg(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Eh(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Eh(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Th(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n0&&Hh(t)?qh(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Bh(t)?e.check(vg,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Bh(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Hh(t)?qh(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Hh(t)?qh(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Bh(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function xg(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Sg={name:`codeIndented`,tokenize:wg},Cg={partial:!0,tokenize:Tg};function wg(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),qh(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Bh(t)?e.attempt(Cg,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Bh(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Tg(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Bh(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):qh(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Bh(e)?i(e):n(e)}}var Eg={name:`codeText`,previous:Og,resolve:Dg,tokenize:kg};function Dg(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&jg(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),jg(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),jg(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function zg(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Ih(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Bh(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Vh(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Bh(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Bh(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Hh(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Vg(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Bh(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),qh(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Bh(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Hg(e,t){let n;return r;function r(i){return Bh(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Hh(i)?qh(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Ug={name:`definition`,tokenize:Gg},Wg={partial:!0,tokenize:Kg};function Gg(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Bg.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Mh(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Vh(t)?Hg(e,l)(t):l(t)}function l(t){return zg(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Wg,d,d)(t)}function d(t){return Hh(t)?qh(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Bh(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Kg(e,t,n){return r;function r(t){return Vh(t)?Hg(e,i)(t):n(t)}function i(t){return Vg(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Hh(t)?qh(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Bh(e)?t(e):n(e)}}var qg={name:`hardBreakEscape`,tokenize:Jg};function Jg(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Bh(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Yg={name:`headingAtx`,resolve:Xg,tokenize:Zg};function Xg(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Th(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Zg(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Vh(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Bh(n)?(e.exit(`atxHeading`),t(n)):Hh(n)?qh(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Vh(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Qg=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),$g=[`pre`,`script`,`style`,`textarea`],e_={concrete:!0,name:`htmlFlow`,resolveTo:r_,tokenize:i_},t_={partial:!0,tokenize:o_},n_={partial:!0,tokenize:a_};function r_(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function i_(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):Nh(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Nh(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return Nh(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Vh(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&$g.includes(l)?(i=1,r.interrupt?t(s):O(s)):Qg.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||Ph(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Hh(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Nh(t)?(e.consume(t),b):Hh(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Ph(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Hh(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Hh(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Bh(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Vh(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Hh(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Bh(t)?O(t):Hh(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):Bh(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(t_,R,k)(t)):t===null||Bh(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(n_,A,R)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Bh(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return $g.includes(n)?(e.consume(t),L):O(t)}return Nh(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||Bh(t)?(e.exit(`htmlFlowData`),R(t)):(e.consume(t),L)}function R(n){return e.exit(`htmlFlow`),t(n)}}function a_(e,t,n){let r=this;return i;function i(t){return Bh(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function o_(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(cg,t,n)}}var s_={name:`htmlText`,tokenize:c_};function c_(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Nh(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Nh(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Bh(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Bh(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):Bh(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Bh(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return Nh(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Ph(t)?(e.consume(t),S):C(t)}function C(t){return Bh(t)?(o=C,N(t)):Hh(t)?(e.consume(t),C):M(t)}function w(t){return t===45||Ph(t)?(e.consume(t),w):t===47||t===62||Vh(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||Nh(t)?(e.consume(t),E):Bh(t)?(o=T,N(t)):Hh(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||Ph(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Bh(t)?(o=D,N(t)):Hh(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Bh(t)?(o=O,N(t)):Hh(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):Bh(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Vh(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Vh(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return Hh(t)?qh(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var l_={name:`labelEnd`,resolveAll:p_,resolveTo:m_,tokenize:h_},u_={tokenize:g_},d_={tokenize:__},f_={tokenize:v_};function p_(e){let t=-1,n=[];for(;++t=3&&(a===null||Bh(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Hh(t)?qh(e,s,`whitespace`)(t):s(t))}}var D_={continuation:{tokenize:j_},exit:N_,name:`list`,tokenize:A_},O_={partial:!0,tokenize:P_},k_={partial:!0,tokenize:M_};function A_(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Lh(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(T_,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Lh(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(cg,r.interrupt?n:u,e.attempt(O_,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Hh(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function j_(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(cg,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,qh(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Hh(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(k_,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,qh(e,e.attempt(D_,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function M_(e,t,n){let r=this;return qh(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function N_(e){e.exit(this.containerState.type)}function P_(e,t,n){let r=this;return qh(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Hh(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var F_={name:`setextUnderline`,resolveTo:I_,tokenize:L_};function I_(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function L_(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Hh(t)?qh(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Bh(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var R_={tokenize:z_};function z_(e){let t=this,n=e.attempt(cg,r,e.attempt(this.parser.constructs.flowInitial,i,qh(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Pg,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var B_={resolveAll:W_()},V_=U_(`string`),H_=U_(`text`);function U_(e){return{resolveAll:W_(e===`text`?G_:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++iev,contentInitial:()=>J_,disable:()=>tv,document:()=>q_,flow:()=>X_,flowInitial:()=>Y_,insideSpan:()=>$_,string:()=>Z_,text:()=>Q_}),q_={42:D_,43:D_,45:D_,48:D_,49:D_,50:D_,51:D_,52:D_,53:D_,54:D_,55:D_,56:D_,57:D_,62:ug},J_={91:Ug},Y_={[-2]:Sg,[-1]:Sg,32:Sg},X_={35:Yg,42:T_,45:[F_,T_],60:e_,61:F_,95:T_,96:yg,126:yg},Z_={38:gg,92:mg},Q_={[-5]:C_,[-4]:C_,[-3]:C_,33:y_,38:gg,42:ng,60:[og,s_],91:x_,92:[qg,mg],93:l_,95:ng,96:Eg},$_={null:[ng,B_]},ev={null:[42,95]},tv={null:[]};function nv(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Eh(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=tg(a,l.events,l),l.events):[]}function f(e,t){return iv(p(e),t)}function p(e){return rv(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function iv(e,t){let n=-1,r=[],i;for(;++nvoid 0)}}renameWorkspace(e,t){return this.request(`/api/workspaces`,{method:`PATCH`,body:JSON.stringify({path:e,name:t})})}removeWorkspace(e){return this.request(`/api/workspaces?path=${encodeURIComponent(e)}`,{method:`DELETE`})}createSession(e,t){return this.request(`/api/sessions`,{method:`POST`,body:JSON.stringify({workspacePath:e,commandId:t})})}selectSession(e,t){return this.request(`/api/sessions/select`,{method:`POST`,body:JSON.stringify({path:e,...t?{expectedSessionId:t}:{}})})}forkSession(e){return this.request(`/api/session/fork`,{method:`POST`,body:JSON.stringify(e)})}deleteSession(e){return this.request(`/api/sessions/delete`,{method:`POST`,body:JSON.stringify(e)})}workspaceWorktrees(e,t){let n=new URLSearchParams({path:e});return t!==void 0&&n.set(`cursor`,t),this.request(`/api/workspaces/worktrees?${n}`)}releaseSessionWorktree(e){return this.request(`/api/sessions/worktree-release`,{method:`POST`,body:JSON.stringify(e)})}sessionMarkdown(e,t){return this.request(`/api/sessions/markdown?${new URLSearchParams({sessionPath:e,sessionId:t})}`)}sessionOpenTargets(e,t){return this.request(`/api/sessions/open-targets?${new URLSearchParams({sessionPath:e,sessionId:t})}`)}sessionForkOptions(e,t){return this.request(`/api/sessions/fork-options?${new URLSearchParams({sessionPath:e,sessionId:t})}`)}cancelSessionFork(e){return this.request(`/api/session/fork/cancel`,{method:`POST`,body:JSON.stringify(e)})}openSessionIn(e,t,n){return this.request(`/api/sessions/open`,{method:`POST`,body:JSON.stringify({sessionPath:e,sessionId:t,target:n})})}renameSession(e,t){return this.request(`/api/sessions`,{method:`PATCH`,body:JSON.stringify({path:e,name:t})})}setSessionPin(e,t,n,r){return this.request(`/api/sessions/pin`,{method:`POST`,body:JSON.stringify({path:e,id:t,pinned:n,before:r})})}setSidebarPin(e,t,n){return this.request(`/api/sidebar/pin`,{method:`POST`,body:JSON.stringify({target:e,pinned:t,before:n})})}setWorkspaceOrder(e,t){return this.request(`/api/workspaces/order`,{method:`POST`,body:JSON.stringify({path:e,before:t})})}setSessionOrder(e,t,n){return this.request(`/api/sessions/order`,{method:`POST`,body:JSON.stringify({path:e,id:t,before:n})})}setSessionRead(e,t,n,r){return this.request(`/api/sessions/read`,{method:`POST`,body:JSON.stringify({path:e,id:t,read:n,expectedRevision:r})})}archiveSession(e){return this.request(`/api/sessions/archive?path=${encodeURIComponent(e)}`,{method:`POST`})}unarchiveSession(e){return this.request(`/api/sessions/unarchive?path=${encodeURIComponent(e)}`,{method:`POST`})}listArchivedSessions(e={},t){let n=new URLSearchParams;return e.query!==void 0&&n.set(`q`,e.query),e.cursor!==void 0&&n.set(`cursor`,e.cursor),e.limit!==void 0&&n.set(`limit`,String(e.limit)),e.sort!==void 0&&n.set(`sort`,e.sort),e.cwd!==void 0&&n.set(`cwd`,e.cwd),this.request(`/api/sessions/archived?${n}`,{signal:t})}thinking(e,t){return this.request(`/api/thinking?sessionId=${encodeURIComponent(e)}`,{signal:t})}setThinkingLevel(e,t,n){return this.request(`/api/thinking`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:n,level:t})})}setPlanMode(e,t,n,r){return this.request(`/api/plan`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t,enabled:n,expectedRevision:r})})}compactSession(e,t){return this.request(`/api/compact`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t}),timeoutMs:3e5})}updatePromptQueue(e,t,n){return this.request(`/api/prompt-queue`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t,action:n})})}preparePlanImplementation(e,t,n){return this.request(`/api/plan/implement`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t,expectedRevision:n})})}trust(e,t){return this.request(`/api/trust?sessionId=${encodeURIComponent(e)}`,{signal:t})}providerAuth(e,t){return this.request(`/api/providers/auth-status?sessionId=${encodeURIComponent(e)}`,{signal:t})}saveProviderKey(e,t,n,r){return this.request(`/api/providers/api-key`,{method:`POST`,body:JSON.stringify({sessionId:e,provider:t,apiKey:n}),signal:r})}providerLogin(e,t,n){let r=new URLSearchParams({sessionId:e,...t?{id:t}:{}});return this.request(`/api/providers/login?${r}`,{signal:n})}startProviderLogin(e,t){return this.request(`/api/providers/login`,{method:`POST`,body:JSON.stringify({sessionId:e,provider:t})})}respondProviderLogin(e,t,n,r){return this.request(`/api/providers/login/respond`,{method:`POST`,body:JSON.stringify({sessionId:e,id:t,promptId:n,value:r})})}cancelProviderLogin(e,t){return this.request(`/api/providers/login/cancel`,{method:`POST`,body:JSON.stringify({sessionId:e,id:t})})}logoutProvider(e,t){return this.request(`/api/providers/logout`,{method:`POST`,body:JSON.stringify({sessionId:e,provider:t})})}modelConfigurations(e,t){return this.request(`/api/models/configuration?sessionId=${encodeURIComponent(e)}`,{signal:t})}saveModelConfiguration(e,t,n,r){return this.request(`/api/models/configuration`,{method:`POST`,body:JSON.stringify({sessionId:e,revision:t,model:n}),signal:r})}changeProviderConfiguration(e,t,n,r){return this.request(`/api/providers/configuration`,{method:`POST`,body:JSON.stringify({sessionId:e,revision:t,change:n}),signal:r})}commands(e,t){return this.request(`/api/commands?sessionId=${encodeURIComponent(e)}`,{signal:t})}settingsCatalog(e,t){return this.request(`/api/settings/catalog?sessionId=${encodeURIComponent(e)}`,{signal:t})}reloadSettingsResources(e,t){return this.request(`/api/settings/reload`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t})})}savePreferences(e){return this.request(`/api/settings/preferences`,{method:`POST`,body:JSON.stringify(e)})}discoverProviderModels(e,t,n){return this.request(`/api/models/discover`,{method:`POST`,body:JSON.stringify({sessionId:e,connection:t}),signal:n})}saveModelConfigurations(e,t,n,r){return this.request(`/api/models/configurations`,{method:`POST`,body:JSON.stringify({sessionId:e,revision:t,models:n}),signal:r})}terminalDetail(e,t,n){return this.request(`/api/capabilities/detail?kind=background-terminals&id=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(e)}`,{signal:n})}subagentDetail(e,t,n){return this.request(`/api/capabilities/detail?kind=subagents&id=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(e)}`,{signal:n})}workflowAgentDetail(e,t,n){return this.request(`/api/capabilities/detail?kind=workflows&id=${encodeURIComponent(t)}&sessionId=${encodeURIComponent(e)}`,{signal:n})}subagentAction(e,t,n){return this.request(`/api/capabilities/action`,{method:`POST`,body:JSON.stringify({sessionId:e,...t}),signal:n})}modelDefaults(e,t){return this.request(`/api/models/default?sessionId=${encodeURIComponent(e)}`,{signal:t})}saveModelDefault(e,t,n,r){return this.request(`/api/models/default`,{method:`POST`,body:JSON.stringify({provider:e,modelId:t,sessionId:n,sessionPath:r})})}selectModel(e,t,n,r){return this.request(`/api/model`,{method:`POST`,body:JSON.stringify({provider:e,modelId:t,sessionId:n,sessionPath:r})})}searchModels(e,t,n,r){let i=new URLSearchParams({query:e,limit:`50`});return t&&i.set(`sessionId`,t),r&&i.set(`provider`,r),this.request(`/api/models?${i}`,{signal:n})}cancelActiveTurn(e){return this.request(`/api/turns/cancel`,{method:`POST`,body:JSON.stringify({sessionId:e.sessionId,commandId:e.commandId,epoch:e.epoch})})}pendingQuestions(e,t){return this.request(`/api/questions/pending?sessionId=${encodeURIComponent(e)}`,{signal:t})}async answerQuestions(e,t,n){try{return await this.request(`/api/questions/answer`,{method:`POST`,body:JSON.stringify({sessionId:e.sessionId,requestId:e.requestId,action:t===null?`dismiss`:`answer`,...t===null?{}:{answers:t}}),signal:n})}catch(e){if(e instanceof sf&&e.code===`STALE_QUESTION`)return{state:`stale`};throw e}}async sessionSources(e,t,n,r=0,i){let a=new URLSearchParams({sessionId:e,path:t,offset:String(r),...i?{revision:i}:{}});return this.request(`/api/session-sources?${a}`,{signal:n})}async sourceImage(e,t,n,r,i){let a=new URLSearchParams({sessionId:e,path:t,entryId:n,part:String(r)});return this.request(`/api/session-sources/image?${a}`,{signal:i})}uploadPromptFiles(e,t,n,r){return this.request(`/api/prompt-files`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:t,files:n}),signal:r,timeoutMs:6e4,timeoutMessage:`File upload timed out. Keep the attachments and retry; an identical upload safely recovers its original paths.`})}async prompt(e,t,n,r,i=!1,a=[],o,s){let c=await this.request(`/api/prompt`,{method:`POST`,body:JSON.stringify({sessionId:e,sessionPath:r,content:t,commandId:n,retry:i,images:a,...o===void 0?{}:{planRevision:o},...s,controllerId:await af()}),timeoutMs:3e4,timeoutMessage:`Request timed out; admission may still be pending. Retry the same message to recover its receipt.`});if(typeof c.id!=`string`||!c.id||c.accepted!==!0)throw Error(`Invalid prompt receipt; retry the same message to recover its admission.`);return c}};function uf(e,t){return t.every((t,n)=>e[n]===t)}function df(e){if(uf(e,[137,80,78,71,13,10,26,10]))return`image/png`;if(uf(e,[255,216,255]))return`image/jpeg`;let t=new TextDecoder(`ascii`).decode(e.subarray(0,12));return t.startsWith(`GIF87a`)||t.startsWith(`GIF89a`)?`image/gif`:t.startsWith(`RIFF`)&&t.slice(8,12)===`WEBP`?`image/webp`:null}function ff(e){let t=``,n=32768;for(let r=0;r10485760)throw Error(`image-size`);let t=await e.arrayBuffer().catch(()=>{throw Error(`image-read`)}),n=new Uint8Array(t),r=df(n);if(!r)throw Error(`image-type`);let i=ff(n);return{id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${e.name}`,name:e.name||`image`,size:n.length,mimeType:r,data:i,previewUrl:`data:${r};base64,${i}`}}function mf(e,t){this.v=e,this.k=t}function hf(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`?null:$f(BigInt.prototype.toString),Jf=typeof Symbol>`u`?null:$f(Symbol.prototype.toString),Yf=$f(Object.prototype.hasOwnProperty),Xf=$f(Object.prototype.toString),Zf=$f(RegExp.prototype.test),Qf=ep(TypeError);function $f(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return jf(e,t,n)}}function ep(e){return function(){return Mf(e,[...arguments])}}function tp(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:zf;if(Cf&&Cf(e,null),!Rf(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(wf(t)||(t[r]=e),i=e)}e[i]=!0}return e}function np(e){for(let t=0;t/g),bp=Of(/\${[\w\W]*/g),xp=Of(/^data-[\-\w.\u00B7-\uFFFF]+$/),Sp=Of(/^aria-[\-\w]+$/),Cp=Of(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),wp=Of(/^(?:\w+script|data):/i),Tp=Of(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ep=Of(/^html$/i),Dp=Of(/^[a-z][.\w]*(-[.\w]+)+$/i),Op=Of(/<[/\w!]/g),kp=Of(/<[/\w]/g),Ap=Of(/<\/no(script|embed|frames)/i),jp=Of(/\/>/i),Mp={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Np=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],Pp=Df(tp({},Np)),Fp=function(){let e={};return Nf(Np,t=>{e[t]=Of(RegExp(`])`,`i`))}),Df(e)}(),Ip=function(){return typeof window>`u`?null:window},Lp=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Rp=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},zp=function(e,t,n,r){return Yf(e,t)&&Rf(e[t])?tp(r.base?rp(r.base):{},e[t],r.transform):n},Bp=function(e,t,n){let r=Yf(e,t)?e[t]:void 0;return r&&typeof r==`object`?rp(r):n()};function Vp(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ip(),t=e=>Vp(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==Mp.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=ap(d,`cloneNode`),p=ap(d,`remove`),m=ap(d,`removeAttributeNode`),h=ap(d,`nextSibling`),g=ap(d,`childNodes`),_=ap(d,`parentNode`),v=ap(d,`shadowRoot`),y=ap(d,`attributes`),b=o&&o.prototype?ap(o.prototype,`nodeType`):null,x=o&&o.prototype?ap(o.prototype,`nodeName`):null,S=o&&o.prototype?ap(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let T,E=``,D,O=!1,k=0,A=function(){if(k>0)throw Qf(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},j=function(e){A(),k++;try{return T.createHTML(e)}finally{k--}},M=function(e){A(),k++;try{return T.createScriptURL(e)}finally{k--}},N=function(){return O||=(D=Lp(u,i),!0),D},P=n,F=P.implementation,I=P.createNodeIterator,L=P.createDocumentFragment,R=P.getElementsByTagName,ee=r.importNode,z=Rp();t.isSupported=typeof Sf==`function`&&typeof _==`function`&&F&&F.createHTMLDocument!==void 0;let B=vp,V=yp,H=bp,te=xp,ne=Sp,re=wp,ie=Tp,ae=Dp,U=Cp,oe=null,se=tp({},[...sp,...cp,...lp,...dp,...pp]),ce=null,le=tp({},[...mp,...hp,...gp,..._p]),ue=Object.seal(kf(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),de=null,fe=null,pe=Object.seal(kf(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),me=!0,W=!0,he=!1,ge=!0,_e=!1,ve=!0,ye=!1,be=!1,xe=null,Se=null,Ce=!1,we=!1,Te=!1,G=!1,Ee=!0,De=!1,Oe=`user-content-`,ke=!0,Ae=!1,je={},Me=null,Ne=tp({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Pe=null,Fe=tp({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ie=null,Le=tp({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Re=`http://www.w3.org/1998/Math/MathML`,ze=`http://www.w3.org/2000/svg`,Be=`http://www.w3.org/1999/xhtml`,Ve=Be,He=!1,Ue=null,We=tp({},[Re,ze,Be],Bf),Ge=Df([`mi`,`mo`,`mn`,`ms`,`mtext`]),Ke=tp({},Ge),qe=Df([`annotation-xml`]),Je=tp({},qe),Ye=tp({},[`title`,`style`,`font`,`a`,`script`]),Xe=null,Ze=[`application/xhtml+xml`,`text/html`],Qe=null,$e=null,et=n.createElement(`form`),tt=function(e){return e instanceof RegExp||e instanceof Function},nt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if($e&&$e===e)return;(!e||typeof e!=`object`)&&(e={}),e=rp(e),Xe=Ze.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Qe=Xe===`application/xhtml+xml`?Bf:zf,oe=zp(e,`ALLOWED_TAGS`,se,{transform:Qe}),ce=zp(e,`ALLOWED_ATTR`,le,{transform:Qe}),Ue=zp(e,`ALLOWED_NAMESPACES`,We,{transform:Bf}),Ie=zp(e,`ADD_URI_SAFE_ATTR`,Le,{transform:Qe,base:Le}),Pe=zp(e,`ADD_DATA_URI_TAGS`,Fe,{transform:Qe,base:Fe}),Me=zp(e,`FORBID_CONTENTS`,Ne,{transform:Qe}),de=zp(e,`FORBID_TAGS`,rp({}),{transform:Qe}),fe=zp(e,`FORBID_ATTR`,rp({}),{transform:Qe}),je=Yf(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?rp(e.USE_PROFILES):e.USE_PROFILES:!1,me=e.ALLOW_ARIA_ATTR!==!1,W=e.ALLOW_DATA_ATTR!==!1,he=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ge=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,_e=e.SAFE_FOR_TEMPLATES||!1,ve=e.SAFE_FOR_XML!==!1,ye=e.WHOLE_DOCUMENT||!1,we=e.RETURN_DOM||!1,Te=e.RETURN_DOM_FRAGMENT||!1,G=e.RETURN_TRUSTED_TYPE||!1,Ce=e.FORCE_BODY||!1,Ee=e.SANITIZE_DOM!==!1,De=e.SANITIZE_NAMED_PROPS||!1,ke=e.KEEP_CONTENT!==!1,Ae=e.IN_PLACE||!1,U=op(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Cp,Ve=typeof e.NAMESPACE==`string`?e.NAMESPACE:Be,Ke=Bp(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>tp({},Ge)),Je=Bp(e,`HTML_INTEGRATION_POINTS`,()=>tp({},qe));let t=Bp(e,`CUSTOM_ELEMENT_HANDLING`,()=>kf(null));if(ue=kf(null),Yf(t,`tagNameCheck`)&&tt(t.tagNameCheck)&&(ue.tagNameCheck=t.tagNameCheck),Yf(t,`attributeNameCheck`)&&tt(t.attributeNameCheck)&&(ue.attributeNameCheck=t.attributeNameCheck),Yf(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(ue.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Of(ue),_e&&(W=!1),Te&&(we=!0),je&&(oe=tp({},pp),ce=kf(null),je.html===!0&&(tp(oe,sp),tp(ce,mp)),je.svg===!0&&(tp(oe,cp),tp(ce,hp),tp(ce,_p)),je.svgFilters===!0&&(tp(oe,lp),tp(ce,hp),tp(ce,_p)),je.mathMl===!0&&(tp(oe,dp),tp(ce,gp),tp(ce,_p))),pe.tagCheck=null,pe.attributeCheck=null,Yf(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?pe.tagCheck=e.ADD_TAGS:Rf(e.ADD_TAGS)&&(oe===se&&(oe=rp(oe)),tp(oe,e.ADD_TAGS,Qe))),Yf(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?pe.attributeCheck=e.ADD_ATTR:Rf(e.ADD_ATTR)&&(ce===le&&(ce=rp(ce)),tp(ce,e.ADD_ATTR,Qe))),Yf(e,`ADD_FORBID_CONTENTS`)&&Rf(e.ADD_FORBID_CONTENTS)&&(Me===Ne&&(Me=rp(Me)),tp(Me,e.ADD_FORBID_CONTENTS,Qe)),ke&&(oe[`#text`]=!0),ye&&tp(oe,[`html`,`head`,`body`]),oe.table&&(tp(oe,[`tbody`]),delete de.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Qf(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Qf(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=T;T=e.TRUSTED_TYPES_POLICY;try{E=j(``)}catch(e){throw T=t,e}}else e.TRUSTED_TYPES_POLICY===null?(T=void 0,E=``):(T===void 0&&(T=N()),T&&typeof E==`string`&&(E=j(``)));Df&&Df(e),$e=e},rt=tp({},[...cp,...lp,...up]),it=tp({},[...dp,...fp]),at=function(e,t,n){return t.namespaceURI===Be?e===`svg`:t.namespaceURI===Re?e===`svg`&&(n===`annotation-xml`||Ke[n]):!!rt[e]},ot=function(e,t,n){return t.namespaceURI===Be?e===`math`:t.namespaceURI===ze?e===`math`&&Je[n]:!!it[e]},st=function(e,t,n){return t.namespaceURI===ze&&!Je[n]||t.namespaceURI===Re&&!Ke[n]?!1:!it[e]&&(Ye[e]||!rt[e])},ct=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:Ve,tagName:`template`});let n=zf(e.tagName),r=zf(t.tagName);return Ue[e.namespaceURI]?e.namespaceURI===ze?at(n,t,r):e.namespaceURI===Re?ot(n,t,r):e.namespaceURI===Be?st(n,t,r):!!(Xe===`application/xhtml+xml`&&Ue[e.namespaceURI]):!1},lt=function(e){If(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw Qf(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},ut=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},dt=function(e){mt(e);let t=g(e);if(t){let e=[];Nf(t,t=>{If(e,t)}),Nf(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&ut(e,r,i)}},ft=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}If(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`)if(we||Te)try{lt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},pt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||ce[Qe(i)]||ut(e,r,i)}},mt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===Mp.element&&pt(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},ht=function(e,t){return ve?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},gt=function(e){if(!ve)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===Mp.processingInstruction||n===Mp.comment&&Zf(kp,e.data)){try{p(e)}catch{}continue}if(n===Mp.element){let t=e,n=Qe(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&ht(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},_t=function(e){let t=null,r=null;if(Ce)e=``+e;else{let t=Vf(e,/^[\r\n\t ]+/);r=t&&t[0]}Xe===`application/xhtml+xml`&&Ve===Be&&(e=``+e+``);let i=T?j(e):e;if(Ve===Be)try{t=new l().parseFromString(i,Xe)}catch{}if(!t||!t.documentElement){t=F.createDocument(Ve,`template`,null);try{t.documentElement.innerHTML=He?E:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ve===Be?R.call(t,ye?`html`:`body`)[0]:ye?t.documentElement:a},vt=function(e){let t=S?S(e):e.ownerDocument;return I.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},yt=function(e){return e=Hf(e,B,` `),e=Hf(e,V,` `),e=Hf(e,H,` `),e},bt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=I.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=yt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&Nf(i,e=>{St(e.content)&&bt(e.content)})},xt=function(e){let t=x?x(e):null;return typeof t!=`string`||Qe(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},St=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===Mp.documentFragment}catch{return!1}},Ct=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function wt(e,n,r){e.length!==0&&Nf(e,e=>{e.call(t,n,r,$e)})}let Tt=function(e,t){return!!(ve&&e.hasChildNodes()&&!Ct(e.firstElementChild)&&Zf(Op,e.textContent)&&Zf(Op,e.innerHTML)||ve&&e.namespaceURI===Be&&Pp[t]&&(Ct(e.firstElementChild)||typeof e.textContent==`string`&&Zf(Fp[t],e.textContent))||e.nodeType===Mp.processingInstruction||ve&&e.nodeType===Mp.comment&&Zf(kp,e.data))},Et=function(e,t){return e instanceof RegExp?Zf(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Dt=function(e,t,n){if(!de[t]&&Nt(t)&&Et(ue.tagNameCheck,t))return!1;if(ke&&!Me[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return lt(e),!0},Ot=function(e,t,n,r){return e.length===0?t:t===n||t===r?rp(t):t},kt=function(e,t){return e===t||_(e)!==null?!1:(Ae&&mt(e),!0)},At=function(e,n){if(wt(z.beforeSanitizeElements,e,null),kt(e,n))return!0;if(xt(e))return lt(e),!0;let r=Qe(w(e));if(oe=Ot(z.uponSanitizeElement,oe,se,xe),wt(z.uponSanitizeElement,e,{tagName:r,allowedTags:oe}),kt(e,n))return!0;if(Tt(e,r))return lt(e),!0;if(de[r]||!(pe.tagCheck instanceof Function&&pe.tagCheck(r))&&!oe[r]){let t=Dt(e,r,n);return t===!1&&(wt(z.afterSanitizeElements,e,null),kt(e,n))?!0:t}if(C(e)===Mp.element&&!ct(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Zf(Ap,e.innerHTML))return lt(e),!0;if(_e&&e.nodeType===Mp.text){let n=yt(e.textContent);e.textContent!==n&&(If(t.removed,{element:e.cloneNode()}),e.textContent=n)}return wt(z.afterSanitizeElements,e,null),kt(e,n)},jt=function(e,t,r){if(fe[t]||ht(t,e)||Ee&&(t===`id`||t===`name`)&&(r in n||r in et))return!1;let i=ce[t]||pe.attributeCheck instanceof Function&&pe.attributeCheck(t,e);return W&&Zf(te,t)||me&&Zf(ne,t)?!0:i?Ie[t]||Zf(U,Hf(r,ie,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Uf(r,`data:`)===0&&Pe[e]||he&&!Zf(re,Hf(r,ie,``))?!0:!r:Nt(e)&&Et(ue.tagNameCheck,e)&&Et(ue.attributeNameCheck,t,e)||t===`is`&&ue.allowCustomizedBuiltInElements&&Et(ue.tagNameCheck,r)},Mt=tp({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Nt=function(e){return!Mt[zf(e)]&&Zf(ae,e)},Pt=function(e,t,n,r){if(T&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return j(r);case`TrustedScriptURL`:return M(r)}return r},Ft=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!xt(e)||(lt(e),!1)}catch{return ft(t,e),!1}},It=function(e,n){if(wt(z.beforeSanitizeAttributes,e,null),kt(e,n))return;let r=e.attributes;if(!r||xt(e))return;ce=Ot(z.uponSanitizeAttribute,ce,le,Se);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:ce,forceKeepAttr:void 0},a=r.length,o=Qe(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=Qe(s),d=l,f=s===`value`?d:Wf(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,wt(z.uponSanitizeAttribute,e,i),f=i.attrValue,De&&(u===`id`||u===`name`)&&Uf(f,Oe)!==0&&(ft(s,e,n),f=Oe+f,p=!0),ve&&Zf(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){ft(s,e,n);continue}if(u===`attributename`&&Vf(f,`href`)){ft(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){ft(s,e,n);continue}if(!ge&&Zf(jp,f)){ft(s,e,n);continue}if(_e&&(f=yt(f)),!jt(o,u,f)){ft(s,e,n);continue}f=Pt(o,u,c,f),f!==d&&Ft(e,s,c,f)&&p&&Ff(t.removed)}}wt(z.afterSanitizeAttributes,e,null),kt(e,n)},Lt=function(e){let t=null,n=vt(e);for(wt(z.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(wt(z.uponSanitizeShadowNode,t,null),At(t,e),It(t,e),St(t.content)&&Lt(t.content),C(t)===Mp.element){let e=v(t);St(e)&&(Rt(e),Lt(e))}wt(z.afterSanitizeShadowDOM,e,null)},Rt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Lt(e.shadow);continue}let n=e.node,r=C(n)===Mp.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&Qe(e)===`template`){let e=n.content;St(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);St(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(He=!e,He&&(e=``),typeof e!=`string`&&!Ct(e)&&(e=ip(e),typeof e!=`string`))throw Qf(`dirty is not a string, aborting`);if(!t.isSupported)return e;be?(oe=xe,ce=Se):nt(n),(z.uponSanitizeElement.length>0||z.uponSanitizeAttribute.length>0)&&(oe=rp(oe)),z.uponSanitizeAttribute.length>0&&(ce=rp(ce)),t.removed=[];let c=Ae&&typeof e!=`string`&&Ct(e);if(c){gt(e);let t=w(e);if(typeof t==`string`){let n=Qe(t);if(!oe[n]||de[n])throw dt(e),Qf(`root node is forbidden and cannot be sanitized in-place`)}if(xt(e))throw dt(e),Qf(`root node is clobbered and cannot be sanitized in-place`);try{Rt(e)}catch(t){throw dt(e),t}}else if(Ct(e))i=_t(``),a=i.ownerDocument.importNode(e,!0),a.nodeType===Mp.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Rt(i);else{if(!we&&!_e&&!ye&&e.indexOf(`<`)===-1)return T&&G?j(e):e;if(i=_t(e),!i)return we?null:G?E:``}i&&Ce&<(i.firstChild);let l=c?e:i;try{let e=vt(l);for(;o=e.nextNode();)At(o,l),It(o,l),St(o.content)&&Lt(o.content)}catch(n){throw c&&(dt(e),Nf(t.removed,e=>{e.element&&mt(e.element)})),n}if(c){let n=!1;if(Nf(t.removed,t=>{t.element&&(t.element===e&&(n=!0),mt(t.element))}),n)throw Qf(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return _e&&bt(e),e}if(we){if(_e&&bt(i),Te)for(s=L.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(ce.shadowroot||ce.shadowrootmode)&&(s=ee.call(r,s,!0)),s}let u=ye?i.outerHTML:i.innerHTML;return ye&&oe[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Zf(Ep,i.ownerDocument.doctype.name)&&(u=` +`+u),_e&&(u=yt(u)),T&&G?j(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};nt(e),be=!0,xe=oe,Se=ce},t.clearConfig=function(){$e=null,be=!1,xe=null,Se=null,T=D,E=``},t.isValidAttribute=function(e,t,n){$e||nt({});let r=Qe(e),i=Qe(t);return jt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Yf(z,e)&&If(z[e],t)},t.removeHook=function(e,t){if(Yf(z,e)){if(t!==void 0){let n=Pf(z[e],t);return n===-1?void 0:Lf(z[e],n,1)[0]}return Ff(z[e])}},t.removeHooks=function(e){Yf(z,e)&&(z[e]=[])},t.removeAllHooks=function(){z=Rp()},t}var Hp=Vp();function Up(e){let t=[],n=String(e||``),r=n.indexOf(`,`),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let e=n.slice(i,r).trim();(e||!a)&&t.push(e),i=r+1,r=n.indexOf(`,`,i)}return t}function Wp(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Gp=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Kp=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qp={};function Jp(e,t){return((t||qp).jsx?Kp:Gp).test(e)}var Yp=/[ \t\n\f\r]/g;function Xp(e){return typeof e==`object`?e.type===`text`&&Zp(e.value):Zp(e)}function Zp(e){return e.replace(Yp,``)===``}var Qp=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Qp.prototype.normal={},Qp.prototype.property={},Qp.prototype.space=void 0;function $p(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Qp(n,r,t)}function em(e){return e.toLowerCase()}var tm=class{constructor(e,t){this.attribute=t,this.property=e}};tm.prototype.attribute=``,tm.prototype.booleanish=!1,tm.prototype.boolean=!1,tm.prototype.commaOrSpaceSeparated=!1,tm.prototype.commaSeparated=!1,tm.prototype.defined=!1,tm.prototype.mustUseProperty=!1,tm.prototype.number=!1,tm.prototype.overloadedBoolean=!1,tm.prototype.property=``,tm.prototype.spaceSeparated=!1,tm.prototype.space=void 0;var nm=t({boolean:()=>im,booleanish:()=>am,commaOrSpaceSeparated:()=>um,commaSeparated:()=>lm,number:()=>sm,overloadedBoolean:()=>om,spaceSeparated:()=>cm}),rm=0,im=dm(),am=dm(),om=dm(),sm=dm(),cm=dm(),lm=dm(),um=dm();function dm(){return 2**++rm}var fm=Object.keys(nm),pm=class extends tm{constructor(e,t,n,r){let i=-1;if(super(e,t),mm(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&Dm.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Em,Am);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Em.test(e)){let n=e.replace(Tm,km);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=pm}return new i(r,t)}function km(e){return`-`+e.toLowerCase()}function Am(e){return e.charAt(1).toUpperCase()}var jm=$p([gm,ym,xm,Sm,Cm],`html`),Mm=$p([gm,bm,xm,Sm,Cm],`svg`);function Nm(e){let t=String(e||``).trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function Pm(e){return e.join(` `).trim()}var Fm=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` +`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),Im=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(Fm());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),Lm=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Rm=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Im()),r=Lm();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),zm=Vm(`end`),Bm=Vm(`start`);function Vm(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Hm(e){let t=Bm(e),n=zm(e);if(t&&n)return{start:t,end:n}}function Um(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Gm(e.position):`start`in e||`end`in e?Gm(e):`line`in e||`column`in e?Wm(e):``}function Wm(e){return Km(e&&e.line)+`:`+Km(e&&e.column)}function Gm(e){return Wm(e&&e.start)+`-`+Wm(e&&e.end)}function Km(e){return e&&typeof e==`number`?e:1}var qm=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Um(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};qm.prototype.file=``,qm.prototype.name=``,qm.prototype.reason=``,qm.prototype.message=``,qm.prototype.stack=``,qm.prototype.column=void 0,qm.prototype.line=void 0,qm.prototype.ancestors=void 0,qm.prototype.cause=void 0,qm.prototype.fatal=void 0,qm.prototype.place=void 0,qm.prototype.ruleId=void 0,qm.prototype.source=void 0;var Jm=e(Rm(),1),Ym={}.hasOwnProperty,Xm=new Map,Zm=/[A-Z]/g,Qm=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),$m=new Set([`td`,`th`]);function eh(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=dh(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=uh(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Mm:jm,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=th(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function th(e,t,n){if(t.type===`element`)return nh(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return rh(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return ah(e,t,n);if(t.type===`mdxjsEsm`)return ih(e,t);if(t.type===`root`)return oh(e,t,n);if(t.type===`text`)return sh(e,t)}function nh(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Mm,e.schema=i),e.ancestors.push(t);let a=_h(e,t.tagName,!1),o=fh(e,t),s=mh(e,t);return Qm.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Xp(e)})),ch(e,o,a,t),lh(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function rh(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}vh(e,t.position)}function ih(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vh(e,t.position)}function ah(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Mm,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:_h(e,t.name,!0),o=ph(e,t),s=mh(e,t);return ch(e,o,a,t),lh(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function oh(e,t,n){let r={};return lh(r,mh(e,t)),e.create(t,e.Fragment,r,n)}function sh(e,t){return t.value}function ch(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function lh(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function uh(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function dh(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Bm(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function fh(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Ym.call(t.properties,i)){let a=hh(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&$m.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function ph(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else vh(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else vh(e,t.position);else a=r.value===null||r.value;n[i]=a}return n}function mh(e,t){let n=[],r=-1,i=e.passKeys?new Map:Xm;for(;++ri?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(Ah(e,e.length,0,t),e):t}var Mh={}.hasOwnProperty;function Nh(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function Lh(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Rh=Xh(/[A-Za-z]/),zh=Xh(/[\dA-Za-z]/),Bh=Xh(/[#-'*+\--9=?A-Z^-~]/);function Vh(e){return e!==null&&(e<32||e===127)}var Hh=Xh(/\d/),Uh=Xh(/[\dA-Fa-f]/),Wh=Xh(/[!-/:-@[-`{-~]/);function Gh(e){return e!==null&&e<-2}function Kh(e){return e!==null&&(e<0||e===32)}function qh(e){return e===-2||e===-1||e===32}var Jh=Xh(/\p{P}|\p{S}/u),Yh=Xh(/\s/);function Xh(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Zh(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function Qh(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return qh(r)?(e.enter(n),s(r)):t(r)}function s(r){return qh(r)&&a++o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;er;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function ig(e,t,n){return Qh(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function ag(e){if(e===null||Kh(e)||Yh(e))return 1;if(Jh(e))return 2}function og(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};ug(d,-c),ug(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=jh(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=jh(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=jh(l,og(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=jh(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=jh(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Ah(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n0&&qh(t)?Qh(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Gh(t)?e.check(Cg,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Gh(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),qh(t)?Qh(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),qh(t)?Qh(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Gh(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Eg(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Dg={name:`codeIndented`,tokenize:kg},Og={partial:!0,tokenize:Ag};function kg(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Qh(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):Gh(t)?e.attempt(Og,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Gh(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Ag(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Gh(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Qh(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):Gh(e)?i(e):n(e)}}var jg={name:`codeText`,previous:Ng,resolve:Mg,tokenize:Pg};function Mg(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&Ig(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),Ig(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Ig(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Wg(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Vh(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||Gh(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||Kh(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):Gh(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||Gh(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!qh(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Kg(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):Gh(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Qh(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Gh(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function qg(e,t){let n;return r;function r(i){return Gh(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):qh(i)?Qh(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Jg={name:`definition`,tokenize:Xg},Yg={partial:!0,tokenize:Zg};function Xg(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Gg.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Lh(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return Kh(t)?qg(e,l)(t):l(t)}function l(t){return Wg(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Yg,d,d)(t)}function d(t){return qh(t)?Qh(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Gh(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Zg(e,t,n){return r;function r(t){return Kh(t)?qg(e,i)(t):n(t)}function i(t){return Kg(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return qh(t)?Qh(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Gh(e)?t(e):n(e)}}var Qg={name:`hardBreakEscape`,tokenize:$g};function $g(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Gh(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var e_={name:`headingAtx`,resolve:t_,tokenize:n_};function t_(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Ah(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function n_(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||Kh(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Gh(n)?(e.exit(`atxHeading`),t(n)):qh(n)?Qh(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||Kh(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var r_=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),i_=[`pre`,`script`,`style`,`textarea`],a_={concrete:!0,name:`htmlFlow`,resolveTo:c_,tokenize:l_},o_={partial:!0,tokenize:d_},s_={partial:!0,tokenize:u_};function c_(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function l_(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:I):Rh(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):Rh(a)?(e.consume(a),i=4,r.interrupt?t:I):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:I):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return Rh(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Kh(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&i_.includes(l)?(i=1,r.interrupt?t(s):O(s)):r_.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||zh(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return qh(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Rh(t)?(e.consume(t),b):qh(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||zh(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):qh(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):qh(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Gh(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||Kh(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||qh(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Gh(t)?O(t):qh(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),L):t===63&&i===3?(e.consume(t),I):t===93&&i===5?(e.consume(t),F):Gh(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(o_,R,k)(t)):t===null||Gh(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(s_,A,R)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||Gh(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),I):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return i_.includes(n)?(e.consume(t),L):O(t)}return Rh(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function F(t){return t===93?(e.consume(t),I):O(t)}function I(t){return t===62?(e.consume(t),L):t===45&&i===2?(e.consume(t),I):O(t)}function L(t){return t===null||Gh(t)?(e.exit(`htmlFlowData`),R(t)):(e.consume(t),L)}function R(n){return e.exit(`htmlFlow`),t(n)}}function u_(e,t,n){let r=this;return i;function i(t){return Gh(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function d_(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(pg,t,n)}}var f_={name:`htmlText`,tokenize:p_};function p_(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):Rh(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):Rh(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):Gh(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):Gh(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):Gh(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Gh(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return Rh(t)?(e.consume(t),S):n(t)}function S(t){return t===45||zh(t)?(e.consume(t),S):C(t)}function C(t){return Gh(t)?(o=C,N(t)):qh(t)?(e.consume(t),C):M(t)}function w(t){return t===45||zh(t)?(e.consume(t),w):t===47||t===62||Kh(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||Rh(t)?(e.consume(t),E):Gh(t)?(o=T,N(t)):qh(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||zh(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Gh(t)?(o=D,N(t)):qh(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):Gh(t)?(o=O,N(t)):qh(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):Gh(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Kh(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||Kh(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return qh(t)?Qh(e,F,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):F(t)}function F(t){return e.enter(`htmlTextData`),o(t)}}var m_={name:`labelEnd`,resolveAll:v_,resolveTo:y_,tokenize:b_},h_={tokenize:x_},g_={tokenize:S_},__={tokenize:C_};function v_(e){let t=-1,n=[];for(;++t=3&&(a===null||Gh(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),qh(t)?Qh(e,s,`whitespace`)(t):s(t))}}var M_={continuation:{tokenize:I_},exit:R_,name:`list`,tokenize:F_},N_={partial:!0,tokenize:z_},P_={partial:!0,tokenize:L_};function F_(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:Hh(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(A_,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return Hh(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(pg,r.interrupt?n:u,e.attempt(N_,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return qh(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function I_(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(pg,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Qh(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!qh(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(P_,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Qh(e,e.attempt(M_,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function L_(e,t,n){let r=this;return Qh(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function R_(e){e.exit(this.containerState.type)}function z_(e,t,n){let r=this;return Qh(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!qh(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var B_={name:`setextUnderline`,resolveTo:V_,tokenize:H_};function V_(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function H_(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),qh(t)?Qh(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Gh(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var U_={tokenize:W_};function W_(e){let t=this,n=e.attempt(pg,r,e.attempt(this.parser.constructs.flowInitial,i,Qh(e,e.attempt(this.parser.constructs.flow,i,e.attempt(zg,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var G_={resolveAll:Y_()},K_=J_(`string`),q_=J_(`text`);function J_(e){return{resolveAll:Y_(e===`text`?X_:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++iav,contentInitial:()=>$_,disable:()=>ov,document:()=>Q_,flow:()=>tv,flowInitial:()=>ev,insideSpan:()=>iv,string:()=>nv,text:()=>rv}),Q_={42:M_,43:M_,45:M_,48:M_,49:M_,50:M_,51:M_,52:M_,53:M_,54:M_,55:M_,56:M_,57:M_,62:hg},$_={91:Jg},ev={[-2]:Dg,[-1]:Dg,32:Dg},tv={35:e_,42:A_,45:[B_,A_],60:a_,61:B_,95:A_,96:wg,126:wg},nv={38:xg,92:yg},rv={[-5]:O_,[-4]:O_,[-3]:O_,33:w_,38:xg,42:sg,60:[dg,f_],91:E_,92:[Qg,yg],93:m_,95:sg,96:jg},iv={null:[sg,G_]},av={null:[42,95]},ov={null:[]};function sv(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=jh(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=og(a,l.events,l),l.events):[]}function f(e,t){return lv(p(e),t)}function p(e){return cv(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function lv(e,t){let n=-1,r=[],i;for(;++n0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||vv).call(a,void 0,e[0])}for(r.position={start:hv(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:hv(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Cv(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wv(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Tv(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Kh(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Ev(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Dv(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Ov(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function kv(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ov(e,t);let i={src:Kh(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function Av(e,t){let n={src:Kh(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function jv(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Mv(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ov(e,t);let i={href:Kh(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Nv(e,t){let n={href:Kh(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Pv(e,t,n){let r=e.all(t),i=n?Fv(n):Iv(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Cv).call(a,void 0,e[0])}for(r.position={start:bv(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:bv(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Ov(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function kv(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Av(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=Zh(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function jv(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Mv(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Nv(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function Pv(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Nv(e,t);let i={src:Zh(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function Fv(e,t){let n={src:Zh(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Iv(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Lv(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Nv(e,t);let i={href:Zh(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Rv(e,t){let n={href:Zh(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function zv(e,t,n){let r=e.all(t),i=n?Bv(n):Vv(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s1}function Lv(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=Fm(t.children[1]),o=Pm(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Hv(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(qv(t.slice(i),i>0,!1)),a.join(``)}function qv(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Wv||t===Gv;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Wv||t===Gv;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Jv(e,t){let n={type:`text`,value:Kv(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Yv(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Xv={blockquote:bv,break:xv,code:Sv,delete:Cv,emphasis:wv,footnoteReference:Tv,heading:Ev,html:Dv,imageReference:kv,image:Av,inlineCode:jv,linkReference:Mv,link:Nv,listItem:Pv,list:Lv,paragraph:Rv,root:zv,strong:Bv,table:Vv,tableCell:Uv,tableRow:Hv,text:Jv,thematicBreak:Yv,toml:Zv,yaml:Zv,definition:Zv,footnoteDefinition:Zv};function Zv(){}var{defineProperty:Qv}=Object,$v=typeof self==`object`?self:globalThis,ey=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new $v[e](t)},ty=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?Qv(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof $v[e]==`function`?ey(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(ey(a,o),i)};return r},ny=e=>ty(new Map,e)(0),ry=``,{toString:iy}={},{keys:ay,is:oy}=Object,sy=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=iy.call(e).slice(8,-1);switch(n){case`Array`:return[1,ry];case`Object`:return[2,ry];case`Date`:return[3,ry];case`RegExp`:return[4,ry];case`Map`:return[5,ry];case`Set`:return[6,ry];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},cy=([e,t])=>e===0&&(t===`function`||t===`symbol`),ly=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=sy(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&oy(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of ay(o))(e||!cy(sy(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?ry:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(cy(sy(n))||cy(sy(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!cy(sy(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},uy=(e,{json:t,lossy:n}={})=>{let r=[];return ly(!(t||n),!!t,new Map,r)(e),r},dy=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?ny(uy(e,t)):structuredClone(e):(e,t)=>ny(uy(e,t));function fy(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function py(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function my(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||fy,r=e.options.footnoteBackLabel||py,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...dy(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:` +`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Bv(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r1}function Hv(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=Bm(t.children[1]),o=zm(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function qv(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Qv(t.slice(i),i>0,!1)),a.join(``)}function Qv(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Yv||t===Xv;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Yv||t===Xv;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function $v(e,t){let n={type:`text`,value:Zv(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function ey(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var ty={blockquote:Tv,break:Ev,code:Dv,delete:Ov,emphasis:kv,footnoteReference:Av,heading:jv,html:Mv,imageReference:Pv,image:Fv,inlineCode:Iv,linkReference:Lv,link:Rv,listItem:zv,list:Hv,paragraph:Uv,root:Wv,strong:Gv,table:Kv,tableCell:Jv,tableRow:qv,text:$v,thematicBreak:ey,toml:ny,yaml:ny,definition:ny,footnoteDefinition:ny};function ny(){}var{defineProperty:ry}=Object,iy=typeof self==`object`?self:globalThis,ay=(e,t)=>{switch(e){case`Function`:case`SharedWorker`:case`Worker`:case`eval`:case`setInterval`:case`setTimeout`:throw TypeError(`unable to deserialize `+e)}return new iy[e](t)},oy=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o){let i=r(t),a=r(n);i===`__proto__`?ry(e,i,{value:a,configurable:!0,enumerable:!0,writable:!0}):e[i]=a}return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(typeof iy[e]==`function`?ay(e,t):Error(t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}case`-0`:return-0}return n(ay(a,o),i)};return r},sy=e=>oy(new Map,e)(0),cy=``,{toString:ly}={},{keys:uy,is:dy}=Object,fy=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=ly.call(e).slice(8,-1);switch(n){case`Array`:return[1,cy];case`Object`:return[2,cy];case`Date`:return[3,cy];case`RegExp`:return[4,cy];case`Map`:return[5,cy];case`Set`:return[6,cy];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:e instanceof Error?[7,e.name||`Error`]:[2,n]},py=([e,t])=>e===0&&(t===`function`||t===`symbol`),my=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=o=>{if(n.has(o))return n.get(o);let[s,c]=fy(o);switch(s){case 0:{let t=o;switch(c){case`bigint`:s=8,t=o.toString();break;case`number`:if(!o&&dy(o,-0))return r.push([`-0`])-1;break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+c);t=null;break;case`undefined`:return i([-1],o)}return i([s,t],o)}case 1:{if(c){let e=o;return c===`DataView`?e=new Uint8Array(o.buffer):c===`ArrayBuffer`&&(e=new Uint8Array(o)),i([c,[...e]],o)}let e=[],t=i([s,e],o);for(let t of o)e.push(a(t));return t}case 2:{if(c)switch(c){case`BigInt`:return i([c,o.toString()],o);case`Boolean`:case`Number`:case`String`:return i([c,o.valueOf()],o)}if(t&&`toJSON`in o)return a(o.toJSON());let n=[],r=i([s,n],o);for(let t of uy(o))(e||!py(fy(o[t])))&&n.push([a(t),a(o[t])]);return r}case 3:return i([s,isNaN(o.getTime())?cy:o.toISOString()],o);case 4:{let{source:e,flags:t}=o;return i([s,{source:e,flags:t}],o)}case 5:{let t=[],n=i([s,t],o);for(let[n,r]of o)(e||!(py(fy(n))||py(fy(r))))&&t.push([a(n),a(r)]);return n}case 6:{let t=[],n=i([s,t],o);for(let n of o)(e||!py(fy(n)))&&t.push(a(n));return n}}let{message:l}=o;return i([s,{name:c,message:l}],o)};return a},hy=(e,{json:t,lossy:n}={})=>{let r=[];return my(!(t||n),!!t,new Map,r)(e),r},gy=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?sy(hy(e,t)):structuredClone(e):(e,t)=>sy(hy(e,t));function _y(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function vy(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function yy(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||_y,r=e.options.footnoteBackLabel||vy,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...gy(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:` `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:` -`}]}}var hy=(function(e){if(e==null)return by;if(typeof e==`function`)return yy(e);if(typeof e==`object`)return Array.isArray(e)?gy(e):_y(e);if(typeof e==`string`)return vy(e);throw Error(`Expected function, string, or object as test`)});function gy(e){let t=[],n=-1;for(;++n`:``))+`)`})}return u;function u(){let l=Cy,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Ty(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d`:``))+`)`})}return u;function u(){let l=Oy,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Ay(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d0&&n.push({type:`text`,value:` -`}),n}function Py(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Fy(e,t){let n=ky(e,t),r=n.one(e,void 0),i=my(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:` -`},i)),a}function Iy(e,t){return e&&`run`in e?async function(n,r){let i=Fy(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Fy(n,{file:r,...e||t})}}function Ly(e){if(e)throw e}var Ry=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});ft.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var Hy={basename:Uy,dirname:Wy,extname:Gy,join:Ky,sep:`/`};function Uy(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);Yy(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Wy(e){if(Yy(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Gy(e){Yy(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Ky(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Jy(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Yy(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Xy={cwd:Zy};function Zy(){return`/`}function Qy(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function $y(e){if(typeof e==`string`)e=new URL(e);else if(!Qy(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return eb(e)}function eb(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n0){let[r,...a]=t,o=n[i][1];zy(o)&&zy(r)&&(r=(0,cb.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function db(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function fb(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function pb(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function mb(e){if(!zy(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function hb(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function gb(e){return _b(e)?e:new nb(e)}function _b(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function vb(e){return typeof e==`string`||yb(e)}function yb(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var bb=[],xb={allowDangerousHtml:!0},Sb=/^(https?|ircs?|mailto|xmpp)$/i,Cb=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function wb(e){let t=Tb(e),n=Eb(e);return Db(t.runSync(t.parse(n),n),e)}function Tb(e){let t=e.rehypePlugins||bb,n=e.remarkPlugins||bb,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...xb}:xb;return ub().use(yv).use(n).use(Iy,r).use(t)}function Eb(e){let t=e.children||``,n=new nb;return typeof t==`string`?n.value=t:``+t,n}function Db(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Ob;for(let e of Cb)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return Ey(e,l),Ym(e,{Fragment:K.Fragment,components:i,ignoreInvalidStyle:!0,jsx:K.jsx,jsxs:K.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in _h)if(Object.hasOwn(_h,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=_h[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Ob(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Sb.test(e.slice(0,t))?e:``}var kb=/[#.]/g;function Ab(e,t){let n=e||``,r={},i=0,a,o;for(;i-1&&e<=t.length){let r=0;for(;;){let i=n[r];if(i===void 0){let e=Hb(t,n[r-1]);i=e===-1?t.length+1:e+1,n[r]=i}if(i>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}function i(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length1?n[e.line-2]:0)+e.column-1;if(r=55296&&e<=57343}function yx(e){return e>=56320&&e<=57343}function bx(e,t){return(e-55296)*1024+9216+t}function xx(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function Sx(e){return e>=64976&&e<=65007||gx.has(e)}var J;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(J||={});var Cx=65536,wx=class{constructor(e){this.handler=e,this.html=``,this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=Cx,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,a=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(yx(t))return this.pos++,this._addGap(),bx(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,q.EOF;return this._err(J.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,q.EOF;let n=this.html.charCodeAt(t);return n===q.CARRIAGE_RETURN?q.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,q.EOF;let e=this.html.charCodeAt(this.pos);return e===q.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,q.LINE_FEED):e===q.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,vx(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===q.LINE_FEED||e===q.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){xx(e)?this._err(J.controlCharacterInInputStream):Sx(e)&&this._err(J.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var Dx=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),Ox=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);String.fromCodePoint;function kx(e){return e>=55296&&e<=57343||e>1114111?65533:Ox.get(e)??e}var Ax;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(Ax||={});var jx=32,Mx;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(Mx||={});function Nx(e){return e>=Ax.ZERO&&e<=Ax.NINE}function Px(e){return e>=Ax.UPPER_A&&e<=Ax.UPPER_F||e>=Ax.LOWER_A&&e<=Ax.LOWER_F}function Fx(e){return e>=Ax.UPPER_A&&e<=Ax.UPPER_Z||e>=Ax.LOWER_A&&e<=Ax.LOWER_Z||Nx(e)}function Ix(e){return e===Ax.EQUALS||Fx(e)}var Lx;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(Lx||={});var Rx;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(Rx||={});var zx=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=Lx.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Rx.Strict}startEntity(e){this.decodeMode=e,this.state=Lx.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case Lx.EntityStart:return e.charCodeAt(t)===Ax.NUM?(this.state=Lx.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=Lx.NamedEntity,this.stateNamedEntity(e,t));case Lx.NumericStart:return this.stateNumericStart(e,t);case Lx.NumericDecimal:return this.stateNumericDecimal(e,t);case Lx.NumericHex:return this.stateNumericHex(e,t);case Lx.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|jx)===Ax.LOWER_X?(this.state=Lx.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=Lx.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+Number.parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t>14;for(;t>14,i!==0){if(a===Ax.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Rx.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&Mx.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~Mx.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case Lx.NamedEntity:return this.result!==0&&(this.decodeMode!==Rx.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Lx.NumericDecimal:return this.emitNumericEntity(0,2);case Lx.NumericHex:return this.emitNumericEntity(0,3);case Lx.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Lx.EntityStart:return 0}}};function Bx(e,t,n,r){let i=(t&Mx.BRANCH_LENGTH)>>7,a=t&Mx.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(nr)s=t-1;else return e[t+i]}return-1}var Vx;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(Vx||={});var Hx;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(Hx||={});var Ux;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(Ux||={});var Y;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(Y||={});var X;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(X||={});var Wx=new Map([[Y.A,X.A],[Y.ADDRESS,X.ADDRESS],[Y.ANNOTATION_XML,X.ANNOTATION_XML],[Y.APPLET,X.APPLET],[Y.AREA,X.AREA],[Y.ARTICLE,X.ARTICLE],[Y.ASIDE,X.ASIDE],[Y.B,X.B],[Y.BASE,X.BASE],[Y.BASEFONT,X.BASEFONT],[Y.BGSOUND,X.BGSOUND],[Y.BIG,X.BIG],[Y.BLOCKQUOTE,X.BLOCKQUOTE],[Y.BODY,X.BODY],[Y.BR,X.BR],[Y.BUTTON,X.BUTTON],[Y.CAPTION,X.CAPTION],[Y.CENTER,X.CENTER],[Y.CODE,X.CODE],[Y.COL,X.COL],[Y.COLGROUP,X.COLGROUP],[Y.DD,X.DD],[Y.DESC,X.DESC],[Y.DETAILS,X.DETAILS],[Y.DIALOG,X.DIALOG],[Y.DIR,X.DIR],[Y.DIV,X.DIV],[Y.DL,X.DL],[Y.DT,X.DT],[Y.EM,X.EM],[Y.EMBED,X.EMBED],[Y.FIELDSET,X.FIELDSET],[Y.FIGCAPTION,X.FIGCAPTION],[Y.FIGURE,X.FIGURE],[Y.FONT,X.FONT],[Y.FOOTER,X.FOOTER],[Y.FOREIGN_OBJECT,X.FOREIGN_OBJECT],[Y.FORM,X.FORM],[Y.FRAME,X.FRAME],[Y.FRAMESET,X.FRAMESET],[Y.H1,X.H1],[Y.H2,X.H2],[Y.H3,X.H3],[Y.H4,X.H4],[Y.H5,X.H5],[Y.H6,X.H6],[Y.HEAD,X.HEAD],[Y.HEADER,X.HEADER],[Y.HGROUP,X.HGROUP],[Y.HR,X.HR],[Y.HTML,X.HTML],[Y.I,X.I],[Y.IMG,X.IMG],[Y.IMAGE,X.IMAGE],[Y.INPUT,X.INPUT],[Y.IFRAME,X.IFRAME],[Y.KEYGEN,X.KEYGEN],[Y.LABEL,X.LABEL],[Y.LI,X.LI],[Y.LINK,X.LINK],[Y.LISTING,X.LISTING],[Y.MAIN,X.MAIN],[Y.MALIGNMARK,X.MALIGNMARK],[Y.MARQUEE,X.MARQUEE],[Y.MATH,X.MATH],[Y.MENU,X.MENU],[Y.META,X.META],[Y.MGLYPH,X.MGLYPH],[Y.MI,X.MI],[Y.MO,X.MO],[Y.MN,X.MN],[Y.MS,X.MS],[Y.MTEXT,X.MTEXT],[Y.NAV,X.NAV],[Y.NOBR,X.NOBR],[Y.NOFRAMES,X.NOFRAMES],[Y.NOEMBED,X.NOEMBED],[Y.NOSCRIPT,X.NOSCRIPT],[Y.OBJECT,X.OBJECT],[Y.OL,X.OL],[Y.OPTGROUP,X.OPTGROUP],[Y.OPTION,X.OPTION],[Y.P,X.P],[Y.PARAM,X.PARAM],[Y.PLAINTEXT,X.PLAINTEXT],[Y.PRE,X.PRE],[Y.RB,X.RB],[Y.RP,X.RP],[Y.RT,X.RT],[Y.RTC,X.RTC],[Y.RUBY,X.RUBY],[Y.S,X.S],[Y.SCRIPT,X.SCRIPT],[Y.SEARCH,X.SEARCH],[Y.SECTION,X.SECTION],[Y.SELECT,X.SELECT],[Y.SOURCE,X.SOURCE],[Y.SMALL,X.SMALL],[Y.SPAN,X.SPAN],[Y.STRIKE,X.STRIKE],[Y.STRONG,X.STRONG],[Y.STYLE,X.STYLE],[Y.SUB,X.SUB],[Y.SUMMARY,X.SUMMARY],[Y.SUP,X.SUP],[Y.TABLE,X.TABLE],[Y.TBODY,X.TBODY],[Y.TEMPLATE,X.TEMPLATE],[Y.TEXTAREA,X.TEXTAREA],[Y.TFOOT,X.TFOOT],[Y.TD,X.TD],[Y.TH,X.TH],[Y.THEAD,X.THEAD],[Y.TITLE,X.TITLE],[Y.TR,X.TR],[Y.TRACK,X.TRACK],[Y.TT,X.TT],[Y.U,X.U],[Y.UL,X.UL],[Y.SVG,X.SVG],[Y.VAR,X.VAR],[Y.WBR,X.WBR],[Y.XMP,X.XMP]]);function Gx(e){return Wx.get(e)??X.UNKNOWN}var Kx=X,qx={[Vx.HTML]:new Set([Kx.ADDRESS,Kx.APPLET,Kx.AREA,Kx.ARTICLE,Kx.ASIDE,Kx.BASE,Kx.BASEFONT,Kx.BGSOUND,Kx.BLOCKQUOTE,Kx.BODY,Kx.BR,Kx.BUTTON,Kx.CAPTION,Kx.CENTER,Kx.COL,Kx.COLGROUP,Kx.DD,Kx.DETAILS,Kx.DIR,Kx.DIV,Kx.DL,Kx.DT,Kx.EMBED,Kx.FIELDSET,Kx.FIGCAPTION,Kx.FIGURE,Kx.FOOTER,Kx.FORM,Kx.FRAME,Kx.FRAMESET,Kx.H1,Kx.H2,Kx.H3,Kx.H4,Kx.H5,Kx.H6,Kx.HEAD,Kx.HEADER,Kx.HGROUP,Kx.HR,Kx.HTML,Kx.IFRAME,Kx.IMG,Kx.INPUT,Kx.LI,Kx.LINK,Kx.LISTING,Kx.MAIN,Kx.MARQUEE,Kx.MENU,Kx.META,Kx.NAV,Kx.NOEMBED,Kx.NOFRAMES,Kx.NOSCRIPT,Kx.OBJECT,Kx.OL,Kx.P,Kx.PARAM,Kx.PLAINTEXT,Kx.PRE,Kx.SCRIPT,Kx.SECTION,Kx.SELECT,Kx.SOURCE,Kx.STYLE,Kx.SUMMARY,Kx.TABLE,Kx.TBODY,Kx.TD,Kx.TEMPLATE,Kx.TEXTAREA,Kx.TFOOT,Kx.TH,Kx.THEAD,Kx.TITLE,Kx.TR,Kx.TRACK,Kx.UL,Kx.WBR,Kx.XMP]),[Vx.MATHML]:new Set([Kx.MI,Kx.MO,Kx.MN,Kx.MS,Kx.MTEXT,Kx.ANNOTATION_XML]),[Vx.SVG]:new Set([Kx.TITLE,Kx.FOREIGN_OBJECT,Kx.DESC]),[Vx.XLINK]:new Set,[Vx.XML]:new Set,[Vx.XMLNS]:new Set},Jx=new Set([Kx.H1,Kx.H2,Kx.H3,Kx.H4,Kx.H5,Kx.H6]);Y.STYLE,Y.SCRIPT,Y.XMP,Y.IFRAME,Y.NOEMBED,Y.NOFRAMES,Y.PLAINTEXT;var Z;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(Z||={});var Yx={DATA:Z.DATA,RCDATA:Z.RCDATA,RAWTEXT:Z.RAWTEXT,SCRIPT_DATA:Z.SCRIPT_DATA,PLAINTEXT:Z.PLAINTEXT,CDATA_SECTION:Z.CDATA_SECTION};function Xx(e){return e>=q.DIGIT_0&&e<=q.DIGIT_9}function Zx(e){return e>=q.LATIN_CAPITAL_A&&e<=q.LATIN_CAPITAL_Z}function Qx(e){return e>=q.LATIN_SMALL_A&&e<=q.LATIN_SMALL_Z}function $x(e){return Qx(e)||Zx(e)}function eS(e){return $x(e)||Xx(e)}function tS(e){return e+32}function nS(e){return e===q.SPACE||e===q.LINE_FEED||e===q.TABULATION||e===q.FORM_FEED}function rS(e){return nS(e)||e===q.SOLIDUS||e===q.GREATER_THAN_SIGN}function iS(e){return e===q.NULL?J.nullCharacterReference:e>1114111?J.characterReferenceOutsideUnicodeRange:vx(e)?J.surrogateCharacterReference:Sx(e)?J.noncharacterCharacterReference:xx(e)||e===q.CARRIAGE_RETURN?J.controlCharacterReference:null}var aS=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName=``,this.active=!1,this.state=Z.DATA,this.returnState=Z.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new wx(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new zx(Dx,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(J.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(J.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=iS(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;(r=(n=this.handler).onParseError)==null||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||n?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t0&&this._err(J.endTagWithAttributes),e.selfClosing&&this._err(J.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case Tx.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case Tx.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case Tx.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:Tx.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,t)}_emitCodePoint(e){let t=nS(e)?Tx.WHITESPACE_CHARACTER:e===q.NULL?Tx.NULL_CHARACTER:Tx.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(Tx.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=Z.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Rx.Attribute:Rx.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case Z.DATA:this._stateData(e);break;case Z.RCDATA:this._stateRcdata(e);break;case Z.RAWTEXT:this._stateRawtext(e);break;case Z.SCRIPT_DATA:this._stateScriptData(e);break;case Z.PLAINTEXT:this._statePlaintext(e);break;case Z.TAG_OPEN:this._stateTagOpen(e);break;case Z.END_TAG_OPEN:this._stateEndTagOpen(e);break;case Z.TAG_NAME:this._stateTagName(e);break;case Z.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case Z.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case Z.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case Z.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case Z.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case Z.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case Z.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case Z.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case Z.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case Z.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case Z.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case Z.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case Z.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case Z.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case Z.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case Z.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case Z.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case Z.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case Z.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case Z.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case Z.BOGUS_COMMENT:this._stateBogusComment(e);break;case Z.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case Z.COMMENT_START:this._stateCommentStart(e);break;case Z.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case Z.COMMENT:this._stateComment(e);break;case Z.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case Z.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case Z.COMMENT_END:this._stateCommentEnd(e);break;case Z.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case Z.DOCTYPE:this._stateDoctype(e);break;case Z.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case Z.DOCTYPE_NAME:this._stateDoctypeName(e);break;case Z.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case Z.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case Z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case Z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case Z.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case Z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case Z.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case Z.CDATA_SECTION:this._stateCdataSection(e);break;case Z.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case Z.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case Z.CHARACTER_REFERENCE:this._stateCharacterReference();break;case Z.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case q.LESS_THAN_SIGN:this.state=Z.TAG_OPEN;break;case q.AMPERSAND:this._startCharacterReference();break;case q.NULL:this._err(J.unexpectedNullCharacter),this._emitCodePoint(e);break;case q.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case q.AMPERSAND:this._startCharacterReference();break;case q.LESS_THAN_SIGN:this.state=Z.RCDATA_LESS_THAN_SIGN;break;case q.NULL:this._err(J.unexpectedNullCharacter),this._emitChars(`�`);break;case q.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case q.LESS_THAN_SIGN:this.state=Z.RAWTEXT_LESS_THAN_SIGN;break;case q.NULL:this._err(J.unexpectedNullCharacter),this._emitChars(`�`);break;case q.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case q.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_LESS_THAN_SIGN;break;case q.NULL:this._err(J.unexpectedNullCharacter),this._emitChars(`�`);break;case q.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case q.NULL:this._err(J.unexpectedNullCharacter),this._emitChars(`�`);break;case q.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if($x(e))this._createStartTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case q.EXCLAMATION_MARK:this.state=Z.MARKUP_DECLARATION_OPEN;break;case q.SOLIDUS:this.state=Z.END_TAG_OPEN;break;case q.QUESTION_MARK:this._err(J.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e);break;case q.EOF:this._err(J.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(J.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=Z.DATA,this._stateData(e)}}_stateEndTagOpen(e){if($x(e))this._createEndTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case q.GREATER_THAN_SIGN:this._err(J.missingEndTagName),this.state=Z.DATA;break;case q.EOF:this._err(J.eofBeforeTagName),this._emitChars(``);break;case q.NULL:this._err(J.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case q.EOF:this._err(J.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===q.SOLIDUS?this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:$x(e)?(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){$x(e)?(this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(``);break;case q.NULL:this._err(J.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case q.EOF:this._err(J.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===q.SOLIDUS?(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(_x.SCRIPT,!1)&&rS(this.preprocessor.peek(_x.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<_x.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Z.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:break;case q.SOLIDUS:case q.GREATER_THAN_SIGN:case q.EOF:this.state=Z.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case q.EQUALS_SIGN:this._err(J.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=Z.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=Z.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:case q.SOLIDUS:case q.GREATER_THAN_SIGN:case q.EOF:this._leaveAttrName(),this.state=Z.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case q.EQUALS_SIGN:this._leaveAttrName(),this.state=Z.BEFORE_ATTRIBUTE_VALUE;break;case q.QUOTATION_MARK:case q.APOSTROPHE:case q.LESS_THAN_SIGN:this._err(J.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case q.NULL:this._err(J.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(Zx(e)?tS(e):e)}}_stateAfterAttributeName(e){switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:break;case q.SOLIDUS:this.state=Z.SELF_CLOSING_START_TAG;break;case q.EQUALS_SIGN:this.state=Z.BEFORE_ATTRIBUTE_VALUE;break;case q.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentTagToken();break;case q.EOF:this._err(J.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=Z.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:break;case q.QUOTATION_MARK:this.state=Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case q.APOSTROPHE:this.state=Z.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case q.GREATER_THAN_SIGN:this._err(J.missingAttributeValue),this.state=Z.DATA,this.emitCurrentTagToken();break;default:this.state=Z.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case q.QUOTATION_MARK:this.state=Z.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case q.AMPERSAND:this._startCharacterReference();break;case q.NULL:this._err(J.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case q.EOF:this._err(J.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case q.APOSTROPHE:this.state=Z.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case q.AMPERSAND:this._startCharacterReference();break;case q.NULL:this._err(J.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case q.EOF:this._err(J.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:this._leaveAttrValue(),this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case q.AMPERSAND:this._startCharacterReference();break;case q.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Z.DATA,this.emitCurrentTagToken();break;case q.NULL:this._err(J.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case q.QUOTATION_MARK:case q.APOSTROPHE:case q.LESS_THAN_SIGN:case q.EQUALS_SIGN:case q.GRAVE_ACCENT:this._err(J.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case q.EOF:this._err(J.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:this._leaveAttrValue(),this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case q.SOLIDUS:this._leaveAttrValue(),this.state=Z.SELF_CLOSING_START_TAG;break;case q.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Z.DATA,this.emitCurrentTagToken();break;case q.EOF:this._err(J.eofInTag),this._emitEOFToken();break;default:this._err(J.missingWhitespaceBetweenAttributes),this.state=Z.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case q.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=Z.DATA,this.emitCurrentTagToken();break}case q.EOF:this._err(J.eofInTag),this._emitEOFToken();break;default:this._err(J.unexpectedSolidusInTag),this.state=Z.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case q.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentComment(t);break;case q.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case q.NULL:this._err(J.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(_x.DASH_DASH,!0)?(this._createCommentToken(_x.DASH_DASH.length+1),this.state=Z.COMMENT_START):this._consumeSequenceIfMatch(_x.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(_x.DOCTYPE.length+1),this.state=Z.DOCTYPE):this._consumeSequenceIfMatch(_x.CDATA_START,!0)?this.inForeignNode?this.state=Z.CDATA_SECTION:(this._err(J.cdataInHtmlContent),this._createCommentToken(_x.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=Z.BOGUS_COMMENT):this._ensureHibernation()||(this._err(J.incorrectlyOpenedComment),this._createCommentToken(2),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case q.HYPHEN_MINUS:this.state=Z.COMMENT_START_DASH;break;case q.GREATER_THAN_SIGN:{this._err(J.abruptClosingOfEmptyComment),this.state=Z.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case q.HYPHEN_MINUS:this.state=Z.COMMENT_END;break;case q.GREATER_THAN_SIGN:this._err(J.abruptClosingOfEmptyComment),this.state=Z.DATA,this.emitCurrentComment(t);break;case q.EOF:this._err(J.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Z.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case q.HYPHEN_MINUS:this.state=Z.COMMENT_END_DASH;break;case q.LESS_THAN_SIGN:t.data+=`<`,this.state=Z.COMMENT_LESS_THAN_SIGN;break;case q.NULL:this._err(J.unexpectedNullCharacter),t.data+=`�`;break;case q.EOF:this._err(J.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case q.EXCLAMATION_MARK:t.data+=`!`,this.state=Z.COMMENT_LESS_THAN_SIGN_BANG;break;case q.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===q.HYPHEN_MINUS?this.state=Z.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=Z.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===q.HYPHEN_MINUS?this.state=Z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=Z.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==q.GREATER_THAN_SIGN&&e!==q.EOF&&this._err(J.nestedComment),this.state=Z.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case q.HYPHEN_MINUS:this.state=Z.COMMENT_END;break;case q.EOF:this._err(J.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case q.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentComment(t);break;case q.EXCLAMATION_MARK:this.state=Z.COMMENT_END_BANG;break;case q.HYPHEN_MINUS:t.data+=`-`;break;case q.EOF:this._err(J.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case q.HYPHEN_MINUS:t.data+=`--!`,this.state=Z.COMMENT_END_DASH;break;case q.GREATER_THAN_SIGN:this._err(J.incorrectlyClosedComment),this.state=Z.DATA,this.emitCurrentComment(t);break;case q.EOF:this._err(J.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=Z.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_NAME;break;case q.GREATER_THAN_SIGN:this.state=Z.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case q.EOF:{this._err(J.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(J.missingWhitespaceBeforeDoctypeName),this.state=Z.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(Zx(e))this._createDoctypeToken(String.fromCharCode(tS(e))),this.state=Z.DOCTYPE_NAME;else switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:break;case q.NULL:this._err(J.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=Z.DOCTYPE_NAME;break;case q.GREATER_THAN_SIGN:{this._err(J.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Z.DATA;break}case q.EOF:{this._err(J.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=Z.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:this.state=Z.AFTER_DOCTYPE_NAME;break;case q.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case q.NULL:this._err(J.unexpectedNullCharacter),t.name+=`�`;break;case q.EOF:this._err(J.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(Zx(e)?tS(e):e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:break;case q.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case q.EOF:this._err(J.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(_x.PUBLIC,!1)?this.state=Z.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(_x.SYSTEM,!1)?this.state=Z.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(J.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case q.QUOTATION_MARK:this._err(J.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case q.APOSTROPHE:this._err(J.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case q.GREATER_THAN_SIGN:this._err(J.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case q.EOF:this._err(J.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(J.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:break;case q.QUOTATION_MARK:t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case q.APOSTROPHE:t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case q.GREATER_THAN_SIGN:this._err(J.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case q.EOF:this._err(J.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(J.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case q.QUOTATION_MARK:this.state=Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case q.NULL:this._err(J.unexpectedNullCharacter),t.publicId+=`�`;break;case q.GREATER_THAN_SIGN:this._err(J.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case q.EOF:this._err(J.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case q.APOSTROPHE:this.state=Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case q.NULL:this._err(J.unexpectedNullCharacter),t.publicId+=`�`;break;case q.GREATER_THAN_SIGN:this._err(J.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case q.EOF:this._err(J.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:this.state=Z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case q.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case q.QUOTATION_MARK:this._err(J.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case q.APOSTROPHE:this._err(J.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case q.EOF:this._err(J.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(J.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:break;case q.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case q.QUOTATION_MARK:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case q.APOSTROPHE:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case q.EOF:this._err(J.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(J.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case q.QUOTATION_MARK:this._err(J.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case q.APOSTROPHE:this._err(J.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case q.GREATER_THAN_SIGN:this._err(J.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case q.EOF:this._err(J.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(J.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:break;case q.QUOTATION_MARK:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case q.APOSTROPHE:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case q.GREATER_THAN_SIGN:this._err(J.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case q.EOF:this._err(J.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(J.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case q.QUOTATION_MARK:this.state=Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case q.NULL:this._err(J.unexpectedNullCharacter),t.systemId+=`�`;break;case q.GREATER_THAN_SIGN:this._err(J.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case q.EOF:this._err(J.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case q.APOSTROPHE:this.state=Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case q.NULL:this._err(J.unexpectedNullCharacter),t.systemId+=`�`;break;case q.GREATER_THAN_SIGN:this._err(J.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case q.EOF:this._err(J.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case q.SPACE:case q.LINE_FEED:case q.TABULATION:case q.FORM_FEED:break;case q.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case q.EOF:this._err(J.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(J.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case q.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case q.NULL:this._err(J.unexpectedNullCharacter);break;case q.EOF:this.emitCurrentDoctype(t),this._emitEOFToken()}}_stateCdataSection(e){switch(e){case q.RIGHT_SQUARE_BRACKET:this.state=Z.CDATA_SECTION_BRACKET;break;case q.EOF:this._err(J.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===q.RIGHT_SQUARE_BRACKET?this.state=Z.CDATA_SECTION_END:(this._emitChars(`]`),this.state=Z.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case q.GREATER_THAN_SIGN:this.state=Z.DATA;break;case q.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=Z.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(q.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&eS(this.preprocessor.peek(1))?Z.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){eS(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===q.SEMICOLON&&this._err(J.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},oS=new Set([X.DD,X.DT,X.LI,X.OPTGROUP,X.OPTION,X.P,X.RB,X.RP,X.RT,X.RTC]),sS=new Set([...oS,X.CAPTION,X.COLGROUP,X.TBODY,X.TD,X.TFOOT,X.TH,X.THEAD,X.TR]),cS=new Set([X.APPLET,X.CAPTION,X.HTML,X.MARQUEE,X.OBJECT,X.TABLE,X.TD,X.TEMPLATE,X.TH]),lS=new Set([...cS,X.OL,X.UL]),uS=new Set([...cS,X.BUTTON]),dS=new Set([X.ANNOTATION_XML,X.MI,X.MN,X.MO,X.MS,X.MTEXT]),fS=new Set([X.DESC,X.FOREIGN_OBJECT,X.TITLE]),pS=new Set([X.TR,X.TEMPLATE,X.HTML]),mS=new Set([X.TBODY,X.TFOOT,X.THEAD,X.TEMPLATE,X.HTML]),hS=new Set([X.TABLE,X.TEMPLATE,X.HTML]),gS=new Set([X.TD,X.TH]),_S=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=X.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===X.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===Vx.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==Vx.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(hS,Vx.HTML)}clearBackToTableBodyContext(){this.clearBackTo(mS,Vx.HTML)}clearBackToTableRowContext(){this.clearBackTo(pS,Vx.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===X.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===X.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case Vx.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case Vx.SVG:if(fS.has(r))return!1;break;case Vx.MATHML:if(dS.has(r))return!1}}return!0}hasInScope(e){return this.hasInDynamicScope(e,cS)}hasInListItemScope(e){return this.hasInDynamicScope(e,lS)}hasInButtonScope(e){return this.hasInDynamicScope(e,uS)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case Vx.HTML:if(Jx.has(t))return!0;if(cS.has(t))return!1;break;case Vx.SVG:if(fS.has(t))return!1;break;case Vx.MATHML:if(dS.has(t))return!1}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Vx.HTML)switch(this.tagIDs[t]){case e:return!0;case X.TABLE:case X.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===Vx.HTML)switch(this.tagIDs[e]){case X.TBODY:case X.THEAD:case X.TFOOT:return!0;case X.TABLE:case X.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Vx.HTML)switch(this.tagIDs[t]){case e:return!0;case X.OPTION:case X.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&oS.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&sS.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&sS.has(this.currentTagId);)this.pop()}},vS=3,yS;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(yS||={});var bS={type:yS.Marker},xS=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e[e.name,e.value])),i=0;for(let e=0;er.get(e.name)===e.value)&&(i+=1,i>=vS&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(bS)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:yS.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:yS.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(bS);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===yS.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===yS.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===yS.Element&&t.element===e)}},SS={createDocument(){return{nodeName:`#document`,mode:Ux.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>e.nodeName===`#documentType`);if(i)i.name=t,i.publicId=n,i.systemId=r;else{let i={nodeName:`#documentType`,name:t,publicId:n,systemId:r,parentNode:null};SS.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(SS.isTextNode(n)){n.value+=t;return}}SS.appendChild(e,SS.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&SS.isTextNode(r)?r.value+=t:SS.insertBefore(e,SS.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;re.startsWith(t))}function MS(e){return e.name===CS&&e.publicId===null&&(e.systemId===null||e.systemId===wS)}function NS(e){if(e.name!==CS)return Ux.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===TS)return Ux.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),OS.has(n))return Ux.QUIRKS;let e=t===null?DS:ES;if(jS(n,e))return Ux.QUIRKS;if(e=t===null?kS:AS,jS(n,e))return Ux.LIMITED_QUIRKS}return Ux.NO_QUIRKS}var PS={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},FS=`definitionurl`,IS=`definitionURL`,LS=new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),RS=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:Vx.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:Vx.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:Vx.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:Vx.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:Vx.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:Vx.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:Vx.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:Vx.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:Vx.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:Vx.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:Vx.XMLNS}]]),zS=new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),BS=new Set([X.B,X.BIG,X.BLOCKQUOTE,X.BODY,X.BR,X.CENTER,X.CODE,X.DD,X.DIV,X.DL,X.DT,X.EM,X.EMBED,X.H1,X.H2,X.H3,X.H4,X.H5,X.H6,X.HEAD,X.HR,X.I,X.IMG,X.LI,X.LISTING,X.MENU,X.META,X.NOBR,X.OL,X.P,X.PRE,X.RUBY,X.S,X.SMALL,X.SPAN,X.STRONG,X.STRIKE,X.SUB,X.SUP,X.TABLE,X.TT,X.U,X.UL,X.VAR]);function VS(e){let t=e.tagID;return t===X.FONT&&e.attrs.some(({name:e})=>e===Hx.COLOR||e===Hx.SIZE||e===Hx.FACE)||BS.has(t)}function HS(e){for(let t=0;t0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(r=(n=this.treeAdapter).onItemPop)==null||r.call(n,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===Vx.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,Vx.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Q.TEXT}switchToPlaintextParsing(){this.insertionMode=Q.TEXT,this.originalInsertionMode=Q.IN_BODY,this.tokenizer.state=Yx.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===Y.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==Vx.HTML))switch(this.fragmentContextID){case X.TITLE:case X.TEXTAREA:this.tokenizer.state=Yx.RCDATA;break;case X.STYLE:case X.XMP:case X.IFRAME:case X.NOEMBED:case X.NOFRAMES:case X.NOSCRIPT:this.tokenizer.state=Yx.RAWTEXT;break;case X.SCRIPT:this.tokenizer.state=Yx.SCRIPT_DATA;break;case X.PLAINTEXT:this.tokenizer.state=Yx.PLAINTEXT}}_setDocumentType(e){let t=e.name||``,n=e.publicId||``,r=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,Vx.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,Vx.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(Y.HTML,Vx.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,X.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=r[(n?r.lastIndexOf(n):r.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===Tx.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,e.tagID===X.SVG&&this.treeAdapter.getTagName(t)===Y.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===Vx.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===X.MGLYPH||e.tagID===X.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,Vx.HTML)}_processToken(e){switch(e.type){case Tx.CHARACTER:this.onCharacter(e);break;case Tx.NULL_CHARACTER:this.onNullCharacter(e);break;case Tx.COMMENT:this.onComment(e);break;case Tx.DOCTYPE:this.onDoctype(e);break;case Tx.START_TAG:this._processStartTag(e);break;case Tx.END_TAG:this.onEndTag(e);break;case Tx.EOF:this.onEof(e);break;case Tx.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e)}}_isIntegrationPoint(e,t,n){return JS(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===yS.Marker||this.openElements.contains(e.element)),n=t===-1?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=Q.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(X.P),this.openElements.popUntilTagNamePopped(X.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case X.TR:this.insertionMode=Q.IN_ROW;return;case X.TBODY:case X.THEAD:case X.TFOOT:this.insertionMode=Q.IN_TABLE_BODY;return;case X.CAPTION:this.insertionMode=Q.IN_CAPTION;return;case X.COLGROUP:this.insertionMode=Q.IN_COLUMN_GROUP;return;case X.TABLE:this.insertionMode=Q.IN_TABLE;return;case X.BODY:this.insertionMode=Q.IN_BODY;return;case X.FRAMESET:this.insertionMode=Q.IN_FRAMESET;return;case X.SELECT:this._resetInsertionModeForSelect(e);return;case X.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case X.HTML:this.insertionMode=this.headElement?Q.AFTER_HEAD:Q.BEFORE_HEAD;return;case X.TD:case X.TH:if(e>0){this.insertionMode=Q.IN_CELL;return}break;case X.HEAD:if(e>0){this.insertionMode=Q.IN_HEAD;return}}this.insertionMode=Q.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===X.TEMPLATE)break;if(e===X.TABLE){this.insertionMode=Q.IN_SELECT_IN_TABLE;return}}this.insertionMode=Q.IN_SELECT}_isElementCausesFosterParenting(e){return $S.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case X.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===Vx.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case X.TABLE:{let n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return qx[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){yT(this,e);return}switch(this.insertionMode){case Q.INITIAL:mC(this,e);break;case Q.BEFORE_HTML:_C(this,e);break;case Q.BEFORE_HEAD:bC(this,e);break;case Q.IN_HEAD:wC(this,e);break;case Q.IN_HEAD_NO_SCRIPT:DC(this,e);break;case Q.AFTER_HEAD:AC(this,e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:NC(this,e);break;case Q.TEXT:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:Ow(this,e);break;case Q.IN_TABLE_TEXT:Vw(this,e);break;case Q.IN_COLUMN_GROUP:Jw(this,e);break;case Q.AFTER_BODY:uT(this,e);break;case Q.AFTER_AFTER_BODY:gT(this,e)}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){vT(this,e);return}switch(this.insertionMode){case Q.INITIAL:mC(this,e);break;case Q.BEFORE_HTML:_C(this,e);break;case Q.BEFORE_HEAD:bC(this,e);break;case Q.IN_HEAD:wC(this,e);break;case Q.IN_HEAD_NO_SCRIPT:DC(this,e);break;case Q.AFTER_HEAD:AC(this,e);break;case Q.TEXT:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:Ow(this,e);break;case Q.IN_COLUMN_GROUP:Jw(this,e);break;case Q.AFTER_BODY:uT(this,e);break;case Q.AFTER_AFTER_BODY:gT(this,e)}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){lC(this,e);return}switch(this.insertionMode){case Q.INITIAL:case Q.BEFORE_HTML:case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_TEMPLATE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:lC(this,e);break;case Q.IN_TABLE_TEXT:Hw(this,e);break;case Q.AFTER_BODY:uC(this,e);break;case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:dC(this,e)}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case Q.INITIAL:pC(this,e);break;case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:this._err(e,J.misplacedDoctype);break;case Q.IN_TABLE_TEXT:Hw(this,e)}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,J.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?xT(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:mC(this,e);break;case Q.BEFORE_HTML:hC(this,e);break;case Q.BEFORE_HEAD:vC(this,e);break;case Q.IN_HEAD:xC(this,e);break;case Q.IN_HEAD_NO_SCRIPT:TC(this,e);break;case Q.AFTER_HEAD:OC(this,e);break;case Q.IN_BODY:fw(this,e);break;case Q.IN_TABLE:Lw(this,e);break;case Q.IN_TABLE_TEXT:Hw(this,e);break;case Q.IN_CAPTION:Ww(this,e);break;case Q.IN_COLUMN_GROUP:Kw(this,e);break;case Q.IN_TABLE_BODY:Yw(this,e);break;case Q.IN_ROW:Zw(this,e);break;case Q.IN_CELL:$w(this,e);break;case Q.IN_SELECT:tT(this,e);break;case Q.IN_SELECT_IN_TABLE:rT(this,e);break;case Q.IN_TEMPLATE:aT(this,e);break;case Q.AFTER_BODY:cT(this,e);break;case Q.IN_FRAMESET:dT(this,e);break;case Q.AFTER_FRAMESET:pT(this,e);break;case Q.AFTER_AFTER_BODY:hT(this,e);break;case Q.AFTER_AFTER_FRAMESET:_T(this,e)}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?ST(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:mC(this,e);break;case Q.BEFORE_HTML:gC(this,e);break;case Q.BEFORE_HEAD:yC(this,e);break;case Q.IN_HEAD:SC(this,e);break;case Q.IN_HEAD_NO_SCRIPT:EC(this,e);break;case Q.AFTER_HEAD:kC(this,e);break;case Q.IN_BODY:ww(this,e);break;case Q.TEXT:Ew(this,e);break;case Q.IN_TABLE:Rw(this,e);break;case Q.IN_TABLE_TEXT:Hw(this,e);break;case Q.IN_CAPTION:Gw(this,e);break;case Q.IN_COLUMN_GROUP:qw(this,e);break;case Q.IN_TABLE_BODY:Xw(this,e);break;case Q.IN_ROW:Qw(this,e);break;case Q.IN_CELL:eT(this,e);break;case Q.IN_SELECT:nT(this,e);break;case Q.IN_SELECT_IN_TABLE:iT(this,e);break;case Q.IN_TEMPLATE:oT(this,e);break;case Q.AFTER_BODY:lT(this,e);break;case Q.IN_FRAMESET:fT(this,e);break;case Q.AFTER_FRAMESET:mT(this,e);break;case Q.AFTER_AFTER_BODY:gT(this,e)}}onEof(e){switch(this.insertionMode){case Q.INITIAL:mC(this,e);break;case Q.BEFORE_HTML:_C(this,e);break;case Q.BEFORE_HEAD:bC(this,e);break;case Q.IN_HEAD:wC(this,e);break;case Q.IN_HEAD_NO_SCRIPT:DC(this,e);break;case Q.AFTER_HEAD:AC(this,e);break;case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:Tw(this,e);break;case Q.TEXT:Dw(this,e);break;case Q.IN_TABLE_TEXT:Hw(this,e);break;case Q.IN_TEMPLATE:sT(this,e);break;case Q.AFTER_BODY:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:fC(this,e)}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===q.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.TEXT:case Q.IN_COLUMN_GROUP:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:this._insertCharacters(e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:case Q.AFTER_BODY:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:MC(this,e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:Ow(this,e);break;case Q.IN_TABLE_TEXT:Bw(this,e)}}};function nC(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):Cw(e,t),n}function rC(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function iC(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),s=n&&a>=ZS;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=aC(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function aC(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function oC(e,t,n){let r=Gx(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===X.TEMPLATE&&i===Vx.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function sC(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function cC(e,t){for(let n=0;n=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function pC(e,t){e._setDocumentType(t);let n=t.forceQuirks?Ux.QUIRKS:NS(t);MS(t)||e._err(t,J.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Q.BEFORE_HTML}function mC(e,t){e._err(t,J.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Ux.QUIRKS),e.insertionMode=Q.BEFORE_HTML,e._processToken(t)}function hC(e,t){t.tagID===X.HTML?(e._insertElement(t,Vx.HTML),e.insertionMode=Q.BEFORE_HEAD):_C(e,t)}function gC(e,t){let n=t.tagID;(n===X.HTML||n===X.HEAD||n===X.BODY||n===X.BR)&&_C(e,t)}function _C(e,t){e._insertFakeRootElement(),e.insertionMode=Q.BEFORE_HEAD,e._processToken(t)}function vC(e,t){switch(t.tagID){case X.HTML:fw(e,t);break;case X.HEAD:e._insertElement(t,Vx.HTML),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD;break;default:bC(e,t)}}function yC(e,t){let n=t.tagID;n===X.HEAD||n===X.BODY||n===X.HTML||n===X.BR?bC(e,t):e._err(t,J.endTagWithoutMatchingOpenElement)}function bC(e,t){e._insertFakeElement(Y.HEAD,X.HEAD),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD,e._processToken(t)}function xC(e,t){switch(t.tagID){case X.HTML:fw(e,t);break;case X.BASE:case X.BASEFONT:case X.BGSOUND:case X.LINK:case X.META:e._appendElement(t,Vx.HTML),t.ackSelfClosing=!0;break;case X.TITLE:e._switchToTextParsing(t,Yx.RCDATA);break;case X.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,Yx.RAWTEXT):(e._insertElement(t,Vx.HTML),e.insertionMode=Q.IN_HEAD_NO_SCRIPT);break;case X.NOFRAMES:case X.STYLE:e._switchToTextParsing(t,Yx.RAWTEXT);break;case X.SCRIPT:e._switchToTextParsing(t,Yx.SCRIPT_DATA);break;case X.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Q.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Q.IN_TEMPLATE);break;case X.HEAD:e._err(t,J.misplacedStartTagForHeadElement);break;default:wC(e,t)}}function SC(e,t){switch(t.tagID){case X.HEAD:e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD;break;case X.BODY:case X.BR:case X.HTML:wC(e,t);break;case X.TEMPLATE:CC(e,t);break;default:e._err(t,J.endTagWithoutMatchingOpenElement)}}function CC(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==X.TEMPLATE&&e._err(t,J.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(X.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,J.endTagWithoutMatchingOpenElement)}function wC(e,t){e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD,e._processToken(t)}function TC(e,t){switch(t.tagID){case X.HTML:fw(e,t);break;case X.BASEFONT:case X.BGSOUND:case X.HEAD:case X.LINK:case X.META:case X.NOFRAMES:case X.STYLE:xC(e,t);break;case X.NOSCRIPT:e._err(t,J.nestedNoscriptInHead);break;default:DC(e,t)}}function EC(e,t){switch(t.tagID){case X.NOSCRIPT:e.openElements.pop(),e.insertionMode=Q.IN_HEAD;break;case X.BR:DC(e,t);break;default:e._err(t,J.endTagWithoutMatchingOpenElement)}}function DC(e,t){let n=t.type===Tx.EOF?J.openElementsLeftAfterEof:J.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Q.IN_HEAD,e._processToken(t)}function OC(e,t){switch(t.tagID){case X.HTML:fw(e,t);break;case X.BODY:e._insertElement(t,Vx.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_BODY;break;case X.FRAMESET:e._insertElement(t,Vx.HTML),e.insertionMode=Q.IN_FRAMESET;break;case X.BASE:case X.BASEFONT:case X.BGSOUND:case X.LINK:case X.META:case X.NOFRAMES:case X.SCRIPT:case X.STYLE:case X.TEMPLATE:case X.TITLE:e._err(t,J.abandonedHeadElementChild),e.openElements.push(e.headElement,X.HEAD),xC(e,t),e.openElements.remove(e.headElement);break;case X.HEAD:e._err(t,J.misplacedStartTagForHeadElement);break;default:AC(e,t)}}function kC(e,t){switch(t.tagID){case X.BODY:case X.HTML:case X.BR:AC(e,t);break;case X.TEMPLATE:CC(e,t);break;default:e._err(t,J.endTagWithoutMatchingOpenElement)}}function AC(e,t){e._insertFakeElement(Y.BODY,X.BODY),e.insertionMode=Q.IN_BODY,jC(e,t)}function jC(e,t){switch(t.type){case Tx.CHARACTER:NC(e,t);break;case Tx.WHITESPACE_CHARACTER:MC(e,t);break;case Tx.COMMENT:lC(e,t);break;case Tx.START_TAG:fw(e,t);break;case Tx.END_TAG:ww(e,t);break;case Tx.EOF:Tw(e,t)}}function MC(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function NC(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function PC(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function FC(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function IC(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,Vx.HTML),e.insertionMode=Q.IN_FRAMESET)}function LC(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,Vx.HTML)}function RC(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Jx.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,Vx.HTML)}function zC(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,Vx.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function BC(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,Vx.HTML),n||(e.formElement=e.openElements.current))}function VC(e,t){e.framesetOk=!1;let n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let r=e.openElements.tagIDs[t];if(n===X.LI&&r===X.LI||(n===X.DD||n===X.DT)&&(r===X.DD||r===X.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==X.ADDRESS&&r!==X.DIV&&r!==X.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,Vx.HTML)}function HC(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,Vx.HTML),e.tokenizer.state=Yx.PLAINTEXT}function UC(e,t){e.openElements.hasInScope(X.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(X.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,Vx.HTML),e.framesetOk=!1}function WC(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(Y.A);n&&(cC(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,Vx.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function GC(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Vx.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function KC(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(X.NOBR)&&(cC(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,Vx.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function qC(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Vx.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function JC(e,t){e.treeAdapter.getDocumentMode(e.document)!==Ux.QUIRKS&&e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,Vx.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_TABLE}function YC(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,Vx.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function XC(e){let t=Ex(e,Hx.TYPE);return t!=null&&t.toLowerCase()===YS}function ZC(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,Vx.HTML),XC(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function QC(e,t){e._appendElement(t,Vx.HTML),t.ackSelfClosing=!0}function $C(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._appendElement(t,Vx.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function ew(e,t){t.tagName=Y.IMG,t.tagID=X.IMG,YC(e,t)}function tw(e,t){e._insertElement(t,Vx.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Yx.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Q.TEXT}function nw(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Yx.RAWTEXT)}function rw(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Yx.RAWTEXT)}function iw(e,t){e._switchToTextParsing(t,Yx.RAWTEXT)}function aw(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Vx.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Q.IN_TABLE||e.insertionMode===Q.IN_CAPTION||e.insertionMode===Q.IN_TABLE_BODY||e.insertionMode===Q.IN_ROW||e.insertionMode===Q.IN_CELL?Q.IN_SELECT_IN_TABLE:Q.IN_SELECT}function ow(e,t){e.openElements.currentTagId===X.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,Vx.HTML)}function sw(e,t){e.openElements.hasInScope(X.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,Vx.HTML)}function cw(e,t){e.openElements.hasInScope(X.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(X.RTC),e._insertElement(t,Vx.HTML)}function lw(e,t){e._reconstructActiveFormattingElements(),HS(t),WS(t),t.selfClosing?e._appendElement(t,Vx.MATHML):e._insertElement(t,Vx.MATHML),t.ackSelfClosing=!0}function uw(e,t){e._reconstructActiveFormattingElements(),US(t),WS(t),t.selfClosing?e._appendElement(t,Vx.SVG):e._insertElement(t,Vx.SVG),t.ackSelfClosing=!0}function dw(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Vx.HTML)}function fw(e,t){switch(t.tagID){case X.I:case X.S:case X.B:case X.U:case X.EM:case X.TT:case X.BIG:case X.CODE:case X.FONT:case X.SMALL:case X.STRIKE:case X.STRONG:GC(e,t);break;case X.A:WC(e,t);break;case X.H1:case X.H2:case X.H3:case X.H4:case X.H5:case X.H6:RC(e,t);break;case X.P:case X.DL:case X.OL:case X.UL:case X.DIV:case X.DIR:case X.NAV:case X.MAIN:case X.MENU:case X.ASIDE:case X.CENTER:case X.FIGURE:case X.FOOTER:case X.HEADER:case X.HGROUP:case X.DIALOG:case X.DETAILS:case X.ADDRESS:case X.ARTICLE:case X.SEARCH:case X.SECTION:case X.SUMMARY:case X.FIELDSET:case X.BLOCKQUOTE:case X.FIGCAPTION:LC(e,t);break;case X.LI:case X.DD:case X.DT:VC(e,t);break;case X.BR:case X.IMG:case X.WBR:case X.AREA:case X.EMBED:case X.KEYGEN:YC(e,t);break;case X.HR:$C(e,t);break;case X.RB:case X.RTC:sw(e,t);break;case X.RT:case X.RP:cw(e,t);break;case X.PRE:case X.LISTING:zC(e,t);break;case X.XMP:nw(e,t);break;case X.SVG:uw(e,t);break;case X.HTML:PC(e,t);break;case X.BASE:case X.LINK:case X.META:case X.STYLE:case X.TITLE:case X.SCRIPT:case X.BGSOUND:case X.BASEFONT:case X.TEMPLATE:xC(e,t);break;case X.BODY:FC(e,t);break;case X.FORM:BC(e,t);break;case X.NOBR:KC(e,t);break;case X.MATH:lw(e,t);break;case X.TABLE:JC(e,t);break;case X.INPUT:ZC(e,t);break;case X.PARAM:case X.TRACK:case X.SOURCE:QC(e,t);break;case X.IMAGE:ew(e,t);break;case X.BUTTON:UC(e,t);break;case X.APPLET:case X.OBJECT:case X.MARQUEE:qC(e,t);break;case X.IFRAME:rw(e,t);break;case X.SELECT:aw(e,t);break;case X.OPTION:case X.OPTGROUP:ow(e,t);break;case X.NOEMBED:case X.NOFRAMES:iw(e,t);break;case X.FRAMESET:IC(e,t);break;case X.TEXTAREA:tw(e,t);break;case X.NOSCRIPT:e.options.scriptingEnabled?iw(e,t):dw(e,t);break;case X.PLAINTEXT:HC(e,t);break;case X.COL:case X.TH:case X.TD:case X.TR:case X.HEAD:case X.FRAME:case X.TBODY:case X.TFOOT:case X.THEAD:case X.CAPTION:case X.COLGROUP:break;default:dw(e,t)}}function pw(e,t){if(e.openElements.hasInScope(X.BODY)&&(e.insertionMode=Q.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function mw(e,t){e.openElements.hasInScope(X.BODY)&&(e.insertionMode=Q.AFTER_BODY,lT(e,t))}function hw(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function gw(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(X.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(X.FORM):n&&e.openElements.remove(n))}function _w(e){e.openElements.hasInButtonScope(X.P)||e._insertFakeElement(Y.P,X.P),e._closePElement()}function vw(e){e.openElements.hasInListItemScope(X.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(X.LI),e.openElements.popUntilTagNamePopped(X.LI))}function yw(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function bw(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function xw(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function Sw(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(Y.BR,X.BR),e.openElements.pop(),e.framesetOk=!1}function Cw(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==X.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,a))break}}function ww(e,t){switch(t.tagID){case X.A:case X.B:case X.I:case X.S:case X.U:case X.EM:case X.TT:case X.BIG:case X.CODE:case X.FONT:case X.NOBR:case X.SMALL:case X.STRIKE:case X.STRONG:cC(e,t);break;case X.P:_w(e);break;case X.DL:case X.UL:case X.OL:case X.DIR:case X.DIV:case X.NAV:case X.PRE:case X.MAIN:case X.MENU:case X.ASIDE:case X.BUTTON:case X.CENTER:case X.FIGURE:case X.FOOTER:case X.HEADER:case X.HGROUP:case X.DIALOG:case X.ADDRESS:case X.ARTICLE:case X.DETAILS:case X.SEARCH:case X.SECTION:case X.SUMMARY:case X.LISTING:case X.FIELDSET:case X.BLOCKQUOTE:case X.FIGCAPTION:hw(e,t);break;case X.LI:vw(e);break;case X.DD:case X.DT:yw(e,t);break;case X.H1:case X.H2:case X.H3:case X.H4:case X.H5:case X.H6:bw(e);break;case X.BR:Sw(e);break;case X.BODY:pw(e,t);break;case X.HTML:mw(e,t);break;case X.FORM:gw(e);break;case X.APPLET:case X.OBJECT:case X.MARQUEE:xw(e,t);break;case X.TEMPLATE:CC(e,t);break;default:Cw(e,t)}}function Tw(e,t){e.tmplInsertionModeStack.length>0?sT(e,t):fC(e,t)}function Ew(e,t){var n;t.tagID===X.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Dw(e,t){e._err(t,J.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Ow(e,t){if(e.openElements.currentTagId!==void 0&&$S.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Q.IN_TABLE_TEXT,t.type){case Tx.CHARACTER:Vw(e,t);break;case Tx.WHITESPACE_CHARACTER:Bw(e,t)}else zw(e,t)}function kw(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,Vx.HTML),e.insertionMode=Q.IN_CAPTION}function Aw(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,Vx.HTML),e.insertionMode=Q.IN_COLUMN_GROUP}function jw(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Y.COLGROUP,X.COLGROUP),e.insertionMode=Q.IN_COLUMN_GROUP,Kw(e,t)}function Mw(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,Vx.HTML),e.insertionMode=Q.IN_TABLE_BODY}function Nw(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Y.TBODY,X.TBODY),e.insertionMode=Q.IN_TABLE_BODY,Yw(e,t)}function Pw(e,t){e.openElements.hasInTableScope(X.TABLE)&&(e.openElements.popUntilTagNamePopped(X.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function Fw(e,t){XC(t)?e._appendElement(t,Vx.HTML):zw(e,t),t.ackSelfClosing=!0}function Iw(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,Vx.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Lw(e,t){switch(t.tagID){case X.TD:case X.TH:case X.TR:Nw(e,t);break;case X.STYLE:case X.SCRIPT:case X.TEMPLATE:xC(e,t);break;case X.COL:jw(e,t);break;case X.FORM:Iw(e,t);break;case X.TABLE:Pw(e,t);break;case X.TBODY:case X.TFOOT:case X.THEAD:Mw(e,t);break;case X.INPUT:Fw(e,t);break;case X.CAPTION:kw(e,t);break;case X.COLGROUP:Aw(e,t);break;default:zw(e,t)}}function Rw(e,t){switch(t.tagID){case X.TABLE:e.openElements.hasInTableScope(X.TABLE)&&(e.openElements.popUntilTagNamePopped(X.TABLE),e._resetInsertionMode());break;case X.TEMPLATE:CC(e,t);break;case X.BODY:case X.CAPTION:case X.COL:case X.COLGROUP:case X.HTML:case X.TBODY:case X.TD:case X.TFOOT:case X.TH:case X.THEAD:case X.TR:break;default:zw(e,t)}}function zw(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,jC(e,t),e.fosterParentingEnabled=n}function Bw(e,t){e.pendingCharacterTokens.push(t)}function Vw(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Hw(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===X.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===X.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===X.OPTGROUP&&e.openElements.pop();break;case X.OPTION:e.openElements.currentTagId===X.OPTION&&e.openElements.pop();break;case X.SELECT:e.openElements.hasInSelectScope(X.SELECT)&&(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode());break;case X.TEMPLATE:CC(e,t)}}function rT(e,t){let n=t.tagID;n===X.CAPTION||n===X.TABLE||n===X.TBODY||n===X.TFOOT||n===X.THEAD||n===X.TR||n===X.TD||n===X.TH?(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode(),e._processStartTag(t)):tT(e,t)}function iT(e,t){let n=t.tagID;n===X.CAPTION||n===X.TABLE||n===X.TBODY||n===X.TFOOT||n===X.THEAD||n===X.TR||n===X.TD||n===X.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode(),e.onEndTag(t)):nT(e,t)}function aT(e,t){switch(t.tagID){case X.BASE:case X.BASEFONT:case X.BGSOUND:case X.LINK:case X.META:case X.NOFRAMES:case X.SCRIPT:case X.STYLE:case X.TEMPLATE:case X.TITLE:xC(e,t);break;case X.CAPTION:case X.COLGROUP:case X.TBODY:case X.TFOOT:case X.THEAD:e.tmplInsertionModeStack[0]=Q.IN_TABLE,e.insertionMode=Q.IN_TABLE,Lw(e,t);break;case X.COL:e.tmplInsertionModeStack[0]=Q.IN_COLUMN_GROUP,e.insertionMode=Q.IN_COLUMN_GROUP,Kw(e,t);break;case X.TR:e.tmplInsertionModeStack[0]=Q.IN_TABLE_BODY,e.insertionMode=Q.IN_TABLE_BODY,Yw(e,t);break;case X.TD:case X.TH:e.tmplInsertionModeStack[0]=Q.IN_ROW,e.insertionMode=Q.IN_ROW,Zw(e,t);break;default:e.tmplInsertionModeStack[0]=Q.IN_BODY,e.insertionMode=Q.IN_BODY,fw(e,t)}}function oT(e,t){t.tagID===X.TEMPLATE&&CC(e,t)}function sT(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(X.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):fC(e,t)}function cT(e,t){t.tagID===X.HTML?fw(e,t):uT(e,t)}function lT(e,t){if(t.tagID===X.HTML){if(e.fragmentContext||(e.insertionMode=Q.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===X.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!e.treeAdapter.getNodeSourceCodeLocation(n)?.endTag&&e._setEndLocation(n,t)}}else uT(e,t)}function uT(e,t){e.insertionMode=Q.IN_BODY,jC(e,t)}function dT(e,t){switch(t.tagID){case X.HTML:fw(e,t);break;case X.FRAMESET:e._insertElement(t,Vx.HTML);break;case X.FRAME:e._appendElement(t,Vx.HTML),t.ackSelfClosing=!0;break;case X.NOFRAMES:xC(e,t)}}function fT(e,t){t.tagID===X.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==X.FRAMESET&&(e.insertionMode=Q.AFTER_FRAMESET))}function pT(e,t){switch(t.tagID){case X.HTML:fw(e,t);break;case X.NOFRAMES:xC(e,t)}}function mT(e,t){t.tagID===X.HTML&&(e.insertionMode=Q.AFTER_AFTER_FRAMESET)}function hT(e,t){t.tagID===X.HTML?fw(e,t):gT(e,t)}function gT(e,t){e.insertionMode=Q.IN_BODY,jC(e,t)}function _T(e,t){switch(t.tagID){case X.HTML:fw(e,t);break;case X.NOFRAMES:xC(e,t)}}function vT(e,t){t.chars=`�`,e._insertCharacters(t)}function yT(e,t){e._insertCharacters(t),e.framesetOk=!1}function bT(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==Vx.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function xT(e,t){if(VS(t))bT(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===Vx.MATHML?HS(t):r===Vx.SVG&&(GS(t),US(t)),WS(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function ST(e,t){if(t.tagID===X.P||t.tagID===X.BR){bT(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===Vx.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}Y.AREA,Y.BASE,Y.BASEFONT,Y.BGSOUND,Y.BR,Y.COL,Y.EMBED,Y.FRAME,Y.HR,Y.IMG,Y.INPUT,Y.KEYGEN,Y.LINK,Y.META,Y.PARAM,Y.SOURCE,Y.TRACK,Y.WBR;var CT=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,wT=new Set([`mdxFlowExpression`,`mdxJsxFlowElement`,`mdxJsxTextElement`,`mdxTextExpression`,`mdxjsEsm`]),TT={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function ET(e,t){let n=BT(e),r=tx(`type`,{handlers:{root:OT,element:kT,text:AT,comment:NT,doctype:jT,raw:PT},unknown:FT}),i={parser:n?new tC(TT):tC.getFragmentParser(void 0,TT),handle(e){r(e,i)},stitches:!1,options:t||{}};r(e,i),IT(i,Fm());let a=Kb(n?i.parser.document:i.parser.getFragment(),{file:i.options.file});return i.stitches&&Ey(a,`comment`,function(e,t,n){let r=e;if(r.value.stitch&&n&&t!==void 0){let e=n.children;return e[t]=r.value.stitch,t}}),a.type===`root`&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function DT(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);let n={type:Tx.CHARACTER,chars:e.value,location:VT(e)};IT(t,Fm(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function jT(e,t){let n={type:Tx.DOCTYPE,name:`html`,forceQuirks:!1,publicId:``,systemId:``,location:VT(e)};IT(t,Fm(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function MT(e,t){t.stitches=!0;let n=HT(e);`children`in e&&`children`in n&&(n.children=ET({type:`root`,children:e.children},t.options).children),NT({type:`comment`,value:{stitch:n}},t)}function NT(e,t){let n=e.value,r={type:Tx.COMMENT,data:n,location:VT(e)};IT(t,Fm(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function PT(e,t){if(t.parser.tokenizer.preprocessor.html=``,t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,LT(t,Fm(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(CT,`<$1$2`):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;let e=t.parser.tokenizer._consume();t.parser.tokenizer._callState(e)}}function FT(e,t){let n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))MT(n,t);else{let e=``;throw wT.has(n.type)&&(e=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),Error("Cannot compile `"+n.type+"` node"+e)}}function IT(e,t){LT(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=Yx.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:``,value:``}}function LT(e,t){if(t&&t.offset!==void 0){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function RT(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===Yx.PLAINTEXT)return;IT(t,Fm(e));let r=t.parser.openElements.current,i=`namespaceURI`in r?r.namespaceURI:Ub.html;i===Ub.html&&n===`svg`&&(i=Ub.svg);let a=ax({...e,children:[]},{space:i===Ub.svg?`svg`:`html`}),o={type:Tx.START_TAG,tagName:n,tagID:Gx(n),selfClosing:!1,ackSelfClosing:!1,attrs:`attrs`in a?a.attrs:[],location:VT(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function zT(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&hx.includes(n)||t.parser.tokenizer.state===Yx.PLAINTEXT)return;IT(t,Pm(e));let r={type:Tx.END_TAG,tagName:n,tagID:Gx(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:VT(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===Yx.RCDATA||t.parser.tokenizer.state===Yx.RAWTEXT||t.parser.tokenizer.state===Yx.SCRIPT_DATA)&&(t.parser.tokenizer.state=Yx.DATA)}function BT(e){let t=e.type===`root`?e.children[0]:e;return!!(t&&(t.type===`doctype`||t.type===`element`&&t.tagName.toLowerCase()===`html`))}function VT(e){let t=Fm(e)||{line:void 0,column:void 0,offset:void 0},n=Pm(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function HT(e){return`children`in e?dy({...e,children:[]}):dy(e)}function UT(e){return function(t,n){return ET(t,{...e,file:n})}}var WT=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],GT={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...WT,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...WT],h2:[[`className`,`sr-only`]],img:[...WT,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...WT,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...WT],table:[...WT],ul:[...WT,[`className`,`contains-task-list`]],"*":`abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width`.split(`.`)},clobber:[`ariaDescribedBy`,`ariaLabelledBy`,`id`,`name`],clobberPrefix:`user-content-`,protocols:{cite:[`http`,`https`],href:[`http`,`https`,`irc`,`ircs`,`mailto`,`xmpp`],longDesc:[`http`,`https`],src:[`http`,`https`]},required:{input:{disabled:!0,type:`checkbox`}},strip:[`script`],tagNames:`a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var`.split(`.`)},KT={}.hasOwnProperty;function qT(e,t){let n={type:`root`,children:[]},r=JT({schema:t?{...GT,...t}:GT,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function JT(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return YT(e,n);case`doctype`:return XT(e,n);case`element`:return ZT(e,n);case`root`:return QT(e,n);case`text`:return $T(e,n)}}}function YT(e,t){if(e.schema.allowComments){let e=typeof t.value==`string`?t.value:``,n=e.indexOf(`-->`),r={type:`comment`,value:n<0?e:e.slice(0,n)};return oE(r,t),r}}function XT(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return oE(e,t),e}}function ZT(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=eE(e,t.children),i=tE(e,t.properties);e.stack.pop();let a=!1;if(n&&n!==`*`&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&KT.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(a=!1;++r1){let e=!1,n=0;for(;++n-1&&a>c||o>-1&&a>o||s>-1&&a>s)return!0;let l=-1;for(;++l4&&t.slice(0,4).toLowerCase()===`data`)return n}function cE(e){return function(t){return qT(t,e)}}function lE(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function uE(e,t,n){let r=hy((n||{}).ignore||[]),i=dE(t),a=-1;for(;++a0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=_E(e,`(`),a=_E(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function NE(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Wh(n)||Uh(n))&&(!t||n!==47)}UE.peek=HE;function PE(){this.buffer()}function FE(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function IE(){this.buffer()}function LE(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function RE(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Mh(this.sliceSerialize(e)).toLowerCase(),n.label=t}function zE(e){this.exit(e)}function BE(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Mh(this.sliceSerialize(e)).toLowerCase(),n.label=t}function VE(e){this.exit(e)}function HE(){return`[`}function UE(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function WE(){return{enter:{gfmFootnoteCallString:PE,gfmFootnoteCall:FE,gfmFootnoteDefinitionLabelString:IE,gfmFootnoteDefinition:LE},exit:{gfmFootnoteCallString:RE,gfmFootnoteCall:zE,gfmFootnoteDefinitionLabelString:BE,gfmFootnoteDefinition:VE}}}function GE(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:UE},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?` -`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?qE:KE))),s(),o}}function KE(e,t,n){return t===0?e:qE(e,t,n)}function qE(e,t,n){return(n?``:` `)+e}var JE=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];$E.peek=eD;function YE(){return{canContainEols:[`delete`],enter:{strikethrough:ZE},exit:{strikethrough:QE}}}function XE(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:JE}],handlers:{delete:$E}}}function ZE(e){this.enter({type:`delete`,children:[]},e)}function QE(e){this.exit(e)}function $E(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function eD(){return`~`}function tD(e){return e.length}function nD(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||tD,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++ul&&(l=e[u].length);++ac[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++dc[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),oD);return i(),o}function oD(e,t,n){return`>`+(n?``:` `)+e}function sD(e,t){return cD(e,t.inConstruct,!0)&&!cD(e,t.notInConstruct,!1)}function cD(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ro&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function dD(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function fD(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function pD(e,t,n,r){let i=fD(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(dD(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,mD);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(uD(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:` +`}),n}function zy(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function By(e,t){let n=Py(e,t),r=n.one(e,void 0),i=yy(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:` +`},i)),a}function Vy(e,t){return e&&`run`in e?async function(n,r){let i=By(n,{file:r,...t});await e.run(i,r)}:function(n,r){return By(n,{file:r,...e||t})}}function Hy(e){if(e)throw e}var Uy=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});ft.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var qy={basename:Jy,dirname:Yy,extname:Xy,join:Zy,sep:`/`};function Jy(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);eb(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function Yy(e){if(eb(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function Xy(e){eb(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function Zy(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function $y(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function eb(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var tb={cwd:nb};function nb(){return`/`}function rb(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function ib(e){if(typeof e==`string`)e=new URL(e);else if(!rb(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return ab(e)}function ab(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n0){let[r,...a]=t,o=n[i][1];Wy(o)&&Wy(r)&&(r=(0,pb.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function gb(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function _b(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function vb(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function yb(e){if(!Wy(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function bb(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function xb(e){return Sb(e)?e:new sb(e)}function Sb(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Cb(e){return typeof e==`string`||wb(e)}function wb(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Tb=[],Eb={allowDangerousHtml:!0},Db=/^(https?|ircs?|mailto|xmpp)$/i,Ob=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function kb(e){let t=Ab(e),n=jb(e);return Mb(t.runSync(t.parse(n),n),e)}function Ab(e){let t=e.rehypePlugins||Tb,n=e.remarkPlugins||Tb,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Eb}:Eb;return hb().use(wv).use(n).use(Vy,r).use(t)}function jb(e){let t=e.children||``,n=new sb;return typeof t==`string`?n.value=t:``+t,n}function Mb(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Nb;for(let e of Ob)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return jy(e,l),eh(e,{Fragment:K.Fragment,components:i,ignoreInvalidStyle:!0,jsx:K.jsx,jsxs:K.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Sh)if(Object.hasOwn(Sh,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Sh[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Nb(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Db.test(e.slice(0,t))?e:``}var Pb=/[#.]/g;function Fb(e,t){let n=e||``,r={},i=0,a,o;for(;i-1&&e<=t.length){let r=0;for(;;){let i=n[r];if(i===void 0){let e=qb(t,n[r-1]);i=e===-1?t.length+1:e+1,n[r]=i}if(i>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}function i(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length1?n[e.line-2]:0)+e.column-1;if(r=55296&&e<=57343}function wx(e){return e>=56320&&e<=57343}function Tx(e,t){return(e-55296)*1024+9216+t}function Ex(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function Dx(e){return e>=64976&&e<=65007||xx.has(e)}var J;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(J||={});var Ox=65536,kx=class{constructor(e){this.handler=e,this.html=``,this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=Ox,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,a=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(wx(t))return this.pos++,this._addGap(),Tx(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,q.EOF;return this._err(J.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,q.EOF;let n=this.html.charCodeAt(t);return n===q.CARRIAGE_RETURN?q.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,q.EOF;let e=this.html.charCodeAt(this.pos);return e===q.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,q.LINE_FEED):e===q.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Cx(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===q.LINE_FEED||e===q.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){Ex(e)?this._err(J.controlCharacterInInputStream):Dx(e)&&this._err(J.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var Mx=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),Nx=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);String.fromCodePoint;function Px(e){return e>=55296&&e<=57343||e>1114111?65533:Nx.get(e)??e}var Fx;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(Fx||={});var Ix=32,Lx;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(Lx||={});function Rx(e){return e>=Fx.ZERO&&e<=Fx.NINE}function zx(e){return e>=Fx.UPPER_A&&e<=Fx.UPPER_F||e>=Fx.LOWER_A&&e<=Fx.LOWER_F}function Bx(e){return e>=Fx.UPPER_A&&e<=Fx.UPPER_Z||e>=Fx.LOWER_A&&e<=Fx.LOWER_Z||Rx(e)}function Vx(e){return e===Fx.EQUALS||Bx(e)}var Hx;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(Hx||={});var Ux;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(Ux||={});var Wx=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=Hx.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Ux.Strict}startEntity(e){this.decodeMode=e,this.state=Hx.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case Hx.EntityStart:return e.charCodeAt(t)===Fx.NUM?(this.state=Hx.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=Hx.NamedEntity,this.stateNamedEntity(e,t));case Hx.NumericStart:return this.stateNumericStart(e,t);case Hx.NumericDecimal:return this.stateNumericDecimal(e,t);case Hx.NumericHex:return this.stateNumericHex(e,t);case Hx.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|Ix)===Fx.LOWER_X?(this.state=Hx.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=Hx.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+Number.parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t>14;for(;t>14,i!==0){if(a===Fx.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Ux.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&Lx.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~Lx.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case Hx.NamedEntity:return this.result!==0&&(this.decodeMode!==Ux.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Hx.NumericDecimal:return this.emitNumericEntity(0,2);case Hx.NumericHex:return this.emitNumericEntity(0,3);case Hx.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Hx.EntityStart:return 0}}};function Gx(e,t,n,r){let i=(t&Lx.BRANCH_LENGTH)>>7,a=t&Lx.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(nr)s=t-1;else return e[t+i]}return-1}var Kx;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(Kx||={});var qx;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(qx||={});var Jx;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(Jx||={});var Y;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(Y||={});var X;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(X||={});var Yx=new Map([[Y.A,X.A],[Y.ADDRESS,X.ADDRESS],[Y.ANNOTATION_XML,X.ANNOTATION_XML],[Y.APPLET,X.APPLET],[Y.AREA,X.AREA],[Y.ARTICLE,X.ARTICLE],[Y.ASIDE,X.ASIDE],[Y.B,X.B],[Y.BASE,X.BASE],[Y.BASEFONT,X.BASEFONT],[Y.BGSOUND,X.BGSOUND],[Y.BIG,X.BIG],[Y.BLOCKQUOTE,X.BLOCKQUOTE],[Y.BODY,X.BODY],[Y.BR,X.BR],[Y.BUTTON,X.BUTTON],[Y.CAPTION,X.CAPTION],[Y.CENTER,X.CENTER],[Y.CODE,X.CODE],[Y.COL,X.COL],[Y.COLGROUP,X.COLGROUP],[Y.DD,X.DD],[Y.DESC,X.DESC],[Y.DETAILS,X.DETAILS],[Y.DIALOG,X.DIALOG],[Y.DIR,X.DIR],[Y.DIV,X.DIV],[Y.DL,X.DL],[Y.DT,X.DT],[Y.EM,X.EM],[Y.EMBED,X.EMBED],[Y.FIELDSET,X.FIELDSET],[Y.FIGCAPTION,X.FIGCAPTION],[Y.FIGURE,X.FIGURE],[Y.FONT,X.FONT],[Y.FOOTER,X.FOOTER],[Y.FOREIGN_OBJECT,X.FOREIGN_OBJECT],[Y.FORM,X.FORM],[Y.FRAME,X.FRAME],[Y.FRAMESET,X.FRAMESET],[Y.H1,X.H1],[Y.H2,X.H2],[Y.H3,X.H3],[Y.H4,X.H4],[Y.H5,X.H5],[Y.H6,X.H6],[Y.HEAD,X.HEAD],[Y.HEADER,X.HEADER],[Y.HGROUP,X.HGROUP],[Y.HR,X.HR],[Y.HTML,X.HTML],[Y.I,X.I],[Y.IMG,X.IMG],[Y.IMAGE,X.IMAGE],[Y.INPUT,X.INPUT],[Y.IFRAME,X.IFRAME],[Y.KEYGEN,X.KEYGEN],[Y.LABEL,X.LABEL],[Y.LI,X.LI],[Y.LINK,X.LINK],[Y.LISTING,X.LISTING],[Y.MAIN,X.MAIN],[Y.MALIGNMARK,X.MALIGNMARK],[Y.MARQUEE,X.MARQUEE],[Y.MATH,X.MATH],[Y.MENU,X.MENU],[Y.META,X.META],[Y.MGLYPH,X.MGLYPH],[Y.MI,X.MI],[Y.MO,X.MO],[Y.MN,X.MN],[Y.MS,X.MS],[Y.MTEXT,X.MTEXT],[Y.NAV,X.NAV],[Y.NOBR,X.NOBR],[Y.NOFRAMES,X.NOFRAMES],[Y.NOEMBED,X.NOEMBED],[Y.NOSCRIPT,X.NOSCRIPT],[Y.OBJECT,X.OBJECT],[Y.OL,X.OL],[Y.OPTGROUP,X.OPTGROUP],[Y.OPTION,X.OPTION],[Y.P,X.P],[Y.PARAM,X.PARAM],[Y.PLAINTEXT,X.PLAINTEXT],[Y.PRE,X.PRE],[Y.RB,X.RB],[Y.RP,X.RP],[Y.RT,X.RT],[Y.RTC,X.RTC],[Y.RUBY,X.RUBY],[Y.S,X.S],[Y.SCRIPT,X.SCRIPT],[Y.SEARCH,X.SEARCH],[Y.SECTION,X.SECTION],[Y.SELECT,X.SELECT],[Y.SOURCE,X.SOURCE],[Y.SMALL,X.SMALL],[Y.SPAN,X.SPAN],[Y.STRIKE,X.STRIKE],[Y.STRONG,X.STRONG],[Y.STYLE,X.STYLE],[Y.SUB,X.SUB],[Y.SUMMARY,X.SUMMARY],[Y.SUP,X.SUP],[Y.TABLE,X.TABLE],[Y.TBODY,X.TBODY],[Y.TEMPLATE,X.TEMPLATE],[Y.TEXTAREA,X.TEXTAREA],[Y.TFOOT,X.TFOOT],[Y.TD,X.TD],[Y.TH,X.TH],[Y.THEAD,X.THEAD],[Y.TITLE,X.TITLE],[Y.TR,X.TR],[Y.TRACK,X.TRACK],[Y.TT,X.TT],[Y.U,X.U],[Y.UL,X.UL],[Y.SVG,X.SVG],[Y.VAR,X.VAR],[Y.WBR,X.WBR],[Y.XMP,X.XMP]]);function Xx(e){return Yx.get(e)??X.UNKNOWN}var Zx=X,Qx={[Kx.HTML]:new Set([Zx.ADDRESS,Zx.APPLET,Zx.AREA,Zx.ARTICLE,Zx.ASIDE,Zx.BASE,Zx.BASEFONT,Zx.BGSOUND,Zx.BLOCKQUOTE,Zx.BODY,Zx.BR,Zx.BUTTON,Zx.CAPTION,Zx.CENTER,Zx.COL,Zx.COLGROUP,Zx.DD,Zx.DETAILS,Zx.DIR,Zx.DIV,Zx.DL,Zx.DT,Zx.EMBED,Zx.FIELDSET,Zx.FIGCAPTION,Zx.FIGURE,Zx.FOOTER,Zx.FORM,Zx.FRAME,Zx.FRAMESET,Zx.H1,Zx.H2,Zx.H3,Zx.H4,Zx.H5,Zx.H6,Zx.HEAD,Zx.HEADER,Zx.HGROUP,Zx.HR,Zx.HTML,Zx.IFRAME,Zx.IMG,Zx.INPUT,Zx.LI,Zx.LINK,Zx.LISTING,Zx.MAIN,Zx.MARQUEE,Zx.MENU,Zx.META,Zx.NAV,Zx.NOEMBED,Zx.NOFRAMES,Zx.NOSCRIPT,Zx.OBJECT,Zx.OL,Zx.P,Zx.PARAM,Zx.PLAINTEXT,Zx.PRE,Zx.SCRIPT,Zx.SECTION,Zx.SELECT,Zx.SOURCE,Zx.STYLE,Zx.SUMMARY,Zx.TABLE,Zx.TBODY,Zx.TD,Zx.TEMPLATE,Zx.TEXTAREA,Zx.TFOOT,Zx.TH,Zx.THEAD,Zx.TITLE,Zx.TR,Zx.TRACK,Zx.UL,Zx.WBR,Zx.XMP]),[Kx.MATHML]:new Set([Zx.MI,Zx.MO,Zx.MN,Zx.MS,Zx.MTEXT,Zx.ANNOTATION_XML]),[Kx.SVG]:new Set([Zx.TITLE,Zx.FOREIGN_OBJECT,Zx.DESC]),[Kx.XLINK]:new Set,[Kx.XML]:new Set,[Kx.XMLNS]:new Set},$x=new Set([Zx.H1,Zx.H2,Zx.H3,Zx.H4,Zx.H5,Zx.H6]);Y.STYLE,Y.SCRIPT,Y.XMP,Y.IFRAME,Y.NOEMBED,Y.NOFRAMES,Y.PLAINTEXT;var Z;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(Z||={});var eS={DATA:Z.DATA,RCDATA:Z.RCDATA,RAWTEXT:Z.RAWTEXT,SCRIPT_DATA:Z.SCRIPT_DATA,PLAINTEXT:Z.PLAINTEXT,CDATA_SECTION:Z.CDATA_SECTION};function tS(e){return e>=q.DIGIT_0&&e<=q.DIGIT_9}function nS(e){return e>=q.LATIN_CAPITAL_A&&e<=q.LATIN_CAPITAL_Z}function rS(e){return e>=q.LATIN_SMALL_A&&e<=q.LATIN_SMALL_Z}function iS(e){return rS(e)||nS(e)}function aS(e){return iS(e)||tS(e)}function oS(e){return e+32}function sS(e){return e===q.SPACE||e===q.LINE_FEED||e===q.TABULATION||e===q.FORM_FEED}function cS(e){return sS(e)||e===q.SOLIDUS||e===q.GREATER_THAN_SIGN}function lS(e){return e===q.NULL?J.nullCharacterReference:e>1114111?J.characterReferenceOutsideUnicodeRange:Cx(e)?J.surrogateCharacterReference:Dx(e)?J.noncharacterCharacterReference:Ex(e)||e===q.CARRIAGE_RETURN?J.controlCharacterReference:null}var uS=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName=``,this.active=!1,this.state=Z.DATA,this.returnState=Z.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new kx(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Wx(Mx,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(J.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(J.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=lS(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;(r=(n=this.handler).onParseError)==null||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||n?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t0&&this._err(J.endTagWithAttributes),e.selfClosing&&this._err(J.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case Ax.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case Ax.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case Ax.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken)}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:Ax.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,t)}_emitCodePoint(e){let t=sS(e)?Ax.WHITESPACE_CHARACTER:e===q.NULL?Ax.NULL_CHARACTER:Ax.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(Ax.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=Z.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Ux.Attribute:Ux.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case Z.DATA:this._stateData(e);break;case Z.RCDATA:this._stateRcdata(e);break;case Z.RAWTEXT:this._stateRawtext(e);break;case Z.SCRIPT_DATA:this._stateScriptData(e);break;case Z.PLAINTEXT:this._statePlaintext(e);break;case Z.TAG_OPEN:this._stateTagOpen(e);break;case Z.END_TAG_OPEN:this._stateEndTagOpen(e);break;case Z.TAG_NAME:this._stateTagName(e);break;case Z.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case Z.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case Z.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case Z.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case Z.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case Z.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case Z.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case Z.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case Z.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case Z.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case Z.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case Z.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case Z.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case Z.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case Z.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case Z.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case Z.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case Z.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case Z.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case Z.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case Z.BOGUS_COMMENT:this._stateBogusComment(e);break;case Z.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case Z.COMMENT_START:this._stateCommentStart(e);break;case Z.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case Z.COMMENT:this._stateComment(e);break;case Z.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case Z.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case Z.COMMENT_END:this._stateCommentEnd(e);break;case Z.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case Z.DOCTYPE:this._stateDoctype(e);break;case Z.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case Z.DOCTYPE_NAME:this._stateDoctypeName(e);break;case Z.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case Z.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case Z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case Z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case Z.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case Z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case Z.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case Z.CDATA_SECTION:this._stateCdataSection(e);break;case Z.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case Z.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case Z.CHARACTER_REFERENCE:this._stateCharacterReference();break;case Z.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case q.LESS_THAN_SIGN:this.state=Z.TAG_OPEN;break;case q.AMPERSAND:this._startCharacterReference();break;case q.NULL:this._err(J.unexpectedNullCharacter),this._emitCodePoint(e);break;case q.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case q.AMPERSAND:this._startCharacterReference();break;case q.LESS_THAN_SIGN:this.state=Z.RCDATA_LESS_THAN_SIGN;break;case q.NULL:this._err(J.unexpectedNullCharacter),this._emitChars(`�`);break;case q.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case q.LESS_THAN_SIGN:this.state=Z.RAWTEXT_LESS_THAN_SIGN;break;case q.NULL:this._err(J.unexpectedNullCharacter),this._emitChars(`�`);break;case q.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case q.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_LESS_THAN_SIGN;break;case q.NULL:this._err(J.unexpectedNullCharacter),this._emitChars(`�`);break;case q.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case q.NULL:this._err(J.unexpectedNullCharacter),this._emitChars(`�`);break;case q.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(iS(e))this._createStartTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case q.EXCLAMATION_MARK:this.state=Z.MARKUP_DECLARATION_OPEN;break;case q.SOLIDUS:this.state=Z.END_TAG_OPEN;break;case q.QUESTION_MARK:this._err(J.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e);break;case q.EOF:this._err(J.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(J.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=Z.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(iS(e))this._createEndTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case q.GREATER_THAN_SIGN:this._err(J.missingEndTagName),this.state=Z.DATA;break;case q.EOF:this._err(J.eofBeforeTagName),this._emitChars(``);break;case q.NULL:this._err(J.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case q.EOF:this._err(J.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===q.SOLIDUS?this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:iS(e)?(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){iS(e)?(this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(``);break;case q.NULL:this._err(J.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case q.EOF:this._err(J.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===q.SOLIDUS?(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(Sx.SCRIPT,!1)&&cS(this.preprocessor.peek(Sx.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==Kx.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(bS,Kx.HTML)}clearBackToTableBodyContext(){this.clearBackTo(yS,Kx.HTML)}clearBackToTableRowContext(){this.clearBackTo(vS,Kx.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===X.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===X.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case Kx.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case Kx.SVG:if(_S.has(r))return!1;break;case Kx.MATHML:if(gS.has(r))return!1}}return!0}hasInScope(e){return this.hasInDynamicScope(e,pS)}hasInListItemScope(e){return this.hasInDynamicScope(e,mS)}hasInButtonScope(e){return this.hasInDynamicScope(e,hS)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case Kx.HTML:if($x.has(t))return!0;if(pS.has(t))return!1;break;case Kx.SVG:if(_S.has(t))return!1;break;case Kx.MATHML:if(gS.has(t))return!1}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Kx.HTML)switch(this.tagIDs[t]){case e:return!0;case X.TABLE:case X.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===Kx.HTML)switch(this.tagIDs[e]){case X.TBODY:case X.THEAD:case X.TFOOT:return!0;case X.TABLE:case X.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===Kx.HTML)switch(this.tagIDs[t]){case e:return!0;case X.OPTION:case X.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&dS.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&fS.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&fS.has(this.currentTagId);)this.pop()}},CS=3,wS;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(wS||={});var TS={type:wS.Marker},ES=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e[e.name,e.value])),i=0;for(let e=0;er.get(e.name)===e.value)&&(i+=1,i>=CS&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(TS)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:wS.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:wS.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(TS);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===wS.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===wS.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===wS.Element&&t.element===e)}},DS={createDocument(){return{nodeName:`#document`,mode:Jx.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>e.nodeName===`#documentType`);if(i)i.name=t,i.publicId=n,i.systemId=r;else{let i={nodeName:`#documentType`,name:t,publicId:n,systemId:r,parentNode:null};DS.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(DS.isTextNode(n)){n.value+=t;return}}DS.appendChild(e,DS.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&DS.isTextNode(r)?r.value+=t:DS.insertBefore(e,DS.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;re.startsWith(t))}function LS(e){return e.name===OS&&e.publicId===null&&(e.systemId===null||e.systemId===kS)}function RS(e){if(e.name!==OS)return Jx.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===AS)return Jx.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),NS.has(n))return Jx.QUIRKS;let e=t===null?MS:jS;if(IS(n,e))return Jx.QUIRKS;if(e=t===null?PS:FS,IS(n,e))return Jx.LIMITED_QUIRKS}return Jx.NO_QUIRKS}var zS={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},BS=`definitionurl`,VS=`definitionURL`,HS=new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),US=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:Kx.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:Kx.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:Kx.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:Kx.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:Kx.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:Kx.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:Kx.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:Kx.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:Kx.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:Kx.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:Kx.XMLNS}]]),WS=new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),GS=new Set([X.B,X.BIG,X.BLOCKQUOTE,X.BODY,X.BR,X.CENTER,X.CODE,X.DD,X.DIV,X.DL,X.DT,X.EM,X.EMBED,X.H1,X.H2,X.H3,X.H4,X.H5,X.H6,X.HEAD,X.HR,X.I,X.IMG,X.LI,X.LISTING,X.MENU,X.META,X.NOBR,X.OL,X.P,X.PRE,X.RUBY,X.S,X.SMALL,X.SPAN,X.STRONG,X.STRIKE,X.SUB,X.SUP,X.TABLE,X.TT,X.U,X.UL,X.VAR]);function KS(e){let t=e.tagID;return t===X.FONT&&e.attrs.some(({name:e})=>e===qx.COLOR||e===qx.SIZE||e===qx.FACE)||GS.has(t)}function qS(e){for(let t=0;t0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(r=(n=this.treeAdapter).onItemPop)==null||r.call(n,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===Kx.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,Kx.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Q.TEXT}switchToPlaintextParsing(){this.insertionMode=Q.TEXT,this.originalInsertionMode=Q.IN_BODY,this.tokenizer.state=eS.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===Y.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==Kx.HTML))switch(this.fragmentContextID){case X.TITLE:case X.TEXTAREA:this.tokenizer.state=eS.RCDATA;break;case X.STYLE:case X.XMP:case X.IFRAME:case X.NOEMBED:case X.NOFRAMES:case X.NOSCRIPT:this.tokenizer.state=eS.RAWTEXT;break;case X.SCRIPT:this.tokenizer.state=eS.SCRIPT_DATA;break;case X.PLAINTEXT:this.tokenizer.state=eS.PLAINTEXT}}_setDocumentType(e){let t=e.name||``,n=e.publicId||``,r=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,Kx.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,Kx.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(Y.HTML,Kx.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,X.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=r[(n?r.lastIndexOf(n):r.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===Ax.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,e.tagID===X.SVG&&this.treeAdapter.getTagName(t)===Y.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===Kx.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===X.MGLYPH||e.tagID===X.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,Kx.HTML)}_processToken(e){switch(e.type){case Ax.CHARACTER:this.onCharacter(e);break;case Ax.NULL_CHARACTER:this.onNullCharacter(e);break;case Ax.COMMENT:this.onComment(e);break;case Ax.DOCTYPE:this.onDoctype(e);break;case Ax.START_TAG:this._processStartTag(e);break;case Ax.END_TAG:this.onEndTag(e);break;case Ax.EOF:this.onEof(e);break;case Ax.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e)}}_isIntegrationPoint(e,t,n){return $S(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===wS.Marker||this.openElements.contains(e.element)),n=t===-1?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=Q.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(X.P),this.openElements.popUntilTagNamePopped(X.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case X.TR:this.insertionMode=Q.IN_ROW;return;case X.TBODY:case X.THEAD:case X.TFOOT:this.insertionMode=Q.IN_TABLE_BODY;return;case X.CAPTION:this.insertionMode=Q.IN_CAPTION;return;case X.COLGROUP:this.insertionMode=Q.IN_COLUMN_GROUP;return;case X.TABLE:this.insertionMode=Q.IN_TABLE;return;case X.BODY:this.insertionMode=Q.IN_BODY;return;case X.FRAMESET:this.insertionMode=Q.IN_FRAMESET;return;case X.SELECT:this._resetInsertionModeForSelect(e);return;case X.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case X.HTML:this.insertionMode=this.headElement?Q.AFTER_HEAD:Q.BEFORE_HEAD;return;case X.TD:case X.TH:if(e>0){this.insertionMode=Q.IN_CELL;return}break;case X.HEAD:if(e>0){this.insertionMode=Q.IN_HEAD;return}}this.insertionMode=Q.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===X.TEMPLATE)break;if(e===X.TABLE){this.insertionMode=Q.IN_SELECT_IN_TABLE;return}}this.insertionMode=Q.IN_SELECT}_isElementCausesFosterParenting(e){return iC.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case X.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===Kx.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case X.TABLE:{let n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return Qx[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){wT(this,e);return}switch(this.insertionMode){case Q.INITIAL:yC(this,e);break;case Q.BEFORE_HTML:SC(this,e);break;case Q.BEFORE_HEAD:TC(this,e);break;case Q.IN_HEAD:kC(this,e);break;case Q.IN_HEAD_NO_SCRIPT:MC(this,e);break;case Q.AFTER_HEAD:FC(this,e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:RC(this,e);break;case Q.TEXT:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:Nw(this,e);break;case Q.IN_TABLE_TEXT:Kw(this,e);break;case Q.IN_COLUMN_GROUP:$w(this,e);break;case Q.AFTER_BODY:hT(this,e);break;case Q.AFTER_AFTER_BODY:xT(this,e)}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){CT(this,e);return}switch(this.insertionMode){case Q.INITIAL:yC(this,e);break;case Q.BEFORE_HTML:SC(this,e);break;case Q.BEFORE_HEAD:TC(this,e);break;case Q.IN_HEAD:kC(this,e);break;case Q.IN_HEAD_NO_SCRIPT:MC(this,e);break;case Q.AFTER_HEAD:FC(this,e);break;case Q.TEXT:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:Nw(this,e);break;case Q.IN_COLUMN_GROUP:$w(this,e);break;case Q.AFTER_BODY:hT(this,e);break;case Q.AFTER_AFTER_BODY:xT(this,e)}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){mC(this,e);return}switch(this.insertionMode){case Q.INITIAL:case Q.BEFORE_HTML:case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_TEMPLATE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:mC(this,e);break;case Q.IN_TABLE_TEXT:qw(this,e);break;case Q.AFTER_BODY:hC(this,e);break;case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:gC(this,e)}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case Q.INITIAL:vC(this,e);break;case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:this._err(e,J.misplacedDoctype);break;case Q.IN_TABLE_TEXT:qw(this,e)}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,J.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?ET(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:yC(this,e);break;case Q.BEFORE_HTML:bC(this,e);break;case Q.BEFORE_HEAD:CC(this,e);break;case Q.IN_HEAD:EC(this,e);break;case Q.IN_HEAD_NO_SCRIPT:AC(this,e);break;case Q.AFTER_HEAD:NC(this,e);break;case Q.IN_BODY:_w(this,e);break;case Q.IN_TABLE:Hw(this,e);break;case Q.IN_TABLE_TEXT:qw(this,e);break;case Q.IN_CAPTION:Yw(this,e);break;case Q.IN_COLUMN_GROUP:Zw(this,e);break;case Q.IN_TABLE_BODY:eT(this,e);break;case Q.IN_ROW:nT(this,e);break;case Q.IN_CELL:iT(this,e);break;case Q.IN_SELECT:oT(this,e);break;case Q.IN_SELECT_IN_TABLE:cT(this,e);break;case Q.IN_TEMPLATE:uT(this,e);break;case Q.AFTER_BODY:pT(this,e);break;case Q.IN_FRAMESET:gT(this,e);break;case Q.AFTER_FRAMESET:vT(this,e);break;case Q.AFTER_AFTER_BODY:bT(this,e);break;case Q.AFTER_AFTER_FRAMESET:ST(this,e)}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?DT(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:yC(this,e);break;case Q.BEFORE_HTML:xC(this,e);break;case Q.BEFORE_HEAD:wC(this,e);break;case Q.IN_HEAD:DC(this,e);break;case Q.IN_HEAD_NO_SCRIPT:jC(this,e);break;case Q.AFTER_HEAD:PC(this,e);break;case Q.IN_BODY:kw(this,e);break;case Q.TEXT:jw(this,e);break;case Q.IN_TABLE:Uw(this,e);break;case Q.IN_TABLE_TEXT:qw(this,e);break;case Q.IN_CAPTION:Xw(this,e);break;case Q.IN_COLUMN_GROUP:Qw(this,e);break;case Q.IN_TABLE_BODY:tT(this,e);break;case Q.IN_ROW:rT(this,e);break;case Q.IN_CELL:aT(this,e);break;case Q.IN_SELECT:sT(this,e);break;case Q.IN_SELECT_IN_TABLE:lT(this,e);break;case Q.IN_TEMPLATE:dT(this,e);break;case Q.AFTER_BODY:mT(this,e);break;case Q.IN_FRAMESET:_T(this,e);break;case Q.AFTER_FRAMESET:yT(this,e);break;case Q.AFTER_AFTER_BODY:xT(this,e)}}onEof(e){switch(this.insertionMode){case Q.INITIAL:yC(this,e);break;case Q.BEFORE_HTML:SC(this,e);break;case Q.BEFORE_HEAD:TC(this,e);break;case Q.IN_HEAD:kC(this,e);break;case Q.IN_HEAD_NO_SCRIPT:MC(this,e);break;case Q.AFTER_HEAD:FC(this,e);break;case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:Aw(this,e);break;case Q.TEXT:Mw(this,e);break;case Q.IN_TABLE_TEXT:qw(this,e);break;case Q.IN_TEMPLATE:fT(this,e);break;case Q.AFTER_BODY:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:_C(this,e)}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===q.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.TEXT:case Q.IN_COLUMN_GROUP:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:this._insertCharacters(e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:case Q.AFTER_BODY:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:LC(this,e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:Nw(this,e);break;case Q.IN_TABLE_TEXT:Gw(this,e)}}};function sC(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):Ow(e,t),n}function cC(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function lC(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),s=n&&a>=nC;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=uC(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function uC(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function dC(e,t,n){let r=Xx(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===X.TEMPLATE&&i===Kx.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function fC(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function pC(e,t){for(let n=0;n=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function vC(e,t){e._setDocumentType(t);let n=t.forceQuirks?Jx.QUIRKS:RS(t);LS(t)||e._err(t,J.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Q.BEFORE_HTML}function yC(e,t){e._err(t,J.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Jx.QUIRKS),e.insertionMode=Q.BEFORE_HTML,e._processToken(t)}function bC(e,t){t.tagID===X.HTML?(e._insertElement(t,Kx.HTML),e.insertionMode=Q.BEFORE_HEAD):SC(e,t)}function xC(e,t){let n=t.tagID;(n===X.HTML||n===X.HEAD||n===X.BODY||n===X.BR)&&SC(e,t)}function SC(e,t){e._insertFakeRootElement(),e.insertionMode=Q.BEFORE_HEAD,e._processToken(t)}function CC(e,t){switch(t.tagID){case X.HTML:_w(e,t);break;case X.HEAD:e._insertElement(t,Kx.HTML),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD;break;default:TC(e,t)}}function wC(e,t){let n=t.tagID;n===X.HEAD||n===X.BODY||n===X.HTML||n===X.BR?TC(e,t):e._err(t,J.endTagWithoutMatchingOpenElement)}function TC(e,t){e._insertFakeElement(Y.HEAD,X.HEAD),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD,e._processToken(t)}function EC(e,t){switch(t.tagID){case X.HTML:_w(e,t);break;case X.BASE:case X.BASEFONT:case X.BGSOUND:case X.LINK:case X.META:e._appendElement(t,Kx.HTML),t.ackSelfClosing=!0;break;case X.TITLE:e._switchToTextParsing(t,eS.RCDATA);break;case X.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,eS.RAWTEXT):(e._insertElement(t,Kx.HTML),e.insertionMode=Q.IN_HEAD_NO_SCRIPT);break;case X.NOFRAMES:case X.STYLE:e._switchToTextParsing(t,eS.RAWTEXT);break;case X.SCRIPT:e._switchToTextParsing(t,eS.SCRIPT_DATA);break;case X.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Q.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Q.IN_TEMPLATE);break;case X.HEAD:e._err(t,J.misplacedStartTagForHeadElement);break;default:kC(e,t)}}function DC(e,t){switch(t.tagID){case X.HEAD:e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD;break;case X.BODY:case X.BR:case X.HTML:kC(e,t);break;case X.TEMPLATE:OC(e,t);break;default:e._err(t,J.endTagWithoutMatchingOpenElement)}}function OC(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==X.TEMPLATE&&e._err(t,J.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(X.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,J.endTagWithoutMatchingOpenElement)}function kC(e,t){e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD,e._processToken(t)}function AC(e,t){switch(t.tagID){case X.HTML:_w(e,t);break;case X.BASEFONT:case X.BGSOUND:case X.HEAD:case X.LINK:case X.META:case X.NOFRAMES:case X.STYLE:EC(e,t);break;case X.NOSCRIPT:e._err(t,J.nestedNoscriptInHead);break;default:MC(e,t)}}function jC(e,t){switch(t.tagID){case X.NOSCRIPT:e.openElements.pop(),e.insertionMode=Q.IN_HEAD;break;case X.BR:MC(e,t);break;default:e._err(t,J.endTagWithoutMatchingOpenElement)}}function MC(e,t){let n=t.type===Ax.EOF?J.openElementsLeftAfterEof:J.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Q.IN_HEAD,e._processToken(t)}function NC(e,t){switch(t.tagID){case X.HTML:_w(e,t);break;case X.BODY:e._insertElement(t,Kx.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_BODY;break;case X.FRAMESET:e._insertElement(t,Kx.HTML),e.insertionMode=Q.IN_FRAMESET;break;case X.BASE:case X.BASEFONT:case X.BGSOUND:case X.LINK:case X.META:case X.NOFRAMES:case X.SCRIPT:case X.STYLE:case X.TEMPLATE:case X.TITLE:e._err(t,J.abandonedHeadElementChild),e.openElements.push(e.headElement,X.HEAD),EC(e,t),e.openElements.remove(e.headElement);break;case X.HEAD:e._err(t,J.misplacedStartTagForHeadElement);break;default:FC(e,t)}}function PC(e,t){switch(t.tagID){case X.BODY:case X.HTML:case X.BR:FC(e,t);break;case X.TEMPLATE:OC(e,t);break;default:e._err(t,J.endTagWithoutMatchingOpenElement)}}function FC(e,t){e._insertFakeElement(Y.BODY,X.BODY),e.insertionMode=Q.IN_BODY,IC(e,t)}function IC(e,t){switch(t.type){case Ax.CHARACTER:RC(e,t);break;case Ax.WHITESPACE_CHARACTER:LC(e,t);break;case Ax.COMMENT:mC(e,t);break;case Ax.START_TAG:_w(e,t);break;case Ax.END_TAG:kw(e,t);break;case Ax.EOF:Aw(e,t)}}function LC(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function RC(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function zC(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function BC(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function VC(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,Kx.HTML),e.insertionMode=Q.IN_FRAMESET)}function HC(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,Kx.HTML)}function UC(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&$x.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,Kx.HTML)}function WC(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,Kx.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function GC(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,Kx.HTML),n||(e.formElement=e.openElements.current))}function KC(e,t){e.framesetOk=!1;let n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let r=e.openElements.tagIDs[t];if(n===X.LI&&r===X.LI||(n===X.DD||n===X.DT)&&(r===X.DD||r===X.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==X.ADDRESS&&r!==X.DIV&&r!==X.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,Kx.HTML)}function qC(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,Kx.HTML),e.tokenizer.state=eS.PLAINTEXT}function JC(e,t){e.openElements.hasInScope(X.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(X.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,Kx.HTML),e.framesetOk=!1}function YC(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(Y.A);n&&(pC(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,Kx.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function XC(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Kx.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function ZC(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(X.NOBR)&&(pC(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,Kx.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function QC(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Kx.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function $C(e,t){e.treeAdapter.getDocumentMode(e.document)!==Jx.QUIRKS&&e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._insertElement(t,Kx.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_TABLE}function ew(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,Kx.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function tw(e){let t=jx(e,qx.TYPE);return t!=null&&t.toLowerCase()===eC}function nw(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,Kx.HTML),tw(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function rw(e,t){e._appendElement(t,Kx.HTML),t.ackSelfClosing=!0}function iw(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._appendElement(t,Kx.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function aw(e,t){t.tagName=Y.IMG,t.tagID=X.IMG,ew(e,t)}function ow(e,t){e._insertElement(t,Kx.HTML),e.skipNextNewLine=!0,e.tokenizer.state=eS.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Q.TEXT}function sw(e,t){e.openElements.hasInButtonScope(X.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,eS.RAWTEXT)}function cw(e,t){e.framesetOk=!1,e._switchToTextParsing(t,eS.RAWTEXT)}function lw(e,t){e._switchToTextParsing(t,eS.RAWTEXT)}function uw(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Kx.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Q.IN_TABLE||e.insertionMode===Q.IN_CAPTION||e.insertionMode===Q.IN_TABLE_BODY||e.insertionMode===Q.IN_ROW||e.insertionMode===Q.IN_CELL?Q.IN_SELECT_IN_TABLE:Q.IN_SELECT}function dw(e,t){e.openElements.currentTagId===X.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,Kx.HTML)}function fw(e,t){e.openElements.hasInScope(X.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,Kx.HTML)}function pw(e,t){e.openElements.hasInScope(X.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(X.RTC),e._insertElement(t,Kx.HTML)}function mw(e,t){e._reconstructActiveFormattingElements(),qS(t),YS(t),t.selfClosing?e._appendElement(t,Kx.MATHML):e._insertElement(t,Kx.MATHML),t.ackSelfClosing=!0}function hw(e,t){e._reconstructActiveFormattingElements(),JS(t),YS(t),t.selfClosing?e._appendElement(t,Kx.SVG):e._insertElement(t,Kx.SVG),t.ackSelfClosing=!0}function gw(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,Kx.HTML)}function _w(e,t){switch(t.tagID){case X.I:case X.S:case X.B:case X.U:case X.EM:case X.TT:case X.BIG:case X.CODE:case X.FONT:case X.SMALL:case X.STRIKE:case X.STRONG:XC(e,t);break;case X.A:YC(e,t);break;case X.H1:case X.H2:case X.H3:case X.H4:case X.H5:case X.H6:UC(e,t);break;case X.P:case X.DL:case X.OL:case X.UL:case X.DIV:case X.DIR:case X.NAV:case X.MAIN:case X.MENU:case X.ASIDE:case X.CENTER:case X.FIGURE:case X.FOOTER:case X.HEADER:case X.HGROUP:case X.DIALOG:case X.DETAILS:case X.ADDRESS:case X.ARTICLE:case X.SEARCH:case X.SECTION:case X.SUMMARY:case X.FIELDSET:case X.BLOCKQUOTE:case X.FIGCAPTION:HC(e,t);break;case X.LI:case X.DD:case X.DT:KC(e,t);break;case X.BR:case X.IMG:case X.WBR:case X.AREA:case X.EMBED:case X.KEYGEN:ew(e,t);break;case X.HR:iw(e,t);break;case X.RB:case X.RTC:fw(e,t);break;case X.RT:case X.RP:pw(e,t);break;case X.PRE:case X.LISTING:WC(e,t);break;case X.XMP:sw(e,t);break;case X.SVG:hw(e,t);break;case X.HTML:zC(e,t);break;case X.BASE:case X.LINK:case X.META:case X.STYLE:case X.TITLE:case X.SCRIPT:case X.BGSOUND:case X.BASEFONT:case X.TEMPLATE:EC(e,t);break;case X.BODY:BC(e,t);break;case X.FORM:GC(e,t);break;case X.NOBR:ZC(e,t);break;case X.MATH:mw(e,t);break;case X.TABLE:$C(e,t);break;case X.INPUT:nw(e,t);break;case X.PARAM:case X.TRACK:case X.SOURCE:rw(e,t);break;case X.IMAGE:aw(e,t);break;case X.BUTTON:JC(e,t);break;case X.APPLET:case X.OBJECT:case X.MARQUEE:QC(e,t);break;case X.IFRAME:cw(e,t);break;case X.SELECT:uw(e,t);break;case X.OPTION:case X.OPTGROUP:dw(e,t);break;case X.NOEMBED:case X.NOFRAMES:lw(e,t);break;case X.FRAMESET:VC(e,t);break;case X.TEXTAREA:ow(e,t);break;case X.NOSCRIPT:e.options.scriptingEnabled?lw(e,t):gw(e,t);break;case X.PLAINTEXT:qC(e,t);break;case X.COL:case X.TH:case X.TD:case X.TR:case X.HEAD:case X.FRAME:case X.TBODY:case X.TFOOT:case X.THEAD:case X.CAPTION:case X.COLGROUP:break;default:gw(e,t)}}function vw(e,t){if(e.openElements.hasInScope(X.BODY)&&(e.insertionMode=Q.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function yw(e,t){e.openElements.hasInScope(X.BODY)&&(e.insertionMode=Q.AFTER_BODY,mT(e,t))}function bw(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function xw(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(X.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(X.FORM):n&&e.openElements.remove(n))}function Sw(e){e.openElements.hasInButtonScope(X.P)||e._insertFakeElement(Y.P,X.P),e._closePElement()}function Cw(e){e.openElements.hasInListItemScope(X.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(X.LI),e.openElements.popUntilTagNamePopped(X.LI))}function ww(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function Tw(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function Ew(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function Dw(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(Y.BR,X.BR),e.openElements.pop(),e.framesetOk=!1}function Ow(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==X.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,a))break}}function kw(e,t){switch(t.tagID){case X.A:case X.B:case X.I:case X.S:case X.U:case X.EM:case X.TT:case X.BIG:case X.CODE:case X.FONT:case X.NOBR:case X.SMALL:case X.STRIKE:case X.STRONG:pC(e,t);break;case X.P:Sw(e);break;case X.DL:case X.UL:case X.OL:case X.DIR:case X.DIV:case X.NAV:case X.PRE:case X.MAIN:case X.MENU:case X.ASIDE:case X.BUTTON:case X.CENTER:case X.FIGURE:case X.FOOTER:case X.HEADER:case X.HGROUP:case X.DIALOG:case X.ADDRESS:case X.ARTICLE:case X.DETAILS:case X.SEARCH:case X.SECTION:case X.SUMMARY:case X.LISTING:case X.FIELDSET:case X.BLOCKQUOTE:case X.FIGCAPTION:bw(e,t);break;case X.LI:Cw(e);break;case X.DD:case X.DT:ww(e,t);break;case X.H1:case X.H2:case X.H3:case X.H4:case X.H5:case X.H6:Tw(e);break;case X.BR:Dw(e);break;case X.BODY:vw(e,t);break;case X.HTML:yw(e,t);break;case X.FORM:xw(e);break;case X.APPLET:case X.OBJECT:case X.MARQUEE:Ew(e,t);break;case X.TEMPLATE:OC(e,t);break;default:Ow(e,t)}}function Aw(e,t){e.tmplInsertionModeStack.length>0?fT(e,t):_C(e,t)}function jw(e,t){var n;t.tagID===X.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Mw(e,t){e._err(t,J.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Nw(e,t){if(e.openElements.currentTagId!==void 0&&iC.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Q.IN_TABLE_TEXT,t.type){case Ax.CHARACTER:Kw(e,t);break;case Ax.WHITESPACE_CHARACTER:Gw(e,t)}else Ww(e,t)}function Pw(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,Kx.HTML),e.insertionMode=Q.IN_CAPTION}function Fw(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,Kx.HTML),e.insertionMode=Q.IN_COLUMN_GROUP}function Iw(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Y.COLGROUP,X.COLGROUP),e.insertionMode=Q.IN_COLUMN_GROUP,Zw(e,t)}function Lw(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,Kx.HTML),e.insertionMode=Q.IN_TABLE_BODY}function Rw(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(Y.TBODY,X.TBODY),e.insertionMode=Q.IN_TABLE_BODY,eT(e,t)}function zw(e,t){e.openElements.hasInTableScope(X.TABLE)&&(e.openElements.popUntilTagNamePopped(X.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function Bw(e,t){tw(t)?e._appendElement(t,Kx.HTML):Ww(e,t),t.ackSelfClosing=!0}function Vw(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,Kx.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Hw(e,t){switch(t.tagID){case X.TD:case X.TH:case X.TR:Rw(e,t);break;case X.STYLE:case X.SCRIPT:case X.TEMPLATE:EC(e,t);break;case X.COL:Iw(e,t);break;case X.FORM:Vw(e,t);break;case X.TABLE:zw(e,t);break;case X.TBODY:case X.TFOOT:case X.THEAD:Lw(e,t);break;case X.INPUT:Bw(e,t);break;case X.CAPTION:Pw(e,t);break;case X.COLGROUP:Fw(e,t);break;default:Ww(e,t)}}function Uw(e,t){switch(t.tagID){case X.TABLE:e.openElements.hasInTableScope(X.TABLE)&&(e.openElements.popUntilTagNamePopped(X.TABLE),e._resetInsertionMode());break;case X.TEMPLATE:OC(e,t);break;case X.BODY:case X.CAPTION:case X.COL:case X.COLGROUP:case X.HTML:case X.TBODY:case X.TD:case X.TFOOT:case X.TH:case X.THEAD:case X.TR:break;default:Ww(e,t)}}function Ww(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,IC(e,t),e.fosterParentingEnabled=n}function Gw(e,t){e.pendingCharacterTokens.push(t)}function Kw(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function qw(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===X.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===X.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===X.OPTGROUP&&e.openElements.pop();break;case X.OPTION:e.openElements.currentTagId===X.OPTION&&e.openElements.pop();break;case X.SELECT:e.openElements.hasInSelectScope(X.SELECT)&&(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode());break;case X.TEMPLATE:OC(e,t)}}function cT(e,t){let n=t.tagID;n===X.CAPTION||n===X.TABLE||n===X.TBODY||n===X.TFOOT||n===X.THEAD||n===X.TR||n===X.TD||n===X.TH?(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode(),e._processStartTag(t)):oT(e,t)}function lT(e,t){let n=t.tagID;n===X.CAPTION||n===X.TABLE||n===X.TBODY||n===X.TFOOT||n===X.THEAD||n===X.TR||n===X.TD||n===X.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(X.SELECT),e._resetInsertionMode(),e.onEndTag(t)):sT(e,t)}function uT(e,t){switch(t.tagID){case X.BASE:case X.BASEFONT:case X.BGSOUND:case X.LINK:case X.META:case X.NOFRAMES:case X.SCRIPT:case X.STYLE:case X.TEMPLATE:case X.TITLE:EC(e,t);break;case X.CAPTION:case X.COLGROUP:case X.TBODY:case X.TFOOT:case X.THEAD:e.tmplInsertionModeStack[0]=Q.IN_TABLE,e.insertionMode=Q.IN_TABLE,Hw(e,t);break;case X.COL:e.tmplInsertionModeStack[0]=Q.IN_COLUMN_GROUP,e.insertionMode=Q.IN_COLUMN_GROUP,Zw(e,t);break;case X.TR:e.tmplInsertionModeStack[0]=Q.IN_TABLE_BODY,e.insertionMode=Q.IN_TABLE_BODY,eT(e,t);break;case X.TD:case X.TH:e.tmplInsertionModeStack[0]=Q.IN_ROW,e.insertionMode=Q.IN_ROW,nT(e,t);break;default:e.tmplInsertionModeStack[0]=Q.IN_BODY,e.insertionMode=Q.IN_BODY,_w(e,t)}}function dT(e,t){t.tagID===X.TEMPLATE&&OC(e,t)}function fT(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(X.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):_C(e,t)}function pT(e,t){t.tagID===X.HTML?_w(e,t):hT(e,t)}function mT(e,t){if(t.tagID===X.HTML){if(e.fragmentContext||(e.insertionMode=Q.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===X.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!e.treeAdapter.getNodeSourceCodeLocation(n)?.endTag&&e._setEndLocation(n,t)}}else hT(e,t)}function hT(e,t){e.insertionMode=Q.IN_BODY,IC(e,t)}function gT(e,t){switch(t.tagID){case X.HTML:_w(e,t);break;case X.FRAMESET:e._insertElement(t,Kx.HTML);break;case X.FRAME:e._appendElement(t,Kx.HTML),t.ackSelfClosing=!0;break;case X.NOFRAMES:EC(e,t)}}function _T(e,t){t.tagID===X.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==X.FRAMESET&&(e.insertionMode=Q.AFTER_FRAMESET))}function vT(e,t){switch(t.tagID){case X.HTML:_w(e,t);break;case X.NOFRAMES:EC(e,t)}}function yT(e,t){t.tagID===X.HTML&&(e.insertionMode=Q.AFTER_AFTER_FRAMESET)}function bT(e,t){t.tagID===X.HTML?_w(e,t):xT(e,t)}function xT(e,t){e.insertionMode=Q.IN_BODY,IC(e,t)}function ST(e,t){switch(t.tagID){case X.HTML:_w(e,t);break;case X.NOFRAMES:EC(e,t)}}function CT(e,t){t.chars=`�`,e._insertCharacters(t)}function wT(e,t){e._insertCharacters(t),e.framesetOk=!1}function TT(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==Kx.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function ET(e,t){if(KS(t))TT(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===Kx.MATHML?qS(t):r===Kx.SVG&&(XS(t),JS(t)),YS(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function DT(e,t){if(t.tagID===X.P||t.tagID===X.BR){TT(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===Kx.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}Y.AREA,Y.BASE,Y.BASEFONT,Y.BGSOUND,Y.BR,Y.COL,Y.EMBED,Y.FRAME,Y.HR,Y.IMG,Y.INPUT,Y.KEYGEN,Y.LINK,Y.META,Y.PARAM,Y.SOURCE,Y.TRACK,Y.WBR;var OT=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,kT=new Set([`mdxFlowExpression`,`mdxJsxFlowElement`,`mdxJsxTextElement`,`mdxTextExpression`,`mdxjsEsm`]),AT={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function jT(e,t){let n=GT(e),r=ox(`type`,{handlers:{root:NT,element:PT,text:FT,comment:RT,doctype:IT,raw:zT},unknown:BT}),i={parser:n?new oC(AT):oC.getFragmentParser(void 0,AT),handle(e){r(e,i)},stitches:!1,options:t||{}};r(e,i),VT(i,Bm());let a=Zb(n?i.parser.document:i.parser.getFragment(),{file:i.options.file});return i.stitches&&jy(a,`comment`,function(e,t,n){let r=e;if(r.value.stitch&&n&&t!==void 0){let e=n.children;return e[t]=r.value.stitch,t}}),a.type===`root`&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function MT(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);let n={type:Ax.CHARACTER,chars:e.value,location:KT(e)};VT(t,Bm(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function IT(e,t){let n={type:Ax.DOCTYPE,name:`html`,forceQuirks:!1,publicId:``,systemId:``,location:KT(e)};VT(t,Bm(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function LT(e,t){t.stitches=!0;let n=qT(e);`children`in e&&`children`in n&&(n.children=jT({type:`root`,children:e.children},t.options).children),RT({type:`comment`,value:{stitch:n}},t)}function RT(e,t){let n=e.value,r={type:Ax.COMMENT,data:n,location:KT(e)};VT(t,Bm(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function zT(e,t){if(t.parser.tokenizer.preprocessor.html=``,t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,HT(t,Bm(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(OT,`<$1$2`):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;let e=t.parser.tokenizer._consume();t.parser.tokenizer._callState(e)}}function BT(e,t){let n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))LT(n,t);else{let e=``;throw kT.has(n.type)&&(e=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),Error("Cannot compile `"+n.type+"` node"+e)}}function VT(e,t){HT(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=eS.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:``,value:``}}function HT(e,t){if(t&&t.offset!==void 0){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function UT(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===eS.PLAINTEXT)return;VT(t,Bm(e));let r=t.parser.openElements.current,i=`namespaceURI`in r?r.namespaceURI:Jb.html;i===Jb.html&&n===`svg`&&(i=Jb.svg);let a=ux({...e,children:[]},{space:i===Jb.svg?`svg`:`html`}),o={type:Ax.START_TAG,tagName:n,tagID:Xx(n),selfClosing:!1,ackSelfClosing:!1,attrs:`attrs`in a?a.attrs:[],location:KT(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function WT(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&bx.includes(n)||t.parser.tokenizer.state===eS.PLAINTEXT)return;VT(t,zm(e));let r={type:Ax.END_TAG,tagName:n,tagID:Xx(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:KT(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===eS.RCDATA||t.parser.tokenizer.state===eS.RAWTEXT||t.parser.tokenizer.state===eS.SCRIPT_DATA)&&(t.parser.tokenizer.state=eS.DATA)}function GT(e){let t=e.type===`root`?e.children[0]:e;return!!(t&&(t.type===`doctype`||t.type===`element`&&t.tagName.toLowerCase()===`html`))}function KT(e){let t=Bm(e)||{line:void 0,column:void 0,offset:void 0},n=zm(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function qT(e){return`children`in e?gy({...e,children:[]}):gy(e)}function JT(e){return function(t,n){return jT(t,{...e,file:n})}}var YT=[`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`],XT={ancestors:{tbody:[`table`],td:[`table`],th:[`table`],thead:[`table`],tfoot:[`table`],tr:[`table`]},attributes:{a:[...YT,`dataFootnoteBackref`,`dataFootnoteRef`,[`className`,`data-footnote-backref`],`href`],blockquote:[`cite`],code:[[`className`,/^language-./]],del:[`cite`],div:[`itemScope`,`itemType`],dl:[...YT],h2:[[`className`,`sr-only`]],img:[...YT,`longDesc`,`src`],input:[[`disabled`,!0],[`type`,`checkbox`]],ins:[`cite`],li:[[`className`,`task-list-item`]],ol:[...YT,[`className`,`contains-task-list`]],q:[`cite`],section:[`dataFootnotes`,[`className`,`footnotes`]],source:[`srcSet`],summary:[...YT],table:[...YT],ul:[...YT,[`className`,`contains-task-list`]],"*":`abbr.accept.acceptCharset.accessKey.action.align.alt.axis.border.cellPadding.cellSpacing.char.charOff.charSet.checked.clear.colSpan.color.cols.compact.coords.dateTime.dir.encType.frame.hSpace.headers.height.hrefLang.htmlFor.id.isMap.itemProp.label.lang.maxLength.media.method.multiple.name.noHref.noShade.noWrap.open.prompt.readOnly.rev.rowSpan.rows.rules.scope.selected.shape.size.span.start.summary.tabIndex.title.useMap.vAlign.value.width`.split(`.`)},clobber:[`ariaDescribedBy`,`ariaLabelledBy`,`id`,`name`],clobberPrefix:`user-content-`,protocols:{cite:[`http`,`https`],href:[`http`,`https`,`irc`,`ircs`,`mailto`,`xmpp`],longDesc:[`http`,`https`],src:[`http`,`https`]},required:{input:{disabled:!0,type:`checkbox`}},strip:[`script`],tagNames:`a.b.blockquote.br.code.dd.del.details.div.dl.dt.em.h1.h2.h3.h4.h5.h6.hr.i.img.input.ins.kbd.li.ol.p.picture.pre.q.rp.rt.ruby.s.samp.section.source.span.strike.strong.sub.summary.sup.table.tbody.td.tfoot.th.thead.tr.tt.ul.var`.split(`.`)},ZT={}.hasOwnProperty;function QT(e,t){let n={type:`root`,children:[]},r=$T({schema:t?{...XT,...t}:XT,stack:[]},e);return r&&(Array.isArray(r)?r.length===1?n=r[0]:n.children=r:n=r),n}function $T(e,t){if(t&&typeof t==`object`){let n=t;switch(typeof n.type==`string`?n.type:``){case`comment`:return eE(e,n);case`doctype`:return tE(e,n);case`element`:return nE(e,n);case`root`:return rE(e,n);case`text`:return iE(e,n)}}}function eE(e,t){if(e.schema.allowComments){let e=typeof t.value==`string`?t.value:``,n=e.indexOf(`-->`),r={type:`comment`,value:n<0?e:e.slice(0,n)};return dE(r,t),r}}function tE(e,t){if(e.schema.allowDoctypes){let e={type:`doctype`};return dE(e,t),e}}function nE(e,t){let n=typeof t.tagName==`string`?t.tagName:``;e.stack.push(n);let r=aE(e,t.children),i=oE(e,t.properties);e.stack.pop();let a=!1;if(n&&n!==`*`&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&ZT.call(e.schema.ancestors,n))){let t=e.schema.ancestors[n],r=-1;for(a=!1;++r1){let e=!1,n=0;for(;++n-1&&a>c||o>-1&&a>o||s>-1&&a>s)return!0;let l=-1;for(;++l4&&t.slice(0,4).toLowerCase()===`data`)return n}function pE(e){return function(t){return QT(t,e)}}function mE(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function hE(e,t,n){let r=by((n||{}).ignore||[]),i=gE(t),a=-1;for(;++a0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=SE(e,`(`),a=SE(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function RE(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Yh(n)||Jh(n))&&(!t||n!==47)}JE.peek=qE;function zE(){this.buffer()}function BE(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function VE(){this.buffer()}function HE(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function UE(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Lh(this.sliceSerialize(e)).toLowerCase(),n.label=t}function WE(e){this.exit(e)}function GE(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Lh(this.sliceSerialize(e)).toLowerCase(),n.label=t}function KE(e){this.exit(e)}function qE(){return`[`}function JE(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function YE(){return{enter:{gfmFootnoteCallString:zE,gfmFootnoteCall:BE,gfmFootnoteDefinitionLabelString:VE,gfmFootnoteDefinition:HE},exit:{gfmFootnoteCallString:UE,gfmFootnoteCall:WE,gfmFootnoteDefinitionLabelString:GE,gfmFootnoteDefinition:KE}}}function XE(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:JE},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?` +`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?QE:ZE))),s(),o}}function ZE(e,t,n){return t===0?e:QE(e,t,n)}function QE(e,t,n){return(n?``:` `)+e}var $E=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];iD.peek=aD;function eD(){return{canContainEols:[`delete`],enter:{strikethrough:nD},exit:{strikethrough:rD}}}function tD(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:$E}],handlers:{delete:iD}}}function nD(e){this.enter({type:`delete`,children:[]},e)}function rD(e){this.exit(e)}function iD(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function aD(){return`~`}function oD(e){return e.length}function sD(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||oD,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++ul&&(l=e[u].length);++ac[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++dc[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),dD);return i(),o}function dD(e,t,n){return`>`+(n?``:` `)+e}function fD(e,t){return pD(e,t.inConstruct,!0)&&!pD(e,t.notInConstruct,!1)}function pD(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ro&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function gD(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function _D(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function vD(e,t,n,r){let i=_D(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(gD(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,yD);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(hD(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:` `,encode:["`"],...s.current()})),t()}return u+=s.move(` `),a&&(u+=s.move(a+` -`)),u+=s.move(c),l(),u}function mD(e,t,n){return(n?``:` `)+e}function hD(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function gD(e,t,n,r){let i=hD(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:` -`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function _D(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function vD(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function yD(e,t,n){let r=eg(e),i=eg(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}bD.peek=xD;function bD(e,t,n,r){let i=_D(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=yD(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=vD(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=yD(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+vD(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function xD(e,t,n){return n.options.emphasis||`*`}function SD(e,t){let n=!1;return Ey(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&yh(e)&&(t.options.setext||n))}function CD(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(SD(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:` +`)),u+=s.move(c),l(),u}function yD(e,t,n){return(n?``:` `)+e}function bD(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function xD(e,t,n,r){let i=bD(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:` +`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function SD(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function CD(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function wD(e,t,n){let r=ag(e),i=ag(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}TD.peek=ED;function TD(e,t,n,r){let i=SD(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=wD(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=CD(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=wD(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+CD(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function ED(e,t,n){return n.options.emphasis||`*`}function DD(e,t){let n=!1;return jy(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&wh(e)&&(t.options.setext||n))}function OD(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(DD(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:` `,after:` `});return r(),t(),o+` `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(` `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:` -`,...a.current()});return/^[\t ]/.test(l)&&(l=vD(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}wD.peek=TD;function wD(e){return e.value||``}function TD(){return`<`}ED.peek=DD;function ED(e,t,n,r){let i=hD(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function DD(){return`!`}OD.peek=kD;function OD(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function kD(){return`!`}AD.peek=jD;function AD(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a\u007F]/.test(e.url))}ND.peek=PD;function ND(e,t,n,r){let i=hD(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(MD(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function PD(e,t,n){return MD(e,n)?`<`:`[`}FD.peek=ID;function FD(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function ID(){return`[`}function LD(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function RD(e){let t=LD(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function zD(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function BD(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function VD(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?zD(n):LD(n),s=e.ordered?o===`.`?`)`:`.`:RD(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),BD(n)===o&&t){let t=-1;for(;++t-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function WD(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var GD=hy([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function KD(e,t,n,r){return(e.children.some(function(e){return GD(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function qD(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}JD.peek=YD;function JD(e,t,n,r){let i=qD(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=yD(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=vD(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=yD(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+vD(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function YD(e,t,n){return n.options.strong||`*`}function XD(e,t,n,r){return n.safe(e.value,r)}function ZD(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function QD(e,t,n){let r=(BD(n)+(n.options.ruleSpaces?` `:``)).repeat(ZD(n));return n.options.ruleSpaces?r.slice(0,-1):r}var $D={blockquote:aD,break:lD,code:pD,definition:gD,emphasis:bD,hardBreak:lD,heading:CD,html:wD,image:ED,imageReference:OD,inlineCode:AD,link:ND,linkReference:FD,list:VD,listItem:UD,paragraph:WD,root:KD,strong:JD,text:XD,thematicBreak:QD};function eO(){return{enter:{table:tO,tableData:aO,tableHeader:aO,tableRow:rO},exit:{codeText:oO,table:nO,tableData:iO,tableHeader:iO,tableRow:iO}}}function tO(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function nO(e){this.exit(e),this.data.inTable=void 0}function rO(e){this.enter({type:`tableRow`,children:[]},e)}function iO(e){this.exit(e)}function aO(e){this.enter({type:`tableCell`,children:[]},e)}function oO(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,sO));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function sO(e,t){return t===`|`?t:e}function cO(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:` +`,...a.current()});return/^[\t ]/.test(l)&&(l=CD(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}kD.peek=AD;function kD(e){return e.value||``}function AD(){return`<`}jD.peek=MD;function jD(e,t,n,r){let i=bD(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function MD(){return`!`}ND.peek=PD;function ND(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function PD(){return`!`}FD.peek=ID;function FD(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a\u007F]/.test(e.url))}RD.peek=zD;function RD(e,t,n,r){let i=bD(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(LD(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function zD(e,t,n){return LD(e,n)?`<`:`[`}BD.peek=VD;function BD(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function VD(){return`[`}function HD(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function UD(e){let t=HD(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function WD(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function GD(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function KD(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?WD(n):HD(n),s=e.ordered?o===`.`?`)`:`.`:UD(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),GD(n)===o&&t){let t=-1;for(;++t-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function YD(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var XD=by([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function ZD(e,t,n,r){return(e.children.some(function(e){return XD(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function QD(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}$D.peek=eO;function $D(e,t,n,r){let i=QD(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=wD(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=CD(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=wD(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+CD(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function eO(e,t,n){return n.options.strong||`*`}function tO(e,t,n,r){return n.safe(e.value,r)}function nO(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function rO(e,t,n){let r=(GD(n)+(n.options.ruleSpaces?` `:``)).repeat(nO(n));return n.options.ruleSpaces?r.slice(0,-1):r}var iO={blockquote:uD,break:mD,code:vD,definition:xD,emphasis:TD,hardBreak:mD,heading:OD,html:kD,image:jD,imageReference:ND,inlineCode:FD,link:RD,linkReference:BD,list:KD,listItem:JD,paragraph:YD,root:ZD,strong:$D,text:tO,thematicBreak:rO};function aO(){return{enter:{table:oO,tableData:uO,tableHeader:uO,tableRow:cO},exit:{codeText:dO,table:sO,tableData:lO,tableHeader:lO,tableRow:lO}}}function oO(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function sO(e){this.exit(e),this.data.inTable=void 0}function cO(e){this.enter({type:`tableRow`,children:[]},e)}function lO(e){this.exit(e)}function uO(e){this.enter({type:`tableCell`,children:[]},e)}function dO(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,fO));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function fO(e,t){return t===`|`?t:e}function pO(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:` `,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(` -`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return nD(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var BO={tokenize:JO,partial:!0};function VO(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:GO,continuation:{tokenize:KO},exit:qO}},text:{91:{name:`gfmFootnoteCall`,tokenize:WO},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:HO,resolveTo:UO}}}}function HO(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=Mh(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function UO(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function WO(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||Vh(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Mh(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Vh(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function GO(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||Vh(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Mh(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Vh(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),qh(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function KO(e,t,n){return e.check(cg,t,e.attempt(BO,t,n))}function qO(e){e.exit(`gfmFootnoteDefinition`)}function JO(e,t,n){let r=this;return qh(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function YO(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=eg(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var XO=class{constructor(){this.map=[]}add(e,t,n){ZO(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function ZO(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Bh(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Hh(t)?qh(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||Vh(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Hh(t)?qh(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Hh(t)?qh(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Bh(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Hh(t)?qh(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Bh(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Bh(n)?(e.exit(`tableRow`),t(n)):Hh(n)?qh(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Vh(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function tk(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new XO;for(;++nn[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},ik(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function rk(e,t,n,r,i){let a=[],o=ik(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function ik(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var ak={name:`tasklistCheck`,tokenize:sk};function ok(){return{text:{91:ak}}}function sk(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return Vh(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Bh(r)?t(r):Hh(r)?e.check({tokenize:ck},t,n)(r):n(r)}}function ck(e,t,n){return qh(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function lk(e){return Oh([TO(),VO(),YO(e),$O(),ok()])}var uk={};function dk(e){let t=this,n=e||uk,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(lk(n)),a.push(mO()),o.push(hO(n))}var fk=(0,_.createContext)(null),pk=Promise.resolve();function mk({src:e,alt:t}){let n=(0,_.useContext)(fk),r=(0,_.useMemo)(()=>new rf,[]),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(!1),c=n?.parent;return(0,_.useEffect)(()=>{if(!c||!n?.sessionId)return;let t=n.sessionId,i=new AbortController,o,l;return pk=pk.then(async()=>{try{if(i.signal.aborted||(o=(await r.resolveArtifact(t,e,c,i.signal)).handle,i.signal.aborted))return;let n=await r.artifactPreview(t,o,i.signal),s=await r.downloadArtifact(n.artifact,i.signal),u=of(new Uint8Array(await s.slice(0,12).arrayBuffer()));if(!u)throw Error(`Unsupported image`);i.signal.aborted||(l=URL.createObjectURL(new Blob([s],{type:u})),a(l))}catch{i.signal.aborted||s(!0)}finally{o&&r.releaseArtifact(t,o).catch(()=>void 0)}}),()=>{i.abort(),l&&URL.revokeObjectURL(l)}},[r,e,c,n?.sessionId]),i?(0,K.jsx)(`img`,{className:`file-inline-image`,src:i,alt:t}):(0,K.jsx)(`span`,{children:o?`[${t||e}]`:t})}var hk=(0,_.lazy)(()=>Po(()=>import(`./app-MermaidPreview.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])));function gk(){return e=>{let t=e=>e.type===`text`?e.value:e.type===`element`&&![`ul`,`ol`].includes(e.tagName)?e.children.map(t).join(``):``,n=e=>{if(e.type===`element`&&(e.tagName===`li`||e.tagName===`p`)){let n=t(e).trim();for(let t of e.children)t.type===`element`&&t.tagName===`input`&&t.properties.type===`checkbox`&&n&&(t.properties.ariaLabel=n)}for(let t of e.children)t.type===`element`&&n(t)};n(e)}}function _k(){return e=>{let t=e=>{if(e.type===`element`){let t=e.tagName===`a`?`href`:e.tagName===`img`?`src`:void 0,n=t?e.properties[t]:void 0,r=typeof n==`string`?n.replace(/%5c/giu,`\\`):n;t&&typeof r==`string`&&/^[a-z]:[\\/]/iu.test(r)&&!/[\x00-\x1f\x7f]/u.test(r)&&(e.data={...e.data,openpiWindowsPath:r},e.properties[t]=`./`)}for(let n of e.children)n.type===`element`&&t(n)};t(e)}}function vk(e){let t=e?.data?.openpiWindowsPath;return typeof t==`string`?t:void 0}function yk(e){if(!e.trim())return``;try{let t=new URL(e,document.baseURI);return[`http:`,`https:`,`mailto:`,`tel:`].includes(t.protocol)?t.href:``}catch{return``}}function bk({children:e,node:t,...n}){let{t:r}=cr(),[i,a]=(0,_.useState)(`idle`),o=(0,_.useRef)(0),s=(0,_.useRef)(void 0),c=(0,_.useRef)(null);(0,_.useEffect)(()=>()=>{o.current+=1,window.clearTimeout(s.current)},[]);let l=i===`copied`;return(0,K.jsxs)(`div`,{className:`markdown-code-block`,children:[(0,K.jsxs)(`div`,{className:`markdown-code-toolbar`,children:[i===`failed`&&(0,K.jsx)(`span`,{role:`status`,children:r(`copyCodeFailed`)}),(0,K.jsx)(`button`,{type:`button`,"aria-label":r(l?`copiedCode`:`copyCode`),title:r(l?`copiedCode`:`copyCode`),disabled:i===`copying`,onClick:()=>{let e=++o.current;window.clearTimeout(s.current),a(`copying`),wd(c.current?.textContent??``).then(t=>{e===o.current&&(a(t?`copied`:`failed`),t&&(s.current=window.setTimeout(()=>a(`idle`),1200)))})},children:l?(0,K.jsx)(I,{"aria-hidden":`true`}):(0,K.jsx)(oe,{"aria-hidden":`true`})})]}),(0,K.jsx)(`section`,{className:`markdown-code-scroll`,"aria-label":r(`codeBlock`),tabIndex:0,onKeyDown:e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(e.preventDefault(),t.scrollLeft+=e.key===`ArrowRight`?40:-40)},children:(0,K.jsx)(`pre`,{ref:c,...n,children:e})})]})}function xk(e){let t=e.children;return(0,_.isValidElement)(t)&&t.props.className===`language-mermaid`?(0,K.jsx)(_.Suspense,{fallback:(0,K.jsx)(`pre`,{children:t.props.children}),children:(0,K.jsx)(hk,{source:String(t.props.children??``)})}):(0,K.jsx)(bk,{...e})}var Sk=(0,_.memo)(function({children:e,filePreview:t=!1}){let{t:n}=cr(),r=(0,_.useContext)(fk),i=0;return(0,K.jsx)(`div`,{className:`markdown`,children:(0,K.jsx)(wb,{remarkPlugins:[dk,gE],rehypePlugins:[...t?[UT]:[],_k,cE,gk],urlTransform:e=>Td(e)?e:yk(e),components:{pre:t?xk:bk,table({children:e,...t}){return(0,K.jsx)(`section`,{className:`markdown-table-scroll`,"aria-label":`Table`,tabIndex:0,children:(0,K.jsx)(`table`,{...t,children:e})})},a({href:e,node:t,children:i,...a}){if(e=vk(t)??e,Td(e??``))return r&&!r.disabled?(0,K.jsxs)(`button`,{type:`button`,className:`artifact-link`,title:`Open read-only file: ${e}`,onClick:()=>r.open(e??``,r.parent),children:[i,(0,K.jsxs)(`small`,{className:`artifact-link-path`,"aria-hidden":`true`,children:[` `,`(`,e,`)`]})]}):(0,K.jsxs)(`span`,{title:n(`artifactReferenceUnavailable`,{path:e}),children:[i,(0,K.jsxs)(`small`,{className:`artifact-link-path`,children:[` (`,e,`)`]})]});let o=yk(e??``);return o?(0,K.jsx)(`a`,{...a,href:o,target:`_blank`,rel:`noreferrer`,children:i}):i},img({src:e,node:a,alt:o,title:s}){if(e=vk(a)??e,t&&e&&Td(e)&&r?.parent&&!r.disabled&&i++<16)return(0,K.jsx)(mk,{src:e,alt:o||``});if(Td(e??``))return r&&!r.disabled?(0,K.jsxs)(`button`,{type:`button`,className:`artifact-link`,title:`Open read-only file: ${e}`,onClick:()=>r.open(e??``,r.parent),children:[`[image: `,o||`image`,`]`,(0,K.jsxs)(`small`,{className:`artifact-link-path`,"aria-hidden":`true`,children:[` `,`(`,e,`)`]})]}):(0,K.jsxs)(`span`,{title:n(`artifactReferenceUnavailable`,{path:e}),children:[`[image: `,o||`image`,`]`,(0,K.jsxs)(`small`,{className:`artifact-link-path`,children:[` (`,e,`)`]})]});let c=yk(e??``),l=o||`image`;return c?(0,K.jsxs)(`a`,{href:c,title:s,target:`_blank`,rel:`noreferrer`,children:[`[image: `,l,`]`]}):(0,K.jsx)(`span`,{children:l})}},children:e})})}),Ck=(0,_.createContext)(void 0);function wk(){return(0,_.useContext)(Ck)}function Tk(e,t){let n=[],r=[],i=``,a=!1,o=!1;for(let s=0;s0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var GO={tokenize:$O,partial:!0};function KO(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:XO,continuation:{tokenize:ZO},exit:QO}},text:{91:{name:`gfmFootnoteCall`,tokenize:YO},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:qO,resolveTo:JO}}}}function qO(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=Lh(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function JO(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function YO(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||Kh(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Lh(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Kh(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function XO(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||Kh(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Lh(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Kh(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),Qh(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function ZO(e,t,n){return e.check(pg,t,e.attempt(GO,t,n))}function QO(e){e.exit(`gfmFootnoteDefinition`)}function $O(e,t,n){let r=this;return Qh(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function ek(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=ag(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var tk=class{constructor(){this.map=[]}add(e,t,n){nk(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function nk(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):Gh(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):qh(t)?Qh(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||Kh(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,qh(t)?Qh(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return qh(t)?Qh(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||Gh(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return qh(t)?Qh(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Gh(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||Gh(n)?(e.exit(`tableRow`),t(n)):qh(n)?Qh(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Kh(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function ok(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new tk;for(;++nn[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},lk(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function ck(e,t,n,r,i){let a=[],o=lk(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function lk(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var uk={name:`tasklistCheck`,tokenize:fk};function dk(){return{text:{91:uk}}}function fk(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return Kh(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return Gh(r)?t(r):qh(r)?e.check({tokenize:pk},t,n)(r):n(r)}}function pk(e,t,n){return Qh(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function mk(e){return Nh([AO(),KO(),ek(e),ik(),dk()])}var hk={};function gk(e){let t=this,n=e||hk,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(mk(n)),a.push(yO()),o.push(bO(n))}var _k=(0,_.createContext)(null),vk=Promise.resolve();function yk({src:e,alt:t}){let n=(0,_.useContext)(_k),r=(0,_.useMemo)(()=>new lf,[]),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(!1),c=n?.parent;return(0,_.useEffect)(()=>{if(!c||!n?.sessionId)return;let t=n.sessionId,i=new AbortController,o,l;return vk=vk.then(async()=>{try{if(i.signal.aborted||(o=(await r.resolveArtifact(t,e,c,i.signal)).handle,i.signal.aborted))return;let n=await r.artifactPreview(t,o,i.signal),s=await r.downloadArtifact(n.artifact,i.signal),u=df(new Uint8Array(await s.slice(0,12).arrayBuffer()));if(!u)throw Error(`Unsupported image`);i.signal.aborted||(l=URL.createObjectURL(new Blob([s],{type:u})),a(l))}catch{i.signal.aborted||s(!0)}finally{o&&r.releaseArtifact(t,o).catch(()=>void 0)}}),()=>{i.abort(),l&&URL.revokeObjectURL(l)}},[r,e,c,n?.sessionId]),i?(0,K.jsx)(`img`,{className:`file-inline-image`,src:i,alt:t}):(0,K.jsx)(`span`,{children:o?`[${t||e}]`:t})}var bk=(0,_.lazy)(()=>Po(()=>import(`./app-MermaidPreview.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])));function xk(){return e=>{let t=e=>e.type===`text`?e.value:e.type===`element`&&![`ul`,`ol`].includes(e.tagName)?e.children.map(t).join(``):``,n=e=>{if(e.type===`element`&&(e.tagName===`li`||e.tagName===`p`)){let n=t(e).trim();for(let t of e.children)t.type===`element`&&t.tagName===`input`&&t.properties.type===`checkbox`&&n&&(t.properties.ariaLabel=n)}for(let t of e.children)t.type===`element`&&n(t)};n(e)}}function Sk(){return e=>{let t=e=>{if(e.type===`element`){let t=e.tagName===`a`?`href`:e.tagName===`img`?`src`:void 0,n=t?e.properties[t]:void 0,r=typeof n==`string`?n.replace(/%5c/giu,`\\`):n;t&&typeof r==`string`&&/^[a-z]:[\\/]/iu.test(r)&&!/[\x00-\x1f\x7f]/u.test(r)&&(e.data={...e.data,openpiWindowsPath:r},e.properties[t]=`./`)}for(let n of e.children)n.type===`element`&&t(n)};t(e)}}function Ck(e){let t=e?.data?.openpiWindowsPath;return typeof t==`string`?t:void 0}function wk(e){if(!e.trim())return``;try{let t=new URL(e,document.baseURI);return[`http:`,`https:`,`mailto:`,`tel:`].includes(t.protocol)?t.href:``}catch{return``}}function Tk({children:e,node:t,...n}){let{t:r}=cr(),[i,a]=(0,_.useState)(`idle`),o=(0,_.useRef)(0),s=(0,_.useRef)(void 0),c=(0,_.useRef)(null);(0,_.useEffect)(()=>()=>{o.current+=1,window.clearTimeout(s.current)},[]);let l=i===`copied`;return(0,K.jsxs)(`div`,{className:`markdown-code-block`,children:[(0,K.jsxs)(`div`,{className:`markdown-code-toolbar`,children:[i===`failed`&&(0,K.jsx)(`span`,{role:`status`,children:r(`copyCodeFailed`)}),(0,K.jsx)(`button`,{type:`button`,"aria-label":r(l?`copiedCode`:`copyCode`),title:r(l?`copiedCode`:`copyCode`),disabled:i===`copying`,onClick:()=>{let e=++o.current;window.clearTimeout(s.current),a(`copying`),wd(c.current?.textContent??``).then(t=>{e===o.current&&(a(t?`copied`:`failed`),t&&(s.current=window.setTimeout(()=>a(`idle`),1200)))})},children:l?(0,K.jsx)(I,{"aria-hidden":`true`}):(0,K.jsx)(oe,{"aria-hidden":`true`})})]}),(0,K.jsx)(`section`,{className:`markdown-code-scroll`,"aria-label":r(`codeBlock`),tabIndex:0,onKeyDown:e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;let t=e.currentTarget;t.scrollWidth<=t.clientWidth||(e.preventDefault(),t.scrollLeft+=e.key===`ArrowRight`?40:-40)},children:(0,K.jsx)(`pre`,{ref:c,...n,children:e})})]})}function Ek(e){let t=e.children;return(0,_.isValidElement)(t)&&t.props.className===`language-mermaid`?(0,K.jsx)(_.Suspense,{fallback:(0,K.jsx)(`pre`,{children:t.props.children}),children:(0,K.jsx)(bk,{source:String(t.props.children??``)})}):(0,K.jsx)(Tk,{...e})}var Dk=(0,_.memo)(function({children:e,filePreview:t=!1}){let{t:n}=cr(),r=(0,_.useContext)(_k),i=0;return(0,K.jsx)(`div`,{className:`markdown`,children:(0,K.jsx)(kb,{remarkPlugins:[gk,xE],rehypePlugins:[...t?[JT]:[],Sk,pE,xk],urlTransform:e=>Td(e)?e:wk(e),components:{pre:t?Ek:Tk,table({children:e,...t}){return(0,K.jsx)(`section`,{className:`markdown-table-scroll`,"aria-label":`Table`,tabIndex:0,children:(0,K.jsx)(`table`,{...t,children:e})})},a({href:e,node:t,children:i,...a}){if(e=Ck(t)??e,Td(e??``))return r&&!r.disabled?(0,K.jsxs)(`button`,{type:`button`,className:`artifact-link`,title:`Open read-only file: ${e}`,onClick:()=>r.open(e??``,r.parent),children:[i,(0,K.jsxs)(`small`,{className:`artifact-link-path`,"aria-hidden":`true`,children:[` `,`(`,e,`)`]})]}):(0,K.jsxs)(`span`,{title:n(`artifactReferenceUnavailable`,{path:e}),children:[i,(0,K.jsxs)(`small`,{className:`artifact-link-path`,children:[` (`,e,`)`]})]});let o=wk(e??``);return o?(0,K.jsx)(`a`,{...a,href:o,target:`_blank`,rel:`noreferrer`,children:i}):i},img({src:e,node:a,alt:o,title:s}){if(e=Ck(a)??e,t&&e&&Td(e)&&r?.parent&&!r.disabled&&i++<16)return(0,K.jsx)(yk,{src:e,alt:o||``});if(Td(e??``))return r&&!r.disabled?(0,K.jsxs)(`button`,{type:`button`,className:`artifact-link`,title:`Open read-only file: ${e}`,onClick:()=>r.open(e??``,r.parent),children:[`[image: `,o||`image`,`]`,(0,K.jsxs)(`small`,{className:`artifact-link-path`,"aria-hidden":`true`,children:[` `,`(`,e,`)`]})]}):(0,K.jsxs)(`span`,{title:n(`artifactReferenceUnavailable`,{path:e}),children:[`[image: `,o||`image`,`]`,(0,K.jsxs)(`small`,{className:`artifact-link-path`,children:[` (`,e,`)`]})]});let c=wk(e??``),l=o||`image`;return c?(0,K.jsxs)(`a`,{href:c,title:s,target:`_blank`,rel:`noreferrer`,children:[`[image: `,l,`]`]}):(0,K.jsx)(`span`,{children:l})}},children:e})})}),Ok=(0,_.createContext)(void 0);function kk(){return(0,_.useContext)(Ok)}function Ak(e,t){let n=[],r=[],i=``,a=!1,o=!1;for(let s=0;s${e}`}function Dk({table:e}){let{t}=cr(),n=Math.max(0,...e.rows.map(e=>e.length));return(0,K.jsxs)(K.Fragment,{children:[e.truncated&&(0,K.jsx)(`p`,{className:`evidence-warning`,children:t(`filesTableTruncated`)}),(0,K.jsx)(`section`,{className:`file-table-scroll`,"aria-label":e.name||t(`filesTable`),tabIndex:0,children:(0,K.jsxs)(`table`,{className:`file-table`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{"aria-label":t(`filesRow`)}),Array.from({length:n},(e,t)=>(0,K.jsx)(`th`,{scope:`col`,children:t<26?String.fromCharCode(65+t):`A${String.fromCharCode(65+t-26)}`},t))]})}),(0,K.jsx)(`tbody`,{children:e.rows.map((e,t)=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{scope:`row`,className:`file-row-number`,children:t+1}),Array.from({length:n},(t,n)=>(0,K.jsx)(`td`,{children:e[n]??``},n))]},t))})]})})]})}function Ok({html:e,name:t}){return(0,K.jsx)(`iframe`,{className:`file-preview-frame`,title:t,sandbox:``,referrerPolicy:`no-referrer`,srcDoc:Ek(e)})}function kk({data:e,extension:t,name:n,initialPage:r,onReadingChange:i}){let{t:a}=cr(),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(r??0);return(0,_.useEffect)(()=>i(u),[i,u]),(0,_.useEffect)(()=>{let n=new Worker(new URL(`/app-office-worker-pvhGCwqI.js`,``+import.meta.url),{type:`module`}),r=window.setTimeout(()=>{n.terminate(),l(a(`filesDocumentLimit`))},15e3);n.onmessage=e=>{clearTimeout(r),n.terminate(),e.data.result?s(e.data.result):l(e.data.error||a(`filesPreviewFailed`))},n.onerror=()=>{clearTimeout(r),n.terminate(),l(a(`filesPreviewFailed`))};let i=e.slice(0);return n.postMessage({data:i,extension:t},[i]),()=>{clearTimeout(r),n.terminate()}},[e,t,a]),c?(0,K.jsx)(`p`,{role:`alert`,className:`evidence-warning`,children:c}):o?o.kind===`document`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`file-preview-note`,children:a(`filesOfficeLayout`)}),(0,K.jsx)(Ok,{html:o.html,name:n})]}):o.kind===`sheets`?(0,K.jsxs)(K.Fragment,{children:[o.truncated&&(0,K.jsx)(`p`,{children:a(`filesTableTruncated`)}),(0,K.jsx)(`div`,{className:`file-sheet-tabs`,role:`toolbar`,"aria-label":a(`filesSheets`),children:o.sheets.map((e,t)=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":u===t,onClick:()=>d(t),children:e.name},e.name))}),o.sheets[u]&&(0,K.jsx)(Dk,{table:o.sheets[u]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`file-preview-toolbar`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:u===0,"aria-label":a(`filesPreviousPage`),onClick:()=>d(e=>e-1),children:(0,K.jsx)(R,{})}),(0,K.jsxs)(`span`,{children:[u+1,` / `,o.slides.length]}),(0,K.jsx)(`button`,{type:`button`,disabled:u===o.slides.length-1,"aria-label":a(`filesNextPage`),onClick:()=>d(e=>e+1),children:(0,K.jsx)(ee,{})})]}),(0,K.jsx)(`p`,{className:`file-preview-note`,children:a(`filesSlidesLayout`)}),o.truncated&&(0,K.jsx)(`p`,{children:a(`artifactPreviewTruncated`)}),(0,K.jsx)(Ok,{html:o.slides[u],name:n})]}):(0,K.jsx)(`p`,{role:`status`,children:a(`readingFile`)})}function Ak({data:e,initialPage:t,initialScale:n,onReadingChange:r}){let{t:i}=cr(),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(t??1),[l,u]=(0,_.useState)(n??1);(0,_.useEffect)(()=>r(s,l),[r,s,l]);let[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(!0),h=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=!1,n;return Promise.all([Po(()=>import(`./app-pdf.js`),[]),Po(()=>import(`./app-pdf.worker.min.js`),[])]).then(async([r,i])=>{if(t)return;r.GlobalWorkerOptions.workerSrc=i.default,n=r.getDocument({data:new Uint8Array(e.slice(0)),useWasm:!1,useSystemFonts:!0,disableAutoFetch:!0,maxImageSize:16e6});let a=await n.promise;t||o(a)}).catch(e=>{t||(m(!1),f(e instanceof Error?e.message:i(`filesPreviewFailed`)))}),()=>{t=!0,n?.destroy()}},[e,i]),(0,_.useEffect)(()=>{if(!a||!h.current)return;let e=!1,t,n=h.current;return m(!0),a.getPage(s).then(async r=>{if(e)return;let i=r.getViewport({scale:1}),a=Math.min(l*1.5,Math.sqrt(8e6/(i.width*i.height))),o=r.getViewport({scale:a});n.width=o.width,n.height=o.height,n.style.width=`${Math.min(i.width,n.parentElement?.clientWidth||i.width)*l}px`,t=r.render({canvas:n,viewport:o}),await t.promise,e||(f(``),m(!1))}).catch(t=>{e||(m(!1),f(t instanceof Error?t.message:i(`filesPreviewFailed`)))}),()=>{e=!0,t?.cancel()}},[a,s,l,i]),(0,K.jsxs)(`div`,{className:`file-pdf`,children:[(0,K.jsxs)(`div`,{className:`file-preview-toolbar`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`filesPreviousPage`),disabled:!a||s===1,onClick:()=>c(e=>e-1),children:(0,K.jsx)(R,{})}),(0,K.jsxs)(`span`,{children:[s,` / `,a?.numPages??`…`]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`filesNextPage`),disabled:!a||s===a.numPages,onClick:()=>c(e=>e+1),children:(0,K.jsx)(ee,{})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`filesZoomOut`),disabled:l<=.5,onClick:()=>u(e=>Math.max(.5,e-.25)),children:(0,K.jsx)($e,{})}),(0,K.jsxs)(`button`,{type:`button`,"aria-label":i(`filesZoomReset`),onClick:()=>u(1),children:[(0,K.jsx)(Ge,{}),` `,Math.round(l*100),`%`]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`filesZoomIn`),disabled:l>=3,onClick:()=>u(e=>Math.min(3,e+.25)),children:(0,K.jsx)(lt,{})})]}),d&&(0,K.jsx)(`p`,{role:`alert`,children:d}),p&&(0,K.jsx)(`p`,{role:`status`,children:i(`readingFile`)}),(0,K.jsx)(`section`,{className:`file-media-viewport`,tabIndex:0,"aria-label":i(`filePreview`),children:(0,K.jsx)(`canvas`,{ref:h,"aria-label":i(`filesPdfPage`,{page:s}),role:`img`})})]})}function jk({artifact:e,client:t}){let{t:n}=cr(),r=wk(),i=r?.artifact?.document,a=i?.path===e.path&&i.revision===e.revision?i:void 0,o=(t,n)=>{r?.artifact?.reference===encodeURI(e.path)&&(r.artifact.document={path:e.path,revision:e.revision,page:t,scale:n})},[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(``);if((0,_.useEffect)(()=>{let r=new AbortController;return t.downloadArtifact(e,r.signal).then(e=>e.arrayBuffer()).then(e=>{r.signal.aborted||c(e)}).catch(e=>{r.signal.aborted||u(e instanceof Error?e.message:n(`filesPreviewFailed`))}),()=>r.abort()},[e,t,n]),l)return(0,K.jsx)(`p`,{role:`alert`,className:`evidence-warning`,children:l});if(!s)return(0,K.jsx)(`p`,{role:`status`,children:n(`readingFile`)});let d=e.name.split(`.`).at(-1)?.toLowerCase()??``;return d===`pdf`?(0,K.jsx)(Ak,{data:s,initialPage:a?.page,initialScale:a?.scale,onReadingChange:o}):(0,K.jsx)(kk,{data:s,extension:d,name:e.name,initialPage:a?.page,onReadingChange:o})}function Mk({children:e,text:t}){let{t:n}=cr(),r=(0,_.useRef)(null),i=(0,_.useRef)(null),a=(0,_.useRef)(null),o=(0,_.useId)(),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(null);(0,_.useLayoutEffect)(()=>{let e=[...r.current?.querySelectorAll(`.markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6`)??[]].filter(e=>e.textContent?.trim());u(e);let t=r.current?.closest(`.artifact-panel-body`),n=()=>{let n=t?.getBoundingClientRect().top??0;f(e.filter(e=>e.getBoundingClientRect().top<=n+56).at(-1)??e[0]??null)};return n(),t?.addEventListener(`scroll`,n,{passive:!0}),()=>t?.removeEventListener(`scroll`,n)},[t]),(0,_.useEffect)(()=>{if(!s)return;a.current?.querySelector(`button`)?.focus();let e=e=>{e.target instanceof Node&&!a.current?.contains(e.target)&&c(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[s]);let p=e=>{let t=e.parentElement;for(;t&&t!==r.current;)t instanceof HTMLDetailsElement&&(t.open=!0),t=t.parentElement;let n=r.current?.closest(`.artifact-panel-body`);n&&n.scrollTo({top:n.scrollTop+e.getBoundingClientRect().top-n.getBoundingClientRect().top-16,behavior:`instant`}),f(e),c(!1),e.tabIndex=-1,e.focus({preventScroll:!0})};return(0,K.jsxs)(`div`,{className:`file-markdown`,ref:r,children:[l.length>1&&(0,K.jsx)(`div`,{className:`file-outline-bar`,children:(0,K.jsxs)(`section`,{className:`file-outline`,"aria-label":n(`filesOutline`),ref:a,onKeyDown:e=>{e.key===`Escape`&&s&&(e.preventDefault(),e.stopPropagation(),c(!1),i.current?.focus())},children:[(0,K.jsx)(`button`,{type:`button`,ref:i,className:`icon-button`,title:n(`filesOutline`),"aria-label":n(`filesOutline`),"aria-expanded":s,"aria-controls":o,onClick:()=>c(e=>!e),children:(0,K.jsx)(Ve,{"aria-hidden":`true`})}),s&&(0,K.jsx)(`nav`,{id:o,"aria-label":n(`filesOutline`),className:`file-outline-panel`,children:l.map((e,t)=>(0,K.jsxs)(`button`,{type:`button`,"aria-current":d===e?`location`:void 0,style:{paddingInlineStart:10+(Number(e.tagName.slice(1))-1)*10},onClick:()=>p(e),children:[(0,K.jsx)(`small`,{"aria-hidden":`true`,children:e.tagName.slice(1)}),(0,K.jsx)(`span`,{children:e.textContent})]},`${t}:${e.textContent}`))})]})}),e]})}function Nk({text:e,name:t}){let[n,r]=(0,_.useState)(``);return(0,_.useEffect)(()=>{let n=!1;return r(``),Po(async()=>{let{default:e}=await import(`./app-common.js`);return{default:e}},__vite__mapDeps([21,1])).then(({default:i})=>{let a=t.split(`.`).at(-1)?.toLowerCase()??``,o={tsx:`typescript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,svg:`xml`,html:`xml`,yml:`yaml`,md:`markdown`,sh:`bash`}[a]??a;if(n||e.length>1e5||!i.getLanguage(o))return;let s=i.highlight(e,{language:o,ignoreIllegals:!0});r(Lp.sanitize(s.value,{ALLOWED_TAGS:[`span`],ALLOWED_ATTR:[`class`]}))}).catch(()=>void 0),()=>{n=!0}},[e,t]),(0,K.jsx)(`section`,{className:`file-code`,"aria-label":`File preview content`,tabIndex:0,children:(0,K.jsx)(`pre`,{children:n?(0,K.jsx)(`code`,{dangerouslySetInnerHTML:{__html:n}}):(0,K.jsx)(`code`,{children:e})})})}function Pk({preview:e,client:t,source:n=!1}){let{t:r}=cr(),{name:i}=e.artifact,a=i.split(`.`).at(-1)?.toLowerCase()??``,o=e.text,s=Fk(i),c=(0,_.useMemo)(()=>[`csv`,`tsv`].includes(a)?Tk(o??``,a===`tsv`?` `:`,`):null,[o,a]);return[`pdf`,`docx`,`xlsx`,`pptx`].includes(a)?(0,K.jsx)(jk,{artifact:e.artifact,client:t}):o===void 0?(0,K.jsx)(`p`,{children:r(`artifactUnsupported`)}):(0,K.jsx)(K.Fragment,{children:n||!s?(0,K.jsx)(Nk,{text:o,name:i}):[`md`,`markdown`].includes(a)?(0,K.jsx)(Mk,{text:o,children:(0,K.jsx)(Sk,{filePreview:!0,children:o})}):c?(0,K.jsx)(Dk,{table:c}):(0,K.jsx)(Ok,{html:o,name:i})})}function Fk(e){return/\.(?:md|markdown|html?|svg|csv|tsv)$/iu.test(e)}var Ik=new Map;function Lk(e,t,n,r){for(let[i,a]of Ik){let o=JSON.parse(i);if(!Array.isArray(o)||o[0]!==e||o[1]!==t||typeof o[2]!=`string`)continue;let s=o[2],c=n.includes(`\\`)?`\\`:`/`;if(s!==n&&!s.startsWith(`${n}${c}`))continue;let l=JSON.stringify([e,t,`${r}${s.slice(n.length)}`]);Ik.has(l)||(Ik.set(l,a),Ik.delete(i))}}function Rk(e,t,n,r){let{t:i}=cr(),[,a]=(0,_.useReducer)(e=>e+1,0),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),u=e?JSON.stringify([e.artifact.sessionId,t,e.artifact.path]):``,d=(0,_.useRef)(u);d.current=u,(0,_.useEffect)(()=>()=>{d.current=``},[]),(0,_.useEffect)(()=>{let e=e=>{Ik.size&&(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[]);let f=Ik.get(u),p=!!(e?.artifact.editable&&!e.truncated&&(f||Ik.size<16));return{text:f?.text??e?.text??``,dirty:!!f,conflict:!!(f&&e&&f.revision!==e.artifact.revision),canEdit:p,saving:o,change:t=>{!e||o||(e.text?.includes(`\r +`&&s++,n.length===500)){o||=s${e}`}function Mk({table:e}){let{t}=cr(),n=Math.max(0,...e.rows.map(e=>e.length));return(0,K.jsxs)(K.Fragment,{children:[e.truncated&&(0,K.jsx)(`p`,{className:`evidence-warning`,children:t(`filesTableTruncated`)}),(0,K.jsx)(`section`,{className:`file-table-scroll`,"aria-label":e.name||t(`filesTable`),tabIndex:0,children:(0,K.jsxs)(`table`,{className:`file-table`,children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{"aria-label":t(`filesRow`)}),Array.from({length:n},(e,t)=>(0,K.jsx)(`th`,{scope:`col`,children:t<26?String.fromCharCode(65+t):`A${String.fromCharCode(65+t-26)}`},t))]})}),(0,K.jsx)(`tbody`,{children:e.rows.map((e,t)=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{scope:`row`,className:`file-row-number`,children:t+1}),Array.from({length:n},(t,n)=>(0,K.jsx)(`td`,{children:e[n]??``},n))]},t))})]})})]})}function Nk({html:e,name:t}){return(0,K.jsx)(`iframe`,{className:`file-preview-frame`,title:t,sandbox:``,referrerPolicy:`no-referrer`,srcDoc:jk(e)})}function Pk({data:e,extension:t,name:n,initialPage:r,onReadingChange:i}){let{t:a}=cr(),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(r??0);return(0,_.useEffect)(()=>i(u),[i,u]),(0,_.useEffect)(()=>{let n=new Worker(new URL(`/app-office-worker-pvhGCwqI.js`,``+import.meta.url),{type:`module`}),r=window.setTimeout(()=>{n.terminate(),l(a(`filesDocumentLimit`))},15e3);n.onmessage=e=>{clearTimeout(r),n.terminate(),e.data.result?s(e.data.result):l(e.data.error||a(`filesPreviewFailed`))},n.onerror=()=>{clearTimeout(r),n.terminate(),l(a(`filesPreviewFailed`))};let i=e.slice(0);return n.postMessage({data:i,extension:t},[i]),()=>{clearTimeout(r),n.terminate()}},[e,t,a]),c?(0,K.jsx)(`p`,{role:`alert`,className:`evidence-warning`,children:c}):o?o.kind===`document`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`file-preview-note`,children:a(`filesOfficeLayout`)}),(0,K.jsx)(Nk,{html:o.html,name:n})]}):o.kind===`sheets`?(0,K.jsxs)(K.Fragment,{children:[o.truncated&&(0,K.jsx)(`p`,{children:a(`filesTableTruncated`)}),(0,K.jsx)(`div`,{className:`file-sheet-tabs`,role:`toolbar`,"aria-label":a(`filesSheets`),children:o.sheets.map((e,t)=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":u===t,onClick:()=>d(t),children:e.name},e.name))}),o.sheets[u]&&(0,K.jsx)(Mk,{table:o.sheets[u]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`file-preview-toolbar`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:u===0,"aria-label":a(`filesPreviousPage`),onClick:()=>d(e=>e-1),children:(0,K.jsx)(R,{})}),(0,K.jsxs)(`span`,{children:[u+1,` / `,o.slides.length]}),(0,K.jsx)(`button`,{type:`button`,disabled:u===o.slides.length-1,"aria-label":a(`filesNextPage`),onClick:()=>d(e=>e+1),children:(0,K.jsx)(ee,{})})]}),(0,K.jsx)(`p`,{className:`file-preview-note`,children:a(`filesSlidesLayout`)}),o.truncated&&(0,K.jsx)(`p`,{children:a(`artifactPreviewTruncated`)}),(0,K.jsx)(Nk,{html:o.slides[u],name:n})]}):(0,K.jsx)(`p`,{role:`status`,children:a(`readingFile`)})}function Fk({data:e,initialPage:t,initialScale:n,onReadingChange:r}){let{t:i}=cr(),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(t??1),[l,u]=(0,_.useState)(n??1);(0,_.useEffect)(()=>r(s,l),[r,s,l]);let[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(!0),h=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=!1,n;return Promise.all([Po(()=>import(`./app-pdf.js`),[]),Po(()=>import(`./app-pdf.worker.min.js`),[])]).then(async([r,i])=>{if(t)return;r.GlobalWorkerOptions.workerSrc=i.default,n=r.getDocument({data:new Uint8Array(e.slice(0)),useWasm:!1,useSystemFonts:!0,disableAutoFetch:!0,maxImageSize:16e6});let a=await n.promise;t||o(a)}).catch(e=>{t||(m(!1),f(e instanceof Error?e.message:i(`filesPreviewFailed`)))}),()=>{t=!0,n?.destroy()}},[e,i]),(0,_.useEffect)(()=>{if(!a||!h.current)return;let e=!1,t,n=h.current;return m(!0),a.getPage(s).then(async r=>{if(e)return;let i=r.getViewport({scale:1}),a=Math.min(l*1.5,Math.sqrt(8e6/(i.width*i.height))),o=r.getViewport({scale:a});n.width=o.width,n.height=o.height,n.style.width=`${Math.min(i.width,n.parentElement?.clientWidth||i.width)*l}px`,t=r.render({canvas:n,viewport:o}),await t.promise,e||(f(``),m(!1))}).catch(t=>{e||(m(!1),f(t instanceof Error?t.message:i(`filesPreviewFailed`)))}),()=>{e=!0,t?.cancel()}},[a,s,l,i]),(0,K.jsxs)(`div`,{className:`file-pdf`,children:[(0,K.jsxs)(`div`,{className:`file-preview-toolbar`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`filesPreviousPage`),disabled:!a||s===1,onClick:()=>c(e=>e-1),children:(0,K.jsx)(R,{})}),(0,K.jsxs)(`span`,{children:[s,` / `,a?.numPages??`…`]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`filesNextPage`),disabled:!a||s===a.numPages,onClick:()=>c(e=>e+1),children:(0,K.jsx)(ee,{})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`filesZoomOut`),disabled:l<=.5,onClick:()=>u(e=>Math.max(.5,e-.25)),children:(0,K.jsx)($e,{})}),(0,K.jsxs)(`button`,{type:`button`,"aria-label":i(`filesZoomReset`),onClick:()=>u(1),children:[(0,K.jsx)(Ge,{}),` `,Math.round(l*100),`%`]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`filesZoomIn`),disabled:l>=3,onClick:()=>u(e=>Math.min(3,e+.25)),children:(0,K.jsx)(lt,{})})]}),d&&(0,K.jsx)(`p`,{role:`alert`,children:d}),p&&(0,K.jsx)(`p`,{role:`status`,children:i(`readingFile`)}),(0,K.jsx)(`section`,{className:`file-media-viewport`,tabIndex:0,"aria-label":i(`filePreview`),children:(0,K.jsx)(`canvas`,{ref:h,"aria-label":i(`filesPdfPage`,{page:s}),role:`img`})})]})}function Ik({artifact:e,client:t}){let{t:n}=cr(),r=kk(),i=r?.artifact?.document,a=i?.path===e.path&&i.revision===e.revision?i:void 0,o=(t,n)=>{r?.artifact?.reference===encodeURI(e.path)&&(r.artifact.document={path:e.path,revision:e.revision,page:t,scale:n})},[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(``);if((0,_.useEffect)(()=>{let r=new AbortController;return t.downloadArtifact(e,r.signal).then(e=>e.arrayBuffer()).then(e=>{r.signal.aborted||c(e)}).catch(e=>{r.signal.aborted||u(e instanceof Error?e.message:n(`filesPreviewFailed`))}),()=>r.abort()},[e,t,n]),l)return(0,K.jsx)(`p`,{role:`alert`,className:`evidence-warning`,children:l});if(!s)return(0,K.jsx)(`p`,{role:`status`,children:n(`readingFile`)});let d=e.name.split(`.`).at(-1)?.toLowerCase()??``;return d===`pdf`?(0,K.jsx)(Fk,{data:s,initialPage:a?.page,initialScale:a?.scale,onReadingChange:o}):(0,K.jsx)(Pk,{data:s,extension:d,name:e.name,initialPage:a?.page,onReadingChange:o})}function Lk({children:e,text:t}){let{t:n}=cr(),r=(0,_.useRef)(null),i=(0,_.useRef)(null),a=(0,_.useRef)(null),o=(0,_.useId)(),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(null);(0,_.useLayoutEffect)(()=>{let e=[...r.current?.querySelectorAll(`.markdown h1, .markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6`)??[]].filter(e=>e.textContent?.trim());u(e);let t=r.current?.closest(`.artifact-panel-body`),n=()=>{let n=t?.getBoundingClientRect().top??0;f(e.filter(e=>e.getBoundingClientRect().top<=n+56).at(-1)??e[0]??null)};return n(),t?.addEventListener(`scroll`,n,{passive:!0}),()=>t?.removeEventListener(`scroll`,n)},[t]),(0,_.useEffect)(()=>{if(!s)return;a.current?.querySelector(`button`)?.focus();let e=e=>{e.target instanceof Node&&!a.current?.contains(e.target)&&c(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[s]);let p=e=>{let t=e.parentElement;for(;t&&t!==r.current;)t instanceof HTMLDetailsElement&&(t.open=!0),t=t.parentElement;let n=r.current?.closest(`.artifact-panel-body`);n&&n.scrollTo({top:n.scrollTop+e.getBoundingClientRect().top-n.getBoundingClientRect().top-16,behavior:`instant`}),f(e),c(!1),e.tabIndex=-1,e.focus({preventScroll:!0})};return(0,K.jsxs)(`div`,{className:`file-markdown`,ref:r,children:[l.length>1&&(0,K.jsx)(`div`,{className:`file-outline-bar`,children:(0,K.jsxs)(`section`,{className:`file-outline`,"aria-label":n(`filesOutline`),ref:a,onKeyDown:e=>{e.key===`Escape`&&s&&(e.preventDefault(),e.stopPropagation(),c(!1),i.current?.focus())},children:[(0,K.jsx)(`button`,{type:`button`,ref:i,className:`icon-button`,title:n(`filesOutline`),"aria-label":n(`filesOutline`),"aria-expanded":s,"aria-controls":o,onClick:()=>c(e=>!e),children:(0,K.jsx)(Ve,{"aria-hidden":`true`})}),s&&(0,K.jsx)(`nav`,{id:o,"aria-label":n(`filesOutline`),className:`file-outline-panel`,children:l.map((e,t)=>(0,K.jsxs)(`button`,{type:`button`,"aria-current":d===e?`location`:void 0,style:{paddingInlineStart:10+(Number(e.tagName.slice(1))-1)*10},onClick:()=>p(e),children:[(0,K.jsx)(`small`,{"aria-hidden":`true`,children:e.tagName.slice(1)}),(0,K.jsx)(`span`,{children:e.textContent})]},`${t}:${e.textContent}`))})]})}),e]})}function Rk({text:e,name:t}){let[n,r]=(0,_.useState)(``);return(0,_.useEffect)(()=>{let n=!1;return r(``),Po(async()=>{let{default:e}=await import(`./app-common.js`);return{default:e}},__vite__mapDeps([21,1])).then(({default:i})=>{let a=t.split(`.`).at(-1)?.toLowerCase()??``,o={tsx:`typescript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,svg:`xml`,html:`xml`,yml:`yaml`,md:`markdown`,sh:`bash`}[a]??a;if(n||e.length>1e5||!i.getLanguage(o))return;let s=i.highlight(e,{language:o,ignoreIllegals:!0});r(Hp.sanitize(s.value,{ALLOWED_TAGS:[`span`],ALLOWED_ATTR:[`class`]}))}).catch(()=>void 0),()=>{n=!0}},[e,t]),(0,K.jsx)(`section`,{className:`file-code`,"aria-label":`File preview content`,tabIndex:0,children:(0,K.jsx)(`pre`,{children:n?(0,K.jsx)(`code`,{dangerouslySetInnerHTML:{__html:n}}):(0,K.jsx)(`code`,{children:e})})})}function zk({preview:e,client:t,source:n=!1}){let{t:r}=cr(),{name:i}=e.artifact,a=i.split(`.`).at(-1)?.toLowerCase()??``,o=e.text,s=Bk(i),c=(0,_.useMemo)(()=>[`csv`,`tsv`].includes(a)?Ak(o??``,a===`tsv`?` `:`,`):null,[o,a]);return[`pdf`,`docx`,`xlsx`,`pptx`].includes(a)?(0,K.jsx)(Ik,{artifact:e.artifact,client:t}):o===void 0?(0,K.jsx)(`p`,{children:r(`artifactUnsupported`)}):(0,K.jsx)(K.Fragment,{children:n||!s?(0,K.jsx)(Rk,{text:o,name:i}):[`md`,`markdown`].includes(a)?(0,K.jsx)(Lk,{text:o,children:(0,K.jsx)(Dk,{filePreview:!0,children:o})}):c?(0,K.jsx)(Mk,{table:c}):(0,K.jsx)(Nk,{html:o,name:i})})}function Bk(e){return/\.(?:md|markdown|html?|svg|csv|tsv)$/iu.test(e)}var Vk=new Map;function Hk(e,t,n,r){for(let[i,a]of Vk){let o=JSON.parse(i);if(!Array.isArray(o)||o[0]!==e||o[1]!==t||typeof o[2]!=`string`)continue;let s=o[2],c=n.includes(`\\`)?`\\`:`/`;if(s!==n&&!s.startsWith(`${n}${c}`))continue;let l=JSON.stringify([e,t,`${r}${s.slice(n.length)}`]);Vk.has(l)||(Vk.set(l,a),Vk.delete(i))}}function Uk(e,t,n,r){let{t:i}=cr(),[,a]=(0,_.useReducer)(e=>e+1,0),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),u=e?JSON.stringify([e.artifact.sessionId,t,e.artifact.path]):``,d=(0,_.useRef)(u);d.current=u,(0,_.useEffect)(()=>()=>{d.current=``},[]),(0,_.useEffect)(()=>{let e=e=>{Vk.size&&(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[]);let f=Vk.get(u),p=!!(e?.artifact.editable&&!e.truncated&&(f||Vk.size<16));return{text:f?.text??e?.text??``,dirty:!!f,conflict:!!(f&&e&&f.revision!==e.artifact.revision),canEdit:p,saving:o,change:t=>{!e||o||(e.text?.includes(`\r `)&&!/(?{Ik.delete(u),l(null),a()},reconcile:()=>{!f||!e||e.truncated||(Ik.set(u,{text:f.text,revision:e.artifact.revision}),l(null),a())},save:async()=>{if(!(!f||!e||o||!p)){s(!0),l(null);try{let t=await n.saveArtifact(e.artifact,f.revision,f.text);Ik.get(u)===f&&Ik.delete(u),d.current===u&&(r(f.text,t.revision),l({key:u,error:!1,text:i(`filesSaved`)}))}catch(e){d.current===u&&l({key:u,error:!0,text:e instanceof tf&&e.code===`ARTIFACT_CHANGED`?i(`filesSaveConflict`):i(`filesSaveFailed`)})}finally{s(!1),a()}}},message:c?.key===u?c:null}}function zk({artifact:e,client:t}){let{t:n}=cr(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),{sessionId:l,handle:u,revision:d}=e;return(0,_.useEffect)(()=>{let e=new AbortController,r;return i(null),o(null),t.downloadArtifact({sessionId:l,handle:u,revision:d},e.signal).then(async t=>{let a=of(new Uint8Array(await t.slice(0,12).arrayBuffer()));if(!e.signal.aborted){if(!a)throw Error(n(`artifactImagePreviewFailed`));r=URL.createObjectURL(new Blob([t],{type:a})),i({url:r,loaded:!1})}}).catch(t=>{e.signal.aborted||o(t instanceof Error?t.message:n(`artifactImagePreviewFailed`))}),()=>{e.abort(),r&&URL.revokeObjectURL(r)}},[l,u,d,t,n]),a?(0,K.jsxs)(`div`,{role:`alert`,className:`evidence-warning`,children:[(0,K.jsx)(`p`,{children:n(`artifactImagePreviewFailed`)}),a!==n(`artifactImagePreviewFailed`)&&(0,K.jsx)(`small`,{children:a})]}):(0,K.jsxs)(`div`,{className:`artifact-image-preview`,"data-original":s,children:[(0,K.jsxs)(`div`,{className:`file-preview-toolbar`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-pressed":!s,onClick:()=>c(!1),children:n(`filesFitImage`)}),(0,K.jsx)(`button`,{type:`button`,"aria-pressed":s,onClick:()=>c(!0),children:n(`filesOriginalImage`)})]}),!r?.loaded&&(0,K.jsx)(`p`,{role:`status`,children:n(`readingFile`)}),(0,K.jsx)(`div`,{className:`file-media-viewport`,children:r&&(0,K.jsx)(`img`,{src:r.url,alt:e.name,hidden:!r.loaded,onLoad:()=>i(e=>e?{...e,loaded:!0}:null),onError:()=>o(n(`artifactImagePreviewFailed`))})})]})}var Bk=(0,_.forwardRef)(function({sessionId:e,sessionPath:t,children:n,disabled:r=!1,embedded:i=!1,active:a=!0,onOpen:o,onClose:s},c){let{t:l}=cr(),u=(0,_.useMemo)(()=>new rf,[]),d=wk(),f=i?d?.artifact:void 0,[p,m]=(0,_.useState)(()=>f?{sessionId:e,sessionPath:t,reference:f.reference}:null),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(f?.source??!1),[b,x]=(0,_.useState)(f?.editing??!1),[S,C]=(0,_.useState)(null),[w,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(!1),[O,k]=(0,_.useState)(null),[A,j]=(0,_.useState)(!1),[M,N]=(0,_.useState)(!1),P=(0,_.useRef)(null),F=(0,_.useRef)(null),L=(0,_.useRef)(0),R=(0,_.useRef)(null),z=(0,_.useRef)(null),B=(0,_.useRef)(null),V=(0,_.useRef)(null),H=(0,_.useRef)(f?.scroll??0),te=(0,_.useRef)(!!f);(0,_.useLayoutEffect)(()=>{!i||!d||(d.artifact=p?{reference:h?.artifact.path?encodeURI(h.artifact.path):p.reference,source:v,editing:b,scroll:H.current,document:d.artifact?.document}:void 0)},[i,d,p,h?.artifact.path,v,b]);let ne=(0,_.useRef)(null),re=(0,_.useRef)(new Set),ie=(0,_.useRef)(void 0),ae=(0,_.useRef)(!1),U=(0,_.useRef)(null),se=JSON.stringify([e,t,r]),le=(0,_.useRef)(se);le.current=se;let ue=!!(p&&!r&&p.sessionId===e&&p.sessionPath===t);(0,_.useEffect)(()=>()=>{U.current!==null&&(window.cancelAnimationFrame(U.current),U.current=null)},[se]);let de=(0,_.useCallback)((n,i,a)=>{if(r)return;let s=document.activeElement,c=a??(s instanceof HTMLElement?s:null),l=!!(i||c?.closest(`.artifact-panel`));l||(F.current=c),o?.(l),U.current!==null&&(window.cancelAnimationFrame(U.current),U.current=null),ae.current=!0,L.current++,g(null),y(!1),x(!1),H.current=0,te.current=!1,C(null),T(!1),k(null),j(!1),ie.current=i,m({reference:n,parent:i,sessionId:e,sessionPath:t})},[r,o,e,t]),fe=(0,_.useCallback)(({restoreFocus:e=!0}={})=>{if(!p)return;let t=++L.current,n=F.current,r=document.activeElement,i=ue?`user`:`context`;if(F.current=null,ae.current=!1,ie.current=void 0,m(null),g(null),k(null),P.current?.abort(),s?.(i),U.current!==null&&window.cancelAnimationFrame(U.current),i===`context`||!e){U.current=null;return}U.current=window.requestAnimationFrame(()=>{U.current=null,t===L.current&&le.current===se&&(document.activeElement===document.body||document.activeElement===r||document.activeElement===n)&&n?.isConnected&&n.checkVisibility({visibilityProperty:!0})&&n.focus()})},[s,p,ue,se]);Ki({isActive:ue&&a,onDismiss:fe,getContainer:()=>R.current,isPresent:()=>R.current?.contains(document.activeElement)??!1}),(0,_.useImperativeHandle)(c,()=>({close:fe}),[fe]),(0,_.useLayoutEffect)(()=>{b?B.current?.focus({preventScroll:!0}):V.current&&(V.current.scrollTop=H.current)},[b]),(0,_.useLayoutEffect)(()=>{!a||!h||!te.current||!V.current||(V.current.scrollTop=H.current,te.current=!1)},[a,h]),(0,_.useEffect)(()=>{!p||ue||(L.current++,m(null),g(null),k(null),ae.current=!1,F.current=null,ie.current=void 0,s?.(`context`))},[p,ue,s]),(0,_.useEffect)(()=>{if(!p||!e||!ue||!a)return;let t=new AbortController,n,r=p.parent,i,o=!1,s,c=!1,l=2e3;ae.current&&(ae.current=!1,z.current?.focus());let d=async()=>{if(document.visibilityState===`hidden`){i=setTimeout(d,2e3);return}try{if(n||=(await(p.external?u.authorizeArtifact(e,p.reference,t.signal):u.resolveArtifact(e,p.reference,r,t.signal))).handle,r&&=(u.releaseArtifact(e,r).catch(()=>void 0),void 0),o){u.releaseArtifact(e,n).catch(()=>void 0);return}if(s){if((await u.artifactMetadata(e,n,t.signal)).identity===s){o||C(null),l=Math.min(l*2,3e4);return}if(c){o||j(!0),l=3e4;return}}let i=await u.artifactPreview(e,n,t.signal);o||(s=i.identity,c=i.text!==void 0,l=2e3,g(e=>e?.artifact.path===i.artifact.path&&e.artifact.revision===i.artifact.revision?{...i,text:e.text,truncated:e.truncated,nextOffset:e.nextOffset}:i),C(null))}catch(e){let t=e instanceof tf&&[401,403,410].includes(e.status);!o&&t&&(g(null),ne.current?.abort()),o||T(e instanceof tf&&e.code===`ARTIFACT_DENIED`),l=Math.min(l*2,3e4),o||C(e instanceof Error?e.message:`Unable to read file`),t&&(o=!0)}finally{o||(i=setTimeout(d,l))}};return d(),()=>{o=!0,t.abort(),clearTimeout(i),ne.current?.abort(),P.current?.abort(),N(!1),D(!1),n&&n!==ie.current&&u.releaseArtifact(e,n).catch(()=>void 0),r&&u.releaseArtifact(e,r).catch(()=>void 0);for(let e of re.current)URL.revokeObjectURL(e);re.current.clear()}},[u,p,ue,e,a]);let me=(0,_.useMemo)(()=>({open:de,disabled:r}),[de,r]),W=h?.artifact.path??p?.reference??``,he=h?.artifact.name??W.split(/[\\/]/u).at(-1)??W,ge=Rk(h,t,u,(e,t)=>{g(n=>n&&{...n,text:e,truncated:!1,nextOffset:void 0,artifact:{...n.artifact,revision:t,bytes:new TextEncoder().encode(e).length}}),j(!1),m(e=>e&&{...e})}),ve=async()=>{if(!h||E)return;let e=new AbortController;ne.current=e,D(!0);try{let t=await u.downloadArtifact(h.artifact,e.signal);if(e.signal.aborted)return;let n=URL.createObjectURL(t);re.current.add(n);let r=document.createElement(`a`);r.href=n,r.download=h.artifact.name,r.click(),setTimeout(()=>{URL.revokeObjectURL(n),re.current.delete(n)},1e3)}catch(t){e.signal.aborted||C(t instanceof Error?t.message:`Download failed`)}finally{e.signal.aborted||D(!1)}},ye=async()=>{if(!h?.nextOffset||P.current)return;let e=h,t=new AbortController;P.current=t,N(!0);try{let n=await u.artifactPreview(e.artifact.sessionId,e.artifact.handle,t.signal,{offset:e.nextOffset,revision:e.artifact.revision});t.signal.aborted||g(t=>t?.artifact.handle===e.artifact.handle&&t.artifact.revision===n.artifact.revision?{...n,text:(t.text??``)+(n.text??``)}:t)}catch(e){t.signal.aborted||C(e instanceof Error?e.message:l(`filesReadFailed`))}finally{P.current===t&&(P.current=null,N(!1))}};return(0,K.jsxs)(fk.Provider,{value:me,children:[n,p&&ue&&(0,K.jsx)(Ti,{children:(0,K.jsxs)(`aside`,{ref:R,className:`artifact-panel${i?` artifact-panel-embedded`:``}`,"aria-label":l(`filePreview`),onKeyDown:e=>{if(i&&(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`){e.preventDefault(),e.stopPropagation(),ge.save();return}},children:[(0,K.jsxs)(`header`,{children:[(0,K.jsxs)(`div`,{className:`artifact-title`,children:[(0,K.jsx)(`small`,{title:W,children:i?W.split(/[\\/]/u).slice(0,-1).at(-1)||l(`files`):`${l(`filePreview`)} · ${l(`artifactReadOnly`)}`}),i&&(0,K.jsx)(ee,{"aria-hidden":`true`}),(0,K.jsx)(`h2`,{title:W,children:he}),ge.dirty&&(0,K.jsx)(`span`,{className:`file-unsaved`,role:`img`,title:l(`filesUnsaved`),"aria-label":l(`filesUnsaved`),children:`●`})]}),(0,K.jsxs)(`div`,{className:`artifact-header-actions`,children:[i&&h?.text!==void 0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`fieldset`,{className:`file-mode-switch`,"aria-label":l(`filesMode`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-pressed":!b,onClick:()=>x(!1),children:l(`filesPreview`)}),(0,K.jsx)(`button`,{type:`button`,"aria-pressed":b,disabled:!ge.canEdit,title:l(h.truncated?`filesEditLoadFirst`:h.artifact.editable?`filesEdit`:`filesEditUnavailable`),onClick:()=>{H.current=V.current?.scrollTop??0,x(!0)},children:l(`filesEdit`)})]}),(b||ge.dirty||ge.saving)&&(0,K.jsxs)(`button`,{type:`button`,className:`file-save-button`,title:`${l(`filesSave`)} (Cmd/Ctrl+S)`,disabled:!ge.dirty||ge.saving||!ge.canEdit,onClick:()=>void ge.save(),children:[(0,K.jsx)(pt,{"aria-hidden":`true`}),l(ge.saving?`filesSaving`:ge.dirty?`filesSave`:`filesSaved`)]}),ge.dirty&&(0,K.jsx)(`button`,{type:`button`,title:l(`filesDiscard`),"aria-label":l(`filesDiscard`),disabled:ge.saving,onClick:()=>{window.confirm(l(`filesDiscardConfirm`))&&ge.discard()},children:(0,K.jsx)(ft,{"aria-hidden":`true`})})]}),!i&&h?.text!==void 0&&Fk(he)&&(0,K.jsxs)(`button`,{type:`button`,className:`file-source-toggle`,"aria-pressed":v,onClick:()=>y(e=>!e),children:[v?(0,K.jsx)(_e,{"aria-hidden":`true`}):(0,K.jsx)(ce,{"aria-hidden":`true`}),l(v?`filesPreview`:`filesSource`)]}),(0,K.jsx)(Cd,{content:l(`copyFilePath`),placement:`below`,children:(0,K.jsx)(`button`,{className:`artifact-icon-button`,type:`button`,"aria-label":l(`copyFilePath`),onClick:()=>{let e=++L.current;wd(W).then(t=>{e===L.current&&k(t?`copied`:`failed`)})},children:O===`copied`?(0,K.jsx)(I,{"aria-hidden":`true`}):(0,K.jsx)(oe,{"aria-hidden":`true`})})}),(0,K.jsx)(Cd,{content:l(`refreshFile`),placement:`below`,children:(0,K.jsxs)(`button`,{className:`artifact-icon-button`,type:`button`,"aria-label":l(`refreshFile`),onClick:()=>{L.current++,k(null),C(null),T(!1),j(!1),ie.current=void 0,m(n=>n?{sessionId:e,sessionPath:t,reference:h?encodeURI(h.artifact.path):n.reference,...n.external?{external:!0}:{},...h?{}:{parent:n.parent}}:null)},children:[(0,K.jsx)(dt,{"aria-hidden":`true`}),` `,l(`refreshFile`)]})}),(0,K.jsx)(Cd,{content:l(`downloadFile`),placement:`below`,children:(0,K.jsxs)(`button`,{className:`artifact-icon-button`,type:`button`,"aria-label":l(E?`downloadingFile`:`downloadFile`),disabled:!h||E,onClick:()=>void ve(),children:[(0,K.jsx)(pe,{"aria-hidden":`true`}),` `,l(E?`downloadingFile`:`downloadFile`)]})}),(0,K.jsx)(Cd,{content:l(`closePreview`),placement:`below`,children:(0,K.jsx)(`button`,{className:`artifact-icon-button`,ref:z,type:`button`,"aria-label":l(`closePreview`),onClick:()=>fe(),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})})]})]}),(0,K.jsxs)(`div`,{className:`artifact-panel-body`,ref:V,onScroll:e=>{te.current||(H.current=e.currentTarget.scrollTop,i&&d?.artifact&&(d.artifact.scroll=H.current))},children:[!i&&(0,K.jsx)(`div`,{className:`artifact-source`,children:(0,K.jsx)(`code`,{title:W,children:W})}),O&&(0,K.jsx)(`p`,{role:`status`,children:l(O===`copied`?`filePathCopied`:`copyFailed`)}),S&&(0,K.jsxs)(`p`,{role:`status`,className:`evidence-warning`,children:[h?l(`artifactOlderPreview`):``,S]}),A&&(0,K.jsx)(`p`,{className:`evidence-warning`,role:`status`,children:l(`filesContentChanged`)}),ge.message&&(0,K.jsx)(`p`,{role:`status`,className:ge.message.error?`evidence-warning`:`file-save-status`,children:ge.message.text}),ge.conflict&&(0,K.jsxs)(`div`,{className:`file-conflict`,children:[(0,K.jsx)(`p`,{children:l(`filesSaveConflict`)}),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{children:l(`filesDiskVersion`)}),(0,K.jsx)(`pre`,{children:h?.text})]}),(0,K.jsx)(`button`,{type:`button`,disabled:!ge.canEdit||ge.saving,onClick:ge.reconcile,children:l(`filesReconcile`)})]}),w&&!p.external&&/^(?:\/(?!\/)|[a-z]:[\\/])/iu.test(p.reference)&&(0,K.jsxs)(`div`,{className:`artifact-external-access`,children:[(0,K.jsx)(`p`,{children:l(`artifactExternalAccess`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{ae.current=!0,C(null),T(!1),m({...p,parent:void 0,external:!0})},children:l(`artifactAuthorizeFile`)})]}),!h&&!S&&(0,K.jsx)(`p`,{role:`status`,children:l(`readingFile`)}),h&&(0,K.jsxs)(K.Fragment,{children:[h.truncated&&(0,K.jsx)(`p`,{className:`evidence-warning`,children:l(`artifactPreviewTruncated`)}),/\.(?:png|jpe?g|gif|webp)$/iu.test(h.artifact.name)?(0,K.jsx)(zk,{artifact:h.artifact,client:u},JSON.stringify([h.artifact.sessionId,h.artifact.path,h.artifact.handle,h.artifact.revision])):(0,K.jsxs)(fk.Provider,{value:{open:de,disabled:r,parent:h.artifact.handle,sessionId:e},children:[i&&ge.canEdit&&(0,K.jsx)(`textarea`,{ref:B,hidden:!b,className:`file-editor`,"aria-label":l(`filesEditor`),spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:1048576,value:ge.text,disabled:ge.saving,onChange:e=>ge.change(e.currentTarget.value)}),!(i&&b&&ge.canEdit)&&(0,K.jsx)(Pk,{preview:ge.dirty?{...h,text:ge.text}:h,client:u,source:v},`${h.artifact.path}:${h.artifact.revision}`)]}),h.nextOffset!==void 0&&(0,K.jsx)(`button`,{type:`button`,className:`file-read-more`,disabled:M||A,onClick:()=>void ye(),children:l(M?`readingFile`:`filesReadMore`)}),(0,K.jsxs)(`details`,{className:`artifact-file-details`,children:[(0,K.jsx)(`summary`,{children:l(`artifactFileDetails`)}),(0,K.jsx)(`p`,{className:`artifact-session`,children:l(`artifactSession`,{sessionId:e})}),(0,K.jsxs)(`p`,{className:`artifact-revision`,children:[l(`artifactVersion`),`:`,` `,(0,K.jsx)(`code`,{children:h.artifact.revision}),` ·`,` `,l(`artifactBytes`,{count:h.artifact.bytes})]})]})]})]})]})})]})}),Vk=[`noopener`,`noreferrer`];function Hk(e,t){if(e!==`_blank`)return{target:e,rel:t};let n=t?.split(/\s+/).filter(Boolean)??[];for(let e of Vk)n.includes(e)||n.push(e);return{target:e,rel:n.join(` `)}}var Uk=new Set([`option`,`tab`,`row`,`gridcell`,`columnheader`,`rowheader`,`treeitem`]),Wk={root:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kg3NbH:`xf314gf`,kVAEAm:`x1n2onr6`,kB7OPa:`x9f619`,k9WMMc:`x1yc453h`,kaIpWk:`xh6dtrn`,$$css:!0},alignStart:{kGNEyG:`x1cy8zhl`,$$css:!0},interactive:{kkrTdU:`x1ypdohk x16khyan`,k1ekBW:`x15406qy`,kIyJzY:`xkvfbh3`,kAMwcw:`xlr8y92`,$$css:!0},highlighted:{kWkggS:`x1lmrjuc`,$$css:!0},selected:{kWkggS:`xgcxg3y`,$$css:!0},disabled:{kkrTdU:`xt0e3qv`,kfzvcC:`x47corl`,$$css:!0},inlineLabel:{kmuXW:`x2lah0s`,$$css:!0},inlineDescription:{kmuXW:`xs83m0k`,k7Eaqz:`xeuugli`,$$css:!0},label:{kMwMTN:`x5tbw38`,kGuDYH:`xjm74w1`,kLWn49:`xw6l6zx`,$$css:!0},labelSingleTruncate:{kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,$$css:!0},labelMultiTruncate:{kVQacm:`xb3r6kr`,k1xSpc:`x104kibb`,kgKLqz:`x1ua5tub`,$$css:!0},description:{kMwMTN:`x1gb3s7i`,kGuDYH:`x141an7d`,kLWn49:`x1ltkj2j`,$$css:!0},descriptionSingleTruncate:{kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,$$css:!0},descriptionMultiTruncate:{kVQacm:`xb3r6kr`,k1xSpc:`x104kibb`,kgKLqz:`x1ua5tub`,$$css:!0}},Gk={lineClamp:e=>[{kJFfOR:e==null?e:`x1yhjpo9`,$$css:!0},{"--x-WebkitLineClamp":e??void 0}]},Kk={compact:{k8WAf4:`xu0wf1k`,$$css:!0},balanced:{k8WAf4:`xce4md1`,$$css:!0},spacious:{k8WAf4:`x8o8v82`,kg3NbH:`xrrkdod`,$$css:!0}};function qk({as:e=`div`,marker:t,startContent:n,label:r,description:i,endContent:a,align:o=`center`,density:s=`balanced`,labelLines:c,descriptionLines:l,layout:u=`stacked`,onClick:d,interactiveRef:f,href:p,target:m,rel:h,isHighlighted:g=!1,isSelected:v=!1,isDisabled:y=!1,xstyle:b,className:x,style:S,ref:C,role:w,...T}){let E=us(),D=f!=null,O=(0,_.useRef)(null),{onClick:k}=Ya({containerRef:O,interactiveRef:f??void 0,disabled:y});sd(`Item`,"`interactiveRef` is mutually exclusive with `onClick`/`href`. In delegation mode the row only forwards clicks to the referenced control, so `onClick`/`href` are ignored. Drop one of them.",D&&(d!=null||p!=null));let A=d!=null||p!=null||D,{target:j,rel:M}=Hk(m,h),N=w!=null,P=w!=null&&Uk.has(w),F=typeof r==`string`,I=typeof i==`string`,L=c==null?F?Wk.labelSingleTruncate:null:c===1?Wk.labelSingleTruncate:Wk.labelMultiTruncate,R=u===`inline`&&i!=null,ee=l==null?I||R?Wk.descriptionSingleTruncate:null:l===1?Wk.descriptionSingleTruncate:Wk.descriptionMultiTruncate,z=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{...Sr(Wk.label,R&&Wk.inlineLabel,L,c!=null&&c>1&&Gk.lineClamp(c)),children:r}),i!=null&&(0,K.jsx)(`span`,{...Sr(Wk.description,R&&Wk.inlineDescription,ee,l!=null&&l>1&&Gk.lineClamp(l)),children:i})]}),B=e=>{y||e.target.closest(`button, a, input, select, textarea`)||d?.(e)},V=(0,K.jsxs)(K.Fragment,{children:[t,n!=null&&(0,K.jsx)(`span`,{className:`x3psx0u x78zum5`,children:n}),N||D?(0,K.jsx)(`span`,{...{0:{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h`},2:{className:`x78zum5 x98rzlu xeuugli x1yc453h x1q0g3np x6s0dn4 x1lfs0n9`},1:{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h xbyyjgo`},3:{className:`x78zum5 x98rzlu xeuugli x1yc453h x1q0g3np x6s0dn4 x1lfs0n9 xbyyjgo`}}[!!R<<1|!!y<<0],children:z}):p==null?d==null?(0,K.jsx)(`span`,{...{0:{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h`},2:{className:`x78zum5 x98rzlu xeuugli x1yc453h x1q0g3np x6s0dn4 x1lfs0n9`},1:{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h xbyyjgo`},3:{className:`x78zum5 x98rzlu xeuugli x1yc453h x1q0g3np x6s0dn4 x1lfs0n9 xbyyjgo`}}[!!R<<1|!!y<<0],children:z}):(0,K.jsx)(`button`,{type:`button`,onClick:d,disabled:y,...{0:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1a2a7pz`},2:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 x98rzlu xeuugli x1yc453h x1a2a7pz x1q0g3np x6s0dn4 x1lfs0n9`},1:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1a2a7pz xbyyjgo`},3:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 x98rzlu xeuugli x1yc453h x1a2a7pz x1q0g3np x6s0dn4 x1lfs0n9 xbyyjgo`}}[!!R<<1|!!y<<0],children:z}):(0,K.jsx)(E,{href:p,target:j,rel:M,"aria-disabled":y||void 0,tabIndex:y?-1:void 0,...{0:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz`},2:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz x1q0g3np x6s0dn4 x1lfs0n9`},1:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz xbyyjgo`},3:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz x1q0g3np x6s0dn4 x1lfs0n9 xbyyjgo`}}[!!R<<1|!!y<<0],children:z}),a!=null&&(0,K.jsx)(`span`,{...{0:{className:`x3psx0u x78zum5 xvc5jky`},1:{className:`x3psx0u x78zum5 xvc5jky xbyyjgo`}}[!!y<<0],children:a})]}),H=Ao(C,O);return(0,K.jsx)(e,{ref:D?H:C,...T,"aria-selected":P&&v||void 0,"aria-current":T[`aria-current`]??(v&&!P?!0:void 0),"aria-disabled":y||void 0,...oa(ba(`item`,{density:s,align:o}),Wa.focusWithin(Wk.root,Kk[s],o===`start`&&Wk.alignStart,A&&Wk.interactive,A&&ds.backgroundColor,g&&Wk.highlighted,v&&Wk.selected,y&&!N&&Wk.disabled,b),x,S),role:w,onClick:D?k:N?d:A?B:void 0,children:V})}qk.displayName=`Item`;var Jk=(0,_.createContext)(null);Jk.displayName=`DropdownMenuContext`;function Yk(){return(0,_.use)(Jk)}var Xk=(0,_.createContext)(null);Xk.displayName=`DropdownMenuRadioGroupContext`;function Zk(e,t){if(t||e.pointerType!==`mouse`)return;let n=e.currentTarget;n!==n.ownerDocument.activeElement&&n.focus()}var Qk={root:{kB7OPa:`x9f619`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`x1ws5lxm`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0},destructive:{kMwMTN:`xjt36v0`,"--_item-label-color":`xufyqxy`,"--_item-description-color":`xqlix59`,$$css:!0}},$k={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}};function eA({icon:e,label:t,description:n,onClick:r,isDisabled:i=!1,endContent:a,hasCloseOnSelect:o=!0,variant:s=`default`,xstyle:c,className:l,style:u}){let d=Yk(),f=d?.menuSize??`md`,p=(0,_.useCallback)(()=>{i||(r?.(),o&&d?.closeMenu())},[i,r,o,d]),m=(0,_.useCallback)(e=>Zk(e,i),[i]),h=s===`destructive`;return(0,K.jsx)(qk,{role:`menuitem`,tabIndex:i?void 0:-1,onPointerMove:m,startContent:e?Cu(e,{size:`sm`,color:h?`error`:`secondary`}):void 0,label:t,description:n,endContent:a,onClick:p,isDisabled:i,xstyle:[Qk.root,$k[f],h&&Qk.destructive,i&&Qk.disabled,c],...oa(ba(`dropdown-menu-item`,{size:f,variant:h?`destructive`:null}),{className:l,style:u})})}eA.displayName=`DropdownMenuItem`;var tA={horizontal:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kzqmXN:`xh8yej3`,$$css:!0},vertical:{k1xSpc:`x3nfvp2`,kXwgrk:`xdt5ytf`,kGNEyG:`x6s0dn4`,kZKoxP:`x5yr21d`,$$css:!0}},nA={horizontalLine:{kZKoxP:`xsyqizj`,kzQI83:`x1iyjqo2`,kmuXW:`xs83m0k`,$$css:!0},verticalLine:{kzqmXN:`xjk4fl7`,kzQI83:`x1iyjqo2`,kmuXW:`xs83m0k`,$$css:!0},subtle:{kWkggS:`x1m4xfpy`,$$css:!0},strong:{kWkggS:`x7njt3n`,$$css:!0}},rA={horizontal:{keTefX:`xojxgvx`,k71WvV:`x1fcf3bl`,kzqmXN:`xx6qvi6`,$$css:!0},vertical:{keoZOQ:`x1sa9bsh`,k1K539:`x6h7pi7`,kZKoxP:`x12qplqi`,$$css:!0}};function iA({orientation:e=`horizontal`,label:t,variant:n=`subtle`,isFullBleed:r=!1,xstyle:i,className:a,style:o,ref:s,"aria-label":c,"aria-labelledby":l,...u}){let d=e===`horizontal`,f=(0,_.useId)(),p=l??(t&&c==null?f:void 0);return(0,K.jsxs)(`div`,{ref:s,...u,role:`separator`,"aria-orientation":e,"aria-label":c,"aria-labelledby":p,...oa(ba(`divider`,{variant:n,orientation:e}),Sr(d?tA.horizontal:tA.vertical,r&&(d?rA.horizontal:rA.vertical),i),a,o),children:[(0,K.jsx)(`div`,{...Sr(d?nA.horizontalLine:nA.verticalLine,nA[n])}),t&&(0,K.jsx)(`div`,{id:f,...{0:{className:`x2lah0s xrrkdod x141an7d x1ltkj2j xv1l7n4`},1:{className:`x2lah0s x141an7d x1ltkj2j xv1l7n4 xnjsko4 x8o8v82`}}[!d<<0],children:t}),t&&(0,K.jsx)(`div`,{...Sr(d?nA.horizontalLine:nA.verticalLine,nA[n])})]})}iA.displayName=`Divider`;var aA={divider:{kqGvvJ:`xsq74q5`,$$css:!0}},oA=ba(`dropdown-menu-divider`).className;function sA({xstyle:e,className:t,style:n,ref:r}){return(0,K.jsx)(iA,{ref:r,xstyle:[aA.divider,e],className:t?`${oA} ${t}`:oA,style:n})}sA.displayName=`DropdownMenuDivider`;function cA(e){return!e||typeof window>`u`?!1:window.getComputedStyle(e).direction===`rtl`}var lA=new Set([`text`,`search`,`url`,`tel`,`email`,`password`,`number`]);function uA(e){if(e.isContentEditable)return e;let t=e.closest(`[contenteditable]`);return t&&t.getAttribute(`contenteditable`)!==`false`?t:null}function dA(e,t){if(!(e instanceof HTMLElement))return!1;let n=uA(e);if(n){let e=typeof window<`u`?window.getSelection():null;return e&&e.rangeCount>0&&!e.isCollapsed?!0:(n.textContent??``).length>0}let r=e.tagName===`TEXTAREA`,i=e.tagName===`INPUT`&&lA.has(e.type);if(!r&&!i)return!1;let{selectionStart:a,selectionEnd:o,value:s}=e;return a!==o||a==null?!0:t===`ArrowLeft`||t===`ArrowUp`||t===`Home`?a>0:t===`ArrowRight`||t===`ArrowDown`||t===`End`?ae.getAttribute(`aria-disabled`)===`true`||e.disabled===!0||e.hasAttribute(`disabled`),[]),f=(0,_.useCallback)(()=>{let e=u.current;if(!e)return[];let r=Array.from(e.querySelectorAll(t));return n?r.filter(t=>t.closest(n)===e):r},[t,n]),p=(0,_.useCallback)(e=>{let t=u.current;if(!t||!n)return!0;let r=e.target;return!r||r.closest(n)===t},[n]),m=(0,_.useCallback)((e,t,n,r)=>{let i=e.length;if(i===0)return-1;let a=t;for(let t=0;t=i){if(!r)return-1;a=(a+i)%i}let t=e[a];if(t&&!d(t))return a;a+=n}return-1},[d]),h=(0,_.useCallback)(()=>{let e=f(),t=document.activeElement;return e.findIndex(e=>e===t||e.contains(t))},[f]),g=(0,_.useCallback)((e,t)=>{e.getAttribute(`tabindex`)!==String(t)&&e.setAttribute(`tabindex`,String(t))},[]),v=(0,_.useCallback)(()=>{let e=f(),t=e.filter(e=>!d(e));if(t.length===0)return;let n=t.find(e=>e.getAttribute(`tabindex`)===`0`)??t[0];for(let t of e)g(t,t===n?0:-1)},[f,d,g]);wu(()=>{c&&v()});let y=(0,_.useCallback)((e,t)=>{let n=e[t];if(n){if(c)for(let t of e)g(t,t===n?0:-1);n.focus()}},[c,g]),b=(0,_.useCallback)(e=>{let t=f();if(t.length===0)return;let n=Math.max(0,Math.min(e,t.length-1));y(t,n)},[f,y]),x=(0,_.useCallback)(()=>{let e=f(),t=m(e,0,1,!1);return t!==-1&&(y(e,t),!0)},[f,m,y]),S=(0,_.useCallback)(()=>{let e=f(),t=m(e,e.length-1,-1,!1);return t!==-1&&(y(e,t),!0)},[f,m,y]),C=(0,_.useCallback)(()=>{c&&v()},[c,v]);return{listRef:u,handleKeyDown:(0,_.useCallback)(e=>{if(e.ctrlKey||e.metaKey||e.altKey||!p(e))return;if(e.key===`Escape`){i&&(e.preventDefault(),i());return}let t=a===`horizontal`||a===`both`,n=a===`vertical`||a===`both`,c=[],d=[];if(t){let t=e.key===`ArrowLeft`||e.key===`ArrowRight`?s??cA(u.current):!1;c.push(t?`ArrowLeft`:`ArrowRight`),d.push(t?`ArrowRight`:`ArrowLeft`)}n&&(c.push(`ArrowDown`),d.push(`ArrowUp`));let g=c.includes(e.key),_=d.includes(e.key),v=o&&e.key===`Home`,b=o&&e.key===`End`;if(!g&&!_&&!v&&!b||l&&(dA(e.target,e.key)||dA(document.activeElement,e.key)))return;let C=h(),w=f();if(g){let e=C===-1?0:C+1,t=m(w,e,1,r);t!==-1&&y(w,t)}else if(_){let e=C===-1?w.length-1:C-1,t=m(w,e,-1,r);t!==-1&&y(w,t)}else v?x():b&&S();e.preventDefault()},[h,f,r,a,s,o,l,m,y,x,S,i,p]),handleFocus:C,focusItem:b,focusFirst:x,focusLast:S,ownsEvent:p,getItems:f}}var pA=500,mA=300;function hA(e){let{show:t,hide:n,isOpen:r,isEnabled:i,showDelay:a=150,hideDelay:o=200,clickGuardMs:s=pA,itemSelector:c,popoverId:l,ownsFocus:u=!0}=e,d=Wl(`(hover: hover)`),f=(0,_.useRef)(null),p=(0,_.useRef)(null),m=(0,_.useRef)(null),h=(0,_.useRef)(!1),g=(0,_.useRef)(0),v=(0,_.useRef)(0),y=(0,_.useRef)(r);wu(()=>{let e=y.current;y.current=r,e&&!r&&(h.current=!1,v.current=0,g.current=Date.now())},[r]);let b=(0,_.useCallback)(()=>{f.current&&=(clearTimeout(f.current),null),p.current&&=(clearTimeout(p.current),null)},[]),x=(0,_.useRef)(()=>{}),{listRef:S,handleKeyDown:C,focusFirst:w}=fA({itemSelector:c,onEscape:()=>x.current()}),T=(0,_.useCallback)(()=>{let e=S.current?.contains(document.activeElement)??!1;n(),e&&m.current?.focus()},[n,S]);(0,_.useEffect)(()=>{x.current=()=>{b(),T()}},[b,T]),(0,_.useEffect)(()=>()=>b(),[b]);let E=(0,_.useCallback)(()=>{w()||S.current?.focus()},[w,S]),D=(0,_.useCallback)(()=>{if(!u){t();return}t({skipAutoFocus:!0}),E()},[u,t,E]),O=(0,_.useCallback)(()=>s>0&&v.current>0&&Date.now()-v.current{if(l&&e?.preventDefault(),b(),e!=null&&e.detail===0){g.current=0,h.current=!1,v.current=0,r?u&&E():D();return}if(!r){g.current=0,h.current=!1,v.current=0,D();return}if(O()){u&&E();return}T()},[l,b,r,u,O,D,E,T]),A=(0,_.useCallback)(()=>{if(!d||g.current>0&&Date.now()-g.current{v.current=Date.now(),t({skipAutoFocus:!0})};a>0?f.current=setTimeout(e,a):e()},[d,r,b,t,a]),j=(0,_.useCallback)(()=>{g.current=0,h.current&&(b(),p.current=setTimeout(()=>{n()},o))},[b,n,o]),M=(0,_.useCallback)(()=>{b()},[b]),N=(0,_.useCallback)(e=>{m.current=e},[]),P=(0,_.useCallback)(()=>{},[]),F=(0,_.useCallback)(e=>{},[]),I=(0,_.useCallback)(e=>{},[]);return i?{triggerProps:{onClick:k,onMouseEnter:A,onMouseLeave:j,...l?{popoverTarget:l}:null},contentProps:{onMouseEnter:M,onMouseLeave:j,onKeyDown:C},menuRef:S,focusFirst:w,focusMenu:E,confirmHoverOpen:O,close:T,setTriggerEl:N}:{triggerProps:{onClick:P,onMouseEnter:P,onMouseLeave:P},contentProps:{onMouseEnter:P,onMouseLeave:P,onKeyDown:I},menuRef:S,focusFirst:w,focusMenu:E,confirmHoverOpen:O,close:T,setTriggerEl:F}}function gA(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey&&e.key!==` `}function _A(e){let{getItemLabels:t,onMatch:n,getCurrentIndex:r,resetMs:i=750,isDisabled:a}=e,o=(0,_.useRef)(``),s=(0,_.useRef)(void 0),c=(0,_.useCallback)(()=>{o.current=``,s.current&&=(clearTimeout(s.current),void 0)},[]),l=(0,_.useCallback)(()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o.current=``,s.current=void 0},i)},[i]);return{onKeyDown:(0,_.useCallback)(e=>{let i=e.key===` `&&!e.ctrlKey&&!e.metaKey&&o.current.length>0;if(!gA(e)&&!i)return!1;let s=t();if(s.length===0)return!1;let c=e.key.toLowerCase(),u=o.current.length>0&&o.current.split(``).every(e=>e===c)?c:o.current+c;o.current=u,l();let d=r?.()??-1,f=s.length,p=d>=0,m=p?d:0,h=p&&u.length===1?1:0;for(let e=0;e`[role="${e}"]:not([aria-disabled="true"])`).join(`,`),bA=`[role="menu"]`,xA={root:{kB7OPa:`x9f619`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`x1ws5lxm`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},open:{kWkggS:`x1lmrjuc`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0}},SA={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}},CA={popover:{k7Eaqz:`x5w4yej`,$$css:!0},popoverCustomWidth:e=>[{k7Eaqz:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`xkj4a21`,$$css:!0},{"--x-minWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e)}]};function wA(e){let{icon:t,label:n,description:r,isDisabled:i=!1,hasSpinner:a=!1,menuWidth:o,onOpenChange:s,children:c,xstyle:l,className:u,style:d,"data-testid":f,menuDataTestId:p}=e,m=Yk(),h=m?.menuSize??`md`,g=!i,v=(0,_.useId)(),y=(0,_.useId)(),b=(0,_.useRef)(null),[x,S]=(0,_.useState)(!1),C=xi({mode:`context`,lightDismiss:!1,onShow:(0,_.useCallback)(()=>{S(!0),s?.(!0)},[s]),onHide:(0,_.useCallback)(()=>{S(!1),s?.(!1)},[s])}),w=(0,_.useCallback)(()=>{g&&C.show()},[g,C]),T=(0,_.useCallback)(()=>{C.hide()},[C]),{listRef:E,handleKeyDown:D,focusFirst:O,focusItem:k,ownsEvent:A,getItems:j}=fA({itemSelector:yA,boundarySelector:bA,wrap:!1,onEscape:()=>L({focusTrigger:!0})}),M=_A({getItemLabels:()=>j().map(e=>e.textContent),onMatch:k,getCurrentIndex:()=>j().findIndex(e=>e===document.activeElement||e.contains(document.activeElement))}),{triggerProps:N,contentProps:P,confirmHoverOpen:F}=hA({show:w,hide:T,isOpen:x,isEnabled:g}),I=(0,_.useCallback)(e=>{g&&(C.show(),e?.focusFirst&&(O()||E.current?.focus()))},[g,C,O,E]),L=(0,_.useCallback)(e=>{C.hide(),e?.focusTrigger!==!1&&b.current?.focus()},[C]),R=(0,_.useCallback)(e=>{b.current=e,C.ref(e)},[C]),ee=(0,_.useCallback)(()=>{if(!i)if(x){if(F()){O()||E.current?.focus();return}L({focusTrigger:!0})}else I({focusFirst:!0})},[i,x,I,L,F,O,E]),z=(0,_.useCallback)(e=>{if(i)return;let t=typeof window<`u`&&b.current&&window.getComputedStyle(b.current).direction===`rtl`?`ArrowLeft`:`ArrowRight`;(e.key===t||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),I({focusFirst:!0}))},[i,I]),B=(0,_.useCallback)(e=>Zk(e,i),[i]),V=(0,_.useCallback)(e=>{if(!A(e))return;if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),L({focusTrigger:!0});return}if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=document.activeElement;t&&vA.has(t.getAttribute(`role`)??``)&&t.click();return}let t=typeof window<`u`&&E.current&&window.getComputedStyle(E.current).direction===`rtl`?`ArrowRight`:`ArrowLeft`;if(e.key===t){e.preventDefault(),L({focusTrigger:!0});return}if(M.onKeyDown(e)){e.preventDefault();return}D(e)},[A,L,D,M,E]),H=(0,_.useMemo)(()=>({menuSize:h,closeMenu:()=>{L({focusTrigger:!1}),m?.closeMenu()}}),[h,L,m]),te=a?(0,K.jsx)(`span`,{className:`x78zum5 x6s0dn4`,children:(0,K.jsx)($o,{size:`sm`})}):(0,K.jsx)(`span`,{className:`x78zum5 x6s0dn4`,children:(0,K.jsx)(xu,{icon:`chevronRight`,size:`sm`,color:`secondary`,...ba(`dropdown-menu-indicator-icon`)})}),ne=o?CA.popoverCustomWidth(o):CA.popover;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(qk,{ref:e=>R(e),id:y,role:`menuitem`,tabIndex:i?void 0:-1,"aria-haspopup":`menu`,"aria-expanded":x,"aria-controls":x?v:void 0,"aria-disabled":i||void 0,"data-testid":f,onMouseEnter:N.onMouseEnter,onMouseLeave:N.onMouseLeave,onPointerMove:B,startContent:t?Cu(t,{size:`sm`,color:`secondary`}):void 0,label:n,description:r,endContent:te,onClick:ee,onKeyDown:z,isDisabled:i,xstyle:[xA.root,SA[h],x&&xA.open,i&&xA.disabled,l],...oa(ba(`dropdown-menu-item`,{size:h}),{className:u,style:d})}),C.render((0,K.jsx)(`div`,{ref:E,id:v,role:`menu`,tabIndex:-1,"aria-labelledby":y,onKeyDown:V,onMouseEnter:P.onMouseEnter,onMouseLeave:P.onMouseLeave,"data-testid":p,...oa(ba(`dropdown-menu`),{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 xuyqlj2 x1odjw0f x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92`}),children:(0,K.jsx)(Jk,{value:H,children:c})}),{placement:`end`,alignment:`start`,offset:Br[`--spacing-1`],xstyle:[ne,co.end]})]})}wA.displayName=`DropdownMenuSubMenu`;function TA(e,t){return`item-${e.id??t}`}function EA(e,t){return`section-${e.id??t}`}function DA(e,t){let{items:n,id:r,...i}=e;return(0,K.jsx)(eA,{...i},TA(e,t))}function OA(e){let t=[];for(let n=0;n0?t.push((0,K.jsx)(wA,{icon:r.icon,label:r.label,isDisabled:r.isDisabled,children:OA(r.items)},TA(r,n))):t.push(DA(r,n)))}return t}var kA={dropdown:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,kskxy:`xuyqlj2`,kORKVm:`x1odjw0f`,"--_dropdown-menu-radius":`x1fcsqxe`,"--_dropdown-menu-padding":`xgory14`,kmVPX3:`x9epnlk`,kaIpWk:`x1n97fys`,kSiTet:`x1hc1fzr`,k1ekBW:`x19991ni`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,$$css:!0},popoverCustomWidth:e=>[{k7Eaqz:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`xkj4a21`,$$css:!0},{"--x-minWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e)}]},AA=`@astryx.dropdownMenu.label`;function jA({button:e,isMenuOpen:t,onOpenChange:n,menuWidth:r,onClick:i,hasChevron:a=!0,placement:o=`below`,alignment:s=`start`,className:c,style:l,xstyle:u,"data-testid":d,...f}){let p=Rc(),m=e??{label:p(AA)},h=(`items`in f?f.items:void 0)??[],g=f.children,{items:v,children:y,...b}=f,x=(0,_.useId)(),S=m.size??`md`,C=(0,_.useRef)(null),[w,T]=(0,_.useState)(!1),E=t!==void 0,D=E?t:w,O=(0,_.useCallback)(()=>{n?.(!1),E||T(!1),C.current?.focus()},[E,n]),k=(0,_.useRef)(!1),A=(0,_.useRef)(`keyboard`),j=dd({onHide:O,onShow:(0,_.useCallback)(()=>{n?.(!0),E||T(!0)},[E,n]),hasLightDismiss:!0,hasCloseButton:!1,hasAutoFocus:!1,role:`none`}),M=(0,_.useCallback)(()=>{j.hide()},[j]),{listRef:N,handleKeyDown:P,focusFirst:F,focusItem:I,ownsEvent:L,getItems:R}=fA({itemSelector:yA,boundarySelector:bA,wrap:!1,onEscape:M}),ee=_A({getItemLabels:()=>R().map(e=>e.textContent),onMatch:I,getCurrentIndex:()=>R().findIndex(e=>e===document.activeElement||e.contains(document.activeElement))});(0,_.useEffect)(()=>{E&&(t&&!j.isOpen?(k.current=!0,j.show()):!t&&j.isOpen&&j.hide())},[t,E,j]),(0,_.useEffect)(()=>{!j.isOpen||!k.current||(k.current=!1,requestAnimationFrame(()=>{(A.current===`pointer`||!F())&&N.current?.focus(),A.current=`keyboard`}))},[j.isOpen,F,N]);let z=(0,_.useCallback)(e=>{if(L(e)){if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=document.activeElement;t&&vA.has(t.getAttribute(`role`)??``)&&t.click();return}if(e.key===`Tab`){M();return}if(ee.onKeyDown(e)){e.preventDefault();return}P(e)}},[P,M,ee,L]),B=(0,_.useCallback)((e=`keyboard`)=>{A.current=e,k.current=!0,j.show()},[j]),V=(0,_.useCallback)(e=>{if(j.wasJustDismissed())return;i?.();let r=e.detail===0?`keyboard`:`pointer`;E?(t||(A.current=r),n?.(!t)):j.isOpen?j.hide():B(r)},[i,E,n,t,j,B]),H=(0,_.useCallback)(e=>{j.isOpen||(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),B())},[j.isOpen,B]),te=m.isIconOnly===!0,ne=m.endContent??(a&&!te?(0,K.jsx)(xu,{icon:`chevronDown`,size:`sm`,color:`inherit`}):void 0),re=r?kA.popoverCustomWidth(r):kA.popover,ie=(0,_.useMemo)(()=>({closeMenu:M,menuSize:S}),[M,S]),ae=f.items===void 0?g:OA(h);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(qc,{...m,ref:e=>{C.current=e,j.triggerRef(e);let t=m.ref;typeof t==`function`?t(e):t&&(t.current=e)},tooltip:D?void 0:m.tooltip,endContent:ne,onClick:V,onKeyDown:H,"aria-haspopup":`menu`,"aria-expanded":D,"aria-controls":x,"data-testid":d}),j.render((0,K.jsx)(`div`,{...b,ref:N,id:x,role:`menu`,tabIndex:-1,"aria-label":m.label,onKeyDown:z,...oa(ba(`dropdown-menu`),Sr(kA.dropdown,u),c,l),children:(0,K.jsx)(Jk,{value:ie,children:ae})}),{placement:o,alignment:s,offset:Br[`--spacing-1`],xstyle:[re,co[o]]})]})}jA.displayName=`DropdownMenu`;var MA={box:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,kMzoRj:`x1litavf`,ksu8eU:`x1y0btm7`,kaIpWk:`xx3sua9`,k1ekBW:`xts7igz`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},unchecked:{kMwMTN:`xqwr325`,kVAM5u:`xvy26l8 xilc7fp`,kWkggS:`x10xzikg xeultfy`,$$css:!0},checked:{kMwMTN:`x17wrial`,kVAM5u:`xad5do x1ozl1p1`,kWkggS:`x1ewilqj x17srpfb`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kVAM5u:`x14i3s5s x61roa7`,$$css:!0},disabledUnchecked:{kWkggS:`xwmxj5m xqxnq6d`,$$css:!0},checkmark:{k1xSpc:`x1s85apg`,kMwMTN:`x17wrial xs5hli`,$$css:!0},checkmarkVisible:{k1xSpc:`x1lliihq`,$$css:!0},indeterminateMark:{k1xSpc:`x1s85apg`,kWkggS:`x1azo05 xwvh9j7`,kaIpWk:`xjspbzw`,$$css:!0},indeterminateMarkVisible:{k1xSpc:`x1lliihq`,$$css:!0}},NA={sm:{kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,$$css:!0},md:{kzqmXN:`xvy4d1p`,kZKoxP:`xxk0z11`,$$css:!0}},PA={sm:{kzqmXN:`xsmyaan`,kZKoxP:`x1kpxq89`,$$css:!0},md:{kzqmXN:`x6jxa94`,kZKoxP:`x1v9usgg`,$$css:!0}},FA={sm:{kzqmXN:`x1fsd2vl`,kZKoxP:`x36qwtl`,$$css:!0},md:{kzqmXN:`xsmyaan`,kZKoxP:`x36qwtl`,$$css:!0}};function IA({state:e,size:t=`md`,isDisabled:n=!1,children:r,ref:i,className:a,style:o,xstyle:s,...c}){let l=e===`checked`,u=e===`indeterminate`,d=l||u;return(0,K.jsx)(`span`,{...c,ref:i,"aria-hidden":`true`,...oa(ba(`checkbox-indicator`,{size:t,checked:l?`checked`:u?`indeterminate`:null,disabled:n?`disabled`:null},{legacyNames:[`checkbox`]}),Sr(MA.box,NA[t],d?MA.checked:MA.unchecked,n&&MA.disabled,n&&!d&&MA.disabledUnchecked,s),a,o),children:Ea(r)?r:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`svg`,{viewBox:`0 0 10 10`,...oa(ba(`checkbox-indicator-check`,{size:t}),Sr(MA.checkmark,PA[t],l&&MA.checkmarkVisible)),children:(0,K.jsx)(`path`,{d:`M8.5 2.5L4 7.5L1.5 5`,stroke:`currentColor`,strokeWidth:`1.5`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,K.jsx)(`span`,{...oa(ba(`checkbox-indicator-dash`,{size:t}),Sr(MA.indeterminateMark,FA[t],u&&MA.indeterminateMarkVisible))})]})})}IA.displayName=`CheckboxIndicator`;var LA={sm:`sm`,md:`sm`},RA={slot:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,kzqmXN:`xcdlrvm`,kZKoxP:`x1l36t39`,$$css:!0},enabled:{kMwMTN:`xqwr325`,$$css:!0},disabled:{kMwMTN:`xqa6c3m`,$$css:!0}};function zA({state:e,size:t=`md`,isDisabled:n=!1,children:r,ref:i,className:a,style:o,xstyle:s,...c}){let l=e===`checked`;return Ea(r)?(0,K.jsx)(`span`,{...c,ref:i,"aria-hidden":`true`,...oa(Sr(RA.slot,n?RA.disabled:RA.enabled,s),a,o),children:r}):l?(0,K.jsx)(xu,{...c,"aria-hidden":`true`,icon:`check`,size:LA[t],color:n?`disabled`:`accent`,xstyle:s,className:a,style:o}):null}zA.displayName=`CheckIndicator`;var BA={circle:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,kMzoRj:`x1litavf`,ksu8eU:`x1y0btm7`,kaIpWk:`xjspbzw`,k1ekBW:`xts7igz`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},unchecked:{kVAM5u:`xvy26l8 xilc7fp`,kWkggS:`x10xzikg xeultfy`,$$css:!0},checked:{kVAM5u:`xad5do x1ozl1p1`,kWkggS:`x1ewilqj x17srpfb`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kVAM5u:`x14i3s5s x61roa7`,$$css:!0},disabledUnchecked:{kWkggS:`xwmxj5m xqxnq6d`,$$css:!0},dot:{kaIpWk:`xjspbzw`,kWkggS:`x1azo05 xwvh9j7`,$$css:!0}},VA={sm:{kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,$$css:!0},md:{kzqmXN:`xvy4d1p`,kZKoxP:`xxk0z11`,$$css:!0}},HA={sm:{kzqmXN:`x1xc55vz`,kZKoxP:`xdk7pt`,$$css:!0},md:{kzqmXN:`x1fsd2vl`,kZKoxP:`x170jfvy`,$$css:!0}};function UA({state:e,size:t=`md`,isDisabled:n=!1,children:r,ref:i,className:a,style:o,xstyle:s,...c}){let l=e!==`unchecked`;return(0,K.jsx)(`span`,{...c,ref:i,"aria-hidden":`true`,...oa(ba(`radio-indicator`,{size:t,checked:l?`checked`:null,disabled:n?`disabled`:null},{legacyNames:[`radio`]}),Sr(BA.circle,VA[t],l?BA.checked:BA.unchecked,n&&BA.disabled,n&&!l&&BA.disabledUnchecked,s),a,o),children:Ea(r)?r:l&&(0,K.jsx)(`span`,{...oa(ba(`radio-indicator-dot`,{size:t},{legacyNames:[`radio-dot`]}),Sr(BA.dot,HA[t]))})})}UA.displayName=`RadioIndicator`;var WA={check:zA,checkbox:IA,radio:UA};function GA(e){return e==null?null:typeof e==`string`?rl(e):e}function KA(e){return GA(e)?.indicators??null}function qA(e,t){return KA(t)?.[e]??WA[e]}function JA(e){return qA(e,cu())}var YA={root:{kzqmXN:`xh8yej3`,kaIpWk:`x1ws5lxm`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0},marker:{kfzvcC:`x47corl`,kayTVb:`x1g77sc7 xozvky`,keTefX:`x1lziwak x1jymrmb`,$$css:!0}};function XA({label:e,description:t,icon:n,value:r,onChange:i,isDisabled:a=!1,hasCloseOnSelect:o=!1,endContent:s,xstyle:c,className:l,style:u,...d}){let f=Yk(),p=f?.menuSize??`md`,m=p===`sm`?`sm`:`md`,h=JA(`checkbox`),g=(0,_.useCallback)(()=>{a||(i?.(!r),o&&f?.closeMenu())},[a,i,r,o,f]),v=(0,_.useCallback)(e=>Zk(e,a),[a]);return(0,K.jsx)(qk,{...d,role:`menuitemcheckbox`,"aria-checked":r,tabIndex:a?void 0:-1,onPointerMove:v,marker:(0,K.jsx)(h,{state:r?`checked`:`unchecked`,size:m,isDisabled:a,xstyle:YA.marker}),startContent:n?Cu(n,{size:`sm`,color:`secondary`}):void 0,label:e,description:t,endContent:s,onClick:g,isDisabled:a,xstyle:[YA.root,a&&YA.disabled,c],...oa(ba(`dropdown-menu-item`,{size:p}),{className:l,style:u})})}XA.displayName=`DropdownMenuCheckboxItem`;function ZA(e,t){let n=e.name?.trim();if(n)return n;let r=e.firstMessage?.trim();return r&&r!==`(no messages)`?r:t}function QA(e){return e.split(/[\\/]/u).filter(Boolean).at(-1)||e}function $A(e,t=2){let n=e.split(/[\\/]/u).filter(Boolean);return n.length<=t?e:`…/${n.slice(-t).join(`/`)}`}function ej(e,t=96){let n=String(e??``).replace(/\s+/gu,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function tj(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function nj(e,t=Date.now()){if(typeof e!=`number`)return``;let n=Math.max(0,Math.round((t-e)/1e3)),r=Math.floor(n/60),i=n%60;return r>0?`${r}m${String(i).padStart(2,`0`)}s`:`${i}s`}function rj(e,t=e?.selectedSession){if(!e||!t||t.id!==e.currentSessionId)return!1;let n=e.currentSessionPath??e.sessions.find(t=>t.id===e.currentSessionId&&t.controller===`web`)?.path??e.runtime.activeTurn?.sessionPath;return!!(n&&n===t.path)}function ij(e){return e&&typeof e==`object`?e:{}}function aj(e){let t=new Map;for(let n of e){let e=n.role===`toolResult`&&n.toolName===`subagent_spawn`,r=n.role===`toolResult`&&n.toolName===`subagent_send`,i=n.customType===`subagent-finished`,a=n.role===`toolResult`&&[`subagent_wait`,`subagent_check`].includes(n.toolName??``)||n.customType===`subagent-result`||i;if(!e&&!r&&!a||n.isError)continue;let o=ij(n.details);for(let a of Array.isArray(o.results)?o.results:[o]){let s=ij(a);if(typeof s.id!=`string`||!s.id||s.id.length>160||/[\u0000-\u001f\u007f]/u.test(s.id))continue;let c=t.get(s.id),l={...c,id:s.id,title:typeof s.title==`string`?s.title:c?.title??s.id};e?l.receipt=n.content:r?(l.state=s.status===`running`?`running`:void 0,l.result=void 0):(i||(l.result=typeof o.displayContent==`string`?o.displayContent:n.content),l.state=s.outcome===`uncertain`?void 0:s.outcome===`interrupted`?`interrupted`:s.status===`done`||s.status===`error`||s.status===`running`?s.status:void 0),t.delete(s.id),t.set(s.id,l)}}return[...t.values()].slice(-32)}function oj(e,t,n=[],r=!0){let i=new Set(e.map(e=>e.id));return[...e.map(e=>({kind:`subagents`,id:e.id,title:e.title,state:e.outcome===`interrupted`?`interrupted`:!r&&e.status===`running`?void 0:e.status,timestamp:e.settledAt??e.createdAt,saved:!1})),...n.flatMap(e=>(e.children?.items??[]).map(e=>({kind:`workflows`,id:e.id,title:e.title,state:e.outcome===`interrupted`?`interrupted`:e.status===`unknown`||!r&&e.status===`running`?void 0:e.status,timestamp:e.settledAt??e.createdAt,saved:!1}))),...t.filter(e=>!i.has(e.id)).map(e=>({kind:`subagents`,id:e.id,title:e.title,state:e.state===`running`?void 0:e.state,timestamp:void 0,saved:!0}))].sort((e,t)=>(t.timestamp??0)-(e.timestamp??0))}function sj(e){return e===`interrupted`?`interrupted`:e===`running`?`running`:e===`done`||e===`completed`?`done`:[`error`,`failed`,`aborted`,`killed`,`timed_out`].includes(e)?`error`:e===`uncertain`?`warn`:`unknown`}function cj({kind:e,label:t,status:n,onClick:r}){return(0,K.jsxs)(r?`button`:`span`,{className:`activity-chip ${e} ${n}`,type:r?`button`:void 0,onClick:r,children:[n===`running`?(0,K.jsx)(`i`,{className:`activity-chip-dot`}):n===`done`?(0,K.jsx)(I,{}):n===`error`?(0,K.jsx)(Lt,{}):n===`interrupted`?(0,K.jsx)(re,{}):(0,K.jsx)(`span`,{className:`activity-chip-glyph`,children:`?`}),(0,K.jsx)(`span`,{className:`activity-chip-text`,children:t})]})}function lj({snapshot:e,onInspectTerminal:t,onInspectSubagent:n,observed:r=!0}){let{t:i}=cr(),[,a]=(0,_.useState)(0),o=e?.runtime.capabilities,s=(0,_.useMemo)(()=>aj((e?.selectedSession?.entries??[]).flatMap(e=>e.message?[e.message]:[])),[e?.selectedSession?.entries]),c=o?.subagents,l=o?.workflows?.items??[],u=l.flatMap(e=>e.children?.items??[]),d=new Set([...(c?.items??[]).map(e=>`subagents:${e.id}`),...s.map(e=>`subagents:${e.id}`),...u.map(e=>`workflows:${e.id}`)]).size,f=Math.max(d,(c?.items.length??0)+(c?.omitted??0)+u.length+l.reduce((e,t)=>e+(t.children?.omitted??0),0)),p=oj(c?.items??[],s,l,r),m=p.filter(e=>e.state===`running`).length,h=p.filter(e=>e.state===`done`).length,g=p.filter(e=>e.state===`error`||e.state===`interrupted`).length,v=Math.max(0,f-m-h-g),y=[i(`subagentProgress`,{running:m,completed:h}),g?i(`subagentSummaryOther`,{count:g}):``,v?i(`subagentSummaryUnknown`,{count:v}):``].filter(Boolean).join(` · `),b=c?.childExecutionAdmission,x=[...o?.workflows?.items??[],...o?.[`background-terminals`]?.items??[]].some(e=>e.status===`running`);(0,_.useEffect)(()=>{if(!x)return;let e=window.setInterval(()=>a(e=>e+1),1e3);return()=>window.clearInterval(e)},[x]);let S=[];for(let e of o?.workflows?.items??[]){let t=e.agents.total-e.agents.running,n=e.agents.total?` · ${t}/${e.agents.total} agents`:``,r=e.status===`running`&&e.currentPhase?` · ${e.currentPhase}`:``,i=nj(e.startedAt,e.finishedAt);S.push({key:`workflow-${e.runId}`,kind:`workflow`,label:`${e.name||e.runId}${r}${n}${i?` · ${i}`:``}`,status:sj(e.status)})}for(let e of o?.[`background-terminals`]?.items??[]){let n=nj(e.createdAt,e.settledAt);S.push({key:`terminal-${e.id}`,onClick:t?()=>t(e.id):void 0,kind:`terminal`,label:`${e.title||e.id}${n?` · ${n}`:``}`,status:sj(e.status)})}S.sort((e,t)=>Number(t.status===`running`)-Number(e.status===`running`));let C=S.slice(0,5),w=S.length-C.length+(o?.workflows?.omitted??0)+(o?.[`background-terminals`]?.omitted??0);return!C.length&&!w&&!(n&&f)&&!b?.enabled?null:(0,K.jsxs)(`div`,{className:`activity-bar`,role:`status`,"aria-label":`Runtime activity`,children:[n&&f>0&&(0,K.jsx)(`button`,{className:`activity-chip subagent-list-trigger`,type:`button`,onClick:()=>n(),children:y}),b?.enabled&&b.limit!==void 0&&(0,K.jsx)(`span`,{className:`activity-chip subagent-list-trigger`,children:`${b.held}/${b.limit} child slots · ${b.queued} queued · wf ${b.heldByOrigin.workflow} / direct ${b.heldByOrigin.direct} / btw ${b.heldByOrigin.btw}`}),C.map(({key:e,...t})=>(0,K.jsx)(cj,{...t},e)),w>0&&(0,K.jsxs)(`span`,{className:`activity-chip more`,children:[`+`,w]})]})}var uj={count:32,textBytes:1048576,imageBytes:134217728};function dj(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fj(e){if(e.length>8192)return!1;try{let t=JSON.parse(e);return Array.isArray(t)&&(t.length===3&&t[0]===`session`&&typeof t[1]==`string`&&t[1].length>0&&t[1].length<=1024&&typeof t[2]==`string`&&t[2].length>0&&t[2].length<=4096||t.length===2&&t[0]===`workspace`&&(t[1]===null||typeof t[1]==`string`&&t[1].length<=4096))}catch{return!1}}function pj(e,t){if(!fj(e)||!dj(t)||typeof t.prompt!=`string`||t.prompt.length*2>uj.textBytes||!Array.isArray(t.images))return null;let n=[],r=[],i=!1,a=typeof t.caret==`number`&&Number.isSafeInteger(t.caret)&&t.caret>=0&&t.caret<=t.prompt.length?t.caret:t.prompt.length;a!==t.caret&&(i=!0);let o=0;for(let e of t.images){if(!dj(e)||typeof e.name!=`string`||e.name.length>1024||typeof e.data!=`string`||typeof e.size!=`number`||!Number.isSafeInteger(e.size)||e.size<=0||e.size>10485760||e.data.length!==Math.ceil(e.size/3)*4||!/^[A-Za-z0-9+/]*={0,2}$/u.test(e.data)){i=!0;continue}try{let t=atob(e.data);if(t.length!==e.size){i=!0;continue}let r=of(Uint8Array.from(t.slice(0,12),e=>e.charCodeAt(0)));if(!r||r!==e.mimeType||n.length>=8||o+e.size>33554432){i=!0;continue}o+=e.size,n.push({id:typeof e.id==`string`&&e.id.length<=1024?e.id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${n.length}-${e.name}`,name:e.name,size:e.size,data:e.data,mimeType:r,previewUrl:`data:${r};base64,${e.data}`})}catch{i=!0}}let s=0;for(let e of Array.isArray(t.files)?t.files:[]){if(!dj(e)||typeof e.name!=`string`||!e.name||e.name.length>1024||/[\u0000-\u001f\u007f]/u.test(e.name)||typeof e.mimeType!=`string`||e.mimeType.length>256||typeof e.data!=`string`||typeof e.size!=`number`||!Number.isSafeInteger(e.size)||e.size<0||e.size>52428800||e.data.length!==Math.ceil(e.size/3)*4||!/^[A-Za-z0-9+/]*={0,2}$/u.test(e.data)||r.length+n.length>=8||s+e.size>52428800||e.text!==void 0&&(typeof e.text!=`string`||new TextEncoder().encode(e.text).length>1048576)){i=!0;continue}try{if(atob(e.data).length!==e.size){i=!0;continue}s+=e.size,r.push({id:typeof e.id==`string`&&e.id.length<=1024?e.id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${r.length}`,name:e.name,mimeType:e.mimeType,size:e.size,data:e.data,...typeof e.text==`string`?{text:e.text}:{},extraction:e.extraction===`text`||e.extraction===`truncated`?e.extraction:`unavailable`,...e.extraction===`unavailable`&&(e.extractionError===`encoding`||e.extractionError===`document`)?{extractionError:e.extractionError}:{}})}catch{i=!0}}return t.files!==void 0&&!Array.isArray(t.files)&&(i=!0),{draft:{prompt:t.prompt,caret:a,images:n,...r.length?{files:r}:{},revision:0},invalid:i}}var mj=`openpi.composer-drafts`,hj=`drafts`;function gj(){let e=()=>new Promise((e,t)=>{let n;try{n=window.indexedDB.open(mj,1)}catch(e){t(e);return}n.onupgradeneeded=()=>{n.result.createObjectStore(hj,{keyPath:`key`}).createIndex(`usage`,[`textBytes`,`imageBytes`])},n.onerror=()=>t(n.error),n.onblocked=()=>{n.onsuccess=()=>n.result.close(),t(Error(`draft-storage-blocked`))},n.onsuccess=()=>{n.result.onversionchange=()=>n.result.close(),e(n.result)}});return{async read(){let t=await e();try{return await new Promise((e,n)=>{let r=t.transaction(hj,`readonly`),i=r.objectStore(hj).getAll(void 0,uj.count+1),a=[];i.onsuccess=()=>{a=i.result},r.oncomplete=()=>e(a),i.onerror=()=>n(i.error),r.onabort=()=>n(r.error)})}finally{t.close()}},async write(t){let n=await e();try{await new Promise((e,r)=>{let i=n.transaction(hj,`readwrite`),a=i.objectStore(hj),o=new Set(t.map(({key:e})=>e)),s=0,c=0,l=0,u=a.index(`usage`).openKeyCursor();u.onsuccess=()=>{let e=u.result;if(e){if(!o.has(String(e.primaryKey))){let t=e.key;s+=1,c+=t[0],l+=t[1]}e.continue();return}for(let{draft:e}of t)e&&(s+=1,c+=e.prompt.length*2,l+=e.images.reduce((e,t)=>e+t.size,0)+(e.files??[]).reduce((e,t)=>e+t.size+(t.text?.length??0)*2,0));if(s>uj.count||c>uj.textBytes||l>uj.imageBytes){i.abort();return}for(let{key:e,draft:n}of t)n?a.put({key:e,draft:{prompt:n.prompt,caret:n.caret,images:n.images.map(({previewUrl:e,...t})=>t),...n.files?.length?{files:n.files}:{}},textBytes:n.prompt.length*2,imageBytes:n.images.reduce((e,t)=>e+t.size,0)+(n.files??[]).reduce((e,t)=>e+t.size+(t.text?.length??0)*2,0)}):a.delete(e)},i.oncomplete=()=>e(),i.onerror=()=>r(i.error),i.onabort=()=>r(i.error??Error(`draft-storage-limit`))})}finally{n.close()}}}}function _j(e){let t=new Map,n=new Set,r=new Map,i=new Set,a={status:e?`loading`:`saved`,invalid:!1},o=!1,s=!!e,c=0,l=()=>({prompt:``,images:[],caret:0,revision:c,files:void 0}),u=e=>e.prompt.length>0||e.images.length>0||!!e.files?.length,d=e=>e.images.reduce((e,t)=>e+t.size,0)+(e.files??[]).reduce((e,t)=>e+t.size+(t.text?.length??0)*2,0),f=(e={})=>{a={...a,...e};for(let e of i)e()},p=(e,n)=>{let r=0,i=0,a=0;for(let[n,o]of t)n!==e&&(r+=1,i+=o.prompt.length*2,a+=d(o));return u(n)&&(r+=1),i+=n.prompt.length*2,a+=d(n),r<=uj.count&&i<=uj.textBytes&&a<=uj.imageBytes},m=async()=>{if(!e||s||o||r.size===0)return;o=!0,f({status:`pending`});let t=Array.from(r,([e,t])=>({key:e,draft:t}));r.clear();try{await e.write(t),o=!1,f({status:r.size>0?`pending`:`saved`}),r.size>0&&m()}catch{for(let{key:e,draft:n}of t)r.has(e)||r.set(e,n);o=!1,f({status:`failed`})}},h=(t,i)=>{s&&n.add(t),e&&(r.set(t,i),s||f({status:`pending`}),Promise.resolve().then(m))},g=()=>e?e.read().then(e=>{let i=!1;for(let r of e){if(typeof r!=`object`||!r||!(`key`in r)||typeof r.key!=`string`||!(`draft`in r)){i=!0;continue}if(n.has(r.key))continue;let e=pj(r.key,r.draft);if(!e||!u(e.draft)||!p(r.key,e.draft)){i=!0;continue}i||=e.invalid,t.set(r.key,{...e.draft,revision:++c})}n.clear(),s=!1,f({status:r.size>0?`pending`:`saved`,invalid:i}),m()}).catch(()=>{f({status:`failed`})}):Promise.resolve();return{ready:g(),storageState:()=>a,subscribe(e){return i.add(e),()=>i.delete(e)},hasContent:()=>t.size>0,hasUnsavedChanges:()=>r.size>0||o,retryStorage(){return s?(f({status:`loading`}),g()):m()},read(e){return t.get(e)??l()},edit(e,n,r){let i={...n,...r};if(i.caret=Math.min(Math.max(i.caret,0),i.prompt.length),i.prompt!==n.prompt||i.images!==n.images||i.files!==n.files){if(!p(e,i))return null;i.revision=++c}return u(i)?t.set(e,i):t.delete(e),(i.prompt!==n.prompt||i.images!==n.images||i.files!==n.files||i.caret!==n.caret)&&h(e,u(i)?i:null),i},clear(e,n){return t.get(e)?.revision===n?(t.delete(e),c+=1,h(e,null),l()):null},move(e,n){if(t.has(n))return!1;let r=t.get(e);return r&&(t.delete(e),t.set(n,r),h(e,null),h(n,r)),!0}}}var vj={settle(){},release(){}};function yj(e){if(typeof window>`u`||typeof document>`u`)return vj;let t=document.documentElement,n=t.clientWidth;if(n===0)return vj;let r=t.style.scrollbarGutter,i=e.style.paddingRight,a=e.getBoundingClientRect().width,o=!1,s=!1,c=!1;return window.innerWidth>n&&(t.style.scrollbarGutter=`stable`,o=!0),{settle(){if(c)return;c=!0;let t=e.getBoundingClientRect().width-a;if(t<=0)return;let n=Number.parseFloat(window.getComputedStyle(e).paddingRight)||0;e.style.paddingRight=`${n+t}px`,s=!0},release(){s&&=(e.style.paddingRight=i,!1),o&&=(t.style.scrollbarGutter=r,!1)}}}var bj=0,xj=null;function Sj(e){(0,_.useEffect)(()=>{if(!e)return;let{body:t}=document;if(bj===0){let e=window.scrollX,n=window.scrollY,r=yj(t);xj={scrollX:e,scrollY:n,overflow:t.style.overflow,position:t.style.position,top:t.style.top,left:t.style.left,right:t.style.right,gutter:r},t.style.overflow=`hidden`,t.style.position=`fixed`,t.style.top=`-${n}px`,t.style.left=`0`,t.style.right=`0`,r.settle()}return bj+=1,()=>{if(--bj,bj!==0||xj==null)return;let e=xj;xj=null,t.style.overflow=e.overflow,t.style.position=e.position,t.style.top=e.top,t.style.left=e.left,t.style.right=e.right,e.gutter.release(),window.scrollTo(e.scrollX,e.scrollY)}},[e])}var Cj={container:{kB7OPa:`x9f619`,kZCmMZ:`x1c35znw`,kwRFfy:`x64h4k7`,kLKAdn:`x14m0hsi`,kGO01o:`xc1wllq`,$$css:!0}},wj=Br[`--spacing-4`],Tj=`var(--astryx-card-padding, ${wj})`,Ej=`var(--astryx-card-padding-inline, ${Tj})`;`${Ej}`,`${Ej}`,`${Tj}`,`${Tj}`;var Dj=`var(--_section-padding-propagated, ${`var(--astryx-section-padding, ${wj})`})`,Oj=`var(--astryx-section-padding-inline, ${Dj})`;`${Oj}`,`${Oj}`,`${Dj}`,`${Dj}`;var kj=`var(--astryx-dialog-padding, ${wj})`,Aj=`var(--astryx-dialog-padding-inline, ${kj})`;`${Aj}`,`${Aj}`,`${kj}`,`${kj}`;var jj={card:{containerPaddingInlineStart:{"--container-padding-inline-start":`xjmlhfd`,$$css:!0},containerPaddingInlineEnd:{"--container-padding-inline-end":`x1ihxwbr`,$$css:!0},containerPaddingBlockStart:{"--container-padding-block-start":`x1rqz8me`,$$css:!0},containerPaddingBlockEnd:{"--container-padding-block-end":`x1omyuck`,$$css:!0},layoutPaddingOuterX:{"--layout-padding-outer-x":`x14rzhog`,$$css:!0},layoutPaddingOuterY:{"--layout-padding-outer-y":`xjej9fs`,$$css:!0},layoutPaddingInnerX:{"--layout-padding-inner-x":`x4poyjn`,$$css:!0},layoutPaddingInnerY:{"--layout-padding-inner-y":`x1u1kw4e`,$$css:!0}},section:{containerPaddingInlineStart:{"--container-padding-inline-start":`x19lemt0`,$$css:!0},containerPaddingInlineEnd:{"--container-padding-inline-end":`xu1wldr`,$$css:!0},containerPaddingBlockStart:{"--container-padding-block-start":`xnw7zt4`,$$css:!0},containerPaddingBlockEnd:{"--container-padding-block-end":`xek4msv`,$$css:!0},layoutPaddingOuterX:{"--layout-padding-outer-x":`x15i0zw9`,$$css:!0},layoutPaddingOuterY:{"--layout-padding-outer-y":`x1vw4zgg`,$$css:!0},layoutPaddingInnerX:{"--layout-padding-inner-x":`x1v3gmnx`,$$css:!0},layoutPaddingInnerY:{"--layout-padding-inner-y":`x15yx5hm`,$$css:!0}},dialog:{containerPaddingInlineStart:{"--container-padding-inline-start":`x1tewnwq`,$$css:!0},containerPaddingInlineEnd:{"--container-padding-inline-end":`x11h1f2o`,$$css:!0},containerPaddingBlockStart:{"--container-padding-block-start":`x1g2kccc`,$$css:!0},containerPaddingBlockEnd:{"--container-padding-block-end":`x1gvthzm`,$$css:!0},layoutPaddingOuterX:{"--layout-padding-outer-x":`x1hsjncj`,$$css:!0},layoutPaddingOuterY:{"--layout-padding-outer-y":`x1pui4bz`,$$css:!0},layoutPaddingInnerX:{"--layout-padding-inner-x":`x2so38`,$$css:!0},layoutPaddingInnerY:{"--layout-padding-inner-y":`xinu7xd`,$$css:!0}}},Mj={spacing0:{"--container-padding-inline-start":`x1gu2k80`,$$css:!0},spacing0_5:{"--container-padding-inline-start":`x14ws0sr`,$$css:!0},spacing1:{"--container-padding-inline-start":`x1cvlban`,$$css:!0},spacing1_5:{"--container-padding-inline-start":`x176g23i`,$$css:!0},spacing2:{"--container-padding-inline-start":`x1xlrr2o`,$$css:!0},spacing3:{"--container-padding-inline-start":`xfdwxua`,$$css:!0},spacing4:{"--container-padding-inline-start":`x1dlhslv`,$$css:!0},spacing5:{"--container-padding-inline-start":`x1s81nki`,$$css:!0},spacing6:{"--container-padding-inline-start":`x1ep0dkj`,$$css:!0},spacing7:{"--container-padding-inline-start":`x157xojc`,$$css:!0},spacing8:{"--container-padding-inline-start":`xw1diwv`,$$css:!0},spacing9:{"--container-padding-inline-start":`xraca2a`,$$css:!0},spacing10:{"--container-padding-inline-start":`xserb3f`,$$css:!0},spacing11:{"--container-padding-inline-start":`xziclwo`,$$css:!0},spacing12:{"--container-padding-inline-start":`x1iiwihq`,$$css:!0}},Nj={spacing0:{"--container-padding-inline-end":`x91ghl5`,$$css:!0},spacing0_5:{"--container-padding-inline-end":`x1wz3t3y`,$$css:!0},spacing1:{"--container-padding-inline-end":`x2oyxnl`,$$css:!0},spacing1_5:{"--container-padding-inline-end":`xntetml`,$$css:!0},spacing2:{"--container-padding-inline-end":`xcas3b9`,$$css:!0},spacing3:{"--container-padding-inline-end":`xu0ipoa`,$$css:!0},spacing4:{"--container-padding-inline-end":`xs0pscg`,$$css:!0},spacing5:{"--container-padding-inline-end":`xgkj7vj`,$$css:!0},spacing6:{"--container-padding-inline-end":`x94cj42`,$$css:!0},spacing7:{"--container-padding-inline-end":`x11tj35w`,$$css:!0},spacing8:{"--container-padding-inline-end":`x1b9k1pi`,$$css:!0},spacing9:{"--container-padding-inline-end":`x19w02kr`,$$css:!0},spacing10:{"--container-padding-inline-end":`xx5lg5w`,$$css:!0},spacing11:{"--container-padding-inline-end":`x1nmgbqg`,$$css:!0},spacing12:{"--container-padding-inline-end":`x1wsfsk2`,$$css:!0}},Pj={spacing0:{"--container-padding-block-start":`x1i3qcxz`,$$css:!0},spacing0_5:{"--container-padding-block-start":`xvdf9ev`,$$css:!0},spacing1:{"--container-padding-block-start":`xnsckjb`,$$css:!0},spacing1_5:{"--container-padding-block-start":`x1kbx601`,$$css:!0},spacing2:{"--container-padding-block-start":`xa8b4fq`,$$css:!0},spacing3:{"--container-padding-block-start":`x11k4f5r`,$$css:!0},spacing4:{"--container-padding-block-start":`xm01sq8`,$$css:!0},spacing5:{"--container-padding-block-start":`xp8wdkl`,$$css:!0},spacing6:{"--container-padding-block-start":`x1hmud4d`,$$css:!0},spacing7:{"--container-padding-block-start":`x1c00sag`,$$css:!0},spacing8:{"--container-padding-block-start":`xfv60at`,$$css:!0},spacing9:{"--container-padding-block-start":`x14fzdu7`,$$css:!0},spacing10:{"--container-padding-block-start":`x17h9kl7`,$$css:!0},spacing11:{"--container-padding-block-start":`x1rdjxae`,$$css:!0},spacing12:{"--container-padding-block-start":`xecwdl6`,$$css:!0}},Fj={spacing0:{"--container-padding-block-end":`xkunwnr`,$$css:!0},spacing0_5:{"--container-padding-block-end":`x1cao3zv`,$$css:!0},spacing1:{"--container-padding-block-end":`x57a7ii`,$$css:!0},spacing1_5:{"--container-padding-block-end":`xv53x8y`,$$css:!0},spacing2:{"--container-padding-block-end":`x1lsgcmx`,$$css:!0},spacing3:{"--container-padding-block-end":`x1q3ppug`,$$css:!0},spacing4:{"--container-padding-block-end":`x4hfsld`,$$css:!0},spacing5:{"--container-padding-block-end":`xbib2ws`,$$css:!0},spacing6:{"--container-padding-block-end":`x1q8d17g`,$$css:!0},spacing7:{"--container-padding-block-end":`x1yqogew`,$$css:!0},spacing8:{"--container-padding-block-end":`x8lgq76`,$$css:!0},spacing9:{"--container-padding-block-end":`x1f7f9rt`,$$css:!0},spacing10:{"--container-padding-block-end":`x15vxphk`,$$css:!0},spacing11:{"--container-padding-block-end":`x4bg2x9`,$$css:!0},spacing12:{"--container-padding-block-end":`x186mjxr`,$$css:!0}},Ij={spacing0:{"--layout-padding-outer-x":`xswhm3q`,$$css:!0},spacing0_5:{"--layout-padding-outer-x":`xihiwg7`,$$css:!0},spacing1:{"--layout-padding-outer-x":`xc96xmq`,$$css:!0},spacing1_5:{"--layout-padding-outer-x":`x1u93lgd`,$$css:!0},spacing2:{"--layout-padding-outer-x":`x15dxnc0`,$$css:!0},spacing3:{"--layout-padding-outer-x":`xadgj3j`,$$css:!0},spacing4:{"--layout-padding-outer-x":`x1v56qcf`,$$css:!0},spacing5:{"--layout-padding-outer-x":`x1nzs0gl`,$$css:!0},spacing6:{"--layout-padding-outer-x":`x1c3n52a`,$$css:!0},spacing7:{"--layout-padding-outer-x":`x1gfiokx`,$$css:!0},spacing8:{"--layout-padding-outer-x":`x1t3kfz`,$$css:!0},spacing9:{"--layout-padding-outer-x":`xzr4qsh`,$$css:!0},spacing10:{"--layout-padding-outer-x":`x1jdf5a4`,$$css:!0},spacing11:{"--layout-padding-outer-x":`x1hct0t0`,$$css:!0},spacing12:{"--layout-padding-outer-x":`x11cyqoe`,$$css:!0}},Lj={spacing0:{"--layout-padding-outer-y":`x1mzf5mb`,$$css:!0},spacing0_5:{"--layout-padding-outer-y":`x1vj96e0`,$$css:!0},spacing1:{"--layout-padding-outer-y":`x1gpfxoh`,$$css:!0},spacing1_5:{"--layout-padding-outer-y":`xd3dqby`,$$css:!0},spacing2:{"--layout-padding-outer-y":`x10pz7y9`,$$css:!0},spacing3:{"--layout-padding-outer-y":`x1p6yq3h`,$$css:!0},spacing4:{"--layout-padding-outer-y":`xx738ci`,$$css:!0},spacing5:{"--layout-padding-outer-y":`x6yxws5`,$$css:!0},spacing6:{"--layout-padding-outer-y":`x180vrwl`,$$css:!0},spacing7:{"--layout-padding-outer-y":`x1q6rme1`,$$css:!0},spacing8:{"--layout-padding-outer-y":`xid7e43`,$$css:!0},spacing9:{"--layout-padding-outer-y":`x1t5kicu`,$$css:!0},spacing10:{"--layout-padding-outer-y":`x26l4wa`,$$css:!0},spacing11:{"--layout-padding-outer-y":`x10zktp0`,$$css:!0},spacing12:{"--layout-padding-outer-y":`x1yz3n6a`,$$css:!0}},Rj={spacing0:{"--layout-padding-inner-x":`xj1bl4l`,$$css:!0},spacing0_5:{"--layout-padding-inner-x":`xlriy2h`,$$css:!0},spacing1:{"--layout-padding-inner-x":`x6uuyak`,$$css:!0},spacing1_5:{"--layout-padding-inner-x":`xd38f90`,$$css:!0},spacing2:{"--layout-padding-inner-x":`xxqksqd`,$$css:!0},spacing3:{"--layout-padding-inner-x":`x1fyui2f`,$$css:!0},spacing4:{"--layout-padding-inner-x":`x1i2ajwi`,$$css:!0},spacing5:{"--layout-padding-inner-x":`x1tac27u`,$$css:!0},spacing6:{"--layout-padding-inner-x":`x1ntgf3t`,$$css:!0},spacing7:{"--layout-padding-inner-x":`xhjd9tl`,$$css:!0},spacing8:{"--layout-padding-inner-x":`xn7c84u`,$$css:!0},spacing9:{"--layout-padding-inner-x":`xeqkbsz`,$$css:!0},spacing10:{"--layout-padding-inner-x":`x1vf4qco`,$$css:!0},spacing11:{"--layout-padding-inner-x":`xsmamsf`,$$css:!0},spacing12:{"--layout-padding-inner-x":`x2xk2xj`,$$css:!0}},zj={spacing0:{"--layout-padding-inner-y":`xwuefyo`,$$css:!0},spacing0_5:{"--layout-padding-inner-y":`x180h0y5`,$$css:!0},spacing1:{"--layout-padding-inner-y":`xmpug6m`,$$css:!0},spacing1_5:{"--layout-padding-inner-y":`x1g8jpzm`,$$css:!0},spacing2:{"--layout-padding-inner-y":`x1lksgje`,$$css:!0},spacing3:{"--layout-padding-inner-y":`x4j7gld`,$$css:!0},spacing4:{"--layout-padding-inner-y":`x1s3ehtl`,$$css:!0},spacing5:{"--layout-padding-inner-y":`x1rj5eim`,$$css:!0},spacing6:{"--layout-padding-inner-y":`x1ftgg6u`,$$css:!0},spacing7:{"--layout-padding-inner-y":`x1ho74vh`,$$css:!0},spacing8:{"--layout-padding-inner-y":`xm2cs6f`,$$css:!0},spacing9:{"--layout-padding-inner-y":`x1vsq92b`,$$css:!0},spacing10:{"--layout-padding-inner-y":`x18gbwmk`,$$css:!0},spacing11:{"--layout-padding-inner-y":`x14zymzj`,$$css:!0},spacing12:{"--layout-padding-inner-y":`xzfpkx9`,$$css:!0}},Bj={containerMaxHeight:e=>[{"--container-max-height":e==null?e:`x18nyedi`,$$css:!0},{"--x---container-max-height":e??void 0}]};function Vj({padding:e=`spacing4`,paddingOuterX:t,paddingOuterY:n,paddingInnerX:r,paddingInnerY:i,useThemeDefault:a,maxHeight:o}){let s=t??e,c=n??e,l=r??e,u=i??e,d=o?Bj.containerMaxHeight(o):null;if(a){let e=jj[a];return[Cj.container,e.containerPaddingInlineStart,e.containerPaddingInlineEnd,e.containerPaddingBlockStart,e.containerPaddingBlockEnd,e.layoutPaddingOuterX,e.layoutPaddingOuterY,e.layoutPaddingInnerX,e.layoutPaddingInnerY,d]}return[Cj.container,Mj[s],Nj[s],Pj[c],Fj[c],Ij[s],Lj[c],Rj[l],zj[u],d]}var Hj=(0,_.createContext)(null);Hj.displayName=`DialogContext`;function Uj(e,t=16){let n=e.getBoundingClientRect(),r=n.left+n.width/2-window.innerWidth/2,i=n.top+n.height/2-window.innerHeight/2,a=Math.sqrt(r*r+i*i)||1;return{x:Math.round(r/a*t),y:Math.round(i/a*t)}}`${Br[`--spacing-4`]}`,`${Br[`--spacing-4`]}`,`${Br[`--spacing-4`]}`,`${Br[`--spacing-4`]}`,`${Br[`--spacing-4`]}`,`${Br[`--spacing-4`]}`;var Wj={dialog:{kVAEAm:`xixxii4`,kogj98:`x1bpp3o7`,kmVPX3:`x1717udv`,kWkggS:`x10xzikg`,"--_dialog-radius":`xvuvksw`,kaIpWk:`xuacgfc`,kGVxlE:`x1kcpxr7`,k1xSpc:`x1s85apg`,kXwgrk:`xdt5ytf`,kZKoxP:`xg7h5cd`,kZeWKH:`xish69e`,kSiTet:`xg01cxk`,k44tkh:`xqgcaz`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,$$css:!0},open:{k1xSpc:`x78zum5`,kSiTet:`x1hc1fzr`,kKVMdj:`x1ewfqum x1aquc0h`,$$css:!0},backdrop:{kGyWv1:`xnixb3f`,kba3nw:`x1abwkk1`,$$css:!0},fullscreen:{kzqmXN:`x1o6l61p`,kZKoxP:`xtdtrs8`,ks0D6T:`xlbgzzq`,kskxy:`x1wj9ous`,kaIpWk:`x2u8bby`,kogj98:`x1ghz6dp`,kpwlN0:`x10a8y8t`,$$css:!0},fullscreenOpen:{kKVMdj:`xqcmdr3 x1aquc0h`,$$css:!0},fullscreenSafeArea:{kLKAdn:`x15ld1ci`,kGO01o:`x1rgxemn`,kZCmMZ:`xqmdmw x1i7f2ot`,kwRFfy:`x1by8st6 xtjjor6`,$$css:!0},inner:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kUk6DE:`x12lumcd`,kAzted:`x2lwn1j`,kVQacm:`xb3r6kr`,kaIpWk:`x1pjcqnp`,$$css:!0},inlineWrapper:{kmVPX3:`x1717udv`,kWkggS:`x10xzikg`,"--_dialog-radius":`xvuvksw`,kaIpWk:`xuacgfc`,kGVxlE:`x1kcpxr7`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kZKoxP:`xg7h5cd`,kZeWKH:`xish69e`,$$css:!0}},Gj=Br[`--spacing-4`],Kj=`min(100%, ${`calc(100dvw - ${Gj} - ${Gj})`})`;function qj(e){return typeof e==`number`?`${e}px`:e}function Jj(e,t){return{width:qj(e),maxWidth:Kj,maxHeight:qj(t)}}var Yj={kogj98:`x1ghz6dp`,$$css:!0},Xj={sizing:(e,t,n)=>[{kzqmXN:e==null?e:`x5lhr3w`,ks0D6T:t==null?t:`xf68679`,kskxy:n==null?n:`x1jols5v`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e),"--x-maxWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(t),"--x-maxHeight":(e=>typeof e==`number`?e+`px`:e??void 0)(n)}],position:(e,t,n,r)=>[Yj,{k87sOh:e==null?e:`xjbys53`,kLqNvP:t==null?t:`x1lxsm33`,kt4wiu:n==null?n:`xqxgn94`,krVfgx:r==null?r:`x1nqzi6q`,$$css:!0},{"--x-top":(e=>typeof e==`number`?e+`px`:e??void 0)(e),"--x-insetInlineStart":(e=>typeof e==`number`?e+`px`:e??void 0)(t),"--x-insetInlineEnd":(e=>typeof e==`number`?e+`px`:e??void 0)(n),"--x-bottom":(e=>typeof e==`number`?e+`px`:e??void 0)(r)}]};function Zj(e){return typeof e==`number`?`${e}px`:e}function Qj(e){let{top:t,bottom:n,start:r,end:i}=e;return{top:t===void 0?`auto`:Zj(t),bottom:n===void 0?`auto`:Zj(n),insetInlineStart:r===void 0?`auto`:Zj(r),insetInlineEnd:i===void 0?`auto`:Zj(i)}}function $j({isOpen:e,isInline:t=!1,onOpenChange:n,width:r=400,maxHeight:i=`75dvh`,position:a,variant:o=`standard`,purpose:s=`info`,padding:c,children:l,xstyle:u,className:d,style:f,ref:p,...m}){let h=c==null,g=c??4,v=ti[g],y=o===`fullscreen`,b=y?null:Jj(r,i),x=(0,_.useId)(),S=(0,_.useMemo)(()=>({isInline:t,titleId:x}),[t,x]),C=m[`aria-label`]!=null||m[`aria-labelledby`]!=null,w=(0,_.useRef)(null),T=Ao(p,(0,_.useCallback)(e=>{w.current=e,!(!e||C)&&(e.querySelector(`#${CSS.escape(x)}`)==null?e.removeAttribute(`aria-labelledby`):e.setAttribute(`aria-labelledby`,x))},[x,C])),E=(0,_.useRef)(null),D=s!==`required`,O=s===`info`;(0,_.useEffect)(()=>{if(t)return;let n=w.current;if(n)if(e){E.current=document.activeElement;let e=E.current;if(e&&e!==document.body){let t=Uj(e);n.style.setProperty(`--dialog-dir-x`,`${t.x}px`),n.style.setProperty(`--dialog-dir-y`,`${t.y}px`)}else n.style.setProperty(`--dialog-dir-x`,`0px`),n.style.setProperty(`--dialog-dir-y`,`16px`);if(!n.open){n.showModal();let e=n.querySelector(`[data-autofocus]`);e&&e.focus()}}else n.open&&n.close(),E.current?.focus(),E.current=null},[e,t]),Sj(e&&!t);let{shouldDismissOnCloseRequest:k}=Ki({isActive:e,isEnabled:!t,escapeBehavior:D?`close`:`block`,onDismiss:()=>{n(!1)}}),A=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let n=w.current?.querySelector(`#${CSS.escape(x)}`)!=null;e&&!t&&!C&&!n&&!A.current&&(A.current=!0)},[e,t,C,x]);let j=e=>{e.target===e.currentTarget&&O&&n(!1)},M=e=>{e.preventDefault(),k()&&D&&n(!1)},N=(0,K.jsx)(`div`,{...Sr(Wj.inner,...Vj(h?{useThemeDefault:`dialog`,maxHeight:b?.maxHeight}:{paddingInnerX:v,paddingInnerY:v,paddingOuterX:v,paddingOuterY:v,maxHeight:b?.maxHeight}),!h&&g!==4&&ni[g],!h&&g!==4&&ri[g],!h&&g!==4&&ii[g],!h&&g!==4&&ai[g],y&&h&&Wj.fullscreenSafeArea),children:(0,K.jsx)(Hj,{value:S,children:l})}),P=a!=null&&!y,{open:F,...I}=m;return t?e?(0,K.jsx)(`div`,{...I,...oa(ba(`dialog`,{variant:o}),Sr(Wj.inlineWrapper,fi.reset,b&&Xj.sizing(b.width,b.maxWidth,b.maxHeight),y&&Wj.fullscreen,u),d,f),"data-testid":m[`data-testid`],children:(0,K.jsx)(Ti,{children:N})}):null:(0,K.jsx)(`dialog`,{ref:T,...I,...oa(ba(`dialog`,{variant:o}),Wa.focusVisible(Wj.dialog,fi.reset,e&&Wj.open,Wj.backdrop,b&&Xj.sizing(b.width,b.maxWidth,b.maxHeight),P&&(()=>{let e=Qj(a);return Xj.position(e.top,e.insetInlineStart,e.insetInlineEnd,e.bottom)})(),y&&Wj.fullscreen,y&&e&&Wj.fullscreenOpen,u),d,f),onClick:j,onCancel:M,"aria-modal":`true`,...s===`required`?{role:`alertdialog`}:void 0,children:(0,K.jsx)(Ti,{children:N})})}$j.displayName=`Dialog`;var eM=(0,_.createContext)(null);eM.displayName=`LayoutDividerContext`;var tM=(0,_.lazy)(async()=>Po(()=>Promise.resolve().then(()=>bd).then(e=>({default:e.Tooltip})),void 0)),nM={1:`h1`,2:`h2`,3:`h3`,4:`h4`,5:`h5`,6:`h6`};function rM({level:e,type:t,accessibilityLevel:n,color:r=`primary`,display:i=`block`,maxLines:a=0,hasTruncateTooltip:o=!0,wordBreak:s,textWrap:c,justify:l=`start`,hasCapsize:u=!1,hasStrikethrough:d=!1,xstyle:f,className:p,style:m,children:h,ref:g,...v}){let y=nM[e],b=n&&n!==e?{"aria-level":n}:{},x=s??(a===1?`break-all`:`break-word`),S=a>0||u?`block`:i,C=ko({maxLines:a}),w=typeof o==`string`?o:`above`,T=a>0&&o!==!1&&C.isTruncated,E=(0,_.useRef)(null),D=Ao(g,C.ref,E),O=a>1?{WebkitLineClamp:a}:void 0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(y,{ref:D,...oa(ba(`heading`,{level:e,color:r,...t&&{type:t}}),Sr(mo[Ro(r)],t?_o[t]:yo[e],t&&go[t],a===1?xo.singleLine:a>1?xo.multiLine:bo[S],a>0&&So[x],c&&Co[c],l!==`start`&&Do[l],u&&wo.enabled,d&&To.strikethrough,f),p,{...m,...O}),...b,...v,children:h}),T&&(0,K.jsx)(_.Suspense,{fallback:null,children:(0,K.jsx)(tM,{anchorRef:E,content:(0,K.jsx)(`span`,{...Sr(Oo.content),children:C.fullText}),placement:w})})]})}rM.displayName=`Heading`;function iM({ownerKey:e,images:t,onRemove:n}){let{t:r}=cr(),i=(0,_.useRef)(null),[a,o]=(0,_.useState)(null),s=(0,_.useRef)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(`fit`),f=a?.ownerKey===e?t.find(e=>e.id===a.id):void 0,p=a?JSON.stringify([a.ownerKey,a.id]):``,m=()=>{s.current=a,o(null)};return(0,_.useEffect)(()=>{if(a&&!f){s.current=null,o(null);return}if(a||!s.current)return;let n=s.current;s.current=null;let r=document.activeElement;n.ownerKey===e&&t.some(e=>e.id===n.id)&&n.trigger.isConnected&&(r===document.body||i.current?.contains(r))&&n.trigger.focus()},[a,f,e,t]),(0,K.jsxs)(K.Fragment,{children:[t.length>0&&(0,K.jsx)(`section`,{className:`composer-attachments`,"aria-label":r(`imageAttachments`),children:t.map(t=>(0,K.jsxs)(`div`,{className:`composer-attachment`,children:[(0,K.jsx)(`button`,{type:`button`,className:`composer-attachment-preview`,"aria-label":`${r(`previewAttachment`)} ${t.name}`,title:r(`previewAttachment`),onClick:n=>{n.currentTarget.focus(),n.currentTarget.blur(),s.current=null,l(null),d(`fit`),o({ownerKey:e,id:t.id,trigger:n.currentTarget})},children:(0,K.jsx)(`img`,{src:t.previewUrl,alt:``})}),(0,K.jsx)(`span`,{title:t.name,children:t.name}),(0,K.jsx)(`button`,{type:`button`,className:`composer-attachment-remove`,"aria-label":`${r(`removeAttachment`)} ${t.name}`,title:r(`removeAttachment`),onClick:()=>n(t.id),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]},t.id))}),(0,K.jsx)($j,{ref:i,isOpen:!!f,onOpenChange:e=>!e&&m(),purpose:`info`,width:800,maxHeight:`calc(100dvh - 32px)`,padding:0,"aria-label":`${r(`previewAttachment`)} ${f?.name??``}`.trim(),children:f&&(0,K.jsxs)(`div`,{className:`draft-image-preview`,children:[(0,K.jsxs)(`header`,{children:[(0,K.jsx)(`strong`,{title:f.name,children:f.name}),(0,K.jsxs)(`fieldset`,{className:`draft-image-preview-modes`,"aria-label":r(`imageViewMode`),children:[(0,K.jsx)(Cd,{content:r(`fitImage`),placement:`below`,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":r(`fitImage`),"aria-pressed":u===`fit`,disabled:c===p,onClick:()=>d(`fit`),children:(0,K.jsx)(mt,{"aria-hidden":`true`})})}),(0,K.jsx)(Cd,{content:r(`originalImageSize`),placement:`below`,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":r(`originalImageSize`),"aria-pressed":u===`original`,disabled:c===p,onClick:()=>d(`original`),children:(0,K.jsx)(We,{"aria-hidden":`true`})})})]}),(0,K.jsx)(`button`,{type:`button`,"data-autofocus":!0,"aria-label":r(`closeImagePreview`),title:r(`closeImagePreview`),onClick:m,children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]}),(0,K.jsx)(`section`,{className:`draft-image-preview-body`,"aria-label":r(`imageViewMode`),"data-mode":u,tabIndex:u===`original`&&c!==p?0:void 0,children:c===p?(0,K.jsx)(`p`,{className:`composer-attachment-error`,role:`alert`,children:r(`imagePreviewFailed`)}):(0,K.jsx)(`img`,{src:f.previewUrl,alt:f.name,onError:()=>l(p)},p)})]})})]})}function aM({ownerKey:e,files:t,onRemove:n}){let{t:r}=cr(),i=(0,_.useRef)(null),[a,o]=(0,_.useState)(null),s=(0,_.useRef)(null),c=a?.ownerKey===e?t.find(e=>e.id===a.id):void 0,l=()=>{s.current=a,o(null)};(0,_.useEffect)(()=>{if(a&&!c){s.current=null,o(null);return}if(a||!s.current)return;let n=s.current;s.current=null;let r=document.activeElement;n.ownerKey===e&&t.some(e=>e.id===n.id)&&n.trigger.isConnected&&(r===document.body||i.current?.contains(r))&&n.trigger.focus()},[a,c,e,t]);let u=e=>r(e.extractionError?`fileAttachmentExtractionFailed`:e.extraction===`truncated`?`fileAttachmentTextTruncated`:e.extraction===`text`?`fileAttachmentTextReady`:`fileAttachmentOriginalReady`);return(0,K.jsxs)(K.Fragment,{children:[t.length>0&&(0,K.jsx)(`section`,{className:`composer-attachments`,"aria-label":r(`fileAttachments`),children:t.map(t=>(0,K.jsxs)(`div`,{className:`composer-attachment composer-file-attachment`,children:[(0,K.jsx)(`button`,{type:`button`,className:`composer-attachment-preview`,"aria-label":`${r(`previewFileAttachment`)} ${t.name}`,onClick:n=>{n.currentTarget.focus(),n.currentTarget.blur(),s.current=null,o({ownerKey:e,id:t.id,trigger:n.currentTarget})},children:(0,K.jsx)(Se,{"aria-hidden":`true`})}),(0,K.jsxs)(`span`,{title:t.name,children:[t.name,(0,K.jsx)(`small`,{children:u(t)})]}),(0,K.jsx)(`button`,{type:`button`,className:`composer-attachment-remove`,"aria-label":`${r(`removeAttachment`)} ${t.name}`,onClick:()=>n(t.id),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]},t.id))}),(0,K.jsx)($j,{ref:i,isOpen:!!c,onOpenChange:e=>!e&&l(),purpose:`info`,width:720,maxHeight:`calc(100dvh - 32px)`,"aria-label":`${r(`previewFileAttachment`)} ${c?.name??``}`.trim(),children:c&&(0,K.jsxs)(`div`,{className:`draft-file-preview`,children:[(0,K.jsx)(`strong`,{children:c.name}),(0,K.jsxs)(`p`,{children:[u(c),` · `,(c.size/1024).toFixed(1),` KB`]}),c.extractionError&&(0,K.jsx)(`p`,{children:r(c.extractionError===`encoding`?`fileAttachmentEncodingUnavailable`:`fileAttachmentDocumentUnavailable`)}),c.text===void 0?(0,K.jsx)(`p`,{children:r(`fileAttachmentNoText`)}):(0,K.jsxs)(`pre`,{children:[c.text.slice(0,2e4),c.text.length>2e4?`\n${r(`fileAttachmentPreviewTruncated`)}`:``]})]})})]})}var oM=new Set(`txt md markdown csv tsv json jsonl ndjson xml html htm css scss sass less yaml yml toml ini cfg conf config log rst tex diff patch sql graphql gql py ipynb js mjs cjs jsx ts mts cts tsx java kt kts scala c cc cpp cxx h hpp cs go rs rb php swift sh bash zsh fish ps1 bat cmd r lua pl proto vue svelte astro svg srt vtt env gitignore dockerignore editorconfig properties lock`.split(` `));function sM(e,t,n){let r=e.split(`.`).at(-1)?.toLowerCase()||``;return new TextDecoder(`ascii`).decode(n.subarray(0,5))===`%PDF-`?`pdf`:[`pdf`,`docx`,`xlsx`,`pptx`].includes(r)?r:oM.has(r)||/^(?:readme|license|licence|changelog|dockerfile|makefile|gemfile)$/iu.test(e)||t.startsWith(`text/`)||/^application\/(?:json|(?:[^;]+\+)?xml|javascript|x-yaml)(?:;|$)/iu.test(t)?`text`:`binary`}var cM=15e3;function lM(e,t){return new Promise((n,r)=>{let i=new FileReader,a=e=>{clearTimeout(s),t?.removeEventListener(`abort`,o),e?r(e):i.result instanceof ArrayBuffer?n(i.result):r(Error(`file-read`))},o=()=>{i.abort(),a(new DOMException(`File staging cancelled.`,`AbortError`))},s=setTimeout(()=>{i.abort(),a(Error(`file-timeout`))},cM);i.onload=()=>a(),i.onerror=()=>a(Error(`file-read`)),t?.addEventListener(`abort`,o,{once:!0}),t?.aborted?o():i.readAsArrayBuffer(e)})}function uM(e,t,n){return new Promise((r,i)=>{let a=new Worker(new URL(`/app-file-text-worker-DegOHoqE.js`,``+import.meta.url),{type:`module`}),o=(e,t)=>{clearTimeout(c),n?.removeEventListener(`abort`,s),a.terminate(),t?i(t):e?r(e):i(Error(`file-document-invalid`))},s=()=>o(void 0,new DOMException(`File staging cancelled.`,`AbortError`)),c=setTimeout(()=>o(void 0,Error(`file-timeout`)),cM);a.onmessage=e=>{!e.data||!(`result`in e.data||`error`in e.data)||(e.data.error?o(void 0,Error(e.data.error)):o(e.data.result))},a.onerror=()=>o(void 0,Error(`file-document-invalid`)),n?.addEventListener(`abort`,s,{once:!0}),n?.aborted?s():a.postMessage({data:e,kind:t},[e])})}async function dM(e,t){if(e.size>52428800)throw Error(`file-size`);let n=await lM(e,t),r=new Uint8Array(n),i=sM(e.name,e.type,r),a=r.length,o=await uM(n,i,t);return t?.throwIfAborted(),{id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${e.name}`,name:e.name||`file`,size:a,mimeType:e.type||`application/octet-stream`,...o}}var fM=!1;typeof window<`u`&&requestAnimationFrame(()=>{fM=!0});var pM={slideDown:{kKVMdj:`x1srr2gu x1aquc0h`,k44tkh:`x9uej1z`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,$$css:!0},slideUp:{kKVMdj:`x1dvww92 x1aquc0h`,k44tkh:`x9uej1z`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,$$css:!0},fadeIn:{kKVMdj:`xqcmdr3 x1aquc0h`,k44tkh:`x9uej1z`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,$$css:!0},scaleIn:{kKVMdj:`x97zbip x1aquc0h`,k44tkh:`x9uej1z`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,$$css:!0}};function mM(e=`slideDown`){let[t]=(0,_.useState)(()=>fM);return t?pM[e]:null}var hM=new Set([`text`,`password`,`email`,`number`,`search`,`tel`,`url`,`date`,`datetime-local`,`month`,`time`,`week`]),gM=new Set([`true`,`menu`,`listbox`,`tree`,`grid`,`dialog`]);function _M(e){if(e.getAttribute(`role`)===`combobox`)return!0;let t=e.getAttribute(`aria-haspopup`);return t!=null&&gM.has(t)}function vM({containerRef:e,inputRef:t,disabled:n=!1}){return Ya({containerRef:e,interactiveRef:t,onClick:(0,_.useCallback)(()=>{let e=t.current;e!=null&&(e instanceof HTMLElement&&_M(e)?e.click():e instanceof HTMLInputElement&&hM.has(e.type)||e instanceof HTMLTextAreaElement?e.focus():e instanceof HTMLElement?e.click():`focus`in e&&e.focus())},[t]),disabled:n})}var yM={warning:`warning`,error:`error`,success:`success`},bM={warning:`@astryx.input.statusButton.warning`,error:`@astryx.input.statusButton.error`,success:`@astryx.input.statusButton.success`},xM={statusButton:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kfzvcC:`x67bb7w`,kaIpWk:`xjspbzw`,kInvED:`x7s97pk`,$$css:!0}};function SM({status:e,statusVariant:t=`attached`,isInGroup:n=!1,size:r=`md`}){let i=Rc(),a=t===`tooltip`&&!!e?.message,[o,s]=(0,_.useState)(void 0),c=po({placement:`above`,isEnabled:a,isOpen:o}),l=(0,_.useCallback)(()=>{s(void 0)},[]),u=(0,_.useCallback)(()=>{typeof window>`u`||typeof window.matchMedia!=`function`||!window.matchMedia(`(hover: none)`).matches||s(e=>e!==!0)},[]);if((0,_.useEffect)(()=>{if(o!==!0)return;let e=e=>{e.key===`Escape`&&s(void 0)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[o]),!(e&&!n&&t!==`detached`))return{statusIcon:null,describedBy:void 0};let d=(0,K.jsx)(xu,{icon:yM[e.type],size:r,color:e.type,...ba(`input-status-icon`,{size:r,status:e.type})});return a?{statusIcon:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,ref:c.ref,"aria-label":i(bM[e.type]),"aria-describedby":c.describedBy,onClick:u,onBlur:l,...Sr(Ha.focusVisible,xM.statusButton),children:d}),c.renderTooltip(e.message)]}),describedBy:c.describedBy}:{statusIcon:d,describedBy:void 0}}var CM=(0,_.createContext)({direction:`vertical`});CM.displayName=`FormLayoutContext`;var wM={label:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`xzye2dw`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kLWn49:`x1kq96og`,k63SB2:`x1e4wzip`,kMwMTN:`xv1l7n4`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},labelDisabled:{kMwMTN:`xnbbluu`,kkrTdU:`xt0e3qv`,$$css:!0},srOnly:{ksu8eU:`xng3xce`,kMcinP:`xzpqnlu`,kZKoxP:`xjm9jq1`,kLqNvP:`x1o0tod`,kogj98:`xkdpibf`,kVQacm:`xb3r6kr`,kmVPX3:`x1717udv`,kfzvcC:`x47corl`,kVAEAm:`x10l6tqk`,k87sOh:`x13vifvy`,kfSwDN:`x87ps6o`,khDVqt:`xuxw1ft`,kzqmXN:`x1i1rx1s`,$$css:!0}};function TM({label:e,inputID:t,labelID:n,isGroupLabel:r=!1,isLabelHidden:i=!1,isDisabled:a=!1,isOptional:o=!1,isRequired:s=!1,labelIcon:c,labelTooltip:l,description:u,descriptionID:d,className:f,style:p,xstyle:m,ref:h,...g}){let v=Rc(),{defaultOptionality:y}=(0,_.use)(CM),b=o&&y!==`optional`?v(`@astryx.field.optional`):s&&y!==`required`?v(`@astryx.field.required`):null,x=r?`span`:`label`,S=!r&&t!=null,C=(0,_.useRef)(null),w=vM({containerRef:C,inputRef:(0,_.useMemo)(()=>({get current(){return t==null?null:C.current?.ownerDocument.getElementById(t)??null},set current(e){}}),[t]),disabled:!S}),T=(0,K.jsxs)(K.Fragment,{children:[c&&Cu(c,{size:`sm`,color:`inherit`}),e,b&&(0,K.jsxs)(`span`,{className:`x1sodnla x141an7d x1ltkj2j xv1l7n4`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:` ∙ `}),b]}),l&&(0,K.jsx)(Cd,{content:l,placement:`above`,children:(0,K.jsx)(xu,{icon:`info`,size:`sm`,color:`inherit`})})]});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(x,{ref:h,id:n,htmlFor:r?void 0:t,...g,...oa(ba(`field-label`),Sr(wM.label,a&&wM.labelDisabled,i&&wM.srOnly,m),f,p),children:T}),u&&(0,K.jsx)(`span`,{ref:S?C:void 0,id:d,...S?w:void 0,...{0:{className:`x9ynric x141an7d x1ltkj2j x1sodnla xv1l7n4`},2:{className:`x9ynric x141an7d x1ltkj2j x1sodnla xv1l7n4 x1ypdohk x16khyan`},1:{className:`x9ynric x141an7d x1ltkj2j x1sodnla xv1l7n4 xng3xce xzpqnlu xjm9jq1 x1o0tod xkdpibf xb3r6kr x1717udv x47corl x10l6tqk x13vifvy x87ps6o xuxw1ft x1i1rx1s`},3:{className:`x9ynric x141an7d x1ltkj2j x1sodnla xv1l7n4 x1ypdohk x16khyan xng3xce xzpqnlu xjm9jq1 x1o0tod xkdpibf xb3r6kr x1717udv x47corl x10l6tqk x13vifvy x87ps6o xuxw1ft x1i1rx1s`}}[!!S<<1|!!i<<0],children:u})]})}TM.displayName=`FieldLabel`;var EM={warning:`warning`,error:`error`,success:`success`},DM={base:{kMv6JI:`x9ynric`,kGuDYH:`x141an7d`,kLWn49:`x1ltkj2j`,$$css:!0},attached:{keoZOQ:`x1c40v9y`,kLKAdn:`x1ak3mig`,kGO01o:`x1wesfrj`,kg3NbH:`xf314gf`,kVL7Gh:`xquck67`,kT0f0o:`x14i3lts`,$$css:!0},detached:{keoZOQ:`xcsaf9d`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`xh6dtrn`,$$css:!0}},OM={warning:{kWkggS:`x24i8r5`,kMwMTN:`xdhq94a`,$$css:!0},error:{kWkggS:`x1pritpl`,kMwMTN:`x1joocv1`,$$css:!0},success:{kWkggS:`xu13z74`,kMwMTN:`xltfdvo`,$$css:!0}};function kM({ref:e,type:t,message:n,id:r,variant:i=`attached`,xstyle:a,className:o,style:s,...c}){let l=mM(`slideDown`),u=so();return(0,_.useEffect)(()=>{n&&u(n,t===`error`?`assertive`:`polite`)},[u,n,t]),(0,K.jsx)(`div`,{ref:e,id:r,...c,...oa(ba(`field-status`,{type:t,variant:i}),Sr(DM.base,l,i===`attached`?DM.attached:DM.detached,OM[t],a),o,s),children:i===`detached`?(0,K.jsxs)(`span`,{className:`x78zum5 x1cy8zhl xzye2dw`,children:[(0,K.jsx)(`span`,{className:`x3nfvp2 x6s0dn4 x14o5nre x2lah0s`,children:(0,K.jsx)(xu,{icon:EM[t],size:`sm`,color:`inherit`,...ba(`field-status-icon`,{type:t})})}),(0,K.jsx)(`span`,{children:n})]}):n})}kM.displayName=`FieldStatus`;var AM={container:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,$$css:!0},containerGap:{kOIVth:`xzye2dw`,$$css:!0},horizontalLabels:{k1xSpc:`xjp7ctv`,$$css:!0}},jM={width:e=>[{kzqmXN:e==null?e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]};function MM({label:e,isLabelHidden:t=!1,description:n,inputID:r,labelID:i,isGroupLabel:a=!1,descriptionID:o,isOptional:s=!1,isRequired:c=!1,isDisabled:l=!1,labelIcon:u,status:d,labelTooltip:f,statusVariant:p=`attached`,width:m,xstyle:h,children:g,className:v,style:y,ref:b,...x}){let{direction:S}=(0,_.use)(CM),C=S===`horizontal-labels`,w=o??(n?`${r}-desc`:void 0),T=d?.messageID??(d?.message?`${r}-status`:void 0);sd(`Field`,`isOptional and isRequired are mutually exclusive. isOptional takes precedence.`,s&&c);let E=(0,K.jsx)(TM,{label:e,inputID:r,labelID:i,isGroupLabel:a,isLabelHidden:t,isDisabled:l,isOptional:s,isRequired:c,labelIcon:u,labelTooltip:f,description:C?void 0:n,descriptionID:C?void 0:w}),D=d?.message&&p!==`tooltip`?(0,K.jsx)(kM,{type:d.type,message:d.message,id:T,variant:p}):null;return C?(0,K.jsxs)(`div`,{ref:b,...oa(ba(`field`,{layout:`horizontal-labels`}),Sr(AM.horizontalLabels,h),v,y),...x,children:[(0,K.jsx)(`div`,{className:`x1enrzb7`,children:E}),(0,K.jsxs)(`div`,{className:`x78zum5 xdt5ytf xc8icb0`,children:[n&&(0,K.jsx)(zo,{type:`supporting`,display:`block`,id:w,children:n}),g,D]})]}):(0,K.jsxs)(`div`,{ref:b,...oa(ba(`field`),Sr(AM.container,!t&&AM.containerGap,m!=null&&jM.width(m),h),v,y),...x,children:[E,p===`attached`?(0,K.jsxs)(`div`,{className:`x78zum5 xdt5ytf xc8icb0`,children:[g,D]}):(0,K.jsxs)(K.Fragment,{children:[g,D]})]})}MM.displayName=`Field`;var NM={base:{kB7OPa:`x9f619`,kVAEAm:`x1n2onr6`,kY2c9j:`x1vjfegm`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,kMzoRj:`x1litavf`,ksu8eU:`x1y0btm7`,kVAM5u:`xvy26l8 x6q1khz`,"--_field-radius":`x1832zxr`,kaIpWk:`xvdfih8`,kWkggS:`x10xzikg`,k1ekBW:`x12zzom9`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kGVxlE:`x1gnnqk1 x1xqjsvb xuihb5h`,kI3sdo:`x1a2a7pz`,$$css:!0},disabled:{kkrTdU:`xt0e3qv`,kSiTet:`xbyyjgo`,kVAM5u:`xvy26l8`,kGVxlE:`x1gnnqk1`,$$css:!0}},PM={warning:{kVAM5u:`x8wg1ba`,$$css:!0},error:{kVAM5u:`x1ofxpqo`,$$css:!0},success:{kVAM5u:`x16m2moy`,$$css:!0}},FM={warning:{kGVxlE:`x1gnnqk1 x9156jc`,$$css:!0},error:{kGVxlE:`x1gnnqk1 x1bgmis8`,$$css:!0},success:{kGVxlE:`x1gnnqk1 x8wp45d`,$$css:!0}},IM={warning:{kVAM5u:`x8wg1ba xa1yw2k`,$$css:!0},error:{kVAM5u:`x1ofxpqo xk2sxw7`,$$css:!0},success:{kVAM5u:`x16m2moy xyq33ac`,$$css:!0}},LM={button:{kZKoxP:`x1qx5ct2`,kmuXW:`x2lah0s`,kVAEAm:`x1n2onr6`,"--_input-clear-hit-inset":`xtoycft x181bpwf`,"--_input-clear-hit-content":`xqxtgf4 xp8r40j`,k5JduY:`xh3pasq`,kwXMNM:`x1j6awrg`,kv0HGH:`xht581f`,$$css:!0}};function RM({label:e,onClick:t,onPointerDown:n,onClickCapture:r,xstyle:i,iconClassName:a}){let{className:o}=ba(`input-clear-icon`),{className:s}=ba(`input-clear-button`);return(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,label:e,className:s,icon:(0,K.jsx)(xu,{icon:`close`,size:`sm`,color:`secondary`,className:a==null?o:`${o} ${a}`}),onClick:t,onPointerDown:n,onClickCapture:r,isIconOnly:!0,xstyle:[LM.button,i]})}function zM(e){return RM(e)}function BM(e){return RM(e)}zM.displayName=`InputClearButton`;var VM={inGroup:{kUk6DE:`x98rzlu`,k7Eaqz:`xeuugli`,kZKoxP:`x5yr21d`,keTefX:`xd10s4z x1pwwqoy`,krdFHd:`x15mokao x8eehn2`,kVL7Gh:`xbiv7yw x1xrp5p4`,kfmiAY:`x1ga7v0g x1tzxhge`,kT0f0o:`x16uus16 x1rmb4wm`,kXnDq0:`x1rm9qnc`,$$css:!0}};function HM({isRequired:e=!1,isOptional:t=!1}){let{defaultOptionality:n}=(0,_.use)(CM);return!t&&(e||n===`required`)}var UM=(0,_.createContext)(null);UM.displayName=`InputGroupContext`;function WM(){return(0,_.use)(UM)}var GM={sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0}};function KM({type:e=`text`,label:t,isLabelHidden:n=!1,description:r,isOptional:i=!1,isRequired:a=!1,isDisabled:o=!1,isReadOnly:s=!1,disabledMessage:c,startIcon:l,status:u,statusVariant:d=`attached`,size:f,onChange:p,changeAction:m,isLoading:h=!1,value:g,placeholder:v,labelTooltip:y,hasClear:b=!1,hasAutoFocus:x=!1,htmlName:S,onEnter:C,onKeyDown:w,width:T,xstyle:E,className:D,style:O,ref:k,...A}){let j=Rc(),M=HM({isRequired:a,isOptional:i}),N=as(f,`md`),P=(0,_.useId)(),F=(0,_.useId)(),I=(0,_.useId)(),L=(0,_.useId)(),R=(0,_.useRef)(null),ee=(0,_.useRef)(null),z=WM(),[,B]=(0,_.useTransition)(),[V,H]=(0,_.useOptimistic)(g),te=h||V!==g,ne=o&&!!c,re=po({placement:`above`,focusTrigger:`always`,isEnabled:ne}),{statusIcon:ie,describedBy:ae}=SM({status:u,statusVariant:d,isInGroup:!!z}),{ariaLabelledBy:U,ariaDescribedBy:oe}=Oa(F,[r?I:null,!z&&d!==`tooltip`&&u?.message?L:null,ae,ne?re.describedBy:null],z),se=e=>{if(o||s)return;let t=e.target.value;p?.(t,e),m&&!e.defaultPrevented&&B(async()=>{H(t),await m(t,e)})},ce=(0,_.useCallback)(()=>{p?.(``,null),R.current?.focus()},[p]),{onClick:le,onMouseUp:ue}=vM({containerRef:ee,inputRef:R,disabled:o}),de=(0,K.jsxs)(`div`,{ref:e=>{ee.current=e,re.ref(e)},onClick:le,onMouseUp:ue,...oa(ba(`text-input`,{size:N,status:u?.type??null,disabled:o?`disabled`:null,readonly:s?`readonly`:null}),Sr(NM.base,GM[N],o&&NM.disabled,u&&PM[u.type],u&&!o&&FM[u.type],u&&IM[u.type],z&&VM.inGroup,E),D,O),children:[l&&Cu(l,{size:`sm`,color:`secondary`}),z&&(0,K.jsx)(es,{id:F,children:t}),(0,K.jsx)(`input`,{...A,ref:Ao(k,R),id:P,name:o?void 0:S,type:e,value:V,onChange:se,onKeyDown:C||w?e=>{e.key===`Enter`&&C?.(),w?.(e)}:void 0,placeholder:v,disabled:o&&!ne,"aria-disabled":ne?`true`:void 0,readOnly:s||ne||void 0,autoFocus:x,"data-autofocus":x||void 0,"aria-describedby":oe,"aria-required":M?`true`:void 0,"aria-invalid":u?.type===`error`?`true`:void 0,"aria-busy":te||void 0,"aria-labelledby":U,...{0:{className:`x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 x6pjikd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5`},1:{className:`x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 x6pjikd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5 xt0e3qv`}}[!!o<<0]}),b&&g!==``&&!o&&!s&&(0,K.jsx)(zM,{label:j(`@astryx.textInput.clearLabel`,{label:t}),onClick:ce}),te&&(0,K.jsx)($o,{size:`sm`}),ie]});return z?(0,K.jsxs)(K.Fragment,{children:[de,ne&&re.renderTooltip(c)]}):(0,K.jsxs)(MM,{label:t,isLabelHidden:n,description:r,inputID:P,descriptionID:r?I:void 0,isOptional:i,isRequired:a,isDisabled:o,status:u?{type:u.type,message:u.message,messageID:u.message?L:void 0}:void 0,statusVariant:d,labelTooltip:y,width:T,children:[de,ne&&re.renderTooltip(c)]})}KM.displayName=`TextInput`;var qM={ARTIFACT_DENIED:`fileReferenceDenied`,ARTIFACT_MISSING:`fileReferenceMissing`,ARTIFACT_UNSUPPORTED:`fileReferenceUnsupported`,ARTIFACT_EXPIRED:`fileReferenceExpired`,ARTIFACT_LIMIT:`fileReferenceBusy`,ARTIFACT_BUSY:`fileReferenceBusy`};function JM({open:e,sessionId:t,onClose:n,onInsert:r}){let{t:i}=cr(),a=(0,_.useMemo)(()=>new rf,[]),o=(0,_.useRef)(null),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null);(0,_.useEffect)(()=>(c(``),u(!1),f(null),()=>{o.current?.abort(),o.current=null}),[e,t]);let p=()=>{o.current?.abort(),o.current=null,n()},m=async()=>{let e=s.trim();if(!e||o.current)return;if(f(null),!t){let t=r(e);if(t){f(t);return}n();return}let c=new AbortController;o.current=c,u(!0);let l;try{if(l=(await a.resolveArtifact(t,encodeURI(e),void 0,c.signal)).handle,c.signal.aborted||(await a.artifactMetadata(t,l,c.signal),c.signal.aborted))return;let i=r(e);if(i){f(i);return}n()}catch(e){if(!c.signal.aborted){let t=e instanceof tf&&e.code?qM[e.code]:void 0;f(t?i(t):e instanceof Error?e.message:i(`fileReferenceFailed`))}}finally{o.current===c&&(o.current=null),l&&a.releaseArtifact(t,l).catch(()=>void 0),c.signal.aborted||u(!1)}};return(0,K.jsx)($j,{isOpen:e,onOpenChange:e=>!e&&p(),purpose:`form`,width:460,"aria-label":i(`fileReferenceTitle`),children:(0,K.jsxs)(`form`,{className:`openpi-dialog file-reference-dialog`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,K.jsxs)(`div`,{className:`file-reference-heading`,children:[(0,K.jsx)(Se,{"aria-hidden":`true`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:i(`fileReferenceTitle`)}),(0,K.jsx)(`p`,{children:i(`fileReferenceDetail`)})]})]}),(0,K.jsx)(KM,{label:i(`fileReferenceLabel`),value:s,placeholder:i(`fileReferencePlaceholder`),description:i(t?`fileReferenceValidatedHint`:`fileReferenceDraftHint`),hasAutoFocus:!0,hasClear:!0,isDisabled:l,onChange:e=>{c(e.slice(0,4096)),f(null)}}),d&&(0,K.jsx)(`p`,{className:`file-reference-error`,role:`alert`,children:d}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:p,children:i(`cancel`)}),(0,K.jsx)(`button`,{type:`submit`,className:`primary`,disabled:l||!s.trim(),children:i(l?`fileReferenceChecking`:`insertReference`)})]})]})})}function YM(e,t=e.split(/[\\/]/u).at(-1)||e){let n=encodeURI(e).replace(/[<>]/gu,encodeURIComponent);return`[${t.replace(/[\\[\]]/gu,`\\$&`)}](<${n}>)`}function XM(e){return[...e.matchAll(/(?\r\n]+)>\)/gu)].slice(0,100).flatMap(e=>{let t=e[2];return t.length>4096||!Td(t)?[]:[{name:e[1].replace(/\\([\\[\]])/gu,`$1`),reference:t,start:e.index,end:e.index+e[0].length}]})}function ZM({items:e,onClose:t}){let n=(0,_.useRef)(null),r=(0,_.useRef)(t);return r.current=t,(0,_.useEffect)(()=>{n.current?.querySelector(`button:not(:disabled)`)?.focus();let e=e=>{!(e.target instanceof Element)||n.current?.contains(e.target)||e.target.closest(`.composer-context-trigger`)||r.current()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[]),(0,_.useLayoutEffect)(()=>{let e=n.current,t=e?.closest(`form`);if(!e||!t)return;let r=()=>{let n=window.visualViewport,r=n?.offsetTop??0,i=r+(n?.height??window.innerHeight),a=t.getBoundingClientRect(),o=Math.max(0,a.top-r-16),s=Math.max(0,i-a.bottom-16),c=o<180&&s>o;e.dataset.placement=c?`below`:`above`,e.style.maxHeight=`${Math.min(400,c?s:o)}px`};r();let i=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return i?.observe(t),window.addEventListener(`resize`,r),window.visualViewport?.addEventListener(`resize`,r),window.visualViewport?.addEventListener(`scroll`,r),()=>{i?.disconnect(),window.removeEventListener(`resize`,r),window.visualViewport?.removeEventListener(`resize`,r),window.visualViewport?.removeEventListener(`scroll`,r)}},[]),(0,K.jsx)(`div`,{ref:n,id:`composer-action-menu`,className:`composer-action-menu`,role:`menu`,onKeyDown:e=>{if(!e.nativeEvent.isComposing){if(e.key===`Escape`||e.key===`Tab`)e.key===`Escape`&&e.preventDefault(),t(!0);else if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)){e.preventDefault();let t=[...e.currentTarget.querySelectorAll(`button:not(:disabled)`)],n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowUp`?-1:1)+t.length)%t.length]?.focus()}}},children:e.map((t,n)=>(0,K.jsxs)(`div`,{role:`none`,children:[e[n-1]?.section!==t.section&&(0,K.jsx)(`div`,{className:`composer-action-section`,role:`presentation`,children:t.section}),(0,K.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-label":[t.label,t.alias].filter(Boolean).join(` `),"aria-description":t.description,disabled:t.disabled,onClick:t.onClick,title:t.description,children:[t.icon,(0,K.jsx)(`span`,{children:t.label}),t.alias&&(0,K.jsx)(`small`,{children:t.alias}),(0,K.jsx)(`span`,{className:`composer-action-description`,children:t.description})]})]},t.id))})}var QM={triggerContainer:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xrrkdod`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib xdk3u5w`,kLWn49:`x1kq96og`,kMwMTN:`x1tgivj0`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},trigger:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzQI83:`x1iyjqo2`,kmuXW:`xs83m0k`,kCS8Yb:`x1r8uery`,k7Eaqz:`xeuugli`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,kLWn49:`x15bjb6t`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,kaIpWk:`xh6dtrn`,$$css:!0},triggerText:{kzQI83:`x1iyjqo2`,k7Eaqz:`xeuugli`,kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,k9WMMc:`x1yc453h`,$$css:!0},placeholder:{kMwMTN:`xv1l7n4`,$$css:!0},triggerGhost:{kzqmXN:`x14atkfc`,kMzoRj:`xc342km`,kWkggS:`xjbqb8w`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4`,$$css:!0},triggerGhostDisabled:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q`,$$css:!0},triggerIcon:{kmuXW:`x2lah0s`,$$css:!0},triggerIconRotation:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,k3nNDw:`x1g0ag68`,$$css:!0},triggerIconOpen:{k3aq6I:`x19jd1h0`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,$$css:!0},content:{kB7OPa:`x9f619`,kskxy:`xpnbb6b`,kVQacm:`xysyzu8`,kmVPX3:`x1b2ylru`,$$css:!0},sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0},disabled:{kkrTdU:`xt0e3qv`,$$css:!0}};function $M({label:e,value:t,onChange:n,changeAction:r,children:i,triggerLabel:a,placeholder:o,isLabelHidden:s=!1,description:c,isOptional:l=!1,isRequired:u=!1,isDisabled:d=!1,isLoading:f=!1,status:p,statusVariant:m=`attached`,labelTooltip:h,size:g=`md`,variant:v=`input`,startIcon:y,width:b,placement:x=`below`,alignment:S=`start`,handleRef:C,onOpenChange:w,contentXstyle:T,xstyle:E,className:D,style:O,"data-testid":k,onClick:A,...j}){let M=Rc(),N=HM({isRequired:u,isOptional:l}),P=o??M(`@astryx.selector.placeholder`),F=v===`ghost`&&m===`attached`?`detached`:m,I=(0,_.useId)(),L=(0,_.useId)(),R=(0,_.useId)(),ee=(0,_.useId)(),z=(0,_.useId)(),B=[c?ee:null,p?.message?z:null].filter(e=>e!=null).join(` `)||void 0,V=(0,_.useRef)(null),[H,te]=(0,_.useTransition)(),[ne,re]=(0,_.useOptimistic)(t),ie=f||H,ae=ud({dialogLabel:e,hasCloseButton:!1,hasAutoFocus:!0,surfaceTarget:`complex-selector-popup`,onShow:(0,_.useCallback)(()=>{w?.(!0)},[w]),onHide:(0,_.useCallback)(()=>{V.current?.focus(),w?.(!1)},[w])}),U=ae.isOpen,oe=(0,_.useCallback)(()=>{d||(ae.isOpen?ae.hide():ae.show())},[d,ae]),se=(0,_.useCallback)(()=>{ae.hide()},[ae]);(0,_.useImperativeHandle)(C,()=>({open:()=>{d||ae.show()},close:()=>ae.hide(),toggle:()=>{d||(ae.isOpen?ae.hide():ae.show())},isOpen:()=>ae.isOpen}),[d,ae]);let ce=(0,_.useCallback)(e=>{n?.(e),r&&te(async()=>{re(e),await r(e)})},[r,n,re,te]),le=a??P,ue=Cu(y,{size:`sm`,color:`secondary`}),de=(0,K.jsx)(`div`,{id:R,...Sr(QM.content,T),children:i(ne,ce,se,{isOpen:U,isBusy:ie,triggerId:I,contentId:R})}),fe=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{ref:ae.triggerRef,"data-testid":k,...j,onClick:ca(A,oe),...oa(ba(`complex-selector`,{variant:v,size:g,status:p?.type??null}),Sr(NM.base,QM.triggerContainer,QM[g],Ha.focusWithin,v===`ghost`&&QM.triggerGhost,v===`ghost`&&ds.backgroundImage,d&&NM.disabled,v===`ghost`&&d&&QM.triggerGhostDisabled,d&&QM.disabled,a==null&&QM.placeholder,E),D,O),children:[Ea(ue)&&ue,(0,K.jsx)(`button`,{ref:V,id:I,type:`button`,"aria-haspopup":`dialog`,"aria-expanded":U,"aria-controls":R,"aria-describedby":B,"aria-labelledby":L,"aria-required":N?`true`:void 0,"aria-invalid":p?.type===`error`?`true`:void 0,"aria-busy":ie||void 0,disabled:d,onKeyDown:e=>{e.key===`ArrowDown`&&!U&&!d&&(e.preventDefault(),ae.show())},className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz xh6dtrn`,children:(0,K.jsx)(`span`,{className:`x1iyjqo2 xeuugli xb3r6kr xlyipyv xuxw1ft x1yc453h`,children:le})}),ie&&(0,K.jsx)($o,{size:`sm`}),(0,K.jsx)(xu,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:[QM.triggerIcon,QM.triggerIconRotation,U&&QM.triggerIconOpen],...ba(`complex-selector-indicator-icon`,{state:U?`expanded`:`collapsed`})})]}),ae.render(de,{placement:x,alignment:S,offset:Br[`--spacing-1`],xstyle:[QM.popover,co[x]]})]});return(0,K.jsx)(MM,{label:e,isLabelHidden:s,description:c,inputID:I,descriptionID:c?ee:void 0,labelID:L,isOptional:l,isRequired:u,isDisabled:d,status:p?{type:p.type,message:p.message,messageID:p.message?z:void 0}:void 0,statusVariant:F,labelTooltip:h,width:b,children:fe})}$M.displayName=`ComplexSelector`;function eN(e){let t=`${e.provider}/${e.id}`;return e.label===t?t:`${e.label} (${t})`}function tN({snapshot:e,model:t,pending:n,disabled:r,actions:i,onChooseModel:a,onClose:o}){let{t:s}=cr(),c=e?.thinking,l=n??c?.level??``,u=e?.preferences.hiddenThinkingLevels??[],d=(c?.available??[]).filter(e=>!u.some(t=>t===e)||e===l||e===c?.level),[f]=(0,_.useState)(c?.level??``),[p,m]=(0,_.useState)(null),h=(0,_.useRef)(null),g=(0,_.useRef)(null),v=e=>e?e[0].toUpperCase()+e.slice(1):s(`unknownState`),y=()=>{h.current=null,m(null)};(0,_.useEffect)(()=>(g.current?.focus(),()=>{h.current=null}),[]);let b=()=>{let e=h.current;if(y(),e===null||r||!c?.supported)return;let t=d[e];t&&t!==l&&i.selectThinking(t)},x=p??Math.max(0,d.indexOf(l)),S=p===null?l:d[x]??l;return(0,K.jsxs)(`div`,{className:`thinking-controls`,children:[(0,K.jsx)(`div`,{className:`thinking-strength`,"aria-live":`polite`,children:v(S)}),(0,K.jsxs)(`div`,{className:`thinking-slider`,style:{"--thinking-progress":`${d.length>1?x/(d.length-1)*100:0}%`},children:[(0,K.jsx)(`div`,{className:`thinking-slider-dots`,"aria-hidden":`true`,children:d.map((e,t)=>(0,K.jsx)(`span`,{"data-filled":t<=x},e))}),(0,K.jsx)(`input`,{ref:g,type:`range`,"aria-label":s(`thinkingLevel`),"aria-valuetext":v(S),min:0,max:Math.max(0,d.length-1),step:1,value:x,disabled:r||!c?.supported||d.length<2,onChange:e=>{h.current=Number(e.target.value),m(h.current)},onPointerUp:b,onPointerCancel:y,onBlur:b,onKeyUp:e=>{[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`PageUp`,`PageDown`].includes(e.key)&&b()},onKeyDown:e=>{e.key===`Escape`&&(y(),o(),e.preventDefault(),e.stopPropagation())}})]}),(0,K.jsxs)(`button`,{type:`button`,className:`thinking-model-link`,disabled:n!==null,title:s(`selectModel`),onClick:a,children:[(0,K.jsx)(`span`,{children:t?.name||t?.id||s(`selectModel`)}),(0,K.jsx)(ee,{"aria-hidden":`true`})]}),(0,K.jsx)(`button`,{type:`button`,className:`thinking-reset`,"aria-label":s(`resetThinking`,{level:v(f)}),title:s(`resetThinking`,{level:v(f)}),disabled:r||!d.includes(f)||l===f,onClick:()=>{y(),i.selectThinking(f)},children:(0,K.jsx)(ft,{"aria-hidden":`true`})}),c&&!d.includes(c.level)&&(0,K.jsx)(`p`,{className:`thinking-control-notice`,role:`status`,children:s(`thinkingLevelMismatch`)})]})}var nN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M37.9998%2023.021C33.7998%2025.2889%2029.5698%2027.3649%2024.8614%2028.3069C23.8114%2028.5154%2022.6474%2028.5154%2021.5809%2028.3714C20.5639%2028.2439%2020.0554%2027.3484%2020.4169%2026.4064C20.7619%2025.5289%2021.2209%2024.635%2021.8119%2023.9C23.0899%2022.3025%2024.5329%2020.849%2025.8289%2019.268C26.6203%2018.2991%2027.3335%2017.2689%2027.9618%2016.187C28.4208%2015.4205%2028.2078%2014.4935%2027.4038%2014.111C26.0584%2013.4556%2024.6154%2012.9936%2023.1889%2012.4986C23.0239%2012.4341%2022.7779%2012.6096%2022.4509%2012.7221C22.8604%2013.0881%2023.1559%2013.3596%2023.5654%2013.727C19.3339%2014.447%2015.3305%2015.467%2011.4455%2016.874C11.4275%2016.9535%2011.396%2017.0165%2011.411%2017.0495C11.9855%2017.927%2011.723%2018.5975%2010.886%2019.1405C10.5611%2019.3531%2010.2732%2019.6176%2010.034%2019.9235C12.593%2020.6735%2014.873%2020.243%2017.0539%2018.821C16.9234%2018.6305%2016.7914%2018.455%2016.6609%2018.263C17.4799%2018.407%2017.9719%2018.854%2018.0379%2019.556C18.0544%2019.7165%2017.9569%2019.8755%2017.9074%2020.036C17.7919%2019.907%2017.6449%2019.781%2017.5474%2019.6355C17.4799%2019.5395%2017.4634%2019.4285%2017.4154%2019.268C14.8235%2020.993%2012.035%2021.425%208.96751%2020.531C8.96751%2021.137%208.93451%2021.6485%208.98401%2022.1435C9.01701%2022.574%208.83701%2022.766%208.44401%2022.9895C7.55752%2023.5325%206.63803%2024.092%205.90003%2024.8105C5.01504%2025.6879%205.34354%2026.7589%206.54053%2027.2059C7.90102%2027.7159%209.329%2027.7309%2010.7555%2027.5569C12.4445%2027.3484%2014.1005%2027.0769%2015.9394%2026.8219C13.79%2027.8269%2011.6735%2028.5319%209.4445%2028.8169C7.88452%2029.0269%206.32753%2029.1379%204.78554%2028.6909C2.57156%2028.0684%201.58607%2026.4394%202.16057%2024.251C2.70206%2022.2065%204.01455%2020.5775%205.42454%2019.076C10.133%2014.078%2016.0864%2011.5401%2022.9744%2011.0286C24.5824%2010.9176%2026.2069%2011.1246%2027.7143%2011.7951C29.8308%2012.7536%2030.7173%2014.78%2029.6838%2016.826C29.0118%2018.1835%2028.0758%2019.4285%2027.1413%2020.6585C26.2234%2021.872%2025.1899%2022.9895%2024.2224%2024.155C23.9434%2024.506%2023.6809%2024.875%2023.4679%2025.2724C23.0569%2026.0224%2023.3359%2026.5174%2024.2059%2026.4394C26.0254%2026.2624%2027.8808%2026.1199%2029.6358%2025.6729C32.2098%2025.0174%2034.7193%2024.092%2037.2618%2023.2775C37.5243%2023.213%2037.7703%2023.117%2037.9998%2023.0225V23.021Z'%20fill='currentColor'/%3e%3c/svg%3e`,rN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.5835%2024.7904H25.7835C26.0754%2024.7904%2026.314%2025.0318%2026.314%2025.3277V27.8096C26.8199%2027.9343%2027.2691%2028.2255%2027.5896%2028.6362C27.9102%2029.047%2028.0833%2029.5536%2028.0813%2030.0746C28.0813%2031.3605%2027.0517%2032.4037%2025.7835%2032.4037C24.514%2032.4037%2023.4844%2031.3605%2023.4844%2030.0746C23.4844%2028.9741%2024.2399%2028.0509%2025.2531%2027.8082V25.865H21.5849V32.2237C21.5852%2032.3161%2021.5618%2032.407%2021.5169%2032.4877C21.4721%2032.5684%2021.4072%2032.6362%2021.3285%2032.6846L17.6603%2034.9224C17.577%2034.9733%2017.4813%2035%2017.3837%2034.9995C17.2862%2034.999%2017.1907%2034.9714%2017.108%2034.9197L10.3906%2030.7114C10.3131%2030.6628%2010.2493%2030.5952%2010.2052%2030.515C10.161%2030.4348%2010.138%2030.3447%2010.1384%2030.2532V25.8636L6.78241%2023.9136C6.70609%2023.8694%206.64181%2023.8071%206.59521%2023.7322C6.5486%2023.6573%206.52111%2023.5721%206.51514%2023.4841V23.4472V16.4626C6.51514%2016.2717%206.61468%2016.0944%206.77696%2015.999L10.1384%2014.0053V9.70163C10.1384%209.52572%2010.2229%209.36208%2010.3634%209.26253L10.392%209.24344L17.1107%205.07885C17.194%205.027%2017.2901%204.99951%2017.3882%204.99951C17.4863%204.99951%2017.5824%205.027%2017.6657%205.07885L21.3339%207.36296C21.4115%207.41162%2021.4753%207.47921%2021.5194%207.55938C21.5636%207.63955%2021.5866%207.72964%2021.5862%207.82115V13.9999H26.8445V11.3857C26.3384%2011.2609%2025.8889%2010.9696%2025.5684%2010.5585C25.2479%2010.1475%2025.0749%209.6406%2025.0772%209.11935C25.0772%207.83342%2026.1067%206.79023%2027.3749%206.79023C28.6445%206.79023%2029.6727%207.83342%2029.6727%209.11935C29.6727%2010.2198%2028.9186%2011.143%2027.9054%2011.3857V14.5371C27.9059%2014.6073%2027.8926%2014.6768%2027.8662%2014.7418C27.8399%2014.8068%2027.8009%2014.8659%2027.7516%2014.9158C27.7024%2014.9658%2027.6437%2015.0055%2027.5791%2015.0327C27.5144%2015.0599%2027.4451%2015.0741%2027.3749%2015.0744H21.5862V17.5372H30.6191C30.7351%2017.0302%2031.0192%2016.5773%2031.4252%2016.2522C31.8313%2015.9271%2032.3353%2015.749%2032.8554%2015.7467C34.1236%2015.7467%2035.1532%2016.7885%2035.1532%2018.0745C35.1532%2019.3604%2034.125%2020.4036%2032.8554%2020.4036C32.3351%2020.4012%2031.8309%2020.2229%2031.4249%2019.8975C31.0188%2019.5722%2030.7348%2019.119%2030.6191%2018.6117H21.5835V21.2531H28.3377L29.5854%2022.8622C29.9329%2022.659%2030.3283%2022.5522%2030.7309%2022.5527C32.0004%2022.5527%2033.0286%2023.5945%2033.0286%2024.8804C33.0286%2026.1664%2032.0004%2027.2096%2030.7309%2027.2096C29.4627%2027.2096%2028.4331%2026.1664%2028.4331%2024.8804C28.4331%2024.4086%2028.5722%2023.9695%2028.8095%2023.6027L27.8222%2022.3277H21.5835V24.7904ZM17.3875%206.16704L14.6016%207.89342V11.9407H13.5407V8.55071L11.1993%2010.003V14.019L14.0766%2015.8735L17.0316%2014.0135V10.9098H18.0925V14.3135C18.0925%2014.499%2017.9971%2014.6721%2017.8416%2014.7703L14.6466%2016.779V19.6167L16.5857%2020.9927L15.9775%2021.8736L14.0602%2020.5127L11.9738%2021.8831L11.397%2020.9831L13.5857%2019.5445V16.8308L10.6579%2014.9408L7.57606%2016.7681V19.0536L10.2652%2017.4322L10.8079%2018.3554L7.57606%2020.304V23.1363L10.5297%2024.8518L13.6252%2022.9863L14.1666%2023.9095L11.1993%2025.6973V29.9546L13.7575%2031.5569L16.9825%2029.6123L17.5253%2030.5369L14.7748%2032.1951L17.3903%2033.8328L20.5239%2031.9196V24.0377L14.0357%2027.9828L13.4902%2027.0623L20.5239%2022.7859V8.12115L17.3875%206.16704ZM25.7835%2028.8228C25.6198%2028.8237%2025.4579%2028.8568%2025.307%2028.9204C25.1561%2028.984%2025.0192%2029.0767%2024.9042%2029.1932C24.7892%2029.3097%2024.6983%2029.4478%2024.6367%2029.5995C24.5751%2029.7512%2024.5441%2029.9136%2024.5453%2030.0773C24.5453%2030.7687%2025.099%2031.3292%2025.7835%2031.3292C25.947%2031.3281%2026.1087%2031.2948%2026.2594%2031.2313C26.41%2031.1677%2026.5467%2031.0751%2026.6615%2030.9587C26.7764%2030.8424%2026.8672%2030.7045%2026.9287%2030.553C26.9903%2030.4016%2027.0215%2030.2395%2027.0204%2030.076C27.0216%2029.9123%2026.9906%2029.7501%2026.9291%2029.5985C26.8676%2029.4468%2026.7769%2029.3088%2026.662%2029.1923C26.5471%2029.0758%2026.4104%2028.9831%2026.2597%2028.9194C26.109%2028.8558%2025.9472%2028.8238%2025.7835%2028.8228ZM30.7336%2023.6272C30.5699%2023.6281%2030.4079%2023.6613%2030.257%2023.7249C30.1062%2023.7884%2029.9693%2023.8811%2029.8543%2023.9977C29.7393%2024.1142%2029.6484%2024.2523%2029.5868%2024.404C29.5252%2024.5557%2029.4942%2024.7181%2029.4954%2024.8818C29.4954%2025.5745%2030.0491%2026.1364%2030.7322%2026.1364C30.896%2026.1355%2031.0579%2026.1023%2031.2088%2026.0387C31.3597%2025.9752%2031.4966%2025.8825%2031.6116%2025.7659C31.7266%2025.6494%2031.8175%2025.5113%2031.8791%2025.3596C31.9406%2025.2079%2031.9717%2025.0455%2031.9704%2024.8818C31.9717%2024.7181%2031.9406%2024.5557%2031.8791%2024.404C31.8175%2024.2523%2031.7266%2024.1142%2031.6116%2023.9977C31.4966%2023.8811%2031.3597%2023.7884%2031.2088%2023.7249C31.0579%2023.6613%2030.8973%2023.6281%2030.7336%2023.6272ZM32.8541%2016.8226C32.6904%2016.8235%2032.5284%2016.8567%2032.3775%2016.9203C32.2266%2016.9838%2032.0898%2017.0765%2031.9747%2017.1931C31.8597%2017.3096%2031.7688%2017.4477%2031.7073%2017.5994C31.6457%2017.7511%2031.6146%2017.9135%2031.6159%2018.0772C31.6159%2018.7686%2032.1709%2019.329%2032.8541%2019.329C33.0176%2019.3279%2033.1793%2019.2947%2033.3299%2019.2311C33.4806%2019.1676%2033.6172%2019.075%2033.7321%2018.9586C33.8469%2018.8422%2033.9377%2018.7044%2033.9993%2018.5529C34.0609%2018.4014%2034.092%2018.2393%2034.0909%2018.0758C34.0922%2017.9122%2034.0612%2017.7499%2033.9997%2017.5983C33.9382%2017.4467%2033.8474%2017.3087%2033.7325%2017.1922C33.6177%2017.0757%2033.481%2016.9829%2033.3302%2016.9193C33.1795%2016.8556%2033.0177%2016.8223%2032.8541%2016.8213V16.8226ZM27.3736%207.86342C27.2099%207.86449%2027.0482%207.8978%2026.8974%207.96145C26.7467%208.02509%2026.61%208.11783%2026.4951%208.23434C26.3802%208.35086%2026.2895%208.48887%2026.228%208.64049C26.1665%208.79212%2026.1355%208.95437%2026.1367%209.11798C26.1367%209.81072%2026.6904%2010.3725%2027.3736%2010.3725C27.5373%2010.3717%2027.6992%2010.3385%2027.8501%2010.2749C28.001%2010.2113%2028.1379%2010.1186%2028.2529%2010.0021C28.3679%209.88558%2028.4588%209.7475%2028.5204%209.59579C28.582%209.44408%2028.613%209.28171%2028.6118%209.11798C28.613%208.95426%2028.582%208.79189%2028.5204%208.64018C28.4588%208.48847%2028.3679%208.35039%2028.2529%208.23386C28.1379%208.11733%2028.001%208.02462%2027.8501%207.96106C27.6992%207.89749%2027.5373%207.86432%2027.3736%207.86342Z'%20fill='currentColor'/%3e%3c/svg%3e`,iN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M26.9568%209.88184H22.1265L30.7753%2031.7848H35.4917L26.9568%209.88184ZM13.028%209.88184L4.4917%2031.7848H9.32203L11.2305%2027.1793H20.2166L22.0126%2031.6724H26.8444L18.0832%209.88184H13.028ZM12.5783%2023.1361L15.4987%2015.3853L18.5315%2023.1361H12.5783Z'%20fill='currentColor'/%3e%3c/svg%3e`,aN=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2040%2040'%3e%3cpath%20fill='currentColor'%20d='M33.0017%2034.7292C34.7884%2036.1587%2037.4682%2035.2056%2035.0115%2032.5854C27.6419%2024.9626%2029.2053%204%2020.049%204C10.8927%204%2012.456%2024.9626%205.08629%2032.5854C2.40641%2035.4438%205.3096%2036.1587%207.09621%2034.7292C14.0192%2029.7269%2013.5726%2020.913%2020.049%2020.913C26.5253%2020.913%2026.0787%2029.7269%2033.0017%2034.7292Z'/%3e%3c/svg%3e`,oN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.68%207.58398L11.296%2029.68L4%2029.6L12.144%2015.584L21.68%207.58398ZM22.8%209.32798L36%2032.416H11.584L26.464%2029.76L18.672%2020.496L22.8%209.32798Z'%20fill='currentColor'/%3e%3c/svg%3e`,sN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.14882%2013.5552C9.58082%2013.5552%2010.4448%2013.5336%2011.6544%2013.0368C13.0584%2012.4536%2015.8232%2011.4168%2017.832%2010.3368C19.236%209.5808%2019.8408%208.5872%2019.8408%207.248C19.8408%205.412%2018.3504%203.9%2016.4928%203.9H8.71682C6.06002%203.9%203.90002%206.06%203.90002%208.7168C3.90002%2011.3736%205.93042%2013.5552%209.14882%2013.5552Z'%20fill='currentColor'/%3e%3cpath%20d='M10.4664%2016.86C10.4664%2015.564%2011.244%2014.376%2012.4536%2013.8792L14.8944%2012.864C17.3784%2011.8488%2020.1%2013.6632%2020.1%2016.3416C20.1%2018.4152%2018.4152%2020.1%2016.3416%2020.1H13.6848C11.9136%2020.1%2010.4664%2018.6528%2010.4664%2016.86Z'%20fill='currentColor'/%3e%3cpath%20d='M6.68642%2014.1816C5.15282%2014.1816%203.90002%2015.4344%203.90002%2016.968V17.3352C3.90002%2018.8472%205.15282%2020.1%206.68642%2020.1C8.22003%2020.1%209.47283%2018.8472%209.47283%2017.3136V16.9464C9.45123%2015.4344%208.22003%2014.1816%206.68642%2014.1816Z'%20fill='currentColor'/%3e%3c/svg%3e`,cN=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2040%2040'%3e%3cpath%20fill='currentColor'%20d='M29.6214%2014.2072L20.9502%209.12249C20.6718%208.95917%2020.3282%208.95917%2020.0498%209.12249L11.3786%2014.2072C11.1445%2014.3445%2011%2014.5984%2011%2014.8733V25.1267C11%2025.4012%2011.1445%2025.6555%2011.3786%2025.7928L20.0498%2030.8775C20.3282%2031.0408%2020.6718%2031.0408%2020.9502%2030.8775L29.6214%2025.7928C29.8555%2025.6555%2030%2025.4016%2030%2025.1267V14.8733C30%2014.5988%2029.8555%2014.3445%2029.6214%2014.2072ZM29.0767%2015.2843L20.706%2030.0101C20.6494%2030.1093%2020.5%2030.0688%2020.5%2029.9538V20.3115C20.5%2020.1189%2020.3986%2019.9407%2020.2342%2019.8439L12.0124%2015.0226C11.9147%2014.9651%2011.9546%2014.8134%2012.0678%2014.8134H28.8093C29.047%2014.8134%2029.1956%2015.0751%2029.0767%2015.2843Z'/%3e%3c/svg%3e`,lN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M35.6638%209.91965C35.3251%209.75432%2035.1785%2010.0703%2034.9811%2010.2316C34.9131%2010.2836%2034.8558%2010.3516%2034.7985%2010.413C34.3025%2010.9423%2033.7238%2011.289%2032.9678%2011.2476C31.8625%2011.1863%2030.9186%2011.533%2030.0839%2012.3783C29.9066%2011.3356%2029.3173%2010.7143%2028.4213%2010.3143C27.9519%2010.1063%2027.4773%209.89965%2027.148%209.44766C26.9186%209.12633%2026.856%208.76767%2026.7413%208.41568C26.668%208.20235%2026.5946%207.98502%2026.3506%207.94902C26.084%207.90769%2025.98%208.13035%2025.876%208.31702C25.4587%209.07967%2025.2973%209.91965%2025.3133%2010.7703C25.3493%2012.6849%2026.1573%2014.2102%2027.764%2015.2942C27.9466%2015.4182%2027.9933%2015.5435%2027.9359%2015.7249C27.8266%2016.0982%2027.696%2016.4609%2027.5813%2016.8355C27.508%2017.0742%2027.3986%2017.1248%2027.1426%2017.0222C26.2777%2016.6504%2025.4919%2016.1164%2024.828%2015.4489C23.6854%2014.3449%2022.6534%2013.1263%2021.3654%2012.1716C21.067%2011.9511%2020.7606%2011.7416%2020.4468%2011.5436C19.1335%2010.2676%2020.6201%209.21967%2020.9641%209.09567C21.3241%208.965%2021.0881%208.51968%2019.9254%208.52501C18.7628%208.53035%2017.6988%208.91834%2016.3428%209.43699C16.1413%209.51421%2015.934%209.57529%2015.7229%209.61966C14.4557%209.38091%2013.1598%209.33506%2011.8789%209.48366C9.36565%209.76365%207.35902%2010.953%205.88305%2012.9809C4.10975%2015.4182%203.69243%2018.1888%204.20308%2021.0768C4.74041%2024.122%206.29504%2026.6433%208.683%2028.6139C11.1603%2030.6579%2014.0122%2031.6592%2017.2668%2031.4672C19.2428%2031.3539%2021.4441%2031.0886%2023.9254%2028.9873C24.552%2029.2993%2025.208%2029.4233%2026.2986%2029.5166C27.1386%2029.5953%2027.9466%2029.4766%2028.5719%2029.3459C29.5519%2029.1379%2029.4839%2028.23%2029.1306%2028.0646C26.2573%2026.726%2026.888%2027.2713%2026.3133%2026.83C27.7746%2025.102%2029.9746%2023.3074%2030.8359%2017.4928C30.9026%2017.0302%2030.8452%2016.7395%2030.8359%2016.3662C30.8306%2016.1395%2030.8826%2016.0502%2031.1426%2016.0249C31.8639%2015.95%2032.5637%2015.7349%2033.2025%2015.3915C35.0638%2014.3742%2035.8158%2012.7049%2035.9931%2010.7023C36.0198%2010.3956%2035.9878%2010.081%2035.6638%209.91965ZM19.4414%2027.9433C16.6562%2025.754%2015.3055%2025.0327%2014.7482%2025.0634C14.2256%2025.0954%2014.3202%2025.6913%2014.4349%2026.0807C14.5549%2026.4647%2014.7109%2026.7286%2014.9295%2027.066C15.0815%2027.2886%2015.1855%2027.6206%2014.7789%2027.87C13.8816%2028.4246%2012.3229%2027.6833%2012.2496%2027.6473C10.435%2026.578%208.91632%2025.1673%207.84834%2023.2381C6.81637%2021.3808%206.21638%2019.3888%206.11771%2017.2622C6.09105%2016.7475%206.24171%2016.5662%206.7537%2016.4729C7.42583%2016.3442%208.11451%2016.3267%208.79233%2016.4209C11.6349%2016.8368%2014.0536%2018.1075%2016.0828%2020.1194C17.2402%2021.2661%2018.1161%2022.6354%2019.0188%2023.974C19.9788%2025.3953%2021.0108%2026.75%2022.3254%2027.8593C22.7894%2028.2486%2023.1587%2028.5446%2023.5134%2028.7619C22.4441%2028.8819%2020.6601%2028.9086%2019.4414%2027.9433ZM20.7748%2019.3568C20.7745%2019.2906%2020.7904%2019.2253%2020.8211%2019.1666C20.8517%2019.1078%2020.8962%2019.0575%2020.9507%2019.0198C21.0052%2018.9821%2021.068%2018.9583%2021.1337%2018.9503C21.1995%2018.9424%2021.2662%2018.9505%2021.3281%2018.9741C21.407%2019.0024%2021.475%2019.0546%2021.5228%2019.1235C21.5706%2019.1923%2021.5958%2019.2743%2021.5947%2019.3581C21.5949%2019.4123%2021.5843%2019.4659%2021.5636%2019.5159C21.5428%2019.5659%2021.5123%2019.6113%2021.4738%2019.6494C21.4354%2019.6875%2021.3897%2019.7176%2021.3395%2019.7378C21.2893%2019.7581%2021.2356%2019.7682%2021.1814%2019.7675C21.1277%2019.7676%2021.0745%2019.7571%2021.0248%2019.7365C20.9752%2019.7158%2020.9302%2019.6855%2020.8925%2019.6473C20.8548%2019.609%2020.825%2019.5636%2020.805%2019.5138C20.785%2019.4639%2020.7739%2019.4105%2020.7748%2019.3568ZM24.9213%2021.4848C24.6547%2021.5928%2024.3893%2021.6861%2024.1347%2021.6981C23.7516%2021.7114%2023.3756%2021.5918%2023.0707%2021.3594C22.7054%2021.0528%2022.4441%2020.8821%2022.3347%2020.3488C22.297%2020.0881%2022.3042%2019.823%2022.3561%2019.5648C22.4494%2019.1288%2022.3454%2018.8488%2022.0374%2018.5955C21.7881%2018.3875%2021.4694%2018.3302%2021.1201%2018.3302C21.0005%2018.3232%2020.8843%2018.2875%2020.7814%2018.2262C20.6348%2018.1542%2020.5148%2017.9728%2020.6294%2017.7488C20.6668%2017.6768%2020.8428%2017.5008%2020.8854%2017.4688C21.3601%2017.1995%2021.9081%2017.2875%2022.4134%2017.4902C22.8827%2017.6822%2023.2374%2018.0342%2023.748%2018.5328C24.2694%2019.1341%2024.364%2019.3008%2024.6613%2019.7515C24.896%2020.1048%2025.1093%2020.4674%2025.2547%2020.8821C25.344%2021.1421%2025.2293%2021.3541%2024.9213%2021.4848Z'%20fill='currentColor'/%3e%3c/svg%3e`,uN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14.45%205.74999L11.9991%2011.6956L9.54562%205.74999H7.97237L10.6604%2012.2495C10.7678%2012.5138%2010.9515%2012.7402%2011.1882%2012.8996C11.4248%2013.059%2011.7036%2013.1442%2011.9889%2013.1444C12.2742%2013.1446%2012.5531%2013.0597%2012.79%2012.9006C13.0268%2012.7415%2013.2109%2012.5154%2013.3186%2012.2512L16.0232%205.74999H14.45ZM15.4965%2014.808L19.98%2010.2195L19.3684%208.75911L14.4719%2013.7807C14.272%2013.9856%2014.1369%2014.2448%2014.0835%2014.5261C14.0301%2014.8073%2014.0608%2015.098%2014.1718%2015.3619C14.2807%2015.624%2014.4648%2015.848%2014.7008%2016.0056C14.9369%2016.1632%2015.2144%2016.2473%2015.4983%2016.2474L15.5%2016.25L22.5%2016.2325L21.8884%2014.7721L15.4983%2014.808H15.4965ZM4.02%2010.216L4.63162%208.75561L9.52813%2013.7772C9.93763%2014.1964%2010.0557%2014.8176%209.82825%2015.3584C9.71925%2015.6204%209.53511%2015.8443%209.29905%2016.0019C9.06299%2016.1595%208.78557%2016.2437%208.50175%2016.2439L1.50175%2016.2281L1.5%2016.2299L2.11163%2014.7695L8.50175%2014.8062L4.02%2010.216Z'%20fill='currentColor'/%3e%3c/svg%3e`,dN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M35.3993%2026.4544C34.2871%2028.3855%2027.8314%2032.9425%2020%2032.9425C12.1686%2032.9425%205.71288%2028.3855%204.60075%2026.4544C4.5427%2026.3532%204.50826%2026.2401%204.5%2026.1237V22.418C4.51199%2022.3209%204.53496%2022.2256%204.56846%2022.1338C5.04896%2020.9261%206.30833%2019.1733%207.93325%2018.7031C8.14896%2018.149%208.468%2017.3404%208.76508%2016.7437C8.71727%2016.2776%208.69485%2015.8094%208.69792%2015.3409C8.69792%2013.6217%209.06217%2012.113%2010.1601%2010.9906C10.6729%2010.4662%2011.3097%2010.0644%2012.064%209.76091C13.871%208.29357%2016.4453%207.05745%2019.9716%207.05745C23.4978%207.05745%2026.129%208.29357%2027.936%209.76091C28.6903%2010.0644%2029.3271%2010.4662%2029.8399%2010.9906C30.9378%2012.113%2031.3021%2013.6217%2031.3021%2015.3409C31.3021%2015.8162%2031.284%2016.2877%2031.2349%2016.7437C31.532%2017.3404%2031.851%2018.149%2032.0667%2018.7031C33.6917%2019.1733%2034.951%2020.9261%2035.4315%2022.1338C35.4677%2022.2248%2035.4908%2022.3205%2035.5%2022.418V26.1237C35.4917%2026.2401%2035.4573%2026.3532%2035.3993%2026.4544ZM20.2222%2018.7147H19.7778C19.6422%2018.945%2019.4889%2019.1644%2019.3193%2019.3709C18.3247%2020.5941%2016.8419%2021.2981%2014.7881%2021.2981C12.56%2021.2981%2010.9273%2020.8344%209.90304%2019.6719C9.86495%2019.6283%209.82833%2019.5835%209.79325%2019.5375L9.66667%2019.6719V28.1775C11.5202%2029.1837%2015.4972%2030.992%2020%2030.992C24.5028%2030.992%2028.4798%2029.1837%2030.3333%2028.1775V19.6719L30.2067%2019.5375C30.2067%2019.5375%2030.1641%2019.5957%2030.097%2019.6719C29.0727%2020.8344%2027.44%2021.2981%2025.2119%2021.2981C23.1581%2021.2981%2021.6753%2020.5941%2020.6807%2019.3709C20.5111%2019.1644%2020.3578%2018.945%2020.2222%2018.7147ZM23.2292%2022.9127C23.9383%2022.9127%2024.5208%2023.4952%2024.5208%2024.2043V26.7877C24.5208%2027.4968%2023.9383%2028.0793%2023.2292%2028.0793C22.52%2028.0793%2021.9375%2027.4968%2021.9375%2026.7877V24.2043C21.9375%2023.4952%2022.52%2022.9127%2023.2292%2022.9127ZM16.7708%2022.9127C17.48%2022.9127%2018.0625%2023.4952%2018.0625%2024.2043V26.7877C18.0625%2027.4968%2017.48%2028.0793%2016.7708%2028.0793C16.0617%2028.0793%2015.4792%2027.4968%2015.4792%2026.7877V24.2043C15.4792%2023.4952%2016.0617%2022.9127%2016.7708%2022.9127ZM21.0501%2014.9237C21.2258%2016.289%2021.5707%2017.3947%2022.1842%2018.149C22.7551%2018.8517%2023.649%2019.3606%2025.2119%2019.3606C27.2437%2019.3606%2028.1724%2018.9253%2028.6438%2018.3905C29.1398%2017.8287%2029.3646%2016.9051%2029.3646%2015.3409C29.3646%2013.8684%2029.0507%2012.9552%2028.454%2012.3455C27.8378%2011.7152%2026.7502%2011.2321%2024.8063%2011.0216C22.8856%2010.8136%2021.975%2011.1998%2021.5345%2011.7049C21.187%2012.1014%2020.97%2012.7485%2020.9688%2013.7431V13.7702C20.9688%2014.1121%2020.9959%2014.4966%2021.0501%2014.9237ZM18.9499%2014.9237C19.0041%2014.4966%2019.0312%2014.1117%2019.0312%2013.7689V13.7431C19.03%2012.7485%2018.813%2012.1014%2018.4655%2011.7049C18.025%2011.1998%2017.1144%2010.8136%2015.1937%2011.0216C13.2498%2011.2321%2012.1622%2011.7152%2011.546%2012.3455C10.9493%2012.9552%2010.6354%2013.8684%2010.6354%2015.3409C10.6354%2016.9051%2010.8615%2017.8287%2011.3562%2018.3905C11.8276%2018.9253%2012.7563%2019.3606%2014.7881%2019.3606C16.351%2019.3606%2017.2449%2018.8517%2017.8158%2018.149C18.4293%2017.3947%2018.7742%2016.289%2018.9499%2014.9237Z'%20fill='currentColor'/%3e%3c/svg%3e`,fN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M37%2020.034C27.8809%2020.5837%2020.5808%2027.8809%2020.0326%2037H19.966C19.4163%2027.8809%2012.1177%2020.5837%203%2020.034V19.9674C12.1191%2019.4163%2019.4163%2012.1191%2019.966%203H20.0326C20.5822%2012.1191%2027.8809%2019.4163%2037%2019.9674V20.034Z'%20fill='currentColor'/%3e%3c/svg%3e`,pN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M20.056%204.50022C14.0839%204.44597%209.20616%209.15015%209.15036%2015.0106C9.09611%2020.8726%2013.8855%2025.6621%2019.8576%2025.7163H23.6085V21.7391H20.056C16.3252%2021.7825%2013.2671%2018.8468%2013.2237%2015.1827C13.1787%2011.5216%2016.1702%208.52086%2019.901%208.47746H20.056C23.7868%208.47746%2026.8108%2011.4457%2026.8216%2015.1083V24.8809C26.8216%2028.5109%2023.8085%2031.4683%2020.1211%2031.5132C18.3617%2031.5007%2016.6759%2030.8049%2015.42%2029.5726L12.551%2032.3905C14.5529%2034.3571%2017.239%2035.4715%2020.0451%2035.4998H20.1877C26.0823%2035.413%2030.8175%2030.7212%2030.85%2024.9351V14.8603C30.7059%209.0928%2025.9165%204.50022%2020.056%204.50022Z'%20fill='currentColor'/%3e%3c/svg%3e`,mN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M26.7365%207.70867C30.9594%2010.1097%2033.562%2014.5441%2033.562%2019.3448C33.562%2020.7468%2033.3436%2022.0995%2032.9378%2023.3705C33.2276%2023.3346%2033.5219%2023.3669%2033.7971%2023.4647C34.0723%2023.5626%2034.3208%2023.7233%2034.523%2023.9341C34.8338%2024.2495%2035.0303%2024.6597%2035.0814%2025.0996C35.1324%2025.5394%2035.0351%2025.9837%2034.8048%2026.3619C35.0922%2026.5944%2035.3008%2026.9044%2035.4079%2027.2525L35.4318%2027.3398C35.5164%2027.6526%2035.6009%2028.3121%2035.15%2028.9828C35.4938%2029.5042%2035.5431%2030.1608%2035.2811%2030.7244C34.9217%2031.5276%2034.0228%2032.1588%2032.2826%2032.838L31.9979%2032.9479L31.8133%2033.0156C31.1398%2033.2593%2030.5593%2033.4312%2030.3183%2033.5017L30.1971%2033.5355C28.9431%2033.8779%2027.6495%2034.0639%2026.3476%2034.0907C24.4876%2034.0907%2023.1067%2033.5834%2022.2289%2032.5872C20.7465%2032.8382%2019.2331%2032.8468%2017.748%2032.6126C16.8688%2033.5933%2015.4935%2034.0907%2013.6504%2034.0907C12.4424%2034.0666%2011.2411%2033.9044%2010.07%2033.6074L9.75858%2033.5228L9.37391%2033.4101C8.81508%2033.2406%208.26281%2033.0503%207.71825%2032.8394C5.97523%2032.1588%205.07625%2031.529%204.71693%2030.7244C4.45485%2030.1608%204.50416%2029.5028%204.84798%2028.9828C4.68566%2028.7453%204.57646%2028.4756%204.52782%2028.1921C4.47919%2027.9085%204.49227%2027.6178%204.56616%2027.3398C4.66339%2026.9552%204.88461%2026.6127%205.19602%2026.3619C4.96607%2025.9839%204.86892%2025.5399%204.91997%2025.1003C4.97102%2024.6607%205.16735%2024.2508%205.47783%2023.9355C5.80614%2023.5861%206.26268%2023.3846%206.76995%2023.362L6.87985%2023.3606C6.46754%2022.0619%206.2584%2020.7073%206.25986%2019.3448C6.25986%2014.5441%208.86242%2010.1097%2013.0854%207.70867C15.1666%206.52898%2017.518%205.90889%2019.9102%205.90889C22.3025%205.90889%2024.6553%206.52898%2026.7365%207.70867ZM8.99205%2023.8862C9.16818%2024.8542%2012.3132%2027.1975%2012.0075%2027.7006C11.7397%2028.1444%2010.8858%2027.3638%2010.6717%2027.1566L10.6139%2027.1003L10.3772%2026.8932C9.58668%2026.2182%207.13067%2024.2159%206.51631%2024.8754C5.91041%2025.5235%206.68399%2026.0858%208.00288%2026.8762L9.10759%2027.5343L9.29923%2027.6512C10.7717%2028.5573%2010.8774%2028.8349%2010.6378%2029.2195C10.3729%2029.6352%206.312%2026.2605%205.93155%2027.6935C5.5511%2029.1181%2010.077%2029.5309%209.79804%2030.5201C9.51622%2031.5064%206.60649%2028.6545%206.01469%2029.7634C5.41583%2030.8766%2010.1193%2032.1842%2010.1574%2032.1941L10.3828%2032.2504L10.6294%2032.3096C12.3583%2032.7098%2015.6527%2033.2255%2016.8786%2031.4585C17.8269%2030.0875%2017.7804%2029.0504%2016.5292%2027.7809L16.4488%2027.7006C15.1173%2026.3929%2014.3423%2024.4766%2014.3423%2024.4766L14.3183%2024.3949L14.2831%2024.2934C14.1676%2023.9834%2013.8829%2023.393%2013.3954%2023.4705C12.7472%2023.5734%2012.271%2025.1755%2013.5645%2026.1943L13.6349%2026.2478C15.0116%2027.2637%2013.3602%2027.9528%2012.8275%2027.0002L12.7458%2026.8537L12.5443%2026.5014C11.8919%2025.3756%2010.7379%2023.5269%2010.0939%2023.1239C9.34432%2022.6561%208.81592%2022.9154%208.99205%2023.8862ZM29.9055%2023.1239C29.1544%2023.5959%2027.7031%2026.0463%2027.1719%2027.0002C27.0805%2027.1684%2026.9358%2027.3014%2026.7606%2027.3785C26.5854%2027.4555%2026.3895%2027.4721%2026.2038%2027.4258C26.1115%2027.3997%2026.0266%2027.3525%2025.9558%2027.2877C25.9293%2027.2626%2025.9061%2027.2342%2025.8868%2027.2031L25.8671%2027.1637L25.8558%2027.1355L25.8459%2027.1087L25.8417%2027.0904L25.8375%2027.0665C25.8337%2027.0441%2025.8318%2027.0215%2025.8318%2026.9988C25.8318%2026.8297%2025.9319%2026.624%2026.1841%2026.3972C26.2207%2026.3633%2026.2602%2026.3309%2026.3025%2026.2985L26.3687%2026.2478C26.3997%2026.2253%2026.4293%2026.2027%2026.4575%2026.1788C27.7017%2025.1783%2027.2649%2023.6283%2026.6421%2023.4776L26.5984%2023.4691L26.5195%2023.4635C26.4902%2023.4638%2026.4609%2023.4667%2026.4321%2023.4719L26.3927%2023.479L26.3335%2023.4987L26.2785%2023.5227L26.2391%2023.5438L26.1996%2023.5706L26.1489%2023.6086L26.1165%2023.6368C25.8727%2023.8594%2025.7318%2024.2399%2025.6797%2024.4005L25.6571%2024.4766C25.6571%2024.4766%2024.9103%2026.3211%2023.6295%2027.6245L23.5534%2027.7006C23.0391%2028.205%2022.7136%2028.6728%2022.5642%2029.135C22.3627%2029.7507%2022.4712%2030.3581%2022.8601%2031.0415C22.9376%2031.1781%2023.025%2031.3162%2023.1236%2031.4585C24.3664%2033.2551%2027.7482%2032.6929%2029.456%2032.2899L29.859%2032.1913L30.2112%2032.087C30.6001%2031.9686%2031.2483%2031.7587%2031.9021%2031.4952L32.167%2031.3867L32.2586%2031.3472L32.3488%2031.3078L32.5235%2031.2289L32.6376%2031.1753C33.383%2030.8202%2033.996%2030.4102%2034.0383%2030.01L34.0397%2029.9593C34.0385%2029.8907%2034.0206%2029.8235%2033.9875%2029.7634C33.8551%2029.5154%2033.6057%2029.4647%2033.2957%2029.5267L33.2323%2029.5408C33.1703%2029.5549%2033.1055%2029.5746%2033.0406%2029.5972L32.904%2029.6465L32.8279%2029.6775C32.0402%2030.0016%2031.0834%2030.6709%2030.5635%2030.7272H30.572C30.5486%2030.7299%2030.525%2030.7314%2030.5015%2030.7315H30.4677L30.4339%2030.7272L30.4015%2030.7202C30.3056%2030.6976%2030.238%2030.6356%2030.2042%2030.5201C30.191%2030.4743%2030.1886%2030.4261%2030.1971%2030.3792C30.2845%2029.8931%2031.547%2029.5408%2032.6109%2029.0969L32.7039%2029.0575C33.4479%2028.7419%2034.0707%2028.3769%2034.0918%2027.8851V27.8288C34.0892%2027.7821%2034.0816%2027.7358%2034.0693%2027.6907C34.0016%2027.4371%2033.8227%2027.337%2033.562%2027.337C32.4559%2027.337%2029.9689%2029.2533%2029.4475%2029.2533C29.4123%2029.2533%2029.3799%2029.2435%2029.3658%2029.2195C29.3408%2029.1801%2029.3191%2029.1386%2029.301%2029.0955C29.1601%2028.7602%2029.3968%2028.4445%2030.7946%2027.5935L31.0891%2027.4159C31.8472%2026.965%2032.5122%2026.5874%2032.9786%2026.245C33.3873%2025.9463%2033.648%2025.6729%2033.6874%2025.3995L33.6916%2025.3601C33.7029%2025.2009%2033.6381%2025.0402%2033.4845%2024.8754C33.4561%2024.8447%2033.4228%2024.819%2033.3859%2024.7993L33.338%2024.7781L33.3196%2024.7711C33.2605%2024.7517%2033.1987%2024.7422%2033.1365%2024.7429C32.9082%2024.7429%2032.6165%2024.8415%2032.2981%2024.9965C31.4005%2025.4376%2030.2817%2026.338%2029.7251%2026.8072L29.3742%2027.1101L29.3277%2027.1566C29.215%2027.2666%2028.9219%2027.5371%2028.6331%2027.7006L28.533%2027.7527L28.4753%2027.7795C28.4202%2027.8031%2028.3625%2027.8202%2028.3034%2027.8302H28.3104C28.2959%2027.8322%2028.2813%2027.8337%2028.2667%2027.8344L28.2808%2027.833L28.2625%2027.8344C28.1512%2027.8415%2028.0582%2027.8048%2027.9948%2027.7006C27.9792%2027.6727%2027.9723%2027.6408%2027.975%2027.609C28.0131%2026.9537%2030.8411%2024.8035%2031.0074%2023.8862L31.02%2023.8186C31.1609%2022.9027%2030.6382%2022.6674%2029.9055%2023.1239ZM19.9123%207.29581C13.1516%207.29581%207.67034%2012.6911%207.67034%2019.3434C7.67034%2020.3184%207.7873%2021.2653%208.00852%2022.1728L8.01979%2022.1601C8.37488%2021.7402%208.88214%2021.5119%209.45282%2021.5119C9.95304%2021.5232%2010.4378%2021.6768%2010.852%2021.9515C11.162%2022.1488%2011.5072%2022.4926%2011.8595%2022.9294C12.2273%2022.4053%2012.8318%2022.0868%2013.4799%2022.077C14.6805%2022.077%2015.4061%2023.1028%2015.6809%2024.0257L15.7471%2024.1736L15.8317%2024.3526C16.1022%2024.9106%2016.6701%2025.9575%2017.4422%2026.7198C18.9359%2028.1853%2019.3078%2029.7%2018.5695%2031.3219C19.5178%2031.4242%2020.4747%2031.4176%2021.4215%2031.3021C20.7099%2029.724%2021.0551%2028.2444%2022.4642%2026.8128L22.5572%2026.7198C23.5365%2025.756%2024.1875%2024.3385%2024.3213%2024.0257C24.5961%2023.1028%2025.3189%2022.077%2026.5195%2022.077C27.1676%2022.0868%2027.7721%2022.4053%2028.1399%2022.9294C28.4922%2022.4926%2028.8374%2022.1502%2029.1516%2021.9515C29.5658%2021.6763%2030.0494%2021.5239%2030.5466%2021.5119C31.0496%2021.5119%2031.5076%2021.6895%2031.85%2022.0192C32.0472%2021.1596%2032.1529%2020.2649%2032.1529%2019.3448C32.1529%2012.6911%2026.6716%207.29581%2019.9123%207.29581ZM22.529%2019.8732L23.1476%2019.5744C23.9268%2019.2025%2024.4016%2019.0348%2024.4016%2019.7886C24.4016%2021.3287%2023.3152%2024.3089%2019.956%2024.385H19.6968C16.4207%2024.3117%2015.3061%2021.4823%2015.2497%2019.9112L15.2483%2019.7886C15.2483%2018.2288%2017.2943%2020.6143%2019.8278%2020.6143C20.8367%2020.6143%2021.7709%2020.2311%2022.529%2019.8732ZM28.1892%2015.4445C28.8233%2015.4445%2029.3348%2015.9489%2029.3348%2016.5717C29.3348%2017.1931%2028.8219%2017.699%2028.1892%2017.699C28.0401%2017.7001%2027.8922%2017.6718%2027.754%2017.6158C27.6157%2017.5597%2027.4899%2017.477%2027.3837%2017.3723C27.2774%2017.2676%2027.1928%2017.1431%2027.1347%2017.0057C27.0766%2016.8683%2027.0462%2016.7209%2027.0451%2016.5717C27.0451%2015.9489%2027.558%2015.4445%2028.1892%2015.4445ZM11.8102%2015.4445C12.4415%2015.4445%2012.9544%2015.9489%2012.9544%2016.5717C12.9544%2017.1931%2012.4415%2017.699%2011.8102%2017.699C11.6609%2017.7003%2011.5129%2017.6721%2011.3745%2017.6162C11.2361%2017.5602%2011.1101%2017.4775%2011.0037%2017.3728C10.8973%2017.2681%2010.8126%2017.1435%2010.7544%2017.006C10.6962%2016.8686%2010.6657%2016.721%2010.6646%2016.5717C10.6646%2015.9489%2011.1775%2015.4445%2011.8102%2015.4445ZM22.7868%2014.2594C23.2377%2013.7184%2023.9789%2013.4985%2024.6609%2013.7043C25.3415%2013.91%2025.8304%2014.499%2025.8981%2015.1979C25.9657%2015.8954%2025.5993%2016.5647%2024.9695%2016.893C24.5158%2017.1297%2024.3396%2016.2209%2023.8887%2016.0687L23.8916%2016.0645C23.4872%2015.9264%2022.8038%2016.5745%2022.5882%2016.1758C22.425%2015.8734%2022.3565%2015.529%2022.3917%2015.1872C22.4269%2014.8455%2022.5655%2014.5222%2022.7868%2014.2594ZM16.6954%2014.2594C17.1492%2014.8005%2017.2267%2015.5558%2016.8927%2016.1758C16.6785%2016.5745%2015.9909%2015.9264%2015.5893%2016.0645L15.5935%2016.0687C15.4414%2016.1194%2015.3202%2016.2575%2015.2089%2016.4069L15.0426%2016.6394C14.8876%2016.8507%2014.7326%2017.0085%2014.5114%2016.893C14.2053%2016.7349%2013.9535%2016.4889%2013.7882%2016.1866C13.623%2015.8843%2013.552%2015.5395%2013.5842%2015.1965C13.6518%2014.499%2014.1408%2013.91%2014.8214%2013.7043C15.1538%2013.6037%2015.5085%2013.6026%2015.8415%2013.7013C16.1746%2013.7999%2016.4714%2013.994%2016.6954%2014.2594Z'%20fill='currentColor'/%3e%3c/svg%3e`,hN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.51531%2015.81L10.908%2017.7878C10.8981%2018.3134%2010.9136%2018.8392%2010.9545%2019.3633L15.5704%2020.5979C14.2013%2021.163%2012.7171%2021.3928%2011.2413%2021.2683L11.1018%2021.2559L11.0677%2021.2528L11.0026%2021.2458L10.9297%2021.238C10.8891%2021.2332%2010.8486%2021.228%2010.808%2021.2225L10.7251%2021.2117L10.6399%2021.1993C10.557%2021.1872%2010.4743%2021.1741%2010.3919%2021.1598L10.3593%2021.1536L10.3012%2021.1435L10.2183%2021.128L10.164%2021.1164L10.0919%2021.1016L10.0338%2021.0892L9.96019%2021.0737L9.88501%2021.0559L9.81216%2021.0389L9.75946%2021.0257L9.69126%2021.0086L9.62151%2020.99L9.54789%2020.9707L9.48434%2020.9528L9.39986%2020.9296L9.35181%2020.9141L9.28671%2020.8947L9.21464%2020.873L9.13326%2020.8467L9.08831%2020.8319L9.02631%2020.8118L8.95656%2020.7878L8.90541%2020.7692C8.89403%2020.7653%208.88267%2020.7615%208.87131%2020.7575L8.81861%2020.7382L8.74034%2020.7095L8.69617%2020.6924L8.63417%2020.6692L8.56674%2020.6421L8.49854%2020.6149L8.43732%2020.5901L8.36369%2020.5591L8.31487%2020.5374L8.26604%2020.5165C8.25543%2020.5119%208.24484%2020.5073%208.23427%2020.5026L8.18312%2020.4793L8.10329%2020.4429L8.06299%2020.4243L7.98859%2020.3886L7.94054%2020.3654L7.87544%2020.3344L7.80879%2020.3003L7.73672%2020.2639L7.69642%2020.2429L7.61659%2020.2003L7.57242%2020.1771L7.52747%2020.1523C7.51556%2020.1456%207.50367%2020.1389%207.49182%2020.1321L7.41897%2020.091L7.37247%2020.0647L7.33294%2020.0414L7.27714%2020.0097L7.21359%2019.9709L7.14152%2019.9275L7.10122%2019.9027L7.03612%2019.8616L6.98885%2019.8314L6.92762%2019.7927L6.87337%2019.7562L6.8323%2019.7291C6.81831%2019.7199%206.80436%2019.7106%206.79045%2019.7012L6.75635%2019.678L6.72225%2019.6547C6.71188%2019.6475%206.70155%2019.6403%206.69125%2019.633L6.64707%2019.602L6.58817%2019.5602L6.5347%2019.5214L6.47735%2019.4796L6.43395%2019.447L6.37505%2019.4028L6.31615%2019.3571L6.2495%2019.3052L6.21462%2019.2781L6.16502%2019.2378L6.10767%2019.1913L6.0387%2019.1347L6.00305%2019.1045L5.9674%2019.0742C5.95625%2019.0647%205.94515%2019.0552%205.93407%2019.0456L5.8992%2019.0146L5.85192%2018.9735L5.79767%2018.9255L5.74497%2018.8789L5.69692%2018.834L5.645%2018.786L5.60392%2018.7472L5.53572%2018.6821C5.51002%2018.6572%205.48444%2018.6321%205.459%2018.6069L5.43653%2018.5852L5.40475%2018.5527L5.35128%2018.4984L5.31253%2018.4589L5.27378%2018.4178C5.2295%2018.3724%205.18609%2018.3262%205.14358%2018.2791L5.08158%2018.2109L5.03353%2018.1567L4.9785%2018.0947L4.94595%2018.0567L4.90488%2018.0086L4.85993%2017.9559L4.82428%2017.9125C4.81728%2017.904%204.8103%2017.8955%204.80335%2017.887L4.76848%2017.8443L4.71733%2017.7808L4.68555%2017.7405L4.6468%2017.6909L4.6313%2017.6715C4.18786%2017.0967%203.81331%2016.4719%203.51531%2015.81ZM2.72481%2011.3196L11.5234%2013.6733C11.3761%2014.1864%2011.2547%2014.7065%2011.1599%2015.2318L19.543%2017.4747C19.1266%2018.0449%2018.6469%2018.5662%2018.1132%2019.0285L3.20918%2015.0404L3.19678%2015.0047L3.16966%2014.9241C3.15647%2014.8847%203.14356%2014.8452%203.13091%2014.8056L3.12548%2014.7877C3.06583%2014.5981%203.01233%2014.4066%202.96506%2014.2135L2.94181%2014.1158L2.92786%2014.0538L2.91158%2013.9786L2.89763%2013.9159L2.88368%2013.8461L2.87051%2013.781L2.85656%2013.7082C2.83641%2013.5989%202.81781%2013.4888%202.80153%2013.378L2.78836%2013.2866L2.77983%2013.2222L2.76976%2013.1432C2.76457%2013.1016%202.75966%2013.06%202.75503%2013.0184L2.75116%2012.982C2.69326%2012.4297%202.68444%2011.8734%202.72481%2011.3196ZM3.95938%207.32839L13.2191%209.80528C12.9339%2010.2742%2012.6727%2010.7593%2012.4363%2011.2584L21.1899%2013.6004C21.0799%2014.2359%2020.9047%2014.8497%2020.6722%2015.4333L11.721%2013.0386L2.79611%2010.6516L2.80773%2010.5741L2.81393%2010.5361L2.82168%2010.4842L2.83331%2010.4168L2.84726%2010.3408C2.86741%2010.2261%202.89066%2010.1122%202.91546%209.99825L2.93716%209.90215L2.95266%209.83628L2.97126%209.7611C2.98831%209.69135%203.00613%209.6216%203.02551%209.5534L3.04721%209.47435L3.06503%209.41003L3.08828%209.33253L3.10766%209.26898L3.13091%209.19458L3.15106%209.13103L3.17508%209.05741C3.37577%208.45541%203.63808%207.87573%203.95783%207.32761L3.95938%207.32839ZM7.40192%203.9184L16.1478%206.25734C15.6862%206.67623%2015.2494%207.12157%2014.8396%207.59111L20.9024%209.21318C21.1093%209.87348%2021.2449%2010.5648%2021.3%2011.2785L4.33215%206.74016L4.36703%206.68979L4.38795%206.65879L4.41895%206.61616L4.4546%206.56579L4.49723%206.50689L4.53908%206.45109L4.58868%206.38444L4.62743%206.33406L4.6716%206.27749L4.71423%206.22324L4.76073%206.16589L4.80335%206.11241L4.85373%206.05274L4.89558%206.00159L4.94673%205.94192L4.9878%205.89542L5.0436%205.83187L5.08468%205.78537L5.1366%205.72802L5.17845%205.68307L5.23503%205.62262L5.27998%205.57612L5.3288%205.52419L5.459%205.39244L5.5365%205.31649L5.58222%205.27309L5.64112%205.21807C6.17525%204.71752%206.76621%204.28132%207.40192%203.9184ZM12.0132%202.7001H12.0883L12.1519%202.70088L12.2054%202.70165L12.2472%202.7032L12.2999%202.70475L12.3356%202.70553L12.3945%202.70785L12.4309%202.7094L12.4774%202.71173L12.5192%202.71328L12.5867%202.71715L12.668%202.72258L12.7796%202.7311L12.8478%202.73653L12.8819%202.73963L12.9416%202.74583L13.0052%202.75203L13.0416%202.7559L13.1206%202.7652L13.1594%202.76985L13.2431%202.7807L13.3059%202.78845L13.3384%202.7931L13.3888%202.80085L13.5492%202.82565L13.6035%202.83495L13.6538%202.84348L13.7623%202.86363L13.8336%202.87758L13.9189%202.89462L13.9545%202.90237L14.0126%202.91477L14.0444%202.92252L14.0925%202.9326L14.125%202.94035L14.1754%202.95197L14.2134%202.96127L14.2684%202.97445L14.3428%202.99305L14.4296%203.0163L14.5172%203.03955L14.6047%203.06435L14.6435%203.07597L14.6977%203.09147L14.7582%203.11007L14.8148%203.1279L14.8535%203.1403L14.8923%203.1527L14.9512%203.17207L15.0279%203.19765L15.1069%203.22555L15.1441%203.23872L15.1937%203.25655L15.2658%203.2829L15.3511%203.31467L15.441%203.34955L15.5185%203.38055L15.5549%203.39605L15.6014%203.41465L15.6332%203.4286L15.682%203.44875L15.713%203.4627L15.7572%203.48207L15.8424%203.51927L15.9199%203.55492L15.9773%203.58205L16.0354%203.60995L16.0819%203.63165L16.1532%203.6673L16.2237%203.70217L16.3028%203.74247L16.3438%203.76417L16.3818%203.78432L16.4175%203.80292L16.464%203.8285L16.4957%203.84555L16.536%203.86802L16.6042%203.90677L16.6864%203.95327L16.7538%203.9928L16.798%204.01915L16.8391%204.04395L16.9135%204.08967L16.9817%204.1323L17.0576%204.18035L17.0855%204.19895L17.1351%204.23072L17.2002%204.27412L17.2312%204.29505L17.2793%204.3276L17.3273%204.36092L17.3451%204.3741C17.387%204.40277%2017.4288%204.43222%2017.4699%204.46244L17.5342%204.50894L17.5846%204.54614L17.628%204.57947L17.6947%204.62984L17.7582%204.67944L17.7892%204.70269L17.828%204.73447L17.8946%204.78794L17.9558%204.83832L18.0217%204.89334C18.5735%205.35834%2019.0703%205.88767%2019.5012%206.46736L8.29704%203.47045L8.34509%203.44952L8.39547%203.42782L8.45824%203.40147L8.52489%203.37435C8.61247%203.33947%208.70082%203.3046%208.78916%203.27282L8.86356%203.2457L8.93564%203.22012L9.00074%203.19687L9.07514%203.17285C9.14256%203.1496%209.21154%203.1279%209.27974%203.10697L9.35026%203.08605L9.41691%203.06667L9.49596%203.04342L9.56184%203.0256L9.63934%203.00545L9.70599%202.98685L9.77574%202.96902L9.84626%202.95197L9.91989%202.93492L9.98964%202.91942L10.0656%202.90315L10.1361%202.88765L10.2097%202.8737L10.281%202.85975L10.3585%202.8458L10.4291%202.8334L10.505%202.82023L10.5763%202.80938L10.6515%202.79775L10.7228%202.78768L10.8018%202.7776L10.8724%202.7683L10.9537%202.759L11.0235%202.75125L11.1049%202.7435C11.1769%202.73575%2011.249%202.72955%2011.3219%202.7249L11.404%202.7187L11.4738%202.71483L11.559%202.71018L11.6311%202.70708L11.7086%202.70398L11.7838%202.70243L11.8605%202.70088L12.0132%202.69933V2.7001Z'%20fill='currentColor'/%3e%3c/svg%3e`,gN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M27.1942%209.03509C24.4881%209.03509%2022.3726%2011.0731%2020.4574%2013.6623C17.8258%2010.3114%2015.6255%209.03509%2012.9925%209.03509C7.62404%209.03509%203.51001%2016.0234%203.51001%2023.4181C3.51001%2028.0453%205.74831%2030.9649%209.49831%2030.9649C12.1971%2030.9649%2014.1387%2029.693%2017.5904%2023.6594C17.5904%2023.6594%2019.029%2021.1199%2020.0173%2019.3699C20.3643%2019.9293%2020.7298%2020.5327%2021.1138%2021.1798L22.7322%2023.902C25.8843%2029.1769%2027.6416%2030.9649%2030.8229%2030.9649C34.4778%2030.9649%2036.51%2028.0058%2036.51%2023.2822C36.51%2015.538%2032.3039%209.03509%2027.1942%209.03509ZM14.9574%2022.0263C12.1606%2026.4123%2011.1928%2027.3962%209.63574%2027.3962C8.03194%2027.3962%207.07872%2025.9883%207.07872%2023.4781C7.07872%2018.1096%209.75562%2012.6199%2012.9471%2012.6199C14.6752%2012.6199%2016.1197%2013.617%2018.3316%2016.7836C16.2308%2020.0058%2014.9574%2022.0263%2014.9574%2022.0263ZM25.5202%2021.4751L23.5831%2018.2456C23.0969%2017.4514%2022.5938%2016.6676%2022.0743%2015.8947C23.8185%2013.2032%2025.2556%2011.8611%2026.9676%2011.8611C30.5202%2011.8611%2033.3638%2017.095%2033.3638%2023.5219C33.3638%2025.9722%2032.5612%2027.3947%2030.8989%2027.3947C29.3053%2027.3947%2028.5451%2026.3421%2025.5188%2021.4737'%20fill='currentColor'/%3e%3c/svg%3e`,_N=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.8758%209.20865C17.8758%208.59461%2017.3777%208.09634%2016.7663%208.09634C16.155%208.09634%2015.6567%208.59575%2015.6567%209.20865V27.6446C15.6567%2029.0714%2014.4985%2030.2324%2013.0755%2030.2324C11.6523%2030.2324%2010.4941%2029.0714%2010.4941%2027.6446V15.8167C10.4941%2015.2027%209.99591%2014.7044%209.38453%2014.7044C8.77316%2014.7044%208.275%2015.2038%208.275%2015.8167V20.8301C8.275%2022.2567%207.11678%2023.4179%205.69364%2023.4179C4.2705%2023.4179%203.1123%2022.2567%203.1123%2020.8301V19.0129C3.1123%2018.6054%203.44177%2018.2752%203.84822%2018.2752C4.25467%2018.2752%204.58413%2018.6054%204.58413%2019.0129V20.8301C4.58413%2021.4441%205.08227%2021.9424%205.69364%2021.9424C6.30502%2021.9424%206.80317%2021.443%206.80317%2020.8301V15.8167C6.80317%2014.39%207.96139%2013.2289%209.38453%2013.2289C10.8077%2013.2289%2011.9659%2014.39%2011.9659%2015.8167V27.6446C11.9659%2028.2587%2012.4641%2028.7569%2013.0755%2028.7569C13.6868%2028.7569%2014.1849%2028.2575%2014.1849%2027.6446V20.4123V9.20865C14.1849%207.78194%2015.3431%206.62082%2016.7663%206.62082C18.1894%206.62082%2019.3476%207.78194%2019.3476%209.20865V24.4746C19.3476%2024.8821%2019.0182%2025.2123%2018.6117%2025.2123C18.2053%2025.2123%2017.8758%2024.8821%2017.8758%2024.4746V9.20865ZM31.531%2013.2289C30.1079%2013.2289%2028.9496%2014.39%2028.9496%2015.8167V25.6969C28.9496%2026.311%2028.4515%2026.8093%2027.8401%2026.8093C27.2287%2026.8093%2026.7306%2026.3099%2026.7306%2025.6969V9.20865C26.7306%207.78194%2025.5723%206.62082%2024.1492%206.62082C22.7261%206.62082%2021.5679%207.78194%2021.5679%209.20865V30.1383C21.5679%2030.7523%2021.0697%2031.2506%2020.4583%2031.2506C19.8469%2031.2506%2019.3488%2030.7511%2019.3488%2030.1383V27.5471C19.3488%2027.1396%2019.0194%2026.8093%2018.6129%2026.8093C18.2065%2026.8093%2017.877%2027.1396%2017.877%2027.5471V30.1383C17.877%2031.565%2019.0352%2032.7261%2020.4583%2032.7261C21.8815%2032.7261%2023.0397%2031.565%2023.0397%2030.1383V9.20865C23.0397%208.59461%2023.5378%208.09634%2024.1492%208.09634C24.7605%208.09634%2025.2587%208.59575%2025.2587%209.20865V25.6969C25.2587%2027.1237%2026.417%2028.2848%2027.8401%2028.2848C29.2632%2028.2848%2030.4215%2027.1237%2030.4215%2025.6969V15.8167C30.4215%2015.2027%2030.9196%2014.7044%2031.531%2014.7044C32.1424%2014.7044%2032.6405%2015.2038%2032.6405%2015.8167V24.4746C32.6405%2024.8821%2032.97%2025.2123%2033.3764%2025.2123C33.7829%2025.2123%2034.1123%2024.8821%2034.1123%2024.4746V15.8167C34.1123%2014.39%2032.9541%2013.2289%2031.531%2013.2289Z'%20fill='currentColor'/%3e%3c/svg%3e`,vN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.92783%208.88101H13.357V13.3088H17.7861V17.738H17.7835H22.2152V13.3088H26.6418V8.88101H31.0722V26.5949H35.5V31.0241H22.2139V26.5962H17.7861V22.1671H13.3557V26.5949L17.7861%2026.5962V31.0241H4.5V26.5949H8.92783V8.88101ZM22.2139%2026.5962H26.6418V22.1671H22.2152V26.5962H22.2139Z'%20fill='currentColor'/%3e%3c/svg%3e`,yN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M5.85893%2026.3499L18.1801%2029.6463C18.1635%2030.5223%2018.1894%2031.3987%2018.2576%2032.2722L25.9507%2034.3298C23.669%2035.2716%2021.1952%2035.6547%2018.7355%2035.4471L18.503%2035.4265L18.4462%2035.4213L18.3377%2035.4097L18.2163%2035.3968C18.1486%2035.3886%2018.081%2035.38%2018.0135%2035.3709L17.8753%2035.3528L17.7332%2035.3322C17.5951%2035.3121%2017.4573%2035.2901%2017.3198%2035.2663L17.2656%2035.256L17.1687%2035.2392L17.0305%2035.2133L16.9401%2035.194L16.82%2035.1694L16.7231%2035.1488L16.6004%2035.1229L16.4751%2035.0932L16.3537%2035.0648L16.2659%2035.0428L16.1522%2035.0144L16.0359%2034.9834L15.9132%2034.9511L15.8073%2034.9214L15.6665%2034.8827L15.5864%2034.8568L15.4779%2034.8245L15.3578%2034.7884L15.2222%2034.7445L15.1473%2034.7199L15.0439%2034.6863L14.9277%2034.6463L14.8424%2034.6153C14.8235%2034.6089%2014.8045%2034.6025%2014.7856%2034.5959L14.6978%2034.5636L14.5673%2034.5158L14.4937%2034.4874L14.3904%2034.4487L14.278%2034.4035L14.1643%2034.3583L14.0623%2034.3169L13.9396%2034.2653L13.8582%2034.2291L13.7768%2034.1942C13.7591%2034.1865%2013.7415%2034.1788%2013.7239%2034.171L13.6386%2034.1322L13.5056%2034.0715L13.4384%2034.0405L13.3144%2033.9811L13.2343%2033.9423L13.1258%2033.8907L13.0147%2033.8338L12.8946%2033.7731L12.8274%2033.7383L12.6944%2033.6672L12.6208%2033.6285L12.5459%2033.5871C12.526%2033.576%2012.5062%2033.5648%2012.4864%2033.5536L12.365%2033.4851L12.2875%2033.4412L12.2217%2033.4024L12.1287%2033.3495L12.0227%2033.2849L11.9026%2033.2126L11.8354%2033.1712L11.7269%2033.1028L11.6482%2033.0524L11.5461%2032.9878L11.4557%2032.9271L11.3872%2032.8819C11.3639%2032.8665%2011.3407%2032.851%2011.3175%2032.8354L11.2607%2032.7966L11.2038%2032.7579C11.1866%2032.7459%2011.1693%2032.7338%2011.1522%2032.7217L11.0785%2032.6701L10.9804%2032.6003L10.8912%2032.5357L10.7957%2032.466L10.7233%2032.4117L10.6252%2032.3381L10.527%2032.2619L10.4159%2032.1753L10.3578%2032.1301L10.2751%2032.063L10.1795%2031.9855L10.0646%2031.8912L10.0052%2031.8408L9.94575%2031.7904C9.92717%2031.7746%209.90866%2031.7586%209.8902%2031.7426L9.83208%2031.691L9.75329%2031.6225L9.66287%2031.5424L9.57504%2031.4649L9.49496%2031.39L9.40841%2031.3099L9.33996%2031.2453L9.22629%2031.1368C9.18345%2031.0953%209.14082%2031.0535%209.09842%2031.0116L9.06096%2030.9754L9.008%2030.9211L8.91887%2030.8307L8.85429%2030.7648L8.78971%2030.6964C8.71592%2030.6207%208.64357%2030.5436%208.57271%2030.4652L8.46938%2030.3515L8.38929%2030.2611L8.29758%2030.1578L8.24333%2030.0945L8.17488%2030.0144L8.09996%2029.9266L8.04054%2029.8542C8.02888%2029.8401%208.01725%2029.8258%208.00567%2029.8116L7.94754%2029.7406L7.86229%2029.6346L7.80934%2029.5675L7.74475%2029.4848L7.71892%2029.4525C6.97985%2028.4945%206.3556%2027.4532%205.85893%2026.3499ZM4.54143%2018.8661L19.2057%2022.7888C18.9602%2023.6439%2018.758%2024.5109%2018.5999%2025.3864L32.5718%2029.1244C31.8777%2030.0748%2031.0782%2030.9436%2030.1887%2031.7142L5.34872%2025.0673L5.32805%2025.0079L5.28284%2024.8736C5.26087%2024.8078%205.23934%2024.742%205.21826%2024.676L5.20922%2024.6462C5.1098%2024.3302%205.02063%2024.011%204.94184%2023.6891L4.90309%2023.5264L4.87984%2023.423L4.85272%2023.2978L4.82947%2023.1931L4.80622%2023.0769L4.78426%2022.9684L4.76101%2022.847C4.72743%2022.6648%204.69643%2022.4814%204.6693%2022.2967L4.64735%2022.1443L4.63314%2022.0371L4.61635%2021.9053C4.6077%2021.8361%204.59952%2021.7668%204.5918%2021.6974L4.58535%2021.6367C4.48884%2020.7162%204.47414%2019.7891%204.54143%2018.8661ZM6.59905%2012.214L22.0318%2016.3421C21.5565%2017.1236%2021.1212%2017.9322%2020.7273%2018.764L35.3166%2022.6674C35.1332%2023.7266%2034.8413%2024.7496%2034.4538%2025.7222L19.5351%2021.731L4.66026%2017.7526L4.67964%2017.6235L4.68997%2017.5602L4.70289%2017.4736L4.72226%2017.3613L4.74551%2017.2347C4.7791%2017.0435%204.81785%2016.8536%204.85918%2016.6638L4.89534%2016.5036L4.92118%2016.3938L4.95218%2016.2685C4.98059%2016.1523%205.0103%2016.036%205.04259%2015.9224L5.07876%2015.7906L5.10847%2015.6834L5.14722%2015.5542L5.17951%2015.4483L5.21826%2015.3243L5.25184%2015.2184L5.29189%2015.0957C5.62637%2014.0924%206.06355%2013.1262%206.59646%2012.2127L6.59905%2012.214ZM12.3366%206.53068L26.913%2010.4289C26.1438%2011.1271%2025.4158%2011.8693%2024.7327%2012.6519L34.8374%2015.3553C35.1823%2016.4558%2035.4083%2017.608%2035.5%2018.7976L7.22034%2011.2336L7.27846%2011.1497L7.31334%2011.098L7.365%2011.027L7.42442%2010.943L7.49546%2010.8448L7.56521%2010.7518L7.64788%2010.6407L7.71246%2010.5568L7.78609%2010.4625L7.85713%2010.3721L7.93463%2010.2765L8.00567%2010.1874L8.08963%2010.0879L8.15938%2010.0027L8.24463%209.90321L8.31308%209.82571L8.40608%209.71979L8.47454%209.64229L8.56108%209.54671L8.63083%209.47179L8.72512%209.37104L8.80004%209.29354L8.88142%209.207L9.09842%208.98742L9.22758%208.86084L9.30379%208.7885L9.40196%208.69679C10.2922%207.86254%2011.2771%207.13554%2012.3366%206.53068ZM20.022%204.50018H20.1473L20.2532%204.50147L20.3423%204.50277L20.4121%204.50535L20.4999%204.50793L20.5593%204.50922L20.6575%204.5131L20.7182%204.51568L20.7957%204.51956L20.8655%204.52214L20.9778%204.5286L21.1135%204.53764L21.2995%204.55185L21.4131%204.56089L21.47%204.56606L21.5694%204.57639L21.6753%204.58672L21.736%204.59318L21.8678%204.60868L21.9324%204.61643L22.0719%204.63452L22.1765%204.64743L22.2308%204.65518L22.3147%204.6681L22.5821%204.70943L22.6725%204.72493L22.7565%204.73914L22.9373%204.77272L23.0561%204.79597L23.1982%204.82439L23.2576%204.83731L23.3545%204.85797L23.4075%204.87089L23.4875%204.88768L23.5418%204.9006L23.6257%204.91997L23.689%204.93547L23.7807%204.95743L23.9047%204.98843L24.0494%205.02718L24.1954%205.06593L24.3413%205.10726L24.4059%205.12664L24.4963%205.15247L24.5971%205.18347L24.6914%205.21318L24.756%205.23385L24.8205%205.25451L24.9187%205.28681L25.0466%205.32943L25.1783%205.37593L25.2403%205.39789L25.323%205.4276L25.4431%205.47151L25.5852%205.52447L25.735%205.5826L25.8642%205.63426L25.9249%205.6601L26.0024%205.6911L26.0554%205.71435L26.1367%205.74793L26.1884%205.77118L26.262%205.80347L26.4041%205.86547L26.5333%205.92489L26.6289%205.97009L26.7257%206.01659L26.8032%206.05276L26.9221%206.11218L27.0396%206.1703L27.1714%206.23747L27.2398%206.27364L27.3031%206.30722L27.3625%206.33822L27.44%206.38084L27.493%206.40926L27.5602%206.44672L27.6738%206.5113L27.8107%206.5888L27.9231%206.65468L27.9967%206.69859L28.0652%206.73993L28.1892%206.81613L28.3029%206.88718L28.4294%206.96726L28.4759%206.99826L28.5586%207.05122L28.6671%207.12355L28.7188%207.15842L28.7989%207.21267L28.8789%207.26822L28.9086%207.29017C28.9784%207.33797%2029.0481%207.38705%2029.1166%207.43742L29.2238%207.51492L29.3078%207.57692L29.3801%207.63246L29.4912%207.71642L29.5971%207.79909L29.6488%207.83784L29.7134%207.8908L29.8244%207.97992L29.9265%208.06388L30.0363%208.15559C30.9559%208.93059%2031.7839%209.81279%2032.5021%2010.779L13.8285%205.7841L13.9086%205.74922L13.9925%205.71305L14.0971%205.66914L14.2082%205.62393C14.3542%205.5658%2014.5014%205.50768%2014.6487%205.45472L14.7727%205.40951L14.8928%205.36689L15.0013%205.32814L15.1253%205.2881C15.2377%205.24935%2015.3526%205.21318%2015.4663%205.17831L15.5839%205.14343L15.6949%205.11114L15.8267%205.07239L15.9365%205.04268L16.0656%205.0091L16.1767%204.9781L16.293%204.94839L16.4105%204.91997L16.5332%204.89156L16.6495%204.86572L16.7761%204.8386L16.8936%204.81276L17.0163%204.78951L17.1351%204.76627L17.2643%204.74302L17.3818%204.72235L17.5084%204.70039L17.6273%204.68231L17.7526%204.66293L17.8714%204.64614L18.0031%204.62935L18.1207%204.61385L18.2563%204.59835L18.3726%204.58543L18.5082%204.57252C18.6283%204.5596%2018.7484%204.54927%2018.8698%204.54152L19.0068%204.53118L19.123%204.52472L19.2651%204.51697L19.3852%204.51181L19.5144%204.50664L19.6397%204.50406L19.7675%204.50147L20.022%204.49889V4.50018Z'%20fill='currentColor'/%3e%3c/svg%3e`,bN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M16.1801%2015.8791V14.0283C16.3472%2014.0155%2016.5271%2014.0026%2016.7199%2014.0026C21.7966%2013.8356%2025.1254%2018.3596%2025.1254%2018.3596C25.1254%2018.3596%2021.5267%2023.3463%2017.671%2023.3463C17.1569%2023.3463%2016.6557%2023.2692%2016.1801%2023.1021V17.4728C18.1465%2017.7298%2018.545%2018.591%2019.7274%2020.5702L22.375%2018.3468C22.375%2018.3468%2020.4343%2015.8277%2017.1955%2015.8277C16.8356%2015.8277%2016.5014%2015.8405%2016.1801%2015.8791ZM16.1801%209.75492V12.5246C16.3472%2012.5118%2016.5271%2012.4989%2016.7199%2012.4861C23.763%2012.2547%2028.377%2018.2696%2028.377%2018.2696C28.377%2018.2696%2023.0819%2024.683%2017.5939%2024.683C17.0798%2024.683%2016.6171%2024.6444%2016.1801%2024.5545V26.2767C16.5528%2026.3152%2016.9384%2026.341%2017.3625%2026.341C22.4649%2026.341%2026.1664%2023.7448%2029.7523%2020.6473C30.3435%2021.1229%2032.7597%2022.2796%2033.261%2022.7937C29.8679%2025.6341%2021.9251%2027.9346%2017.4396%2027.9346C17.0155%2027.9346%2016.5914%2027.9089%2016.1801%2027.8704V30.2866H35.6001V9.75492H16.1801ZM16.1801%2023.1021V24.5545C11.4376%2023.7191%2010.1266%2018.7966%2010.1266%2018.7966C10.1266%2018.7966%2012.4015%2016.2775%2016.1801%2015.8791V17.4728H16.1673C14.188%2017.2414%2012.6329%2019.0922%2012.6329%2019.0922C12.6329%2019.0922%2013.5068%2022.2025%2016.1801%2023.1021ZM7.77464%2018.591C7.77464%2018.591%2010.5765%2014.4525%2016.1801%2014.0283V12.5246C9.9724%2013.0259%204.6001%2018.2696%204.6001%2018.2696C4.6001%2018.2696%207.64612%2027.0735%2016.1801%2027.8575V26.2767C9.90814%2025.4798%207.77464%2018.591%207.77464%2018.591Z'%20fill='currentColor'/%3e%3c/svg%3e`,xN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M32.8377%2017.282C33.2127%2016.25%2033.3072%2015.218%2033.2127%2014.1875C33.1197%2013.1571%2032.7447%2012.1251%2032.2752%2011.1876C31.4322%209.78209%2030.2127%208.6571%2028.8072%208.0001C27.3072%207.34461%2025.7127%207.15711%2024.1197%207.53211C23.3698%206.78212%2022.5253%206.12512%2021.5878%205.65713C20.6503%205.18913%2019.5253%205.00013%2018.4948%205.00013C16.8851%204.99074%2015.3125%205.48246%2013.9948%206.40712C12.6824%207.34311%2011.7449%208.6571%2011.2754%2010.1571C10.1504%2010.4376%209.21289%2010.9071%208.27539%2011.4696C7.4324%2012.1251%206.77541%2012.9696%206.21291%2013.8126C5.36992%2015.2195%205.08792%2016.8125%205.27542%2018.407C5.46399%2019.9968%206.11605%2021.496%207.1504%2022.718C6.79608%2023.7086%206.66795%2024.7659%206.77541%2025.8124C6.86991%2026.8444%207.2449%2027.8749%207.7129%2028.8124C8.55739%2030.2194%209.77538%2031.3444%2011.1824%2031.9999C12.6824%2032.6569%2014.2753%2032.8444%2015.8698%2032.4694C16.6198%2033.2194%2017.4628%2033.8749%2018.4003%2034.3444C19.3378%2034.8139%2020.4628%2034.9999%2021.4948%2034.9999C23.1043%2035.0097%2024.6769%2034.5185%2025.9947%2033.5944C27.3072%2032.6569%2028.2447%2031.3444%2028.7127%2029.8444C29.7719%2029.6432%2030.7682%2029.1934%2031.6197%2028.5319C32.4627%2027.8749%2033.2127%2027.1249%2033.6822%2026.1874C34.5251%2024.7819%2034.8071%2023.1875%2034.6196%2021.5945C34.4322%2020%2033.8697%2018.5015%2032.8377%2017.282ZM21.5878%2033.0304C20.0878%2033.0304%2018.9628%2032.5609%2017.9323%2031.7179C17.9323%2031.7179%2018.0253%2031.6234%2018.1198%2031.6234L24.1197%2028.1554C24.2862%2028.0803%2024.4196%2027.9469%2024.4947%2027.7804C24.5698%2027.636%2024.6021%2027.4731%2024.5877%2027.3109V18.875L27.1197%2020.375V27.3124C27.1455%2028.0547%2027.0215%2028.7945%2026.755%2029.4878C26.4885%2030.181%2026.085%2030.8134%2025.5687%2031.3473C25.0523%2031.8811%2024.4337%2032.3054%2023.7497%2032.5949C23.0658%2032.8843%2022.3305%2033.0314%2021.5878%2033.0304ZM9.49488%2027.8749C8.83789%2026.7499%208.55739%2025.4374%208.83789%2024.125C8.83789%2024.125%208.93239%2024.2195%209.02539%2024.2195L15.0253%2027.6874C15.1693%2027.7638%2015.3325%2027.7966%2015.4948%2027.7819C15.6823%2027.7819%2015.8698%2027.7819%2015.9628%2027.6874L23.2753%2023.4695V26.3749L17.1823%2029.9374C16.5506%2030.3042%2015.8527%2030.5427%2015.1287%2030.6393C14.4046%2030.7358%2013.6686%2030.6884%2012.9629%2030.4999C11.4629%2030.1249%2010.2449%2029.1874%209.49488%2027.8749ZM7.9004%2014.8445C8.56239%2013.7234%209.58826%2012.8627%2010.8074%2012.4056V19.532C10.8074%2019.718%2010.8074%2019.907%2010.9004%2020C10.9755%2020.1665%2011.1089%2020.2998%2011.2754%2020.375L18.5878%2024.5944L16.0573%2026.0944L10.0574%2022.625C9.41842%2022.2639%208.85742%2021.7797%208.40684%2021.2004C7.95627%2020.6211%207.62506%2019.9582%207.4324%2019.25C7.05741%2017.8445%207.1504%2016.157%207.9004%2014.8445ZM28.6197%2019.625L21.3073%2015.407L23.8377%2013.9071L29.8377%2017.375C30.7752%2017.9375%2031.5252%2018.6875%2031.9947%2019.625C32.4642%2020.5625%2032.7447%2021.5945%2032.6502%2022.7195C32.5603%2023.7755%2032.1699%2024.7837%2031.5252%2025.6249C30.8697%2026.4694%2030.0252%2027.1249%2028.9947%2027.4999V20.375C28.9947%2020.1875%2028.9947%2020%2028.9002%2019.907C28.9002%2019.907%2028.8072%2019.718%2028.6197%2019.625ZM31.1502%2015.875C31.1502%2015.875%2031.0572%2015.782%2030.9627%2015.782L24.9627%2012.3126C24.7752%2012.2196%2024.6822%2012.2196%2024.4947%2012.2196C24.3072%2012.2196%2024.1197%2012.2196%2024.0252%2012.3126L16.7128%2016.532V13.6251L22.8073%2010.0626C23.7448%209.50009%2024.7752%209.31259%2025.9002%209.31259C26.9322%209.31259%2027.9627%209.68759%2028.9002%2010.3446C29.7447%2011.0001%2030.4947%2011.8446%2030.8697%2012.7821C31.2447%2013.7196%2031.3377%2014.8445%2031.1502%2015.875ZM15.4003%2021.125L12.8699%2019.625V12.5946C12.8699%2011.5626%2013.1503%2010.4376%2013.7128%209.59459C14.2753%208.6571%2015.1198%208.0001%2016.0573%207.53211C17.0127%207.05249%2018.0956%206.88812%2019.1503%207.06261C20.1823%207.15711%2021.2128%207.62511%2022.0573%208.2821C22.0573%208.2821%2021.9628%208.3751%2021.8698%208.3751L15.8698%2011.8446C15.7033%2011.9197%2015.57%2012.0531%2015.4948%2012.2196C15.4003%2012.4071%2015.4003%2012.5001%2015.4003%2012.6876V21.125ZM16.7128%2018.125L19.9948%2016.25L23.2753%2018.125V21.875L19.9948%2023.75L16.7128%2021.875V18.125Z'%20fill='currentColor'/%3e%3c/svg%3e`,SN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M728.039%20234C819.325%20234%20893.323%20308.62%20893.323%20400.668C893.323%20492.716%20819.325%20567.336%20728.039%20567.336L891.984%20732.656C912.81%20753.655%20898.061%20789.56%20868.613%20789.56H397.472C245.333%20789.56%20122%20665.193%20122%20511.78C122%20358.367%20245.333%20234%20397.472%20234H728.039ZM397.472%20345.112C306.189%20345.112%20232.189%20419.732%20232.189%20511.78C232.189%20603.828%20306.189%20678.448%20397.472%20678.448C488.756%20678.448%20562.756%20603.828%20562.756%20511.78C562.756%20419.732%20488.756%20345.112%20397.472%20345.112Z'%20fill='currentColor'%20transform='scale(0.0234375)'/%3e%3c/svg%3e`,CN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.25'%20d='M27.539%2018.922C29.2526%2018.922%2030.8959%2018.2413%2032.1076%2017.0296C33.3193%2015.8179%2034%2014.1746%2034%2012.461C34%2010.7474%2033.3193%209.10406%2032.1076%207.89238C30.8959%206.68071%2029.2526%206%2027.539%206C25.8254%206%2024.1821%206.68071%2022.9704%207.89238C21.7587%209.10406%2021.078%2010.7474%2021.078%2012.461C21.078%2014.1746%2021.7587%2015.8179%2022.9704%2017.0296C24.1821%2018.2413%2025.8254%2018.922%2027.539%2018.922ZM27.539%2034C29.2526%2034%2030.8959%2033.3193%2032.1076%2032.1076C33.3193%2030.8959%2034%2029.2526%2034%2027.539C34%2025.8254%2033.3193%2024.1821%2032.1076%2022.9704C30.8959%2021.7587%2029.2526%2021.078%2027.539%2021.078C25.8254%2021.078%2024.1821%2021.7587%2022.9704%2022.9704C21.7587%2024.1821%2021.078%2025.8254%2021.078%2027.539C21.078%2029.2526%2021.7587%2030.8959%2022.9704%2032.1076C24.1821%2033.3193%2025.8254%2034%2027.539%2034ZM12.461%2034C14.1746%2034%2015.8179%2033.3193%2017.0296%2032.1076C18.2413%2030.8959%2018.922%2029.2526%2018.922%2027.539C18.922%2025.8254%2018.2413%2024.1821%2017.0296%2022.9704C15.8179%2021.7587%2014.1746%2021.078%2012.461%2021.078C10.7474%2021.078%209.10406%2021.7587%207.89238%2022.9704C6.68071%2024.1821%206%2025.8254%206%2027.539C6%2029.2526%206.68071%2030.8959%207.89238%2032.1076C9.10406%2033.3193%2010.7474%2034%2012.461%2034Z'%20fill='currentColor'/%3e%3cpath%20d='M12.461%2018.922C16.0293%2018.922%2018.922%2016.0293%2018.922%2012.461C18.922%208.89269%2016.0293%206%2012.461%206C8.89269%206%206%208.89269%206%2012.461C6%2016.0293%208.89269%2018.922%2012.461%2018.922Z'%20fill='currentColor'/%3e%3c/svg%3e`,wN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.4579%2015.6036L26.1529%2035H20.0656L6.37059%2015.6036H12.4579ZM12.4524%2026.3764L15.4974%2030.6909L12.4551%2035H6.36377L12.4524%2026.3764ZM33.6365%207.15727V35H28.647V14.2236L33.6365%207.15727ZM33.6365%205L20.0656%2024.2205L17.0206%2019.9073L27.5451%205H33.6365Z'%20fill='currentColor'/%3e%3c/svg%3e`,TN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M20.1312%207.50002L17.4088%2011.1913H5.81625L8.5375%207.50002H20.1325H20.1312ZM34.0675%2028.81L31.3475%2032.5H19.795L22.5125%2028.81H34.0675ZM35%207.50002L16.58%2032.5H5L23.42%207.50002H35Z'%20fill='currentColor'/%3e%3c/svg%3e`,EN={alibaba:nN,"alibaba-cn":nN,"amazon-bedrock":rN,anthropic:iN,"google-antigravity":aN,azure:oN,"azure-openai-responses":oN,cohere:sN,cursor:cN,deepseek:lN,fireworks:uN,"fireworks-ai":uN,"github-copilot":dN,google:fN,"google-gemini-cli":fN,"google-vertex":fN,groq:pN,huggingface:mN,"kimi-coding":hN,"kimi-for-coding":hN,meta:gN,minimax:_N,"minimax-cn":_N,mistral:vN,moonshot:yN,moonshotai:yN,nvidia:bN,openai:xN,"openai-codex":xN,openrouter:SN,together:CN,togetherai:CN,xai:wN,zai:TN,"z-ai":TN},DN={anthropic:`#c8795a`,deepseek:`#4d6bfe`,google:`#4285f4`,"google-gemini-cli":`#4285f4`,"google-vertex":`#4285f4`,"google-antigravity":`#6387ed`,meta:`#1685f8`,azure:`#168cda`,"azure-openai-responses":`#168cda`,"amazon-bedrock":`#e99b32`,alibaba:`#ed7d31`,"alibaba-cn":`#ed7d31`,mistral:`#ef8b31`,nvidia:`#76b900`,cohere:`#659a81`,groq:`#ef6847`};function ON({id:e}){let t=Object.hasOwn(EN,e)?EN[e]:void 0;return(0,K.jsx)(`span`,{className:`models-provider-icon${t?``:` models-provider-connection`}`,"aria-hidden":`true`,style:t?{maskImage:`url("${t}")`,color:Object.hasOwn(DN,e)?DN[e]:void 0}:void 0,children:!t&&(0,K.jsx)(gt,{strokeWidth:1.75})})}var kN=250;function AN(e){let{t}=cr(),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(!1),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useId)(),p=(0,_.useRef)([]),m=e.draftModel??e.currentModel,h=e.thinkingDisabledReason===`thinkingInactiveHint`?void 0:e.snapshot?.thinking,g=h?.supported===!0,v=e.thinkingPendingLevel??h?.level??`off`,y=(i??(g?`thinking`:`models`))===`thinking`,b=e.snapshot?.models??[],x=(e.snapshot?.truncation.modelsOmitted??0)>0,S=b.length>0||x,C=n.trim(),w=e.modelSearch.query===C,E=x&&!!C&&(!w||e.modelSearch.status===`loading`),D=C?x?w?e.modelSearch.models:[]:b.filter(e=>[e.provider,e.id,e.name,e.label].some(e=>e.toLocaleLowerCase().includes(C.toLocaleLowerCase()))):b,O=new Map;for(let e of D){let t=O.get(e.provider);t?t.push(e):O.set(e.provider,[e])}let k=[...O.values()].flat(),A=e.actions.searchModels,j=e.modelSearch.query,M=e.modelSearch.status;(0,_.useEffect)(()=>{if(!x||!C||j===C&&M!==`idle`)return;let e=window.setTimeout(()=>{A(C)},kN);return()=>window.clearTimeout(e)},[x,C,A,j,M]);let N=()=>{r(``),e.actions.clearModelSearch()},P=(t,n)=>{e.actions.selectModel(`${t.provider}/${t.id}`),n()},F=m?eN(m):t(e.snapshot?S?`selectModel`:`configureModels`:`loadingModels`),L=!e.snapshot||e.sessionSwitching||e.modelSelectionPending||e.promptAdmissionPending||!e.workspaceDraft&&!!e.snapshot?.selectedSession&&!rj(e.snapshot)||e.liveRunning;(0,_.useEffect)(()=>{if(!o){c.current=!1;return}e.thinkingNeedsSession&&(m||y)&&!c.current&&(c.current=!0,e.actions.prepareSession())},[o,y,m,e.thinkingNeedsSession,e.actions]),(0,_.useEffect)(()=>{if(!o||y)return;let e=requestAnimationFrame(()=>d.current?.focus());return()=>cancelAnimationFrame(e)},[o,y]),(0,_.useEffect)(()=>{if(!o)return;let e=e=>{let t=e.target;l.current=t instanceof Element&&!t.closest(`.astryx-complex-selector-popup, .model-picker`)?t.closest(`button:not(:disabled), input:not(:disabled), textarea:not(:disabled), select:not(:disabled), a[href], [tabindex], [contenteditable='true']`):null};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[o]);let R=JSON.stringify([e.snapshot?.currentSessionId,e.snapshot?.currentSessionPath,m?.provider,m?.id]),ee=(0,_.useRef)(R);(0,_.useEffect)(()=>{y&&ee.current!==R&&!c.current&&u.current?.close(),ee.current=R,e.thinkingNeedsSession||(c.current=!1)},[R,y,e.thinkingNeedsSession]),(0,_.useEffect)(()=>{L&&!c.current&&u.current?.close()},[L]);let z=(0,_.useRef)(e.openRequest);return(0,_.useEffect)(()=>{e.openRequest!==z.current&&(z.current=e.openRequest,e.openRequest&&!L&&(a(`models`),u.current?.open()))},[e.openRequest,L]),(0,K.jsx)($M,{className:`model-selector model-picker`,label:g?`${F}, ${t(`thinkingLevel`)}: ${v}`:F,isLabelHidden:!0,value:m?`${m.provider}/${m.id}`:``,triggerLabel:(0,K.jsxs)(`span`,{className:`model-thinking-label`,title:F,children:[m&&(0,K.jsx)(ON,{id:m.provider}),(0,K.jsx)(`span`,{className:`model-picker-label`,children:m?.name||m?.id||F}),g&&(0,K.jsx)(`span`,{className:`model-picker-thinking`,children:v[0].toUpperCase()+v.slice(1)})]}),variant:`ghost`,size:`sm`,placement:`above`,alignment:`end`,isDisabled:L,isLoading:e.modelSelectionPending,handleRef:u,onOpenChange:e=>{s(e),e||(l.current?.isConnected&&l.current.focus({preventScroll:!0}),l.current=null,N(),a(null))},children:(i,s,c)=>o&&e.thinkingNeedsSession&&(m||y)?(0,K.jsx)(`p`,{className:`thinking-preparing`,role:`status`,children:t(`switchingSession`)}):o&&y?(0,K.jsx)(tN,{snapshot:e.snapshot,model:m,pending:e.thinkingPendingLevel??null,disabled:L||!!e.thinkingDisabledReason,actions:e.actions,onClose:c,onChooseModel:()=>a(`models`)},R):(0,K.jsxs)(`div`,{className:`model-search-panel ${x?`searchable`:``}`,children:[g&&(0,K.jsxs)(`button`,{type:`button`,className:`model-thinking-back`,onClick:()=>a(`thinking`),children:[(0,K.jsx)(T,{"aria-hidden":`true`}),t(`thinkingLevel`)]}),x&&(0,K.jsx)(`p`,{className:`model-search-truncation`,role:`status`,children:t(`modelsTruncated`,{shown:b.length,omitted:e.snapshot?.truncation.modelsOmitted??0})}),e.snapshot&&!S&&(0,K.jsx)(`p`,{className:`model-search-status`,role:`status`,children:t(`noModels`)}),S&&(0,K.jsxs)(`label`,{className:`model-search-input`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`sr-only`,children:t(`searchModels`)}),(0,K.jsx)(`input`,{ref:d,"aria-controls":f,value:n,placeholder:t(`searchModelsPlaceholder`),onChange:t=>{let n=t.currentTarget.value;r(n),n.trim()||e.actions.clearModelSearch()},onKeyDown:e=>{e.nativeEvent.isComposing||e.keyCode===229||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),c()):e.key===`ArrowDown`&&k.length&&(e.preventDefault(),e.stopPropagation(),p.current[0]?.focus()))}})]}),E&&(0,K.jsx)(`p`,{className:`model-search-status`,role:`status`,children:t(`searchingModels`)}),x&&C&&w&&e.modelSearch.status===`error`&&(0,K.jsxs)(`p`,{className:`model-search-status model-search-error`,role:`alert`,children:[e.modelSearch.error??t(`modelSearchFailed`),(0,K.jsx)(`button`,{type:`button`,className:`model-search-retry`,"aria-label":t(`retryModelSearch`),title:t(`retryModelSearch`),onClick:()=>void A(C),children:(0,K.jsx)(ft,{"aria-hidden":`true`})})]}),S&&C&&(!x||w&&e.modelSearch.status===`ready`)&&k.length===0&&(0,K.jsx)(`p`,{className:`model-search-status`,role:`status`,children:t(`noMatchingModels`)}),x&&C&&w&&e.modelSearch.status===`ready`&&e.modelSearch.matchesOmitted>0&&(0,K.jsx)(`p`,{className:`model-search-status`,role:`status`,children:t(`modelSearchTruncated`,{omitted:e.modelSearch.matchesOmitted})}),S&&(0,K.jsx)(`div`,{className:`model-search-options`,id:f,role:`listbox`,"aria-label":t(`selectModel`),"aria-busy":E,children:k.map((t,n)=>{let r=m?.provider===t.provider&&m.id===t.id;return(0,K.jsxs)(_.Fragment,{children:[(n===0||k[n-1]?.provider!==t.provider)&&(0,K.jsx)(`div`,{className:`model-provider-heading`,"aria-hidden":`true`,children:t.provider}),(0,K.jsxs)(`button`,{className:`model-search-option`,type:`button`,disabled:e.thinkingPendingLevel!=null,role:`option`,"aria-selected":r,"aria-label":eN(t),title:eN(t),ref:e=>{p.current[n]=e},onClick:()=>P(t,c),onKeyDownCapture:e=>{if(e.nativeEvent.isComposing||e.keyCode===229)return;if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),c();return}if(e.key===`ArrowUp`&&n===0){e.preventDefault(),e.stopPropagation(),d.current?.focus();return}let t=e.key===`ArrowDown`?Math.min(n+1,k.length-1):e.key===`ArrowUp`?Math.max(n-1,0):e.key===`Home`?0:e.key===`End`?k.length-1:null;t!==null&&t!==n&&(e.preventDefault(),e.stopPropagation(),p.current[t]?.focus())},children:[(0,K.jsx)(ON,{id:t.provider}),(0,K.jsxs)(`span`,{className:`model-menu-item-text`,children:[(0,K.jsx)(`span`,{className:`model-menu-item-label`,children:t.name||t.id}),t.name&&t.name!==t.id&&(0,K.jsx)(`span`,{className:`model-menu-item-sub`,children:t.id})]}),r&&(0,K.jsx)(I,{"aria-hidden":`true`})]})]},`${t.provider}/${t.id}`)})}),e.onOpenProviders&&(0,K.jsxs)(K.Fragment,{children:[m&&h&&!g&&(0,K.jsx)(`p`,{className:`model-search-status`,children:t(`modelThinkingNotEnabled`)}),(0,K.jsxs)(`button`,{className:`model-settings-command`,type:`button`,onClick:()=>{c(),e.onOpenProviders?.()},children:[(0,K.jsx)(_t,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:t(`openModelSettings`)})]})]})]})})}var jN=`openpi-slash-command-list`;function MN(e){return`openpi-slash-command-${e}`}function NN(e,t){let n=t.trim().toLocaleLowerCase(),r=n?e.filter(e=>e.name.toLocaleLowerCase().includes(n)):[],i=n?r.length>0?r:e.filter(e=>[e.description,e.source].some(e=>e?.toLocaleLowerCase().includes(n))):[...e];return[...i.filter(e=>e.availability===`available`),...i.filter(e=>e.availability===`unsupported`)]}function PN({source:e}){return e===`extension`?(0,K.jsx)(ut,{}):e===`prompt`?(0,K.jsx)(Se,{}):(0,K.jsx)(St,{})}function FN(e){let{t}=cr(),n=(0,_.useRef)(null);(0,_.useLayoutEffect)(()=>{let t=n.current,r=t?.parentElement;if(!t||!r||!e.preferBelow)return;let i=()=>{let e=window.visualViewport,n=e?.offsetTop??0,i=e?.height??window.innerHeight,a=n+i,o=r.getBoundingClientRect(),s=Math.max(0,a-o.bottom-8-12),c=Math.max(0,o.top-n-8-12),l=s>=Math.min(t.scrollHeight,224,i*.32)||s>=c?`below`:`above`,u=l===`below`?s:c;t.dataset.placement=l,t.style.setProperty(`--slash-command-available-height`,`${Math.floor(u)}px`)};i();let a=new ResizeObserver(i);return a.observe(t),a.observe(r),window.addEventListener(`resize`,i),window.visualViewport?.addEventListener(`resize`,i),window.visualViewport?.addEventListener(`scroll`,i),()=>{a.disconnect(),window.removeEventListener(`resize`,i),window.visualViewport?.removeEventListener(`resize`,i),window.visualViewport?.removeEventListener(`scroll`,i)}},[e.preferBelow]);let r=e.commands[e.activeIndex];return(0,_.useEffect)(()=>{r&&(n.current?.querySelector(`[data-command-index="${e.activeIndex}"]`))?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[r,e.activeIndex]),e.draft?(0,K.jsx)(`div`,{ref:n,className:`slash-command-menu slash-command-state`,role:`status`,children:t(`commandSessionRequired`)}):e.commandDiscovery.status===`idle`||e.commandDiscovery.status===`loading`?(0,K.jsx)(`div`,{ref:n,className:`slash-command-menu slash-command-state`,role:`status`,children:t(`commandsLoading`)}):e.commandDiscovery.status===`error`?(0,K.jsxs)(`div`,{ref:n,className:`slash-command-menu slash-command-state`,role:`alert`,children:[(0,K.jsx)(`strong`,{children:t(`commandsUnavailable`)}),(0,K.jsx)(`span`,{children:e.commandDiscovery.error})]}):e.commandDiscovery.status===`ready`&&e.commands.length===0?(0,K.jsx)(`div`,{ref:n,className:`slash-command-menu slash-command-state`,role:`status`,children:t(`commandsNoMatch`)}):(0,K.jsxs)(`div`,{ref:n,className:`slash-command-menu`,children:[(0,K.jsx)(`div`,{id:jN,role:`listbox`,"aria-label":t(`commands`),children:e.commands.map((n,r)=>{let i=n.availability===`unsupported`;return(0,K.jsxs)(`button`,{id:MN(r),"data-command-index":r,className:`slash-command-option`,type:`button`,role:`option`,"aria-selected":r===e.activeIndex,"aria-disabled":i,disabled:i,onMouseEnter:()=>e.onSelect(r),onMouseDown:e=>e.preventDefault(),onClick:()=>e.onComplete(n),children:[(0,K.jsx)(`span`,{className:`slash-command-icon`,children:(0,K.jsx)(PN,{source:n.source})}),(0,K.jsxs)(`span`,{className:`slash-command-copy`,children:[(0,K.jsxs)(`span`,{className:`slash-command-heading`,children:[(0,K.jsxs)(`strong`,{children:[`/`,n.name]}),(0,K.jsx)(`span`,{children:t(`commandSource_${n.source}`)})]}),n.description&&(0,K.jsx)(`span`,{children:n.description}),i&&(0,K.jsx)(`span`,{children:t(`commandUnavailable_${n.unavailableReason??`not_integrated`}`)}),n.support&&(0,K.jsx)(`span`,{children:t(`commandSupport_${n.support}`)})]}),(0,K.jsx)(`span`,{className:`slash-command-support`,children:i?t(`commandUnsupported`):n.action?t(`commandOpensPanel`):n.argumentHint?t(`commandAcceptsArguments`):null})]},`${n.source}:${n.name}`)})}),e.commandDiscovery.commandsOmitted>0&&(0,K.jsx)(`div`,{className:`slash-command-bounded`,role:`status`,children:t(`commandsBounded`,{count:e.commandDiscovery.commandsOmitted})})]})}function IN(e){return{key:JSON.stringify([`workspace`,e]),kind:`workspace`,workspacePath:e}}function LN(e){return{key:JSON.stringify([`session`,e.id,e.path]),kind:`session`,workspacePath:e.cwd,sessionId:e.id,sessionPath:e.path}}function RN(e){let{t}=cr(),n=e.snapshot?.selectedSession,r=e.selectedPath===void 0?n?.path??null:e.selectedPath,i=n?.path===r?n.path:null,a=!e.workspaceDraft&&!e.sessionSwitching&&n&&i?LN(n):null,[o]=(0,_.useState)(()=>_j(gj())),s=(0,_.useSyncExternalStore)(o.subscribe,o.storageState),c=(0,_.useRef)(a??IN(e.selectedWorkspace)),l=e.workspaceDraft||!n&&!e.snapshot?.currentSessionId?IN(e.selectedWorkspace):a??c.current,[u,d]=(0,_.useState)(()=>o.read(c.current.key)),f=(0,_.useRef)(u);f.current=u;let{prompt:p,images:m,files:h=[],caret:g}=u,v=p.trim().length,y=v>Hd,b=l.key,x=(0,_.useRef)(new Map),S=(0,_.useRef)(null),C=(0,_.useRef)(!1),w=e.modelSearch??{query:``,status:`idle`,models:[],totalMatches:0,matchesOmitted:0,error:null},[T,E]=(0,_.useState)(!1),[D,O]=(0,_.useState)(!1),[A,j]=(0,_.useState)(0),[M,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(null),[L,R]=(0,_.useState)(null),[ee,z]=(0,_.useState)(0),B=(0,_.useMemo)(()=>new rf,[]),V=(0,_.useRef)(null),H=(0,_.useRef)(b);(0,_.useEffect)(()=>{H.current!==b&&(H.current=b,F(null))},[b]);let[te,ne]=(0,_.useState)(!1),[re,ie]=(0,_.useState)(null),[ae,U]=(0,_.useState)(null),[oe,se]=(0,_.useState)(!1),[ce,le]=(0,_.useState)(null),[ue,pe]=(0,_.useState)(null),me=(0,_.useRef)(null),W=(0,_.useRef)(null),he=(0,_.useRef)(null),ge=(0,_.useRef)(null),_e=(0,_.useRef)(!1),ve=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=!0;return o.ready.then(()=>{if(!e)return;let t=o.read(c.current.key);f.current=t,C.current=!0,d(t)}),()=>{e=!1}},[o]),(0,_.useEffect)(()=>{let e=e=>{!ge.current&&!Array.from(x.current.values()).some(e=>e.pending)&&!(o.storageState().status!==`saved`&&(o.hasContent()||o.hasUnsavedChanges()))||(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[o]),(0,_.useLayoutEffect)(()=>{let e=me.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`,e.style.overflowY=e.scrollHeight>220?`auto`:`hidden`,C.current&&(C.current=!1,e.setSelectionRange(g,g)))},[p,g]),(0,_.useEffect)(()=>{if(M||!_e.current)return;_e.current=!1;let e=window.setTimeout(()=>{me.current?.focus(),me.current?.setSelectionRange(g,g)},0);return()=>window.clearTimeout(e)},[g,M]);let ye=(0,_.useRef)(null),be=(0,_.useRef)(!1);(0,_.useLayoutEffect)(()=>{let n=c.current;if(n.key===l.key)return;W.current=null;let r=o.read(l.key),i=!1;if(n.kind===`workspace`&&l.kind===`session`&&n.workspacePath===l.workspacePath&&e.createdSession?.sessionId===l.sessionId&&e.createdSession.sessionPath===l.sessionPath&&e.createdSession.workspacePath===l.workspacePath&&o.move(n.key,l.key)){r=f.current;let e=ge.current;e?.ownerKey===n.key&&(e.ownerKey=l.key);let t=x.current.get(n.key);t&&(x.current.delete(n.key),t.owner=l,x.current.set(l.key,t))}else{if(n.kind===`session`&&l.kind===`workspace`&&n.workspacePath===l.workspacePath&&e.workspaceDraft&&e.sessionSwitching&&!r.prompt&&r.images.length===0&&!r.files?.length){let{prompt:e,images:t,files:n,caret:a}=f.current,s=o.edit(l.key,r,{prompt:e,images:t,files:n,caret:a});s?r=s:i=!0}ge.current?.controller.abort(),ge.current=null,ne(!1)}c.current=l,f.current=r,C.current=!0,_e.current=!1,d(r),ie(i?t(`draftLimit`):null),U(null),pe(null),se(!1),N(!1),O(!0)},[o,l,e.workspaceDraft,e.sessionSwitching,e.createdSession,t]),(0,_.useLayoutEffect)(()=>()=>{ge.current?.controller.abort(),ge.current=null},[]);let xe=(0,_.useCallback)((e,n=b)=>{if(c.current.key!==n)return!1;let r=f.current,i=o.edit(n,r,e);return i?(i.revision!==r.revision&&(x.current.get(n)?.pending||x.current.delete(n),ie(e=>e===t(`draftLimit`)?null:e)),e.prompt!==void 0&&(!e.prompt.trim()||e.prompt.startsWith(`/`))&&(W.current=null),f.current=i,d(i),!0):(ie(t(`draftLimit`)),!1)},[o,b,t]);(0,_.useEffect)(()=>{let t=W.current;t&&(e.workspaceDraft||e.snapshot?.runtime.plan!==`ready`||e.snapshot.runtime.planRevision!==t.planRevision||e.snapshot.currentSessionId!==t.sessionId||e.snapshot.selectedSession?.path!==t.sessionPath||r!==t.sessionPath)&&(W.current=null)},[e.snapshot?.runtime.plan,e.snapshot?.runtime.planRevision,e.snapshot?.currentSessionId,e.snapshot?.selectedSession?.path,e.workspaceDraft,r]);let Ce=!!(!e.workspaceDraft&&n?.id&&rj(e.snapshot,n)&&r===n.path),we=!!(e.selectedWorkspace&&(e.workspaceDraft||!n&&!e.snapshot?.currentSessionId)),Te=!!(!e.workspaceDraft&&n&&r===n.path),G=Te||we,Ee=Ce&&e.snapshot?.selectedExecution?.sessionId===n?.id&&e.snapshot?.selectedExecution?.sessionPath===n?.path&&e.snapshot?.selectedExecution?.compaction?.state===`running`,Oe=!e.workspaceDraft&&(Ce?e.snapshot?.runtime.status===`running`||e.liveRunning:e.snapshot?.selectedExecution?.sessionId===n?.id&&e.snapshot?.selectedExecution?.sessionPath===n?.path&&e.snapshot?.selectedExecution?.status===`running`),ke=Ce&&Oe&&!!(e.activeTurn??e.snapshot?.runtime.activeTurn),Ae=e.activeTurn??e.snapshot?.runtime.activeTurn,je=Ce&&Oe&&!Ee&&!e.turnCancellationPending&&Ae?.sessionId===n?.id&&!!Ae?.commandId,Ne=ue?.ownerKey===b?ue:null,Pe=e.sessionSwitching||!!e.planSelectionPending||!G&&!!e.selectedWorkspace,Fe=e.commandDiscovery??{sessionId:null,status:`idle`,commands:[],totalAvailable:0,commandsOmitted:0,error:null},Ie=/^\/[^\s/]*$/u.test(p)&&g>0,Le=T&&Ie&&!D&&G&&!e.sessionSwitching,Re=Ce?n?.id:null,Be=Ie?p.slice(1):``,Ve=(0,_.useMemo)(()=>NN(Fe.commands,Be),[Be,Fe.commands]),He=Le&&!e.workspaceDraft&&Fe.status===`ready`&&Ve.length>0,Ue=Ce&&!p.trim()&&!e.sessionSwitching,We=G&&!!e.selectedWorkspace&&!e.sessionSwitching&&!e.planSelectionPending,Ge=(0,_.useRef)(e.addSourcesRequest?.revision??0);(0,_.useEffect)(()=>{let r=e.addSourcesRequest;if(!(!r||r.revision===Ge.current)&&(Ge.current=r.revision,!(!We||n?.id!==r.sessionId||n.path!==r.path))){if(r.feedback){let{filePath:e,side:n,line:i,code:a}=r.feedback,o=`${YM(e)} — ${t(n===`new`?`sourceFeedbackNew`:`sourceFeedbackOld`,{path:e,line:i})}\n> ${a.split(` +`)),t===e.text&&(!f||f.revision===e.artifact.revision)?Vk.delete(u):Vk.set(u,{text:t,revision:f?.revision??e.artifact.revision}),l(null),a())},discard:()=>{Vk.delete(u),l(null),a()},reconcile:()=>{!f||!e||e.truncated||(Vk.set(u,{text:f.text,revision:e.artifact.revision}),l(null),a())},save:async()=>{if(!(!f||!e||o||!p)){s(!0),l(null);try{let t=await n.saveArtifact(e.artifact,f.revision,f.text);Vk.get(u)===f&&Vk.delete(u),d.current===u&&(r(f.text,t.revision),l({key:u,error:!1,text:i(`filesSaved`)}))}catch(e){d.current===u&&l({key:u,error:!0,text:e instanceof sf&&e.code===`ARTIFACT_CHANGED`?i(`filesSaveConflict`):i(`filesSaveFailed`)})}finally{s(!1),a()}}},message:c?.key===u?c:null}}function Wk({artifact:e,client:t}){let{t:n}=cr(),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),{sessionId:l,handle:u,revision:d}=e;return(0,_.useEffect)(()=>{let e=new AbortController,r;return i(null),o(null),t.downloadArtifact({sessionId:l,handle:u,revision:d},e.signal).then(async t=>{let a=df(new Uint8Array(await t.slice(0,12).arrayBuffer()));if(!e.signal.aborted){if(!a)throw Error(n(`artifactImagePreviewFailed`));r=URL.createObjectURL(new Blob([t],{type:a})),i({url:r,loaded:!1})}}).catch(t=>{e.signal.aborted||o(t instanceof Error?t.message:n(`artifactImagePreviewFailed`))}),()=>{e.abort(),r&&URL.revokeObjectURL(r)}},[l,u,d,t,n]),a?(0,K.jsxs)(`div`,{role:`alert`,className:`evidence-warning`,children:[(0,K.jsx)(`p`,{children:n(`artifactImagePreviewFailed`)}),a!==n(`artifactImagePreviewFailed`)&&(0,K.jsx)(`small`,{children:a})]}):(0,K.jsxs)(`div`,{className:`artifact-image-preview`,"data-original":s,children:[(0,K.jsxs)(`div`,{className:`file-preview-toolbar`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-pressed":!s,onClick:()=>c(!1),children:n(`filesFitImage`)}),(0,K.jsx)(`button`,{type:`button`,"aria-pressed":s,onClick:()=>c(!0),children:n(`filesOriginalImage`)})]}),!r?.loaded&&(0,K.jsx)(`p`,{role:`status`,children:n(`readingFile`)}),(0,K.jsx)(`div`,{className:`file-media-viewport`,children:r&&(0,K.jsx)(`img`,{src:r.url,alt:e.name,hidden:!r.loaded,onLoad:()=>i(e=>e?{...e,loaded:!0}:null),onError:()=>o(n(`artifactImagePreviewFailed`))})})]})}var Gk=(0,_.forwardRef)(function({sessionId:e,sessionPath:t,children:n,disabled:r=!1,embedded:i=!1,active:a=!0,onOpen:o,onClose:s},c){let{t:l}=cr(),u=(0,_.useMemo)(()=>new lf,[]),d=kk(),f=i?d?.artifact:void 0,[p,m]=(0,_.useState)(()=>f?{sessionId:e,sessionPath:t,reference:f.reference}:null),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(f?.source??!1),[b,x]=(0,_.useState)(f?.editing??!1),[S,C]=(0,_.useState)(null),[w,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(!1),[O,k]=(0,_.useState)(null),[A,j]=(0,_.useState)(!1),[M,N]=(0,_.useState)(!1),P=(0,_.useRef)(null),F=(0,_.useRef)(null),L=(0,_.useRef)(0),R=(0,_.useRef)(null),z=(0,_.useRef)(null),B=(0,_.useRef)(null),V=(0,_.useRef)(null),H=(0,_.useRef)(f?.scroll??0),te=(0,_.useRef)(!!f);(0,_.useLayoutEffect)(()=>{!i||!d||(d.artifact=p?{reference:h?.artifact.path?encodeURI(h.artifact.path):p.reference,source:v,editing:b,scroll:H.current,document:d.artifact?.document}:void 0)},[i,d,p,h?.artifact.path,v,b]);let ne=(0,_.useRef)(null),re=(0,_.useRef)(new Set),ie=(0,_.useRef)(void 0),ae=(0,_.useRef)(!1),U=(0,_.useRef)(null),se=JSON.stringify([e,t,r]),le=(0,_.useRef)(se);le.current=se;let ue=!!(p&&!r&&p.sessionId===e&&p.sessionPath===t);(0,_.useEffect)(()=>()=>{U.current!==null&&(window.cancelAnimationFrame(U.current),U.current=null)},[se]);let de=(0,_.useCallback)((n,i,a)=>{if(r)return;let s=document.activeElement,c=a??(s instanceof HTMLElement?s:null),l=!!(i||c?.closest(`.artifact-panel`));l||(F.current=c),o?.(l),U.current!==null&&(window.cancelAnimationFrame(U.current),U.current=null),ae.current=!0,L.current++,g(null),y(!1),x(!1),H.current=0,te.current=!1,C(null),T(!1),k(null),j(!1),ie.current=i,m({reference:n,parent:i,sessionId:e,sessionPath:t})},[r,o,e,t]),fe=(0,_.useCallback)(({restoreFocus:e=!0}={})=>{if(!p)return;let t=++L.current,n=F.current,r=document.activeElement,i=ue?`user`:`context`;if(F.current=null,ae.current=!1,ie.current=void 0,m(null),g(null),k(null),P.current?.abort(),s?.(i),U.current!==null&&window.cancelAnimationFrame(U.current),i===`context`||!e){U.current=null;return}U.current=window.requestAnimationFrame(()=>{U.current=null,t===L.current&&le.current===se&&(document.activeElement===document.body||document.activeElement===r||document.activeElement===n)&&n?.isConnected&&n.checkVisibility({visibilityProperty:!0})&&n.focus()})},[s,p,ue,se]);Ki({isActive:ue&&a,onDismiss:fe,getContainer:()=>R.current,isPresent:()=>R.current?.contains(document.activeElement)??!1}),(0,_.useImperativeHandle)(c,()=>({close:fe}),[fe]),(0,_.useLayoutEffect)(()=>{b?B.current?.focus({preventScroll:!0}):V.current&&(V.current.scrollTop=H.current)},[b]),(0,_.useLayoutEffect)(()=>{!a||!h||!te.current||!V.current||(V.current.scrollTop=H.current,te.current=!1)},[a,h]),(0,_.useEffect)(()=>{!p||ue||(L.current++,m(null),g(null),k(null),ae.current=!1,F.current=null,ie.current=void 0,s?.(`context`))},[p,ue,s]),(0,_.useEffect)(()=>{if(!p||!e||!ue||!a)return;let t=new AbortController,n,r=p.parent,i,o=!1,s,c=!1,l=2e3;ae.current&&(ae.current=!1,z.current?.focus());let d=async()=>{if(document.visibilityState===`hidden`){i=setTimeout(d,2e3);return}try{if(n||=(await(p.external?u.authorizeArtifact(e,p.reference,t.signal):u.resolveArtifact(e,p.reference,r,t.signal))).handle,r&&=(u.releaseArtifact(e,r).catch(()=>void 0),void 0),o){u.releaseArtifact(e,n).catch(()=>void 0);return}if(s){if((await u.artifactMetadata(e,n,t.signal)).identity===s){o||C(null),l=Math.min(l*2,3e4);return}if(c){o||j(!0),l=3e4;return}}let i=await u.artifactPreview(e,n,t.signal);o||(s=i.identity,c=i.text!==void 0,l=2e3,g(e=>e?.artifact.path===i.artifact.path&&e.artifact.revision===i.artifact.revision?{...i,text:e.text,truncated:e.truncated,nextOffset:e.nextOffset}:i),C(null))}catch(e){let t=e instanceof sf&&[401,403,410].includes(e.status);!o&&t&&(g(null),ne.current?.abort()),o||T(e instanceof sf&&e.code===`ARTIFACT_DENIED`),l=Math.min(l*2,3e4),o||C(e instanceof Error?e.message:`Unable to read file`),t&&(o=!0)}finally{o||(i=setTimeout(d,l))}};return d(),()=>{o=!0,t.abort(),clearTimeout(i),ne.current?.abort(),P.current?.abort(),N(!1),D(!1),n&&n!==ie.current&&u.releaseArtifact(e,n).catch(()=>void 0),r&&u.releaseArtifact(e,r).catch(()=>void 0);for(let e of re.current)URL.revokeObjectURL(e);re.current.clear()}},[u,p,ue,e,a]);let me=(0,_.useMemo)(()=>({open:de,disabled:r}),[de,r]),W=h?.artifact.path??p?.reference??``,he=h?.artifact.name??W.split(/[\\/]/u).at(-1)??W,ge=Uk(h,t,u,(e,t)=>{g(n=>n&&{...n,text:e,truncated:!1,nextOffset:void 0,artifact:{...n.artifact,revision:t,bytes:new TextEncoder().encode(e).length}}),j(!1),m(e=>e&&{...e})}),ve=async()=>{if(!h||E)return;let e=new AbortController;ne.current=e,D(!0);try{let t=await u.downloadArtifact(h.artifact,e.signal);if(e.signal.aborted)return;let n=URL.createObjectURL(t);re.current.add(n);let r=document.createElement(`a`);r.href=n,r.download=h.artifact.name,r.click(),setTimeout(()=>{URL.revokeObjectURL(n),re.current.delete(n)},1e3)}catch(t){e.signal.aborted||C(t instanceof Error?t.message:`Download failed`)}finally{e.signal.aborted||D(!1)}},ye=async()=>{if(!h?.nextOffset||P.current)return;let e=h,t=new AbortController;P.current=t,N(!0);try{let n=await u.artifactPreview(e.artifact.sessionId,e.artifact.handle,t.signal,{offset:e.nextOffset,revision:e.artifact.revision});t.signal.aborted||g(t=>t?.artifact.handle===e.artifact.handle&&t.artifact.revision===n.artifact.revision?{...n,text:(t.text??``)+(n.text??``)}:t)}catch(e){t.signal.aborted||C(e instanceof Error?e.message:l(`filesReadFailed`))}finally{P.current===t&&(P.current=null,N(!1))}};return(0,K.jsxs)(_k.Provider,{value:me,children:[n,p&&ue&&(0,K.jsx)(Ti,{children:(0,K.jsxs)(`aside`,{ref:R,className:`artifact-panel${i?` artifact-panel-embedded`:``}`,"aria-label":l(`filePreview`),onKeyDown:e=>{if(i&&(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`){e.preventDefault(),e.stopPropagation(),ge.save();return}},children:[(0,K.jsxs)(`header`,{children:[(0,K.jsxs)(`div`,{className:`artifact-title`,children:[(0,K.jsx)(`small`,{title:W,children:i?W.split(/[\\/]/u).slice(0,-1).at(-1)||l(`files`):`${l(`filePreview`)} · ${l(`artifactReadOnly`)}`}),i&&(0,K.jsx)(ee,{"aria-hidden":`true`}),(0,K.jsx)(`h2`,{title:W,children:he}),ge.dirty&&(0,K.jsx)(`span`,{className:`file-unsaved`,role:`img`,title:l(`filesUnsaved`),"aria-label":l(`filesUnsaved`),children:`●`})]}),(0,K.jsxs)(`div`,{className:`artifact-header-actions`,children:[i&&h?.text!==void 0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`fieldset`,{className:`file-mode-switch`,"aria-label":l(`filesMode`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-pressed":!b,onClick:()=>x(!1),children:l(`filesPreview`)}),(0,K.jsx)(`button`,{type:`button`,"aria-pressed":b,disabled:!ge.canEdit,title:l(h.truncated?`filesEditLoadFirst`:h.artifact.editable?`filesEdit`:`filesEditUnavailable`),onClick:()=>{H.current=V.current?.scrollTop??0,x(!0)},children:l(`filesEdit`)})]}),(b||ge.dirty||ge.saving)&&(0,K.jsxs)(`button`,{type:`button`,className:`file-save-button`,title:`${l(`filesSave`)} (Cmd/Ctrl+S)`,disabled:!ge.dirty||ge.saving||!ge.canEdit,onClick:()=>void ge.save(),children:[(0,K.jsx)(pt,{"aria-hidden":`true`}),l(ge.saving?`filesSaving`:ge.dirty?`filesSave`:`filesSaved`)]}),ge.dirty&&(0,K.jsx)(`button`,{type:`button`,title:l(`filesDiscard`),"aria-label":l(`filesDiscard`),disabled:ge.saving,onClick:()=>{window.confirm(l(`filesDiscardConfirm`))&&ge.discard()},children:(0,K.jsx)(ft,{"aria-hidden":`true`})})]}),!i&&h?.text!==void 0&&Bk(he)&&(0,K.jsxs)(`button`,{type:`button`,className:`file-source-toggle`,"aria-pressed":v,onClick:()=>y(e=>!e),children:[v?(0,K.jsx)(_e,{"aria-hidden":`true`}):(0,K.jsx)(ce,{"aria-hidden":`true`}),l(v?`filesPreview`:`filesSource`)]}),(0,K.jsx)(Cd,{content:l(`copyFilePath`),placement:`below`,children:(0,K.jsx)(`button`,{className:`artifact-icon-button`,type:`button`,"aria-label":l(`copyFilePath`),onClick:()=>{let e=++L.current;wd(W).then(t=>{e===L.current&&k(t?`copied`:`failed`)})},children:O===`copied`?(0,K.jsx)(I,{"aria-hidden":`true`}):(0,K.jsx)(oe,{"aria-hidden":`true`})})}),(0,K.jsx)(Cd,{content:l(`refreshFile`),placement:`below`,children:(0,K.jsxs)(`button`,{className:`artifact-icon-button`,type:`button`,"aria-label":l(`refreshFile`),onClick:()=>{L.current++,k(null),C(null),T(!1),j(!1),ie.current=void 0,m(n=>n?{sessionId:e,sessionPath:t,reference:h?encodeURI(h.artifact.path):n.reference,...n.external?{external:!0}:{},...h?{}:{parent:n.parent}}:null)},children:[(0,K.jsx)(dt,{"aria-hidden":`true`}),` `,l(`refreshFile`)]})}),(0,K.jsx)(Cd,{content:l(`downloadFile`),placement:`below`,children:(0,K.jsxs)(`button`,{className:`artifact-icon-button`,type:`button`,"aria-label":l(E?`downloadingFile`:`downloadFile`),disabled:!h||E,onClick:()=>void ve(),children:[(0,K.jsx)(pe,{"aria-hidden":`true`}),` `,l(E?`downloadingFile`:`downloadFile`)]})}),(0,K.jsx)(Cd,{content:l(`closePreview`),placement:`below`,children:(0,K.jsx)(`button`,{className:`artifact-icon-button`,ref:z,type:`button`,"aria-label":l(`closePreview`),onClick:()=>fe(),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})})]})]}),(0,K.jsxs)(`div`,{className:`artifact-panel-body`,ref:V,onScroll:e=>{te.current||(H.current=e.currentTarget.scrollTop,i&&d?.artifact&&(d.artifact.scroll=H.current))},children:[!i&&(0,K.jsx)(`div`,{className:`artifact-source`,children:(0,K.jsx)(`code`,{title:W,children:W})}),O&&(0,K.jsx)(`p`,{role:`status`,children:l(O===`copied`?`filePathCopied`:`copyFailed`)}),S&&(0,K.jsxs)(`p`,{role:`status`,className:`evidence-warning`,children:[h?l(`artifactOlderPreview`):``,S]}),A&&(0,K.jsx)(`p`,{className:`evidence-warning`,role:`status`,children:l(`filesContentChanged`)}),ge.message&&(0,K.jsx)(`p`,{role:`status`,className:ge.message.error?`evidence-warning`:`file-save-status`,children:ge.message.text}),ge.conflict&&(0,K.jsxs)(`div`,{className:`file-conflict`,children:[(0,K.jsx)(`p`,{children:l(`filesSaveConflict`)}),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{children:l(`filesDiskVersion`)}),(0,K.jsx)(`pre`,{children:h?.text})]}),(0,K.jsx)(`button`,{type:`button`,disabled:!ge.canEdit||ge.saving,onClick:ge.reconcile,children:l(`filesReconcile`)})]}),w&&!p.external&&/^(?:\/(?!\/)|[a-z]:[\\/])/iu.test(p.reference)&&(0,K.jsxs)(`div`,{className:`artifact-external-access`,children:[(0,K.jsx)(`p`,{children:l(`artifactExternalAccess`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{ae.current=!0,C(null),T(!1),m({...p,parent:void 0,external:!0})},children:l(`artifactAuthorizeFile`)})]}),!h&&!S&&(0,K.jsx)(`p`,{role:`status`,children:l(`readingFile`)}),h&&(0,K.jsxs)(K.Fragment,{children:[h.truncated&&(0,K.jsx)(`p`,{className:`evidence-warning`,children:l(`artifactPreviewTruncated`)}),/\.(?:png|jpe?g|gif|webp)$/iu.test(h.artifact.name)?(0,K.jsx)(Wk,{artifact:h.artifact,client:u},JSON.stringify([h.artifact.sessionId,h.artifact.path,h.artifact.handle,h.artifact.revision])):(0,K.jsxs)(_k.Provider,{value:{open:de,disabled:r,parent:h.artifact.handle,sessionId:e},children:[i&&ge.canEdit&&(0,K.jsx)(`textarea`,{ref:B,hidden:!b,className:`file-editor`,"aria-label":l(`filesEditor`),spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:1048576,value:ge.text,disabled:ge.saving,onChange:e=>ge.change(e.currentTarget.value)}),!(i&&b&&ge.canEdit)&&(0,K.jsx)(zk,{preview:ge.dirty?{...h,text:ge.text}:h,client:u,source:v},`${h.artifact.path}:${h.artifact.revision}`)]}),h.nextOffset!==void 0&&(0,K.jsx)(`button`,{type:`button`,className:`file-read-more`,disabled:M||A,onClick:()=>void ye(),children:l(M?`readingFile`:`filesReadMore`)}),(0,K.jsxs)(`details`,{className:`artifact-file-details`,children:[(0,K.jsx)(`summary`,{children:l(`artifactFileDetails`)}),(0,K.jsx)(`p`,{className:`artifact-session`,children:l(`artifactSession`,{sessionId:e})}),(0,K.jsxs)(`p`,{className:`artifact-revision`,children:[l(`artifactVersion`),`:`,` `,(0,K.jsx)(`code`,{children:h.artifact.revision}),` ·`,` `,l(`artifactBytes`,{count:h.artifact.bytes})]})]})]})]})]})})]})}),Kk=[`noopener`,`noreferrer`];function qk(e,t){if(e!==`_blank`)return{target:e,rel:t};let n=t?.split(/\s+/).filter(Boolean)??[];for(let e of Kk)n.includes(e)||n.push(e);return{target:e,rel:n.join(` `)}}var Jk=new Set([`option`,`tab`,`row`,`gridcell`,`columnheader`,`rowheader`,`treeitem`]),Yk={root:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,kg3NbH:`xf314gf`,kVAEAm:`x1n2onr6`,kB7OPa:`x9f619`,k9WMMc:`x1yc453h`,kaIpWk:`xh6dtrn`,$$css:!0},alignStart:{kGNEyG:`x1cy8zhl`,$$css:!0},interactive:{kkrTdU:`x1ypdohk x16khyan`,k1ekBW:`x15406qy`,kIyJzY:`xkvfbh3`,kAMwcw:`xlr8y92`,$$css:!0},highlighted:{kWkggS:`x1lmrjuc`,$$css:!0},selected:{kWkggS:`xgcxg3y`,$$css:!0},disabled:{kkrTdU:`xt0e3qv`,kfzvcC:`x47corl`,$$css:!0},inlineLabel:{kmuXW:`x2lah0s`,$$css:!0},inlineDescription:{kmuXW:`xs83m0k`,k7Eaqz:`xeuugli`,$$css:!0},label:{kMwMTN:`x5tbw38`,kGuDYH:`xjm74w1`,kLWn49:`xw6l6zx`,$$css:!0},labelSingleTruncate:{kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,$$css:!0},labelMultiTruncate:{kVQacm:`xb3r6kr`,k1xSpc:`x104kibb`,kgKLqz:`x1ua5tub`,$$css:!0},description:{kMwMTN:`x1gb3s7i`,kGuDYH:`x141an7d`,kLWn49:`x1ltkj2j`,$$css:!0},descriptionSingleTruncate:{kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,$$css:!0},descriptionMultiTruncate:{kVQacm:`xb3r6kr`,k1xSpc:`x104kibb`,kgKLqz:`x1ua5tub`,$$css:!0}},Xk={lineClamp:e=>[{kJFfOR:e==null?e:`x1yhjpo9`,$$css:!0},{"--x-WebkitLineClamp":e??void 0}]},Zk={compact:{k8WAf4:`xu0wf1k`,$$css:!0},balanced:{k8WAf4:`xce4md1`,$$css:!0},spacious:{k8WAf4:`x8o8v82`,kg3NbH:`xrrkdod`,$$css:!0}};function Qk({as:e=`div`,marker:t,startContent:n,label:r,description:i,endContent:a,align:o=`center`,density:s=`balanced`,labelLines:c,descriptionLines:l,layout:u=`stacked`,onClick:d,interactiveRef:f,href:p,target:m,rel:h,isHighlighted:g=!1,isSelected:v=!1,isDisabled:y=!1,xstyle:b,className:x,style:S,ref:C,role:w,...T}){let E=us(),D=f!=null,O=(0,_.useRef)(null),{onClick:k}=Ya({containerRef:O,interactiveRef:f??void 0,disabled:y});sd(`Item`,"`interactiveRef` is mutually exclusive with `onClick`/`href`. In delegation mode the row only forwards clicks to the referenced control, so `onClick`/`href` are ignored. Drop one of them.",D&&(d!=null||p!=null));let A=d!=null||p!=null||D,{target:j,rel:M}=qk(m,h),N=w!=null,P=w!=null&&Jk.has(w),F=typeof r==`string`,I=typeof i==`string`,L=c==null?F?Yk.labelSingleTruncate:null:c===1?Yk.labelSingleTruncate:Yk.labelMultiTruncate,R=u===`inline`&&i!=null,ee=l==null?I||R?Yk.descriptionSingleTruncate:null:l===1?Yk.descriptionSingleTruncate:Yk.descriptionMultiTruncate,z=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{...Sr(Yk.label,R&&Yk.inlineLabel,L,c!=null&&c>1&&Xk.lineClamp(c)),children:r}),i!=null&&(0,K.jsx)(`span`,{...Sr(Yk.description,R&&Yk.inlineDescription,ee,l!=null&&l>1&&Xk.lineClamp(l)),children:i})]}),B=e=>{y||e.target.closest(`button, a, input, select, textarea`)||d?.(e)},V=(0,K.jsxs)(K.Fragment,{children:[t,n!=null&&(0,K.jsx)(`span`,{className:`x3psx0u x78zum5`,children:n}),N||D?(0,K.jsx)(`span`,{...{0:{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h`},2:{className:`x78zum5 x98rzlu xeuugli x1yc453h x1q0g3np x6s0dn4 x1lfs0n9`},1:{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h xbyyjgo`},3:{className:`x78zum5 x98rzlu xeuugli x1yc453h x1q0g3np x6s0dn4 x1lfs0n9 xbyyjgo`}}[!!R<<1|!!y<<0],children:z}):p==null?d==null?(0,K.jsx)(`span`,{...{0:{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h`},2:{className:`x78zum5 x98rzlu xeuugli x1yc453h x1q0g3np x6s0dn4 x1lfs0n9`},1:{className:`x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h xbyyjgo`},3:{className:`x78zum5 x98rzlu xeuugli x1yc453h x1q0g3np x6s0dn4 x1lfs0n9 xbyyjgo`}}[!!R<<1|!!y<<0],children:z}):(0,K.jsx)(`button`,{type:`button`,onClick:d,disabled:y,...{0:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1a2a7pz`},2:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 x98rzlu xeuugli x1yc453h x1a2a7pz x1q0g3np x6s0dn4 x1lfs0n9`},1:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1a2a7pz xbyyjgo`},3:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 x98rzlu xeuugli x1yc453h x1a2a7pz x1q0g3np x6s0dn4 x1lfs0n9 xbyyjgo`}}[!!R<<1|!!y<<0],children:z}):(0,K.jsx)(E,{href:p,target:j,rel:M,"aria-disabled":y||void 0,tabIndex:y?-1:void 0,...{0:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz`},2:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz x1q0g3np x6s0dn4 x1lfs0n9`},1:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 xdt5ytf x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz xbyyjgo`},3:{className:`xmper1u x16khyan xln7xf2 x1heor9g x78zum5 x98rzlu xeuugli x1yc453h x1hl2dhg x1a2a7pz x1q0g3np x6s0dn4 x1lfs0n9 xbyyjgo`}}[!!R<<1|!!y<<0],children:z}),a!=null&&(0,K.jsx)(`span`,{...{0:{className:`x3psx0u x78zum5 xvc5jky`},1:{className:`x3psx0u x78zum5 xvc5jky xbyyjgo`}}[!!y<<0],children:a})]}),H=Ao(C,O);return(0,K.jsx)(e,{ref:D?H:C,...T,"aria-selected":P&&v||void 0,"aria-current":T[`aria-current`]??(v&&!P?!0:void 0),"aria-disabled":y||void 0,...oa(ba(`item`,{density:s,align:o}),Wa.focusWithin(Yk.root,Zk[s],o===`start`&&Yk.alignStart,A&&Yk.interactive,A&&ds.backgroundColor,g&&Yk.highlighted,v&&Yk.selected,y&&!N&&Yk.disabled,b),x,S),role:w,onClick:D?k:N?d:A?B:void 0,children:V})}Qk.displayName=`Item`;var $k=(0,_.createContext)(null);$k.displayName=`DropdownMenuContext`;function eA(){return(0,_.use)($k)}var tA=(0,_.createContext)(null);tA.displayName=`DropdownMenuRadioGroupContext`;function nA(e,t){if(t||e.pointerType!==`mouse`)return;let n=e.currentTarget;n!==n.ownerDocument.activeElement&&n.focus()}var rA={root:{kB7OPa:`x9f619`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`x1ws5lxm`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0},destructive:{kMwMTN:`xjt36v0`,"--_item-label-color":`xufyqxy`,"--_item-description-color":`xqlix59`,$$css:!0}},iA={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}};function aA({icon:e,label:t,description:n,onClick:r,isDisabled:i=!1,endContent:a,hasCloseOnSelect:o=!0,variant:s=`default`,xstyle:c,className:l,style:u}){let d=eA(),f=d?.menuSize??`md`,p=(0,_.useCallback)(()=>{i||(r?.(),o&&d?.closeMenu())},[i,r,o,d]),m=(0,_.useCallback)(e=>nA(e,i),[i]),h=s===`destructive`;return(0,K.jsx)(Qk,{role:`menuitem`,tabIndex:i?void 0:-1,onPointerMove:m,startContent:e?Cu(e,{size:`sm`,color:h?`error`:`secondary`}):void 0,label:t,description:n,endContent:a,onClick:p,isDisabled:i,xstyle:[rA.root,iA[f],h&&rA.destructive,i&&rA.disabled,c],...oa(ba(`dropdown-menu-item`,{size:f,variant:h?`destructive`:null}),{className:l,style:u})})}aA.displayName=`DropdownMenuItem`;var oA={horizontal:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kzqmXN:`xh8yej3`,$$css:!0},vertical:{k1xSpc:`x3nfvp2`,kXwgrk:`xdt5ytf`,kGNEyG:`x6s0dn4`,kZKoxP:`x5yr21d`,$$css:!0}},sA={horizontalLine:{kZKoxP:`xsyqizj`,kzQI83:`x1iyjqo2`,kmuXW:`xs83m0k`,$$css:!0},verticalLine:{kzqmXN:`xjk4fl7`,kzQI83:`x1iyjqo2`,kmuXW:`xs83m0k`,$$css:!0},subtle:{kWkggS:`x1m4xfpy`,$$css:!0},strong:{kWkggS:`x7njt3n`,$$css:!0}},cA={horizontal:{keTefX:`xojxgvx`,k71WvV:`x1fcf3bl`,kzqmXN:`xx6qvi6`,$$css:!0},vertical:{keoZOQ:`x1sa9bsh`,k1K539:`x6h7pi7`,kZKoxP:`x12qplqi`,$$css:!0}};function lA({orientation:e=`horizontal`,label:t,variant:n=`subtle`,isFullBleed:r=!1,xstyle:i,className:a,style:o,ref:s,"aria-label":c,"aria-labelledby":l,...u}){let d=e===`horizontal`,f=(0,_.useId)(),p=l??(t&&c==null?f:void 0);return(0,K.jsxs)(`div`,{ref:s,...u,role:`separator`,"aria-orientation":e,"aria-label":c,"aria-labelledby":p,...oa(ba(`divider`,{variant:n,orientation:e}),Sr(d?oA.horizontal:oA.vertical,r&&(d?cA.horizontal:cA.vertical),i),a,o),children:[(0,K.jsx)(`div`,{...Sr(d?sA.horizontalLine:sA.verticalLine,sA[n])}),t&&(0,K.jsx)(`div`,{id:f,...{0:{className:`x2lah0s xrrkdod x141an7d x1ltkj2j xv1l7n4`},1:{className:`x2lah0s x141an7d x1ltkj2j xv1l7n4 xnjsko4 x8o8v82`}}[!d<<0],children:t}),t&&(0,K.jsx)(`div`,{...Sr(d?sA.horizontalLine:sA.verticalLine,sA[n])})]})}lA.displayName=`Divider`;var uA={divider:{kqGvvJ:`xsq74q5`,$$css:!0}},dA=ba(`dropdown-menu-divider`).className;function fA({xstyle:e,className:t,style:n,ref:r}){return(0,K.jsx)(lA,{ref:r,xstyle:[uA.divider,e],className:t?`${dA} ${t}`:dA,style:n})}fA.displayName=`DropdownMenuDivider`;function pA(e){return!e||typeof window>`u`?!1:window.getComputedStyle(e).direction===`rtl`}var mA=new Set([`text`,`search`,`url`,`tel`,`email`,`password`,`number`]);function hA(e){if(e.isContentEditable)return e;let t=e.closest(`[contenteditable]`);return t&&t.getAttribute(`contenteditable`)!==`false`?t:null}function gA(e,t){if(!(e instanceof HTMLElement))return!1;let n=hA(e);if(n){let e=typeof window<`u`?window.getSelection():null;return e&&e.rangeCount>0&&!e.isCollapsed?!0:(n.textContent??``).length>0}let r=e.tagName===`TEXTAREA`,i=e.tagName===`INPUT`&&mA.has(e.type);if(!r&&!i)return!1;let{selectionStart:a,selectionEnd:o,value:s}=e;return a!==o||a==null?!0:t===`ArrowLeft`||t===`ArrowUp`||t===`Home`?a>0:t===`ArrowRight`||t===`ArrowDown`||t===`End`?ae.getAttribute(`aria-disabled`)===`true`||e.disabled===!0||e.hasAttribute(`disabled`),[]),f=(0,_.useCallback)(()=>{let e=u.current;if(!e)return[];let r=Array.from(e.querySelectorAll(t));return n?r.filter(t=>t.closest(n)===e):r},[t,n]),p=(0,_.useCallback)(e=>{let t=u.current;if(!t||!n)return!0;let r=e.target;return!r||r.closest(n)===t},[n]),m=(0,_.useCallback)((e,t,n,r)=>{let i=e.length;if(i===0)return-1;let a=t;for(let t=0;t=i){if(!r)return-1;a=(a+i)%i}let t=e[a];if(t&&!d(t))return a;a+=n}return-1},[d]),h=(0,_.useCallback)(()=>{let e=f(),t=document.activeElement;return e.findIndex(e=>e===t||e.contains(t))},[f]),g=(0,_.useCallback)((e,t)=>{e.getAttribute(`tabindex`)!==String(t)&&e.setAttribute(`tabindex`,String(t))},[]),v=(0,_.useCallback)(()=>{let e=f(),t=e.filter(e=>!d(e));if(t.length===0)return;let n=t.find(e=>e.getAttribute(`tabindex`)===`0`)??t[0];for(let t of e)g(t,t===n?0:-1)},[f,d,g]);wu(()=>{c&&v()});let y=(0,_.useCallback)((e,t)=>{let n=e[t];if(n){if(c)for(let t of e)g(t,t===n?0:-1);n.focus()}},[c,g]),b=(0,_.useCallback)(e=>{let t=f();if(t.length===0)return;let n=Math.max(0,Math.min(e,t.length-1));y(t,n)},[f,y]),x=(0,_.useCallback)(()=>{let e=f(),t=m(e,0,1,!1);return t!==-1&&(y(e,t),!0)},[f,m,y]),S=(0,_.useCallback)(()=>{let e=f(),t=m(e,e.length-1,-1,!1);return t!==-1&&(y(e,t),!0)},[f,m,y]),C=(0,_.useCallback)(()=>{c&&v()},[c,v]);return{listRef:u,handleKeyDown:(0,_.useCallback)(e=>{if(e.ctrlKey||e.metaKey||e.altKey||!p(e))return;if(e.key===`Escape`){i&&(e.preventDefault(),i());return}let t=a===`horizontal`||a===`both`,n=a===`vertical`||a===`both`,c=[],d=[];if(t){let t=e.key===`ArrowLeft`||e.key===`ArrowRight`?s??pA(u.current):!1;c.push(t?`ArrowLeft`:`ArrowRight`),d.push(t?`ArrowRight`:`ArrowLeft`)}n&&(c.push(`ArrowDown`),d.push(`ArrowUp`));let g=c.includes(e.key),_=d.includes(e.key),v=o&&e.key===`Home`,b=o&&e.key===`End`;if(!g&&!_&&!v&&!b||l&&(gA(e.target,e.key)||gA(document.activeElement,e.key)))return;let C=h(),w=f();if(g){let e=C===-1?0:C+1,t=m(w,e,1,r);t!==-1&&y(w,t)}else if(_){let e=C===-1?w.length-1:C-1,t=m(w,e,-1,r);t!==-1&&y(w,t)}else v?x():b&&S();e.preventDefault()},[h,f,r,a,s,o,l,m,y,x,S,i,p]),handleFocus:C,focusItem:b,focusFirst:x,focusLast:S,ownsEvent:p,getItems:f}}var vA=500,yA=300;function bA(e){let{show:t,hide:n,isOpen:r,isEnabled:i,showDelay:a=150,hideDelay:o=200,clickGuardMs:s=vA,itemSelector:c,popoverId:l,ownsFocus:u=!0}=e,d=Wl(`(hover: hover)`),f=(0,_.useRef)(null),p=(0,_.useRef)(null),m=(0,_.useRef)(null),h=(0,_.useRef)(!1),g=(0,_.useRef)(0),v=(0,_.useRef)(0),y=(0,_.useRef)(r);wu(()=>{let e=y.current;y.current=r,e&&!r&&(h.current=!1,v.current=0,g.current=Date.now())},[r]);let b=(0,_.useCallback)(()=>{f.current&&=(clearTimeout(f.current),null),p.current&&=(clearTimeout(p.current),null)},[]),x=(0,_.useRef)(()=>{}),{listRef:S,handleKeyDown:C,focusFirst:w}=_A({itemSelector:c,onEscape:()=>x.current()}),T=(0,_.useCallback)(()=>{let e=S.current?.contains(document.activeElement)??!1;n(),e&&m.current?.focus()},[n,S]);(0,_.useEffect)(()=>{x.current=()=>{b(),T()}},[b,T]),(0,_.useEffect)(()=>()=>b(),[b]);let E=(0,_.useCallback)(()=>{w()||S.current?.focus()},[w,S]),D=(0,_.useCallback)(()=>{if(!u){t();return}t({skipAutoFocus:!0}),E()},[u,t,E]),O=(0,_.useCallback)(()=>s>0&&v.current>0&&Date.now()-v.current{if(l&&e?.preventDefault(),b(),e!=null&&e.detail===0){g.current=0,h.current=!1,v.current=0,r?u&&E():D();return}if(!r){g.current=0,h.current=!1,v.current=0,D();return}if(O()){u&&E();return}T()},[l,b,r,u,O,D,E,T]),A=(0,_.useCallback)(()=>{if(!d||g.current>0&&Date.now()-g.current{v.current=Date.now(),t({skipAutoFocus:!0})};a>0?f.current=setTimeout(e,a):e()},[d,r,b,t,a]),j=(0,_.useCallback)(()=>{g.current=0,h.current&&(b(),p.current=setTimeout(()=>{n()},o))},[b,n,o]),M=(0,_.useCallback)(()=>{b()},[b]),N=(0,_.useCallback)(e=>{m.current=e},[]),P=(0,_.useCallback)(()=>{},[]),F=(0,_.useCallback)(e=>{},[]),I=(0,_.useCallback)(e=>{},[]);return i?{triggerProps:{onClick:k,onMouseEnter:A,onMouseLeave:j,...l?{popoverTarget:l}:null},contentProps:{onMouseEnter:M,onMouseLeave:j,onKeyDown:C},menuRef:S,focusFirst:w,focusMenu:E,confirmHoverOpen:O,close:T,setTriggerEl:N}:{triggerProps:{onClick:P,onMouseEnter:P,onMouseLeave:P},contentProps:{onMouseEnter:P,onMouseLeave:P,onKeyDown:I},menuRef:S,focusFirst:w,focusMenu:E,confirmHoverOpen:O,close:T,setTriggerEl:F}}function xA(e){return e.key.length===1&&!e.ctrlKey&&!e.metaKey&&e.key!==` `}function SA(e){let{getItemLabels:t,onMatch:n,getCurrentIndex:r,resetMs:i=750,isDisabled:a}=e,o=(0,_.useRef)(``),s=(0,_.useRef)(void 0),c=(0,_.useCallback)(()=>{o.current=``,s.current&&=(clearTimeout(s.current),void 0)},[]),l=(0,_.useCallback)(()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o.current=``,s.current=void 0},i)},[i]);return{onKeyDown:(0,_.useCallback)(e=>{let i=e.key===` `&&!e.ctrlKey&&!e.metaKey&&o.current.length>0;if(!xA(e)&&!i)return!1;let s=t();if(s.length===0)return!1;let c=e.key.toLowerCase(),u=o.current.length>0&&o.current.split(``).every(e=>e===c)?c:o.current+c;o.current=u,l();let d=r?.()??-1,f=s.length,p=d>=0,m=p?d:0,h=p&&u.length===1?1:0;for(let e=0;e`[role="${e}"]:not([aria-disabled="true"])`).join(`,`),TA=`[role="menu"]`,EA={root:{kB7OPa:`x9f619`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`x1ws5lxm`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},open:{kWkggS:`x1lmrjuc`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0}},DA={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}},OA={popover:{k7Eaqz:`x5w4yej`,$$css:!0},popoverCustomWidth:e=>[{k7Eaqz:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`xkj4a21`,$$css:!0},{"--x-minWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e)}]};function kA(e){let{icon:t,label:n,description:r,isDisabled:i=!1,hasSpinner:a=!1,menuWidth:o,onOpenChange:s,children:c,xstyle:l,className:u,style:d,"data-testid":f,menuDataTestId:p}=e,m=eA(),h=m?.menuSize??`md`,g=!i,v=(0,_.useId)(),y=(0,_.useId)(),b=(0,_.useRef)(null),[x,S]=(0,_.useState)(!1),C=xi({mode:`context`,lightDismiss:!1,onShow:(0,_.useCallback)(()=>{S(!0),s?.(!0)},[s]),onHide:(0,_.useCallback)(()=>{S(!1),s?.(!1)},[s])}),w=(0,_.useCallback)(()=>{g&&C.show()},[g,C]),T=(0,_.useCallback)(()=>{C.hide()},[C]),{listRef:E,handleKeyDown:D,focusFirst:O,focusItem:k,ownsEvent:A,getItems:j}=_A({itemSelector:wA,boundarySelector:TA,wrap:!1,onEscape:()=>L({focusTrigger:!0})}),M=SA({getItemLabels:()=>j().map(e=>e.textContent),onMatch:k,getCurrentIndex:()=>j().findIndex(e=>e===document.activeElement||e.contains(document.activeElement))}),{triggerProps:N,contentProps:P,confirmHoverOpen:F}=bA({show:w,hide:T,isOpen:x,isEnabled:g}),I=(0,_.useCallback)(e=>{g&&(C.show(),e?.focusFirst&&(O()||E.current?.focus()))},[g,C,O,E]),L=(0,_.useCallback)(e=>{C.hide(),e?.focusTrigger!==!1&&b.current?.focus()},[C]),R=(0,_.useCallback)(e=>{b.current=e,C.ref(e)},[C]),ee=(0,_.useCallback)(()=>{if(!i)if(x){if(F()){O()||E.current?.focus();return}L({focusTrigger:!0})}else I({focusFirst:!0})},[i,x,I,L,F,O,E]),z=(0,_.useCallback)(e=>{if(i)return;let t=typeof window<`u`&&b.current&&window.getComputedStyle(b.current).direction===`rtl`?`ArrowLeft`:`ArrowRight`;(e.key===t||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),I({focusFirst:!0}))},[i,I]),B=(0,_.useCallback)(e=>nA(e,i),[i]),V=(0,_.useCallback)(e=>{if(!A(e))return;if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),L({focusTrigger:!0});return}if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=document.activeElement;t&&CA.has(t.getAttribute(`role`)??``)&&t.click();return}let t=typeof window<`u`&&E.current&&window.getComputedStyle(E.current).direction===`rtl`?`ArrowRight`:`ArrowLeft`;if(e.key===t){e.preventDefault(),L({focusTrigger:!0});return}if(M.onKeyDown(e)){e.preventDefault();return}D(e)},[A,L,D,M,E]),H=(0,_.useMemo)(()=>({menuSize:h,closeMenu:()=>{L({focusTrigger:!1}),m?.closeMenu()}}),[h,L,m]),te=a?(0,K.jsx)(`span`,{className:`x78zum5 x6s0dn4`,children:(0,K.jsx)($o,{size:`sm`})}):(0,K.jsx)(`span`,{className:`x78zum5 x6s0dn4`,children:(0,K.jsx)(xu,{icon:`chevronRight`,size:`sm`,color:`secondary`,...ba(`dropdown-menu-indicator-icon`)})}),ne=o?OA.popoverCustomWidth(o):OA.popover;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Qk,{ref:e=>R(e),id:y,role:`menuitem`,tabIndex:i?void 0:-1,"aria-haspopup":`menu`,"aria-expanded":x,"aria-controls":x?v:void 0,"aria-disabled":i||void 0,"data-testid":f,onMouseEnter:N.onMouseEnter,onMouseLeave:N.onMouseLeave,onPointerMove:B,startContent:t?Cu(t,{size:`sm`,color:`secondary`}):void 0,label:n,description:r,endContent:te,onClick:ee,onKeyDown:z,isDisabled:i,xstyle:[EA.root,DA[h],x&&EA.open,i&&EA.disabled,l],...oa(ba(`dropdown-menu-item`,{size:h}),{className:u,style:d})}),C.render((0,K.jsx)(`div`,{ref:E,id:v,role:`menu`,tabIndex:-1,"aria-labelledby":y,onKeyDown:V,onMouseEnter:P.onMouseEnter,onMouseLeave:P.onMouseLeave,"data-testid":p,...oa(ba(`dropdown-menu`),{className:`x9f619 x78zum5 xdt5ytf x1lsbc85 xuyqlj2 x1odjw0f x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92`}),children:(0,K.jsx)($k,{value:H,children:c})}),{placement:`end`,alignment:`start`,offset:Br[`--spacing-1`],xstyle:[ne,co.end]})]})}kA.displayName=`DropdownMenuSubMenu`;function AA(e,t){return`item-${e.id??t}`}function jA(e,t){return`section-${e.id??t}`}function MA(e,t){let{items:n,id:r,...i}=e;return(0,K.jsx)(aA,{...i},AA(e,t))}function NA(e){let t=[];for(let n=0;n0?t.push((0,K.jsx)(kA,{icon:r.icon,label:r.label,isDisabled:r.isDisabled,children:NA(r.items)},AA(r,n))):t.push(MA(r,n)))}return t}var PA={dropdown:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,kskxy:`xuyqlj2`,kORKVm:`x1odjw0f`,"--_dropdown-menu-radius":`x1fcsqxe`,"--_dropdown-menu-padding":`xgory14`,kmVPX3:`x9epnlk`,kaIpWk:`x1n97fys`,kSiTet:`x1hc1fzr`,k1ekBW:`x19991ni`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,$$css:!0},popoverCustomWidth:e=>[{k7Eaqz:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`xkj4a21`,$$css:!0},{"--x-minWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e)}]},FA=`@astryx.dropdownMenu.label`;function IA({button:e,isMenuOpen:t,onOpenChange:n,menuWidth:r,onClick:i,hasChevron:a=!0,placement:o=`below`,alignment:s=`start`,className:c,style:l,xstyle:u,"data-testid":d,...f}){let p=Rc(),m=e??{label:p(FA)},h=(`items`in f?f.items:void 0)??[],g=f.children,{items:v,children:y,...b}=f,x=(0,_.useId)(),S=m.size??`md`,C=(0,_.useRef)(null),[w,T]=(0,_.useState)(!1),E=t!==void 0,D=E?t:w,O=(0,_.useCallback)(()=>{n?.(!1),E||T(!1),C.current?.focus()},[E,n]),k=(0,_.useRef)(!1),A=(0,_.useRef)(`keyboard`),j=dd({onHide:O,onShow:(0,_.useCallback)(()=>{n?.(!0),E||T(!0)},[E,n]),hasLightDismiss:!0,hasCloseButton:!1,hasAutoFocus:!1,role:`none`}),M=(0,_.useCallback)(()=>{j.hide()},[j]),{listRef:N,handleKeyDown:P,focusFirst:F,focusItem:I,ownsEvent:L,getItems:R}=_A({itemSelector:wA,boundarySelector:TA,wrap:!1,onEscape:M}),ee=SA({getItemLabels:()=>R().map(e=>e.textContent),onMatch:I,getCurrentIndex:()=>R().findIndex(e=>e===document.activeElement||e.contains(document.activeElement))});(0,_.useEffect)(()=>{E&&(t&&!j.isOpen?(k.current=!0,j.show()):!t&&j.isOpen&&j.hide())},[t,E,j]),(0,_.useEffect)(()=>{!j.isOpen||!k.current||(k.current=!1,requestAnimationFrame(()=>{(A.current===`pointer`||!F())&&N.current?.focus(),A.current=`keyboard`}))},[j.isOpen,F,N]);let z=(0,_.useCallback)(e=>{if(L(e)){if(e.key===`Enter`||e.key===` `){e.preventDefault();let t=document.activeElement;t&&CA.has(t.getAttribute(`role`)??``)&&t.click();return}if(e.key===`Tab`){M();return}if(ee.onKeyDown(e)){e.preventDefault();return}P(e)}},[P,M,ee,L]),B=(0,_.useCallback)((e=`keyboard`)=>{A.current=e,k.current=!0,j.show()},[j]),V=(0,_.useCallback)(e=>{if(j.wasJustDismissed())return;i?.();let r=e.detail===0?`keyboard`:`pointer`;E?(t||(A.current=r),n?.(!t)):j.isOpen?j.hide():B(r)},[i,E,n,t,j,B]),H=(0,_.useCallback)(e=>{j.isOpen||(e.key===`ArrowDown`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),B())},[j.isOpen,B]),te=m.isIconOnly===!0,ne=m.endContent??(a&&!te?(0,K.jsx)(xu,{icon:`chevronDown`,size:`sm`,color:`inherit`}):void 0),re=r?PA.popoverCustomWidth(r):PA.popover,ie=(0,_.useMemo)(()=>({closeMenu:M,menuSize:S}),[M,S]),ae=f.items===void 0?g:NA(h);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(qc,{...m,ref:e=>{C.current=e,j.triggerRef(e);let t=m.ref;typeof t==`function`?t(e):t&&(t.current=e)},tooltip:D?void 0:m.tooltip,endContent:ne,onClick:V,onKeyDown:H,"aria-haspopup":`menu`,"aria-expanded":D,"aria-controls":x,"data-testid":d}),j.render((0,K.jsx)(`div`,{...b,ref:N,id:x,role:`menu`,tabIndex:-1,"aria-label":m.label,onKeyDown:z,...oa(ba(`dropdown-menu`),Sr(PA.dropdown,u),c,l),children:(0,K.jsx)($k,{value:ie,children:ae})}),{placement:o,alignment:s,offset:Br[`--spacing-1`],xstyle:[re,co[o]]})]})}IA.displayName=`DropdownMenu`;var LA={box:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,kMzoRj:`x1litavf`,ksu8eU:`x1y0btm7`,kaIpWk:`xx3sua9`,k1ekBW:`xts7igz`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},unchecked:{kMwMTN:`xqwr325`,kVAM5u:`xvy26l8 xilc7fp`,kWkggS:`x10xzikg xeultfy`,$$css:!0},checked:{kMwMTN:`x17wrial`,kVAM5u:`xad5do x1ozl1p1`,kWkggS:`x1ewilqj x17srpfb`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kVAM5u:`x14i3s5s x61roa7`,$$css:!0},disabledUnchecked:{kWkggS:`xwmxj5m xqxnq6d`,$$css:!0},checkmark:{k1xSpc:`x1s85apg`,kMwMTN:`x17wrial xs5hli`,$$css:!0},checkmarkVisible:{k1xSpc:`x1lliihq`,$$css:!0},indeterminateMark:{k1xSpc:`x1s85apg`,kWkggS:`x1azo05 xwvh9j7`,kaIpWk:`xjspbzw`,$$css:!0},indeterminateMarkVisible:{k1xSpc:`x1lliihq`,$$css:!0}},RA={sm:{kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,$$css:!0},md:{kzqmXN:`xvy4d1p`,kZKoxP:`xxk0z11`,$$css:!0}},zA={sm:{kzqmXN:`xsmyaan`,kZKoxP:`x1kpxq89`,$$css:!0},md:{kzqmXN:`x6jxa94`,kZKoxP:`x1v9usgg`,$$css:!0}},BA={sm:{kzqmXN:`x1fsd2vl`,kZKoxP:`x36qwtl`,$$css:!0},md:{kzqmXN:`xsmyaan`,kZKoxP:`x36qwtl`,$$css:!0}};function VA({state:e,size:t=`md`,isDisabled:n=!1,children:r,ref:i,className:a,style:o,xstyle:s,...c}){let l=e===`checked`,u=e===`indeterminate`,d=l||u;return(0,K.jsx)(`span`,{...c,ref:i,"aria-hidden":`true`,...oa(ba(`checkbox-indicator`,{size:t,checked:l?`checked`:u?`indeterminate`:null,disabled:n?`disabled`:null},{legacyNames:[`checkbox`]}),Sr(LA.box,RA[t],d?LA.checked:LA.unchecked,n&&LA.disabled,n&&!d&&LA.disabledUnchecked,s),a,o),children:Ea(r)?r:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`svg`,{viewBox:`0 0 10 10`,...oa(ba(`checkbox-indicator-check`,{size:t}),Sr(LA.checkmark,zA[t],l&&LA.checkmarkVisible)),children:(0,K.jsx)(`path`,{d:`M8.5 2.5L4 7.5L1.5 5`,stroke:`currentColor`,strokeWidth:`1.5`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,K.jsx)(`span`,{...oa(ba(`checkbox-indicator-dash`,{size:t}),Sr(LA.indeterminateMark,BA[t],u&&LA.indeterminateMarkVisible))})]})})}VA.displayName=`CheckboxIndicator`;var HA={sm:`sm`,md:`sm`},UA={slot:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,kzqmXN:`xcdlrvm`,kZKoxP:`x1l36t39`,$$css:!0},enabled:{kMwMTN:`xqwr325`,$$css:!0},disabled:{kMwMTN:`xqa6c3m`,$$css:!0}};function WA({state:e,size:t=`md`,isDisabled:n=!1,children:r,ref:i,className:a,style:o,xstyle:s,...c}){let l=e===`checked`;return Ea(r)?(0,K.jsx)(`span`,{...c,ref:i,"aria-hidden":`true`,...oa(Sr(UA.slot,n?UA.disabled:UA.enabled,s),a,o),children:r}):l?(0,K.jsx)(xu,{...c,"aria-hidden":`true`,icon:`check`,size:HA[t],color:n?`disabled`:`accent`,xstyle:s,className:a,style:o}):null}WA.displayName=`CheckIndicator`;var GA={circle:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmuXW:`x2lah0s`,kMzoRj:`x1litavf`,ksu8eU:`x1y0btm7`,kaIpWk:`xjspbzw`,k1ekBW:`xts7igz`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},unchecked:{kVAM5u:`xvy26l8 xilc7fp`,kWkggS:`x10xzikg xeultfy`,$$css:!0},checked:{kVAM5u:`xad5do x1ozl1p1`,kWkggS:`x1ewilqj x17srpfb`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kVAM5u:`x14i3s5s x61roa7`,$$css:!0},disabledUnchecked:{kWkggS:`xwmxj5m xqxnq6d`,$$css:!0},dot:{kaIpWk:`xjspbzw`,kWkggS:`x1azo05 xwvh9j7`,$$css:!0}},KA={sm:{kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,$$css:!0},md:{kzqmXN:`xvy4d1p`,kZKoxP:`xxk0z11`,$$css:!0}},qA={sm:{kzqmXN:`x1xc55vz`,kZKoxP:`xdk7pt`,$$css:!0},md:{kzqmXN:`x1fsd2vl`,kZKoxP:`x170jfvy`,$$css:!0}};function JA({state:e,size:t=`md`,isDisabled:n=!1,children:r,ref:i,className:a,style:o,xstyle:s,...c}){let l=e!==`unchecked`;return(0,K.jsx)(`span`,{...c,ref:i,"aria-hidden":`true`,...oa(ba(`radio-indicator`,{size:t,checked:l?`checked`:null,disabled:n?`disabled`:null},{legacyNames:[`radio`]}),Sr(GA.circle,KA[t],l?GA.checked:GA.unchecked,n&&GA.disabled,n&&!l&&GA.disabledUnchecked,s),a,o),children:Ea(r)?r:l&&(0,K.jsx)(`span`,{...oa(ba(`radio-indicator-dot`,{size:t},{legacyNames:[`radio-dot`]}),Sr(GA.dot,qA[t]))})})}JA.displayName=`RadioIndicator`;var YA={check:WA,checkbox:VA,radio:JA};function XA(e){return e==null?null:typeof e==`string`?rl(e):e}function ZA(e){return XA(e)?.indicators??null}function QA(e,t){return ZA(t)?.[e]??YA[e]}function $A(e){return QA(e,cu())}var ej={root:{kzqmXN:`xh8yej3`,kaIpWk:`x1ws5lxm`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w x1c52tdz`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,$$css:!0},disabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0},marker:{kfzvcC:`x47corl`,kayTVb:`x1g77sc7 xozvky`,keTefX:`x1lziwak x1jymrmb`,$$css:!0}};function tj({label:e,description:t,icon:n,value:r,onChange:i,isDisabled:a=!1,hasCloseOnSelect:o=!1,endContent:s,xstyle:c,className:l,style:u,...d}){let f=eA(),p=f?.menuSize??`md`,m=p===`sm`?`sm`:`md`,h=$A(`checkbox`),g=(0,_.useCallback)(()=>{a||(i?.(!r),o&&f?.closeMenu())},[a,i,r,o,f]),v=(0,_.useCallback)(e=>nA(e,a),[a]);return(0,K.jsx)(Qk,{...d,role:`menuitemcheckbox`,"aria-checked":r,tabIndex:a?void 0:-1,onPointerMove:v,marker:(0,K.jsx)(h,{state:r?`checked`:`unchecked`,size:m,isDisabled:a,xstyle:ej.marker}),startContent:n?Cu(n,{size:`sm`,color:`secondary`}):void 0,label:e,description:t,endContent:s,onClick:g,isDisabled:a,xstyle:[ej.root,a&&ej.disabled,c],...oa(ba(`dropdown-menu-item`,{size:p}),{className:l,style:u})})}tj.displayName=`DropdownMenuCheckboxItem`;function nj(e,t){let n=e.name?.trim();if(n)return n;let r=e.firstMessage?.trim();return r&&r!==`(no messages)`?r:t}function rj(e){return e.split(/[\\/]/u).filter(Boolean).at(-1)||e}function ij(e,t=2){let n=e.split(/[\\/]/u).filter(Boolean);return n.length<=t?e:`…/${n.slice(-t).join(`/`)}`}function aj(e,t=96){let n=String(e??``).replace(/\s+/gu,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function oj(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?``:`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function sj(e,t=Date.now()){if(typeof e!=`number`)return``;let n=Math.max(0,Math.round((t-e)/1e3)),r=Math.floor(n/60),i=n%60;return r>0?`${r}m${String(i).padStart(2,`0`)}s`:`${i}s`}function cj(e,t=e?.selectedSession){if(!e||!t||t.id!==e.currentSessionId)return!1;let n=e.currentSessionPath??e.sessions.find(t=>t.id===e.currentSessionId&&t.controller===`web`)?.path??e.runtime.activeTurn?.sessionPath;return!!(n&&n===t.path)}function lj(e){return e&&typeof e==`object`?e:{}}function uj(e){let t=new Map;for(let n of e){let e=n.role===`toolResult`&&n.toolName===`subagent_spawn`,r=n.role===`toolResult`&&n.toolName===`subagent_send`,i=n.customType===`subagent-finished`,a=n.role===`toolResult`&&[`subagent_wait`,`subagent_check`].includes(n.toolName??``)||n.customType===`subagent-result`||i;if(!e&&!r&&!a||n.isError)continue;let o=lj(n.details);for(let a of Array.isArray(o.results)?o.results:[o]){let s=lj(a);if(typeof s.id!=`string`||!s.id||s.id.length>160||/[\u0000-\u001f\u007f]/u.test(s.id))continue;let c=t.get(s.id),l={...c,id:s.id,title:typeof s.title==`string`?s.title:c?.title??s.id};e?l.receipt=n.content:r?(l.state=s.status===`running`?`running`:void 0,l.result=void 0):(i||(l.result=typeof o.displayContent==`string`?o.displayContent:n.content),l.state=s.outcome===`uncertain`?void 0:s.outcome===`interrupted`?`interrupted`:s.status===`done`||s.status===`error`||s.status===`running`?s.status:void 0),t.delete(s.id),t.set(s.id,l)}}return[...t.values()].slice(-32)}function dj(e,t,n=[],r=!0){let i=new Set(e.map(e=>e.id));return[...e.map(e=>({kind:`subagents`,id:e.id,title:e.title,state:e.outcome===`interrupted`?`interrupted`:!r&&e.status===`running`?void 0:e.status,timestamp:e.settledAt??e.createdAt,saved:!1})),...n.flatMap(e=>(e.children?.items??[]).map(e=>({kind:`workflows`,id:e.id,title:e.title,state:e.outcome===`interrupted`?`interrupted`:e.status===`unknown`||!r&&e.status===`running`?void 0:e.status,timestamp:e.settledAt??e.createdAt,saved:!1}))),...t.filter(e=>!i.has(e.id)).map(e=>({kind:`subagents`,id:e.id,title:e.title,state:e.state===`running`?void 0:e.state,timestamp:void 0,saved:!0}))].sort((e,t)=>(t.timestamp??0)-(e.timestamp??0))}function fj(e){return e===`interrupted`?`interrupted`:e===`running`?`running`:e===`done`||e===`completed`?`done`:[`error`,`failed`,`aborted`,`killed`,`timed_out`].includes(e)?`error`:e===`uncertain`?`warn`:`unknown`}function pj({kind:e,label:t,status:n,onClick:r}){return(0,K.jsxs)(r?`button`:`span`,{className:`activity-chip ${e} ${n}`,type:r?`button`:void 0,onClick:r,children:[n===`running`?(0,K.jsx)(`i`,{className:`activity-chip-dot`}):n===`done`?(0,K.jsx)(I,{}):n===`error`?(0,K.jsx)(Lt,{}):n===`interrupted`?(0,K.jsx)(re,{}):(0,K.jsx)(`span`,{className:`activity-chip-glyph`,children:`?`}),(0,K.jsx)(`span`,{className:`activity-chip-text`,children:t})]})}function mj({snapshot:e,onInspectTerminal:t,onInspectSubagent:n,observed:r=!0}){let{t:i}=cr(),[,a]=(0,_.useState)(0),o=e?.runtime.capabilities,s=(0,_.useMemo)(()=>uj((e?.selectedSession?.entries??[]).flatMap(e=>e.message?[e.message]:[])),[e?.selectedSession?.entries]),c=o?.subagents,l=o?.workflows?.items??[],u=l.flatMap(e=>e.children?.items??[]),d=new Set([...(c?.items??[]).map(e=>`subagents:${e.id}`),...s.map(e=>`subagents:${e.id}`),...u.map(e=>`workflows:${e.id}`)]).size,f=Math.max(d,(c?.items.length??0)+(c?.omitted??0)+u.length+l.reduce((e,t)=>e+(t.children?.omitted??0),0)),p=dj(c?.items??[],s,l,r),m=p.filter(e=>e.state===`running`).length,h=p.filter(e=>e.state===`done`).length,g=p.filter(e=>e.state===`error`||e.state===`interrupted`).length,v=Math.max(0,f-m-h-g),y=[i(`subagentProgress`,{running:m,completed:h}),g?i(`subagentSummaryOther`,{count:g}):``,v?i(`subagentSummaryUnknown`,{count:v}):``].filter(Boolean).join(` · `),b=c?.childExecutionAdmission,x=[...o?.workflows?.items??[],...o?.[`background-terminals`]?.items??[]].some(e=>e.status===`running`);(0,_.useEffect)(()=>{if(!x)return;let e=window.setInterval(()=>a(e=>e+1),1e3);return()=>window.clearInterval(e)},[x]);let S=[];for(let e of o?.workflows?.items??[]){let t=e.agents.total-e.agents.running,n=e.agents.total?` · ${t}/${e.agents.total} agents`:``,r=e.status===`running`&&e.currentPhase?` · ${e.currentPhase}`:``,i=sj(e.startedAt,e.finishedAt);S.push({key:`workflow-${e.runId}`,kind:`workflow`,label:`${e.name||e.runId}${r}${n}${i?` · ${i}`:``}`,status:fj(e.status)})}for(let e of o?.[`background-terminals`]?.items??[]){let n=sj(e.createdAt,e.settledAt);S.push({key:`terminal-${e.id}`,onClick:t?()=>t(e.id):void 0,kind:`terminal`,label:`${e.title||e.id}${n?` · ${n}`:``}`,status:fj(e.status)})}S.sort((e,t)=>Number(t.status===`running`)-Number(e.status===`running`));let C=S.slice(0,5),w=S.length-C.length+(o?.workflows?.omitted??0)+(o?.[`background-terminals`]?.omitted??0);return!C.length&&!w&&!(n&&f)&&!b?.enabled?null:(0,K.jsxs)(`div`,{className:`activity-bar`,role:`status`,"aria-label":`Runtime activity`,children:[n&&f>0&&(0,K.jsx)(`button`,{className:`activity-chip subagent-list-trigger`,type:`button`,onClick:()=>n(),children:y}),b?.enabled&&b.limit!==void 0&&(0,K.jsx)(`span`,{className:`activity-chip subagent-list-trigger`,children:`${b.held}/${b.limit} child slots · ${b.queued} queued · wf ${b.heldByOrigin.workflow} / direct ${b.heldByOrigin.direct} / btw ${b.heldByOrigin.btw}`}),C.map(({key:e,...t})=>(0,K.jsx)(pj,{...t},e)),w>0&&(0,K.jsxs)(`span`,{className:`activity-chip more`,children:[`+`,w]})]})}var hj={count:32,textBytes:1048576,imageBytes:134217728};function gj(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _j(e){if(e.length>8192)return!1;try{let t=JSON.parse(e);return Array.isArray(t)&&(t.length===3&&t[0]===`session`&&typeof t[1]==`string`&&t[1].length>0&&t[1].length<=1024&&typeof t[2]==`string`&&t[2].length>0&&t[2].length<=4096||t.length===2&&t[0]===`workspace`&&(t[1]===null||typeof t[1]==`string`&&t[1].length<=4096))}catch{return!1}}function vj(e,t){if(!_j(e)||!gj(t)||typeof t.prompt!=`string`||t.prompt.length*2>hj.textBytes||!Array.isArray(t.images))return null;let n=[],r=[],i=!1,a=typeof t.caret==`number`&&Number.isSafeInteger(t.caret)&&t.caret>=0&&t.caret<=t.prompt.length?t.caret:t.prompt.length;a!==t.caret&&(i=!0);let o=0;for(let e of t.images){if(!gj(e)||typeof e.name!=`string`||e.name.length>1024||typeof e.data!=`string`||typeof e.size!=`number`||!Number.isSafeInteger(e.size)||e.size<=0||e.size>10485760||e.data.length!==Math.ceil(e.size/3)*4||!/^[A-Za-z0-9+/]*={0,2}$/u.test(e.data)){i=!0;continue}try{let t=atob(e.data);if(t.length!==e.size){i=!0;continue}let r=df(Uint8Array.from(t.slice(0,12),e=>e.charCodeAt(0)));if(!r||r!==e.mimeType||n.length>=8||o+e.size>33554432){i=!0;continue}o+=e.size,n.push({id:typeof e.id==`string`&&e.id.length<=1024?e.id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${n.length}-${e.name}`,name:e.name,size:e.size,data:e.data,mimeType:r,previewUrl:`data:${r};base64,${e.data}`})}catch{i=!0}}let s=0;for(let e of Array.isArray(t.files)?t.files:[]){if(!gj(e)||typeof e.name!=`string`||!e.name||e.name.length>1024||/[\u0000-\u001f\u007f]/u.test(e.name)||typeof e.mimeType!=`string`||e.mimeType.length>256||typeof e.data!=`string`||typeof e.size!=`number`||!Number.isSafeInteger(e.size)||e.size<0||e.size>52428800||e.data.length!==Math.ceil(e.size/3)*4||!/^[A-Za-z0-9+/]*={0,2}$/u.test(e.data)||r.length+n.length>=8||s+e.size>52428800||e.text!==void 0&&(typeof e.text!=`string`||new TextEncoder().encode(e.text).length>1048576)){i=!0;continue}try{if(atob(e.data).length!==e.size){i=!0;continue}s+=e.size,r.push({id:typeof e.id==`string`&&e.id.length<=1024?e.id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${r.length}`,name:e.name,mimeType:e.mimeType,size:e.size,data:e.data,...typeof e.text==`string`?{text:e.text}:{},extraction:e.extraction===`text`||e.extraction===`truncated`?e.extraction:`unavailable`,...e.extraction===`unavailable`&&(e.extractionError===`encoding`||e.extractionError===`document`)?{extractionError:e.extractionError}:{}})}catch{i=!0}}return t.files!==void 0&&!Array.isArray(t.files)&&(i=!0),{draft:{prompt:t.prompt,caret:a,images:n,...r.length?{files:r}:{},revision:0},invalid:i}}var yj=`openpi.composer-drafts`,bj=`drafts`;function xj(){let e=()=>new Promise((e,t)=>{let n;try{n=window.indexedDB.open(yj,1)}catch(e){t(e);return}n.onupgradeneeded=()=>{n.result.createObjectStore(bj,{keyPath:`key`}).createIndex(`usage`,[`textBytes`,`imageBytes`])},n.onerror=()=>t(n.error),n.onblocked=()=>{n.onsuccess=()=>n.result.close(),t(Error(`draft-storage-blocked`))},n.onsuccess=()=>{n.result.onversionchange=()=>n.result.close(),e(n.result)}});return{async read(){let t=await e();try{return await new Promise((e,n)=>{let r=t.transaction(bj,`readonly`),i=r.objectStore(bj).getAll(void 0,hj.count+1),a=[];i.onsuccess=()=>{a=i.result},r.oncomplete=()=>e(a),i.onerror=()=>n(i.error),r.onabort=()=>n(r.error)})}finally{t.close()}},async write(t){let n=await e();try{await new Promise((e,r)=>{let i=n.transaction(bj,`readwrite`),a=i.objectStore(bj),o=new Set(t.map(({key:e})=>e)),s=0,c=0,l=0,u=a.index(`usage`).openKeyCursor();u.onsuccess=()=>{let e=u.result;if(e){if(!o.has(String(e.primaryKey))){let t=e.key;s+=1,c+=t[0],l+=t[1]}e.continue();return}for(let{draft:e}of t)e&&(s+=1,c+=e.prompt.length*2,l+=e.images.reduce((e,t)=>e+t.size,0)+(e.files??[]).reduce((e,t)=>e+t.size+(t.text?.length??0)*2,0));if(s>hj.count||c>hj.textBytes||l>hj.imageBytes){i.abort();return}for(let{key:e,draft:n}of t)n?a.put({key:e,draft:{prompt:n.prompt,caret:n.caret,images:n.images.map(({previewUrl:e,...t})=>t),...n.files?.length?{files:n.files}:{}},textBytes:n.prompt.length*2,imageBytes:n.images.reduce((e,t)=>e+t.size,0)+(n.files??[]).reduce((e,t)=>e+t.size+(t.text?.length??0)*2,0)}):a.delete(e)},i.oncomplete=()=>e(),i.onerror=()=>r(i.error),i.onabort=()=>r(i.error??Error(`draft-storage-limit`))})}finally{n.close()}}}}function Sj(e){let t=new Map,n=new Set,r=new Map,i=new Set,a={status:e?`loading`:`saved`,invalid:!1},o=!1,s=!!e,c=0,l=()=>({prompt:``,images:[],caret:0,revision:c,files:void 0}),u=e=>e.prompt.length>0||e.images.length>0||!!e.files?.length,d=e=>e.images.reduce((e,t)=>e+t.size,0)+(e.files??[]).reduce((e,t)=>e+t.size+(t.text?.length??0)*2,0),f=(e={})=>{a={...a,...e};for(let e of i)e()},p=(e,n)=>{let r=0,i=0,a=0;for(let[n,o]of t)n!==e&&(r+=1,i+=o.prompt.length*2,a+=d(o));return u(n)&&(r+=1),i+=n.prompt.length*2,a+=d(n),r<=hj.count&&i<=hj.textBytes&&a<=hj.imageBytes},m=async()=>{if(!e||s||o||r.size===0)return;o=!0,f({status:`pending`});let t=Array.from(r,([e,t])=>({key:e,draft:t}));r.clear();try{await e.write(t),o=!1,f({status:r.size>0?`pending`:`saved`}),r.size>0&&m()}catch{for(let{key:e,draft:n}of t)r.has(e)||r.set(e,n);o=!1,f({status:`failed`})}},h=(t,i)=>{s&&n.add(t),e&&(r.set(t,i),s||f({status:`pending`}),Promise.resolve().then(m))},g=()=>e?e.read().then(e=>{let i=!1;for(let r of e){if(typeof r!=`object`||!r||!(`key`in r)||typeof r.key!=`string`||!(`draft`in r)){i=!0;continue}if(n.has(r.key))continue;let e=vj(r.key,r.draft);if(!e||!u(e.draft)||!p(r.key,e.draft)){i=!0;continue}i||=e.invalid,t.set(r.key,{...e.draft,revision:++c})}n.clear(),s=!1,f({status:r.size>0?`pending`:`saved`,invalid:i}),m()}).catch(()=>{f({status:`failed`})}):Promise.resolve();return{ready:g(),storageState:()=>a,subscribe(e){return i.add(e),()=>i.delete(e)},hasContent:()=>t.size>0,hasUnsavedChanges:()=>r.size>0||o,retryStorage(){return s?(f({status:`loading`}),g()):m()},read(e){return t.get(e)??l()},edit(e,n,r){let i={...n,...r};if(i.caret=Math.min(Math.max(i.caret,0),i.prompt.length),i.prompt!==n.prompt||i.images!==n.images||i.files!==n.files){if(!p(e,i))return null;i.revision=++c}return u(i)?t.set(e,i):t.delete(e),(i.prompt!==n.prompt||i.images!==n.images||i.files!==n.files||i.caret!==n.caret)&&h(e,u(i)?i:null),i},clear(e,n){return t.get(e)?.revision===n?(t.delete(e),c+=1,h(e,null),l()):null},move(e,n){if(t.has(n))return!1;let r=t.get(e);return r&&(t.delete(e),t.set(n,r),h(e,null),h(n,r)),!0}}}var Cj={settle(){},release(){}};function wj(e){if(typeof window>`u`||typeof document>`u`)return Cj;let t=document.documentElement,n=t.clientWidth;if(n===0)return Cj;let r=t.style.scrollbarGutter,i=e.style.paddingRight,a=e.getBoundingClientRect().width,o=!1,s=!1,c=!1;return window.innerWidth>n&&(t.style.scrollbarGutter=`stable`,o=!0),{settle(){if(c)return;c=!0;let t=e.getBoundingClientRect().width-a;if(t<=0)return;let n=Number.parseFloat(window.getComputedStyle(e).paddingRight)||0;e.style.paddingRight=`${n+t}px`,s=!0},release(){s&&=(e.style.paddingRight=i,!1),o&&=(t.style.scrollbarGutter=r,!1)}}}var Tj=0,Ej=null;function Dj(e){(0,_.useEffect)(()=>{if(!e)return;let{body:t}=document;if(Tj===0){let e=window.scrollX,n=window.scrollY,r=wj(t);Ej={scrollX:e,scrollY:n,overflow:t.style.overflow,position:t.style.position,top:t.style.top,left:t.style.left,right:t.style.right,gutter:r},t.style.overflow=`hidden`,t.style.position=`fixed`,t.style.top=`-${n}px`,t.style.left=`0`,t.style.right=`0`,r.settle()}return Tj+=1,()=>{if(--Tj,Tj!==0||Ej==null)return;let e=Ej;Ej=null,t.style.overflow=e.overflow,t.style.position=e.position,t.style.top=e.top,t.style.left=e.left,t.style.right=e.right,e.gutter.release(),window.scrollTo(e.scrollX,e.scrollY)}},[e])}var Oj={container:{kB7OPa:`x9f619`,kZCmMZ:`x1c35znw`,kwRFfy:`x64h4k7`,kLKAdn:`x14m0hsi`,kGO01o:`xc1wllq`,$$css:!0}},kj=Br[`--spacing-4`],Aj=`var(--astryx-card-padding, ${kj})`,jj=`var(--astryx-card-padding-inline, ${Aj})`;`${jj}`,`${jj}`,`${Aj}`,`${Aj}`;var Mj=`var(--_section-padding-propagated, ${`var(--astryx-section-padding, ${kj})`})`,Nj=`var(--astryx-section-padding-inline, ${Mj})`;`${Nj}`,`${Nj}`,`${Mj}`,`${Mj}`;var Pj=`var(--astryx-dialog-padding, ${kj})`,Fj=`var(--astryx-dialog-padding-inline, ${Pj})`;`${Fj}`,`${Fj}`,`${Pj}`,`${Pj}`;var Ij={card:{containerPaddingInlineStart:{"--container-padding-inline-start":`xjmlhfd`,$$css:!0},containerPaddingInlineEnd:{"--container-padding-inline-end":`x1ihxwbr`,$$css:!0},containerPaddingBlockStart:{"--container-padding-block-start":`x1rqz8me`,$$css:!0},containerPaddingBlockEnd:{"--container-padding-block-end":`x1omyuck`,$$css:!0},layoutPaddingOuterX:{"--layout-padding-outer-x":`x14rzhog`,$$css:!0},layoutPaddingOuterY:{"--layout-padding-outer-y":`xjej9fs`,$$css:!0},layoutPaddingInnerX:{"--layout-padding-inner-x":`x4poyjn`,$$css:!0},layoutPaddingInnerY:{"--layout-padding-inner-y":`x1u1kw4e`,$$css:!0}},section:{containerPaddingInlineStart:{"--container-padding-inline-start":`x19lemt0`,$$css:!0},containerPaddingInlineEnd:{"--container-padding-inline-end":`xu1wldr`,$$css:!0},containerPaddingBlockStart:{"--container-padding-block-start":`xnw7zt4`,$$css:!0},containerPaddingBlockEnd:{"--container-padding-block-end":`xek4msv`,$$css:!0},layoutPaddingOuterX:{"--layout-padding-outer-x":`x15i0zw9`,$$css:!0},layoutPaddingOuterY:{"--layout-padding-outer-y":`x1vw4zgg`,$$css:!0},layoutPaddingInnerX:{"--layout-padding-inner-x":`x1v3gmnx`,$$css:!0},layoutPaddingInnerY:{"--layout-padding-inner-y":`x15yx5hm`,$$css:!0}},dialog:{containerPaddingInlineStart:{"--container-padding-inline-start":`x1tewnwq`,$$css:!0},containerPaddingInlineEnd:{"--container-padding-inline-end":`x11h1f2o`,$$css:!0},containerPaddingBlockStart:{"--container-padding-block-start":`x1g2kccc`,$$css:!0},containerPaddingBlockEnd:{"--container-padding-block-end":`x1gvthzm`,$$css:!0},layoutPaddingOuterX:{"--layout-padding-outer-x":`x1hsjncj`,$$css:!0},layoutPaddingOuterY:{"--layout-padding-outer-y":`x1pui4bz`,$$css:!0},layoutPaddingInnerX:{"--layout-padding-inner-x":`x2so38`,$$css:!0},layoutPaddingInnerY:{"--layout-padding-inner-y":`xinu7xd`,$$css:!0}}},Lj={spacing0:{"--container-padding-inline-start":`x1gu2k80`,$$css:!0},spacing0_5:{"--container-padding-inline-start":`x14ws0sr`,$$css:!0},spacing1:{"--container-padding-inline-start":`x1cvlban`,$$css:!0},spacing1_5:{"--container-padding-inline-start":`x176g23i`,$$css:!0},spacing2:{"--container-padding-inline-start":`x1xlrr2o`,$$css:!0},spacing3:{"--container-padding-inline-start":`xfdwxua`,$$css:!0},spacing4:{"--container-padding-inline-start":`x1dlhslv`,$$css:!0},spacing5:{"--container-padding-inline-start":`x1s81nki`,$$css:!0},spacing6:{"--container-padding-inline-start":`x1ep0dkj`,$$css:!0},spacing7:{"--container-padding-inline-start":`x157xojc`,$$css:!0},spacing8:{"--container-padding-inline-start":`xw1diwv`,$$css:!0},spacing9:{"--container-padding-inline-start":`xraca2a`,$$css:!0},spacing10:{"--container-padding-inline-start":`xserb3f`,$$css:!0},spacing11:{"--container-padding-inline-start":`xziclwo`,$$css:!0},spacing12:{"--container-padding-inline-start":`x1iiwihq`,$$css:!0}},Rj={spacing0:{"--container-padding-inline-end":`x91ghl5`,$$css:!0},spacing0_5:{"--container-padding-inline-end":`x1wz3t3y`,$$css:!0},spacing1:{"--container-padding-inline-end":`x2oyxnl`,$$css:!0},spacing1_5:{"--container-padding-inline-end":`xntetml`,$$css:!0},spacing2:{"--container-padding-inline-end":`xcas3b9`,$$css:!0},spacing3:{"--container-padding-inline-end":`xu0ipoa`,$$css:!0},spacing4:{"--container-padding-inline-end":`xs0pscg`,$$css:!0},spacing5:{"--container-padding-inline-end":`xgkj7vj`,$$css:!0},spacing6:{"--container-padding-inline-end":`x94cj42`,$$css:!0},spacing7:{"--container-padding-inline-end":`x11tj35w`,$$css:!0},spacing8:{"--container-padding-inline-end":`x1b9k1pi`,$$css:!0},spacing9:{"--container-padding-inline-end":`x19w02kr`,$$css:!0},spacing10:{"--container-padding-inline-end":`xx5lg5w`,$$css:!0},spacing11:{"--container-padding-inline-end":`x1nmgbqg`,$$css:!0},spacing12:{"--container-padding-inline-end":`x1wsfsk2`,$$css:!0}},zj={spacing0:{"--container-padding-block-start":`x1i3qcxz`,$$css:!0},spacing0_5:{"--container-padding-block-start":`xvdf9ev`,$$css:!0},spacing1:{"--container-padding-block-start":`xnsckjb`,$$css:!0},spacing1_5:{"--container-padding-block-start":`x1kbx601`,$$css:!0},spacing2:{"--container-padding-block-start":`xa8b4fq`,$$css:!0},spacing3:{"--container-padding-block-start":`x11k4f5r`,$$css:!0},spacing4:{"--container-padding-block-start":`xm01sq8`,$$css:!0},spacing5:{"--container-padding-block-start":`xp8wdkl`,$$css:!0},spacing6:{"--container-padding-block-start":`x1hmud4d`,$$css:!0},spacing7:{"--container-padding-block-start":`x1c00sag`,$$css:!0},spacing8:{"--container-padding-block-start":`xfv60at`,$$css:!0},spacing9:{"--container-padding-block-start":`x14fzdu7`,$$css:!0},spacing10:{"--container-padding-block-start":`x17h9kl7`,$$css:!0},spacing11:{"--container-padding-block-start":`x1rdjxae`,$$css:!0},spacing12:{"--container-padding-block-start":`xecwdl6`,$$css:!0}},Bj={spacing0:{"--container-padding-block-end":`xkunwnr`,$$css:!0},spacing0_5:{"--container-padding-block-end":`x1cao3zv`,$$css:!0},spacing1:{"--container-padding-block-end":`x57a7ii`,$$css:!0},spacing1_5:{"--container-padding-block-end":`xv53x8y`,$$css:!0},spacing2:{"--container-padding-block-end":`x1lsgcmx`,$$css:!0},spacing3:{"--container-padding-block-end":`x1q3ppug`,$$css:!0},spacing4:{"--container-padding-block-end":`x4hfsld`,$$css:!0},spacing5:{"--container-padding-block-end":`xbib2ws`,$$css:!0},spacing6:{"--container-padding-block-end":`x1q8d17g`,$$css:!0},spacing7:{"--container-padding-block-end":`x1yqogew`,$$css:!0},spacing8:{"--container-padding-block-end":`x8lgq76`,$$css:!0},spacing9:{"--container-padding-block-end":`x1f7f9rt`,$$css:!0},spacing10:{"--container-padding-block-end":`x15vxphk`,$$css:!0},spacing11:{"--container-padding-block-end":`x4bg2x9`,$$css:!0},spacing12:{"--container-padding-block-end":`x186mjxr`,$$css:!0}},Vj={spacing0:{"--layout-padding-outer-x":`xswhm3q`,$$css:!0},spacing0_5:{"--layout-padding-outer-x":`xihiwg7`,$$css:!0},spacing1:{"--layout-padding-outer-x":`xc96xmq`,$$css:!0},spacing1_5:{"--layout-padding-outer-x":`x1u93lgd`,$$css:!0},spacing2:{"--layout-padding-outer-x":`x15dxnc0`,$$css:!0},spacing3:{"--layout-padding-outer-x":`xadgj3j`,$$css:!0},spacing4:{"--layout-padding-outer-x":`x1v56qcf`,$$css:!0},spacing5:{"--layout-padding-outer-x":`x1nzs0gl`,$$css:!0},spacing6:{"--layout-padding-outer-x":`x1c3n52a`,$$css:!0},spacing7:{"--layout-padding-outer-x":`x1gfiokx`,$$css:!0},spacing8:{"--layout-padding-outer-x":`x1t3kfz`,$$css:!0},spacing9:{"--layout-padding-outer-x":`xzr4qsh`,$$css:!0},spacing10:{"--layout-padding-outer-x":`x1jdf5a4`,$$css:!0},spacing11:{"--layout-padding-outer-x":`x1hct0t0`,$$css:!0},spacing12:{"--layout-padding-outer-x":`x11cyqoe`,$$css:!0}},Hj={spacing0:{"--layout-padding-outer-y":`x1mzf5mb`,$$css:!0},spacing0_5:{"--layout-padding-outer-y":`x1vj96e0`,$$css:!0},spacing1:{"--layout-padding-outer-y":`x1gpfxoh`,$$css:!0},spacing1_5:{"--layout-padding-outer-y":`xd3dqby`,$$css:!0},spacing2:{"--layout-padding-outer-y":`x10pz7y9`,$$css:!0},spacing3:{"--layout-padding-outer-y":`x1p6yq3h`,$$css:!0},spacing4:{"--layout-padding-outer-y":`xx738ci`,$$css:!0},spacing5:{"--layout-padding-outer-y":`x6yxws5`,$$css:!0},spacing6:{"--layout-padding-outer-y":`x180vrwl`,$$css:!0},spacing7:{"--layout-padding-outer-y":`x1q6rme1`,$$css:!0},spacing8:{"--layout-padding-outer-y":`xid7e43`,$$css:!0},spacing9:{"--layout-padding-outer-y":`x1t5kicu`,$$css:!0},spacing10:{"--layout-padding-outer-y":`x26l4wa`,$$css:!0},spacing11:{"--layout-padding-outer-y":`x10zktp0`,$$css:!0},spacing12:{"--layout-padding-outer-y":`x1yz3n6a`,$$css:!0}},Uj={spacing0:{"--layout-padding-inner-x":`xj1bl4l`,$$css:!0},spacing0_5:{"--layout-padding-inner-x":`xlriy2h`,$$css:!0},spacing1:{"--layout-padding-inner-x":`x6uuyak`,$$css:!0},spacing1_5:{"--layout-padding-inner-x":`xd38f90`,$$css:!0},spacing2:{"--layout-padding-inner-x":`xxqksqd`,$$css:!0},spacing3:{"--layout-padding-inner-x":`x1fyui2f`,$$css:!0},spacing4:{"--layout-padding-inner-x":`x1i2ajwi`,$$css:!0},spacing5:{"--layout-padding-inner-x":`x1tac27u`,$$css:!0},spacing6:{"--layout-padding-inner-x":`x1ntgf3t`,$$css:!0},spacing7:{"--layout-padding-inner-x":`xhjd9tl`,$$css:!0},spacing8:{"--layout-padding-inner-x":`xn7c84u`,$$css:!0},spacing9:{"--layout-padding-inner-x":`xeqkbsz`,$$css:!0},spacing10:{"--layout-padding-inner-x":`x1vf4qco`,$$css:!0},spacing11:{"--layout-padding-inner-x":`xsmamsf`,$$css:!0},spacing12:{"--layout-padding-inner-x":`x2xk2xj`,$$css:!0}},Wj={spacing0:{"--layout-padding-inner-y":`xwuefyo`,$$css:!0},spacing0_5:{"--layout-padding-inner-y":`x180h0y5`,$$css:!0},spacing1:{"--layout-padding-inner-y":`xmpug6m`,$$css:!0},spacing1_5:{"--layout-padding-inner-y":`x1g8jpzm`,$$css:!0},spacing2:{"--layout-padding-inner-y":`x1lksgje`,$$css:!0},spacing3:{"--layout-padding-inner-y":`x4j7gld`,$$css:!0},spacing4:{"--layout-padding-inner-y":`x1s3ehtl`,$$css:!0},spacing5:{"--layout-padding-inner-y":`x1rj5eim`,$$css:!0},spacing6:{"--layout-padding-inner-y":`x1ftgg6u`,$$css:!0},spacing7:{"--layout-padding-inner-y":`x1ho74vh`,$$css:!0},spacing8:{"--layout-padding-inner-y":`xm2cs6f`,$$css:!0},spacing9:{"--layout-padding-inner-y":`x1vsq92b`,$$css:!0},spacing10:{"--layout-padding-inner-y":`x18gbwmk`,$$css:!0},spacing11:{"--layout-padding-inner-y":`x14zymzj`,$$css:!0},spacing12:{"--layout-padding-inner-y":`xzfpkx9`,$$css:!0}},Gj={containerMaxHeight:e=>[{"--container-max-height":e==null?e:`x18nyedi`,$$css:!0},{"--x---container-max-height":e??void 0}]};function Kj({padding:e=`spacing4`,paddingOuterX:t,paddingOuterY:n,paddingInnerX:r,paddingInnerY:i,useThemeDefault:a,maxHeight:o}){let s=t??e,c=n??e,l=r??e,u=i??e,d=o?Gj.containerMaxHeight(o):null;if(a){let e=Ij[a];return[Oj.container,e.containerPaddingInlineStart,e.containerPaddingInlineEnd,e.containerPaddingBlockStart,e.containerPaddingBlockEnd,e.layoutPaddingOuterX,e.layoutPaddingOuterY,e.layoutPaddingInnerX,e.layoutPaddingInnerY,d]}return[Oj.container,Lj[s],Rj[s],zj[c],Bj[c],Vj[s],Hj[c],Uj[l],Wj[u],d]}var qj=(0,_.createContext)(null);qj.displayName=`DialogContext`;function Jj(e,t=16){let n=e.getBoundingClientRect(),r=n.left+n.width/2-window.innerWidth/2,i=n.top+n.height/2-window.innerHeight/2,a=Math.sqrt(r*r+i*i)||1;return{x:Math.round(r/a*t),y:Math.round(i/a*t)}}`${Br[`--spacing-4`]}`,`${Br[`--spacing-4`]}`,`${Br[`--spacing-4`]}`,`${Br[`--spacing-4`]}`,`${Br[`--spacing-4`]}`,`${Br[`--spacing-4`]}`;var Yj={dialog:{kVAEAm:`xixxii4`,kogj98:`x1bpp3o7`,kmVPX3:`x1717udv`,kWkggS:`x10xzikg`,"--_dialog-radius":`xvuvksw`,kaIpWk:`xuacgfc`,kGVxlE:`x1kcpxr7`,k1xSpc:`x1s85apg`,kXwgrk:`xdt5ytf`,kZKoxP:`xg7h5cd`,kZeWKH:`xish69e`,kSiTet:`xg01cxk`,k44tkh:`xqgcaz`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,$$css:!0},open:{k1xSpc:`x78zum5`,kSiTet:`x1hc1fzr`,kKVMdj:`x1ewfqum x1aquc0h`,$$css:!0},backdrop:{kGyWv1:`xnixb3f`,kba3nw:`x1abwkk1`,$$css:!0},fullscreen:{kzqmXN:`x1o6l61p`,kZKoxP:`xtdtrs8`,ks0D6T:`xlbgzzq`,kskxy:`x1wj9ous`,kaIpWk:`x2u8bby`,kogj98:`x1ghz6dp`,kpwlN0:`x10a8y8t`,$$css:!0},fullscreenOpen:{kKVMdj:`xqcmdr3 x1aquc0h`,$$css:!0},fullscreenSafeArea:{kLKAdn:`x15ld1ci`,kGO01o:`x1rgxemn`,kZCmMZ:`xqmdmw x1i7f2ot`,kwRFfy:`x1by8st6 xtjjor6`,$$css:!0},inner:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kUk6DE:`x12lumcd`,kAzted:`x2lwn1j`,kVQacm:`xb3r6kr`,kaIpWk:`x1pjcqnp`,$$css:!0},inlineWrapper:{kmVPX3:`x1717udv`,kWkggS:`x10xzikg`,"--_dialog-radius":`xvuvksw`,kaIpWk:`xuacgfc`,kGVxlE:`x1kcpxr7`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kZKoxP:`xg7h5cd`,kZeWKH:`xish69e`,$$css:!0}},Xj=Br[`--spacing-4`],Zj=`min(100%, ${`calc(100dvw - ${Xj} - ${Xj})`})`;function Qj(e){return typeof e==`number`?`${e}px`:e}function $j(e,t){return{width:Qj(e),maxWidth:Zj,maxHeight:Qj(t)}}var eM={kogj98:`x1ghz6dp`,$$css:!0},tM={sizing:(e,t,n)=>[{kzqmXN:e==null?e:`x5lhr3w`,ks0D6T:t==null?t:`xf68679`,kskxy:n==null?n:`x1jols5v`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e),"--x-maxWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(t),"--x-maxHeight":(e=>typeof e==`number`?e+`px`:e??void 0)(n)}],position:(e,t,n,r)=>[eM,{k87sOh:e==null?e:`xjbys53`,kLqNvP:t==null?t:`x1lxsm33`,kt4wiu:n==null?n:`xqxgn94`,krVfgx:r==null?r:`x1nqzi6q`,$$css:!0},{"--x-top":(e=>typeof e==`number`?e+`px`:e??void 0)(e),"--x-insetInlineStart":(e=>typeof e==`number`?e+`px`:e??void 0)(t),"--x-insetInlineEnd":(e=>typeof e==`number`?e+`px`:e??void 0)(n),"--x-bottom":(e=>typeof e==`number`?e+`px`:e??void 0)(r)}]};function nM(e){return typeof e==`number`?`${e}px`:e}function rM(e){let{top:t,bottom:n,start:r,end:i}=e;return{top:t===void 0?`auto`:nM(t),bottom:n===void 0?`auto`:nM(n),insetInlineStart:r===void 0?`auto`:nM(r),insetInlineEnd:i===void 0?`auto`:nM(i)}}function iM({isOpen:e,isInline:t=!1,onOpenChange:n,width:r=400,maxHeight:i=`75dvh`,position:a,variant:o=`standard`,purpose:s=`info`,padding:c,children:l,xstyle:u,className:d,style:f,ref:p,...m}){let h=c==null,g=c??4,v=ti[g],y=o===`fullscreen`,b=y?null:$j(r,i),x=(0,_.useId)(),S=(0,_.useMemo)(()=>({isInline:t,titleId:x}),[t,x]),C=m[`aria-label`]!=null||m[`aria-labelledby`]!=null,w=(0,_.useRef)(null),T=Ao(p,(0,_.useCallback)(e=>{w.current=e,!(!e||C)&&(e.querySelector(`#${CSS.escape(x)}`)==null?e.removeAttribute(`aria-labelledby`):e.setAttribute(`aria-labelledby`,x))},[x,C])),E=(0,_.useRef)(null),D=s!==`required`,O=s===`info`;(0,_.useEffect)(()=>{if(t)return;let n=w.current;if(n)if(e){E.current=document.activeElement;let e=E.current;if(e&&e!==document.body){let t=Jj(e);n.style.setProperty(`--dialog-dir-x`,`${t.x}px`),n.style.setProperty(`--dialog-dir-y`,`${t.y}px`)}else n.style.setProperty(`--dialog-dir-x`,`0px`),n.style.setProperty(`--dialog-dir-y`,`16px`);if(!n.open){n.showModal();let e=n.querySelector(`[data-autofocus]`);e&&e.focus()}}else n.open&&n.close(),E.current?.focus(),E.current=null},[e,t]),Dj(e&&!t);let{shouldDismissOnCloseRequest:k}=Ki({isActive:e,isEnabled:!t,escapeBehavior:D?`close`:`block`,onDismiss:()=>{n(!1)}}),A=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let n=w.current?.querySelector(`#${CSS.escape(x)}`)!=null;e&&!t&&!C&&!n&&!A.current&&(A.current=!0)},[e,t,C,x]);let j=e=>{e.target===e.currentTarget&&O&&n(!1)},M=e=>{e.preventDefault(),k()&&D&&n(!1)},N=(0,K.jsx)(`div`,{...Sr(Yj.inner,...Kj(h?{useThemeDefault:`dialog`,maxHeight:b?.maxHeight}:{paddingInnerX:v,paddingInnerY:v,paddingOuterX:v,paddingOuterY:v,maxHeight:b?.maxHeight}),!h&&g!==4&&ni[g],!h&&g!==4&&ri[g],!h&&g!==4&&ii[g],!h&&g!==4&&ai[g],y&&h&&Yj.fullscreenSafeArea),children:(0,K.jsx)(qj,{value:S,children:l})}),P=a!=null&&!y,{open:F,...I}=m;return t?e?(0,K.jsx)(`div`,{...I,...oa(ba(`dialog`,{variant:o}),Sr(Yj.inlineWrapper,fi.reset,b&&tM.sizing(b.width,b.maxWidth,b.maxHeight),y&&Yj.fullscreen,u),d,f),"data-testid":m[`data-testid`],children:(0,K.jsx)(Ti,{children:N})}):null:(0,K.jsx)(`dialog`,{ref:T,...I,...oa(ba(`dialog`,{variant:o}),Wa.focusVisible(Yj.dialog,fi.reset,e&&Yj.open,Yj.backdrop,b&&tM.sizing(b.width,b.maxWidth,b.maxHeight),P&&(()=>{let e=rM(a);return tM.position(e.top,e.insetInlineStart,e.insetInlineEnd,e.bottom)})(),y&&Yj.fullscreen,y&&e&&Yj.fullscreenOpen,u),d,f),onClick:j,onCancel:M,"aria-modal":`true`,...s===`required`?{role:`alertdialog`}:void 0,children:(0,K.jsx)(Ti,{children:N})})}iM.displayName=`Dialog`;var aM=(0,_.createContext)(null);aM.displayName=`LayoutDividerContext`;var oM=(0,_.lazy)(async()=>Po(()=>Promise.resolve().then(()=>bd).then(e=>({default:e.Tooltip})),void 0)),sM={1:`h1`,2:`h2`,3:`h3`,4:`h4`,5:`h5`,6:`h6`};function cM({level:e,type:t,accessibilityLevel:n,color:r=`primary`,display:i=`block`,maxLines:a=0,hasTruncateTooltip:o=!0,wordBreak:s,textWrap:c,justify:l=`start`,hasCapsize:u=!1,hasStrikethrough:d=!1,xstyle:f,className:p,style:m,children:h,ref:g,...v}){let y=sM[e],b=n&&n!==e?{"aria-level":n}:{},x=s??(a===1?`break-all`:`break-word`),S=a>0||u?`block`:i,C=ko({maxLines:a}),w=typeof o==`string`?o:`above`,T=a>0&&o!==!1&&C.isTruncated,E=(0,_.useRef)(null),D=Ao(g,C.ref,E),O=a>1?{WebkitLineClamp:a}:void 0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(y,{ref:D,...oa(ba(`heading`,{level:e,color:r,...t&&{type:t}}),Sr(mo[Ro(r)],t?_o[t]:yo[e],t&&go[t],a===1?xo.singleLine:a>1?xo.multiLine:bo[S],a>0&&So[x],c&&Co[c],l!==`start`&&Do[l],u&&wo.enabled,d&&To.strikethrough,f),p,{...m,...O}),...b,...v,children:h}),T&&(0,K.jsx)(_.Suspense,{fallback:null,children:(0,K.jsx)(oM,{anchorRef:E,content:(0,K.jsx)(`span`,{...Sr(Oo.content),children:C.fullText}),placement:w})})]})}cM.displayName=`Heading`;function lM({ownerKey:e,images:t,onRemove:n}){let{t:r}=cr(),i=(0,_.useRef)(null),[a,o]=(0,_.useState)(null),s=(0,_.useRef)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(`fit`),f=a?.ownerKey===e?t.find(e=>e.id===a.id):void 0,p=a?JSON.stringify([a.ownerKey,a.id]):``,m=()=>{s.current=a,o(null)};return(0,_.useEffect)(()=>{if(a&&!f){s.current=null,o(null);return}if(a||!s.current)return;let n=s.current;s.current=null;let r=document.activeElement;n.ownerKey===e&&t.some(e=>e.id===n.id)&&n.trigger.isConnected&&(r===document.body||i.current?.contains(r))&&n.trigger.focus()},[a,f,e,t]),(0,K.jsxs)(K.Fragment,{children:[t.length>0&&(0,K.jsx)(`section`,{className:`composer-attachments`,"aria-label":r(`imageAttachments`),children:t.map(t=>(0,K.jsxs)(`div`,{className:`composer-attachment`,children:[(0,K.jsx)(`button`,{type:`button`,className:`composer-attachment-preview`,"aria-label":`${r(`previewAttachment`)} ${t.name}`,title:r(`previewAttachment`),onClick:n=>{n.currentTarget.focus(),n.currentTarget.blur(),s.current=null,l(null),d(`fit`),o({ownerKey:e,id:t.id,trigger:n.currentTarget})},children:(0,K.jsx)(`img`,{src:t.previewUrl,alt:``})}),(0,K.jsx)(`span`,{title:t.name,children:t.name}),(0,K.jsx)(`button`,{type:`button`,className:`composer-attachment-remove`,"aria-label":`${r(`removeAttachment`)} ${t.name}`,title:r(`removeAttachment`),onClick:()=>n(t.id),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]},t.id))}),(0,K.jsx)(iM,{ref:i,isOpen:!!f,onOpenChange:e=>!e&&m(),purpose:`info`,width:800,maxHeight:`calc(100dvh - 32px)`,padding:0,"aria-label":`${r(`previewAttachment`)} ${f?.name??``}`.trim(),children:f&&(0,K.jsxs)(`div`,{className:`draft-image-preview`,children:[(0,K.jsxs)(`header`,{children:[(0,K.jsx)(`strong`,{title:f.name,children:f.name}),(0,K.jsxs)(`fieldset`,{className:`draft-image-preview-modes`,"aria-label":r(`imageViewMode`),children:[(0,K.jsx)(Cd,{content:r(`fitImage`),placement:`below`,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":r(`fitImage`),"aria-pressed":u===`fit`,disabled:c===p,onClick:()=>d(`fit`),children:(0,K.jsx)(mt,{"aria-hidden":`true`})})}),(0,K.jsx)(Cd,{content:r(`originalImageSize`),placement:`below`,children:(0,K.jsx)(`button`,{type:`button`,"aria-label":r(`originalImageSize`),"aria-pressed":u===`original`,disabled:c===p,onClick:()=>d(`original`),children:(0,K.jsx)(We,{"aria-hidden":`true`})})})]}),(0,K.jsx)(`button`,{type:`button`,"data-autofocus":!0,"aria-label":r(`closeImagePreview`),title:r(`closeImagePreview`),onClick:m,children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]}),(0,K.jsx)(`section`,{className:`draft-image-preview-body`,"aria-label":r(`imageViewMode`),"data-mode":u,tabIndex:u===`original`&&c!==p?0:void 0,children:c===p?(0,K.jsx)(`p`,{className:`composer-attachment-error`,role:`alert`,children:r(`imagePreviewFailed`)}):(0,K.jsx)(`img`,{src:f.previewUrl,alt:f.name,onError:()=>l(p)},p)})]})})]})}function uM({ownerKey:e,files:t,onRemove:n}){let{t:r}=cr(),i=(0,_.useRef)(null),[a,o]=(0,_.useState)(null),s=(0,_.useRef)(null),c=a?.ownerKey===e?t.find(e=>e.id===a.id):void 0,l=()=>{s.current=a,o(null)};(0,_.useEffect)(()=>{if(a&&!c){s.current=null,o(null);return}if(a||!s.current)return;let n=s.current;s.current=null;let r=document.activeElement;n.ownerKey===e&&t.some(e=>e.id===n.id)&&n.trigger.isConnected&&(r===document.body||i.current?.contains(r))&&n.trigger.focus()},[a,c,e,t]);let u=e=>r(e.extractionError?`fileAttachmentExtractionFailed`:e.extraction===`truncated`?`fileAttachmentTextTruncated`:e.extraction===`text`?`fileAttachmentTextReady`:`fileAttachmentOriginalReady`);return(0,K.jsxs)(K.Fragment,{children:[t.length>0&&(0,K.jsx)(`section`,{className:`composer-attachments`,"aria-label":r(`fileAttachments`),children:t.map(t=>(0,K.jsxs)(`div`,{className:`composer-attachment composer-file-attachment`,children:[(0,K.jsx)(`button`,{type:`button`,className:`composer-attachment-preview`,"aria-label":`${r(`previewFileAttachment`)} ${t.name}`,onClick:n=>{n.currentTarget.focus(),n.currentTarget.blur(),s.current=null,o({ownerKey:e,id:t.id,trigger:n.currentTarget})},children:(0,K.jsx)(Se,{"aria-hidden":`true`})}),(0,K.jsxs)(`span`,{title:t.name,children:[t.name,(0,K.jsx)(`small`,{children:u(t)})]}),(0,K.jsx)(`button`,{type:`button`,className:`composer-attachment-remove`,"aria-label":`${r(`removeAttachment`)} ${t.name}`,onClick:()=>n(t.id),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]},t.id))}),(0,K.jsx)(iM,{ref:i,isOpen:!!c,onOpenChange:e=>!e&&l(),purpose:`info`,width:720,maxHeight:`calc(100dvh - 32px)`,"aria-label":`${r(`previewFileAttachment`)} ${c?.name??``}`.trim(),children:c&&(0,K.jsxs)(`div`,{className:`draft-file-preview`,children:[(0,K.jsx)(`strong`,{children:c.name}),(0,K.jsxs)(`p`,{children:[u(c),` · `,(c.size/1024).toFixed(1),` KB`]}),c.extractionError&&(0,K.jsx)(`p`,{children:r(c.extractionError===`encoding`?`fileAttachmentEncodingUnavailable`:`fileAttachmentDocumentUnavailable`)}),c.text===void 0?(0,K.jsx)(`p`,{children:r(`fileAttachmentNoText`)}):(0,K.jsxs)(`pre`,{children:[c.text.slice(0,2e4),c.text.length>2e4?`\n${r(`fileAttachmentPreviewTruncated`)}`:``]})]})})]})}var dM=new Set(`txt md markdown csv tsv json jsonl ndjson xml html htm css scss sass less yaml yml toml ini cfg conf config log rst tex diff patch sql graphql gql py ipynb js mjs cjs jsx ts mts cts tsx java kt kts scala c cc cpp cxx h hpp cs go rs rb php swift sh bash zsh fish ps1 bat cmd r lua pl proto vue svelte astro svg srt vtt env gitignore dockerignore editorconfig properties lock`.split(` `));function fM(e,t,n){let r=e.split(`.`).at(-1)?.toLowerCase()||``;return new TextDecoder(`ascii`).decode(n.subarray(0,5))===`%PDF-`?`pdf`:[`pdf`,`docx`,`xlsx`,`pptx`].includes(r)?r:dM.has(r)||/^(?:readme|license|licence|changelog|dockerfile|makefile|gemfile)$/iu.test(e)||t.startsWith(`text/`)||/^application\/(?:json|(?:[^;]+\+)?xml|javascript|x-yaml)(?:;|$)/iu.test(t)?`text`:`binary`}var pM=15e3;function mM(e,t){return new Promise((n,r)=>{let i=new FileReader,a=e=>{clearTimeout(s),t?.removeEventListener(`abort`,o),e?r(e):i.result instanceof ArrayBuffer?n(i.result):r(Error(`file-read`))},o=()=>{i.abort(),a(new DOMException(`File staging cancelled.`,`AbortError`))},s=setTimeout(()=>{i.abort(),a(Error(`file-timeout`))},pM);i.onload=()=>a(),i.onerror=()=>a(Error(`file-read`)),t?.addEventListener(`abort`,o,{once:!0}),t?.aborted?o():i.readAsArrayBuffer(e)})}function hM(e,t,n){return new Promise((r,i)=>{let a=new Worker(new URL(`/app-file-text-worker-DegOHoqE.js`,``+import.meta.url),{type:`module`}),o=(e,t)=>{clearTimeout(c),n?.removeEventListener(`abort`,s),a.terminate(),t?i(t):e?r(e):i(Error(`file-document-invalid`))},s=()=>o(void 0,new DOMException(`File staging cancelled.`,`AbortError`)),c=setTimeout(()=>o(void 0,Error(`file-timeout`)),pM);a.onmessage=e=>{!e.data||!(`result`in e.data||`error`in e.data)||(e.data.error?o(void 0,Error(e.data.error)):o(e.data.result))},a.onerror=()=>o(void 0,Error(`file-document-invalid`)),n?.addEventListener(`abort`,s,{once:!0}),n?.aborted?s():a.postMessage({data:e,kind:t},[e])})}async function gM(e,t){if(e.size>52428800)throw Error(`file-size`);let n=await mM(e,t),r=new Uint8Array(n),i=fM(e.name,e.type,r),a=r.length,o=await hM(n,i,t);return t?.throwIfAborted(),{id:globalThis.crypto?.randomUUID?.()??`${Date.now()}-${e.name}`,name:e.name||`file`,size:a,mimeType:e.type||`application/octet-stream`,...o}}var _M=!1;typeof window<`u`&&requestAnimationFrame(()=>{_M=!0});var vM={slideDown:{kKVMdj:`x1srr2gu x1aquc0h`,k44tkh:`x9uej1z`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,$$css:!0},slideUp:{kKVMdj:`x1dvww92 x1aquc0h`,k44tkh:`x9uej1z`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,$$css:!0},fadeIn:{kKVMdj:`xqcmdr3 x1aquc0h`,k44tkh:`x9uej1z`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,$$css:!0},scaleIn:{kKVMdj:`x97zbip x1aquc0h`,k44tkh:`x9uej1z`,kyAemX:`x128ha8g`,kWV6AL:`xskzprw`,$$css:!0}};function yM(e=`slideDown`){let[t]=(0,_.useState)(()=>_M);return t?vM[e]:null}var bM=new Set([`text`,`password`,`email`,`number`,`search`,`tel`,`url`,`date`,`datetime-local`,`month`,`time`,`week`]),xM=new Set([`true`,`menu`,`listbox`,`tree`,`grid`,`dialog`]);function SM(e){if(e.getAttribute(`role`)===`combobox`)return!0;let t=e.getAttribute(`aria-haspopup`);return t!=null&&xM.has(t)}function CM({containerRef:e,inputRef:t,disabled:n=!1}){return Ya({containerRef:e,interactiveRef:t,onClick:(0,_.useCallback)(()=>{let e=t.current;e!=null&&(e instanceof HTMLElement&&SM(e)?e.click():e instanceof HTMLInputElement&&bM.has(e.type)||e instanceof HTMLTextAreaElement?e.focus():e instanceof HTMLElement?e.click():`focus`in e&&e.focus())},[t]),disabled:n})}var wM={warning:`warning`,error:`error`,success:`success`},TM={warning:`@astryx.input.statusButton.warning`,error:`@astryx.input.statusButton.error`,success:`@astryx.input.statusButton.success`},EM={statusButton:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kfzvcC:`x67bb7w`,kaIpWk:`xjspbzw`,kInvED:`x7s97pk`,$$css:!0}};function DM({status:e,statusVariant:t=`attached`,isInGroup:n=!1,size:r=`md`}){let i=Rc(),a=t===`tooltip`&&!!e?.message,[o,s]=(0,_.useState)(void 0),c=po({placement:`above`,isEnabled:a,isOpen:o}),l=(0,_.useCallback)(()=>{s(void 0)},[]),u=(0,_.useCallback)(()=>{typeof window>`u`||typeof window.matchMedia!=`function`||!window.matchMedia(`(hover: none)`).matches||s(e=>e!==!0)},[]);if((0,_.useEffect)(()=>{if(o!==!0)return;let e=e=>{e.key===`Escape`&&s(void 0)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[o]),!(e&&!n&&t!==`detached`))return{statusIcon:null,describedBy:void 0};let d=(0,K.jsx)(xu,{icon:wM[e.type],size:r,color:e.type,...ba(`input-status-icon`,{size:r,status:e.type})});return a?{statusIcon:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{type:`button`,ref:c.ref,"aria-label":i(TM[e.type]),"aria-describedby":c.describedBy,onClick:u,onBlur:l,...Sr(Ha.focusVisible,EM.statusButton),children:d}),c.renderTooltip(e.message)]}),describedBy:c.describedBy}:{statusIcon:d,describedBy:void 0}}var OM=(0,_.createContext)({direction:`vertical`});OM.displayName=`FormLayoutContext`;var kM={label:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`xzye2dw`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kLWn49:`x1kq96og`,k63SB2:`x1e4wzip`,kMwMTN:`xv1l7n4`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},labelDisabled:{kMwMTN:`xnbbluu`,kkrTdU:`xt0e3qv`,$$css:!0},srOnly:{ksu8eU:`xng3xce`,kMcinP:`xzpqnlu`,kZKoxP:`xjm9jq1`,kLqNvP:`x1o0tod`,kogj98:`xkdpibf`,kVQacm:`xb3r6kr`,kmVPX3:`x1717udv`,kfzvcC:`x47corl`,kVAEAm:`x10l6tqk`,k87sOh:`x13vifvy`,kfSwDN:`x87ps6o`,khDVqt:`xuxw1ft`,kzqmXN:`x1i1rx1s`,$$css:!0}};function AM({label:e,inputID:t,labelID:n,isGroupLabel:r=!1,isLabelHidden:i=!1,isDisabled:a=!1,isOptional:o=!1,isRequired:s=!1,labelIcon:c,labelTooltip:l,description:u,descriptionID:d,className:f,style:p,xstyle:m,ref:h,...g}){let v=Rc(),{defaultOptionality:y}=(0,_.use)(OM),b=o&&y!==`optional`?v(`@astryx.field.optional`):s&&y!==`required`?v(`@astryx.field.required`):null,x=r?`span`:`label`,S=!r&&t!=null,C=(0,_.useRef)(null),w=CM({containerRef:C,inputRef:(0,_.useMemo)(()=>({get current(){return t==null?null:C.current?.ownerDocument.getElementById(t)??null},set current(e){}}),[t]),disabled:!S}),T=(0,K.jsxs)(K.Fragment,{children:[c&&Cu(c,{size:`sm`,color:`inherit`}),e,b&&(0,K.jsxs)(`span`,{className:`x1sodnla x141an7d x1ltkj2j xv1l7n4`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,children:` ∙ `}),b]}),l&&(0,K.jsx)(Cd,{content:l,placement:`above`,children:(0,K.jsx)(xu,{icon:`info`,size:`sm`,color:`inherit`})})]});return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(x,{ref:h,id:n,htmlFor:r?void 0:t,...g,...oa(ba(`field-label`),Sr(kM.label,a&&kM.labelDisabled,i&&kM.srOnly,m),f,p),children:T}),u&&(0,K.jsx)(`span`,{ref:S?C:void 0,id:d,...S?w:void 0,...{0:{className:`x9ynric x141an7d x1ltkj2j x1sodnla xv1l7n4`},2:{className:`x9ynric x141an7d x1ltkj2j x1sodnla xv1l7n4 x1ypdohk x16khyan`},1:{className:`x9ynric x141an7d x1ltkj2j x1sodnla xv1l7n4 xng3xce xzpqnlu xjm9jq1 x1o0tod xkdpibf xb3r6kr x1717udv x47corl x10l6tqk x13vifvy x87ps6o xuxw1ft x1i1rx1s`},3:{className:`x9ynric x141an7d x1ltkj2j x1sodnla xv1l7n4 x1ypdohk x16khyan xng3xce xzpqnlu xjm9jq1 x1o0tod xkdpibf xb3r6kr x1717udv x47corl x10l6tqk x13vifvy x87ps6o xuxw1ft x1i1rx1s`}}[!!S<<1|!!i<<0],children:u})]})}AM.displayName=`FieldLabel`;var jM={warning:`warning`,error:`error`,success:`success`},MM={base:{kMv6JI:`x9ynric`,kGuDYH:`x141an7d`,kLWn49:`x1ltkj2j`,$$css:!0},attached:{keoZOQ:`x1c40v9y`,kLKAdn:`x1ak3mig`,kGO01o:`x1wesfrj`,kg3NbH:`xf314gf`,kVL7Gh:`xquck67`,kT0f0o:`x14i3lts`,$$css:!0},detached:{keoZOQ:`xcsaf9d`,k8WAf4:`xce4md1`,kg3NbH:`xf314gf`,kaIpWk:`xh6dtrn`,$$css:!0}},NM={warning:{kWkggS:`x24i8r5`,kMwMTN:`xdhq94a`,$$css:!0},error:{kWkggS:`x1pritpl`,kMwMTN:`x1joocv1`,$$css:!0},success:{kWkggS:`xu13z74`,kMwMTN:`xltfdvo`,$$css:!0}};function PM({ref:e,type:t,message:n,id:r,variant:i=`attached`,xstyle:a,className:o,style:s,...c}){let l=yM(`slideDown`),u=so();return(0,_.useEffect)(()=>{n&&u(n,t===`error`?`assertive`:`polite`)},[u,n,t]),(0,K.jsx)(`div`,{ref:e,id:r,...c,...oa(ba(`field-status`,{type:t,variant:i}),Sr(MM.base,l,i===`attached`?MM.attached:MM.detached,NM[t],a),o,s),children:i===`detached`?(0,K.jsxs)(`span`,{className:`x78zum5 x1cy8zhl xzye2dw`,children:[(0,K.jsx)(`span`,{className:`x3nfvp2 x6s0dn4 x14o5nre x2lah0s`,children:(0,K.jsx)(xu,{icon:jM[t],size:`sm`,color:`inherit`,...ba(`field-status-icon`,{type:t})})}),(0,K.jsx)(`span`,{children:n})]}):n})}PM.displayName=`FieldStatus`;var FM={container:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,$$css:!0},containerGap:{kOIVth:`xzye2dw`,$$css:!0},horizontalLabels:{k1xSpc:`xjp7ctv`,$$css:!0}},IM={width:e=>[{kzqmXN:e==null?e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]};function LM({label:e,isLabelHidden:t=!1,description:n,inputID:r,labelID:i,isGroupLabel:a=!1,descriptionID:o,isOptional:s=!1,isRequired:c=!1,isDisabled:l=!1,labelIcon:u,status:d,labelTooltip:f,statusVariant:p=`attached`,width:m,xstyle:h,children:g,className:v,style:y,ref:b,...x}){let{direction:S}=(0,_.use)(OM),C=S===`horizontal-labels`,w=o??(n?`${r}-desc`:void 0),T=d?.messageID??(d?.message?`${r}-status`:void 0);sd(`Field`,`isOptional and isRequired are mutually exclusive. isOptional takes precedence.`,s&&c);let E=(0,K.jsx)(AM,{label:e,inputID:r,labelID:i,isGroupLabel:a,isLabelHidden:t,isDisabled:l,isOptional:s,isRequired:c,labelIcon:u,labelTooltip:f,description:C?void 0:n,descriptionID:C?void 0:w}),D=d?.message&&p!==`tooltip`?(0,K.jsx)(PM,{type:d.type,message:d.message,id:T,variant:p}):null;return C?(0,K.jsxs)(`div`,{ref:b,...oa(ba(`field`,{layout:`horizontal-labels`}),Sr(FM.horizontalLabels,h),v,y),...x,children:[(0,K.jsx)(`div`,{className:`x1enrzb7`,children:E}),(0,K.jsxs)(`div`,{className:`x78zum5 xdt5ytf xc8icb0`,children:[n&&(0,K.jsx)(zo,{type:`supporting`,display:`block`,id:w,children:n}),g,D]})]}):(0,K.jsxs)(`div`,{ref:b,...oa(ba(`field`),Sr(FM.container,!t&&FM.containerGap,m!=null&&IM.width(m),h),v,y),...x,children:[E,p===`attached`?(0,K.jsxs)(`div`,{className:`x78zum5 xdt5ytf xc8icb0`,children:[g,D]}):(0,K.jsxs)(K.Fragment,{children:[g,D]})]})}LM.displayName=`Field`;var RM={base:{kB7OPa:`x9f619`,kVAEAm:`x1n2onr6`,kY2c9j:`x1vjfegm`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,kMzoRj:`x1litavf`,ksu8eU:`x1y0btm7`,kVAM5u:`xvy26l8 x6q1khz`,"--_field-radius":`x1832zxr`,kaIpWk:`xvdfih8`,kWkggS:`x10xzikg`,k1ekBW:`x12zzom9`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kGVxlE:`x1gnnqk1 x1xqjsvb xuihb5h`,kI3sdo:`x1a2a7pz`,$$css:!0},disabled:{kkrTdU:`xt0e3qv`,kSiTet:`xbyyjgo`,kVAM5u:`xvy26l8`,kGVxlE:`x1gnnqk1`,$$css:!0}},zM={warning:{kVAM5u:`x8wg1ba`,$$css:!0},error:{kVAM5u:`x1ofxpqo`,$$css:!0},success:{kVAM5u:`x16m2moy`,$$css:!0}},BM={warning:{kGVxlE:`x1gnnqk1 x9156jc`,$$css:!0},error:{kGVxlE:`x1gnnqk1 x1bgmis8`,$$css:!0},success:{kGVxlE:`x1gnnqk1 x8wp45d`,$$css:!0}},VM={warning:{kVAM5u:`x8wg1ba xa1yw2k`,$$css:!0},error:{kVAM5u:`x1ofxpqo xk2sxw7`,$$css:!0},success:{kVAM5u:`x16m2moy xyq33ac`,$$css:!0}},HM={button:{kZKoxP:`x1qx5ct2`,kmuXW:`x2lah0s`,kVAEAm:`x1n2onr6`,"--_input-clear-hit-inset":`xtoycft x181bpwf`,"--_input-clear-hit-content":`xqxtgf4 xp8r40j`,k5JduY:`xh3pasq`,kwXMNM:`x1j6awrg`,kv0HGH:`xht581f`,$$css:!0}};function UM({label:e,onClick:t,onPointerDown:n,onClickCapture:r,xstyle:i,iconClassName:a}){let{className:o}=ba(`input-clear-icon`),{className:s}=ba(`input-clear-button`);return(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,label:e,className:s,icon:(0,K.jsx)(xu,{icon:`close`,size:`sm`,color:`secondary`,className:a==null?o:`${o} ${a}`}),onClick:t,onPointerDown:n,onClickCapture:r,isIconOnly:!0,xstyle:[HM.button,i]})}function WM(e){return UM(e)}function GM(e){return UM(e)}WM.displayName=`InputClearButton`;var KM={inGroup:{kUk6DE:`x98rzlu`,k7Eaqz:`xeuugli`,kZKoxP:`x5yr21d`,keTefX:`xd10s4z x1pwwqoy`,krdFHd:`x15mokao x8eehn2`,kVL7Gh:`xbiv7yw x1xrp5p4`,kfmiAY:`x1ga7v0g x1tzxhge`,kT0f0o:`x16uus16 x1rmb4wm`,kXnDq0:`x1rm9qnc`,$$css:!0}};function qM({isRequired:e=!1,isOptional:t=!1}){let{defaultOptionality:n}=(0,_.use)(OM);return!t&&(e||n===`required`)}var JM=(0,_.createContext)(null);JM.displayName=`InputGroupContext`;function YM(){return(0,_.use)(JM)}var XM={sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0}};function ZM({type:e=`text`,label:t,isLabelHidden:n=!1,description:r,isOptional:i=!1,isRequired:a=!1,isDisabled:o=!1,isReadOnly:s=!1,disabledMessage:c,startIcon:l,status:u,statusVariant:d=`attached`,size:f,onChange:p,changeAction:m,isLoading:h=!1,value:g,placeholder:v,labelTooltip:y,hasClear:b=!1,hasAutoFocus:x=!1,htmlName:S,onEnter:C,onKeyDown:w,width:T,xstyle:E,className:D,style:O,ref:k,...A}){let j=Rc(),M=qM({isRequired:a,isOptional:i}),N=as(f,`md`),P=(0,_.useId)(),F=(0,_.useId)(),I=(0,_.useId)(),L=(0,_.useId)(),R=(0,_.useRef)(null),ee=(0,_.useRef)(null),z=YM(),[,B]=(0,_.useTransition)(),[V,H]=(0,_.useOptimistic)(g),te=h||V!==g,ne=o&&!!c,re=po({placement:`above`,focusTrigger:`always`,isEnabled:ne}),{statusIcon:ie,describedBy:ae}=DM({status:u,statusVariant:d,isInGroup:!!z}),{ariaLabelledBy:U,ariaDescribedBy:oe}=Oa(F,[r?I:null,!z&&d!==`tooltip`&&u?.message?L:null,ae,ne?re.describedBy:null],z),se=e=>{if(o||s)return;let t=e.target.value;p?.(t,e),m&&!e.defaultPrevented&&B(async()=>{H(t),await m(t,e)})},ce=(0,_.useCallback)(()=>{p?.(``,null),R.current?.focus()},[p]),{onClick:le,onMouseUp:ue}=CM({containerRef:ee,inputRef:R,disabled:o}),de=(0,K.jsxs)(`div`,{ref:e=>{ee.current=e,re.ref(e)},onClick:le,onMouseUp:ue,...oa(ba(`text-input`,{size:N,status:u?.type??null,disabled:o?`disabled`:null,readonly:s?`readonly`:null}),Sr(RM.base,XM[N],o&&RM.disabled,u&&zM[u.type],u&&!o&&BM[u.type],u&&VM[u.type],z&&KM.inGroup,E),D,O),children:[l&&Cu(l,{size:`sm`,color:`secondary`}),z&&(0,K.jsx)(es,{id:F,children:t}),(0,K.jsx)(`input`,{...A,ref:Ao(k,R),id:P,name:o?void 0:S,type:e,value:V,onChange:se,onKeyDown:C||w?e=>{e.key===`Enter`&&C?.(),w?.(e)}:void 0,placeholder:v,disabled:o&&!ne,"aria-disabled":ne?`true`:void 0,readOnly:s||ne||void 0,autoFocus:x,"data-autofocus":x||void 0,"aria-describedby":oe,"aria-required":M?`true`:void 0,"aria-invalid":u?.type===`error`?`true`:void 0,"aria-busy":te||void 0,"aria-labelledby":U,...{0:{className:`x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 x6pjikd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5`},1:{className:`x1lliihq x98rzlu xeuugli xc342km xng3xce x1717udv x9ynric xjm74w1 x6pjikd xw6l6zx x1tgivj0 xjbqb8w x1a2a7pz xeyghm5 xt0e3qv`}}[!!o<<0]}),b&&g!==``&&!o&&!s&&(0,K.jsx)(WM,{label:j(`@astryx.textInput.clearLabel`,{label:t}),onClick:ce}),te&&(0,K.jsx)($o,{size:`sm`}),ie]});return z?(0,K.jsxs)(K.Fragment,{children:[de,ne&&re.renderTooltip(c)]}):(0,K.jsxs)(LM,{label:t,isLabelHidden:n,description:r,inputID:P,descriptionID:r?I:void 0,isOptional:i,isRequired:a,isDisabled:o,status:u?{type:u.type,message:u.message,messageID:u.message?L:void 0}:void 0,statusVariant:d,labelTooltip:y,width:T,children:[de,ne&&re.renderTooltip(c)]})}ZM.displayName=`TextInput`;var QM={ARTIFACT_DENIED:`fileReferenceDenied`,ARTIFACT_MISSING:`fileReferenceMissing`,ARTIFACT_UNSUPPORTED:`fileReferenceUnsupported`,ARTIFACT_EXPIRED:`fileReferenceExpired`,ARTIFACT_LIMIT:`fileReferenceBusy`,ARTIFACT_BUSY:`fileReferenceBusy`};function $M({open:e,sessionId:t,onClose:n,onInsert:r}){let{t:i}=cr(),a=(0,_.useMemo)(()=>new lf,[]),o=(0,_.useRef)(null),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null);(0,_.useEffect)(()=>(c(``),u(!1),f(null),()=>{o.current?.abort(),o.current=null}),[e,t]);let p=()=>{o.current?.abort(),o.current=null,n()},m=async()=>{let e=s.trim();if(!e||o.current)return;if(f(null),!t){let t=r(e);if(t){f(t);return}n();return}let c=new AbortController;o.current=c,u(!0);let l;try{if(l=(await a.resolveArtifact(t,encodeURI(e),void 0,c.signal)).handle,c.signal.aborted||(await a.artifactMetadata(t,l,c.signal),c.signal.aborted))return;let i=r(e);if(i){f(i);return}n()}catch(e){if(!c.signal.aborted){let t=e instanceof sf&&e.code?QM[e.code]:void 0;f(t?i(t):e instanceof Error?e.message:i(`fileReferenceFailed`))}}finally{o.current===c&&(o.current=null),l&&a.releaseArtifact(t,l).catch(()=>void 0),c.signal.aborted||u(!1)}};return(0,K.jsx)(iM,{isOpen:e,onOpenChange:e=>!e&&p(),purpose:`form`,width:460,"aria-label":i(`fileReferenceTitle`),children:(0,K.jsxs)(`form`,{className:`openpi-dialog file-reference-dialog`,onSubmit:e=>{e.preventDefault(),m()},children:[(0,K.jsxs)(`div`,{className:`file-reference-heading`,children:[(0,K.jsx)(Se,{"aria-hidden":`true`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:i(`fileReferenceTitle`)}),(0,K.jsx)(`p`,{children:i(`fileReferenceDetail`)})]})]}),(0,K.jsx)(ZM,{label:i(`fileReferenceLabel`),value:s,placeholder:i(`fileReferencePlaceholder`),description:i(t?`fileReferenceValidatedHint`:`fileReferenceDraftHint`),hasAutoFocus:!0,hasClear:!0,isDisabled:l,onChange:e=>{c(e.slice(0,4096)),f(null)}}),d&&(0,K.jsx)(`p`,{className:`file-reference-error`,role:`alert`,children:d}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:p,children:i(`cancel`)}),(0,K.jsx)(`button`,{type:`submit`,className:`primary`,disabled:l||!s.trim(),children:i(l?`fileReferenceChecking`:`insertReference`)})]})]})})}function eN(e,t=e.split(/[\\/]/u).at(-1)||e){let n=encodeURI(e).replace(/[<>]/gu,encodeURIComponent);return`[${t.replace(/[\\[\]]/gu,`\\$&`)}](<${n}>)`}function tN(e){return[...e.matchAll(/(?\r\n]+)>\)/gu)].slice(0,100).flatMap(e=>{let t=e[2];return t.length>4096||!Td(t)?[]:[{name:e[1].replace(/\\([\\[\]])/gu,`$1`),reference:t,start:e.index,end:e.index+e[0].length}]})}function nN({items:e,onClose:t}){let n=(0,_.useRef)(null),r=(0,_.useRef)(t);return r.current=t,(0,_.useEffect)(()=>{n.current?.querySelector(`button:not(:disabled)`)?.focus();let e=e=>{!(e.target instanceof Element)||n.current?.contains(e.target)||e.target.closest(`.composer-context-trigger`)||r.current()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[]),(0,_.useLayoutEffect)(()=>{let e=n.current,t=e?.closest(`form`);if(!e||!t)return;let r=()=>{let n=window.visualViewport,r=n?.offsetTop??0,i=r+(n?.height??window.innerHeight),a=t.getBoundingClientRect(),o=Math.max(0,a.top-r-16),s=Math.max(0,i-a.bottom-16),c=o<180&&s>o;e.dataset.placement=c?`below`:`above`,e.style.maxHeight=`${Math.min(400,c?s:o)}px`};r();let i=typeof ResizeObserver>`u`?null:new ResizeObserver(r);return i?.observe(t),window.addEventListener(`resize`,r),window.visualViewport?.addEventListener(`resize`,r),window.visualViewport?.addEventListener(`scroll`,r),()=>{i?.disconnect(),window.removeEventListener(`resize`,r),window.visualViewport?.removeEventListener(`resize`,r),window.visualViewport?.removeEventListener(`scroll`,r)}},[]),(0,K.jsx)(`div`,{ref:n,id:`composer-action-menu`,className:`composer-action-menu`,role:`menu`,onKeyDown:e=>{if(!e.nativeEvent.isComposing){if(e.key===`Escape`||e.key===`Tab`)e.key===`Escape`&&e.preventDefault(),t(!0);else if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)){e.preventDefault();let t=[...e.currentTarget.querySelectorAll(`button:not(:disabled)`)],n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowUp`?-1:1)+t.length)%t.length]?.focus()}}},children:e.map((t,n)=>(0,K.jsxs)(`div`,{role:`none`,children:[e[n-1]?.section!==t.section&&(0,K.jsx)(`div`,{className:`composer-action-section`,role:`presentation`,children:t.section}),(0,K.jsxs)(`button`,{type:`button`,role:`menuitem`,"aria-label":[t.label,t.alias].filter(Boolean).join(` `),"aria-description":t.description,disabled:t.disabled,onClick:t.onClick,title:t.description,children:[t.icon,(0,K.jsx)(`span`,{children:t.label}),t.alias&&(0,K.jsx)(`small`,{children:t.alias}),(0,K.jsx)(`span`,{className:`composer-action-description`,children:t.description})]})]},t.id))})}var rN={triggerContainer:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xrrkdod`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib xdk3u5w`,kLWn49:`x1kq96og`,kMwMTN:`x1tgivj0`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},trigger:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzQI83:`x1iyjqo2`,kmuXW:`xs83m0k`,kCS8Yb:`x1r8uery`,k7Eaqz:`xeuugli`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMv6JI:`xjb2p0i`,kGuDYH:`x1qlqyl8`,kLWn49:`x15bjb6t`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kI3sdo:`x1a2a7pz`,kaIpWk:`xh6dtrn`,$$css:!0},triggerText:{kzQI83:`x1iyjqo2`,k7Eaqz:`xeuugli`,kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,k9WMMc:`x1yc453h`,$$css:!0},placeholder:{kMwMTN:`xv1l7n4`,$$css:!0},triggerGhost:{kzqmXN:`x14atkfc`,kMzoRj:`xc342km`,kWkggS:`xjbqb8w`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4`,$$css:!0},triggerGhostDisabled:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q`,$$css:!0},triggerIcon:{kmuXW:`x2lah0s`,$$css:!0},triggerIconRotation:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,k3nNDw:`x1g0ag68`,$$css:!0},triggerIconOpen:{k3aq6I:`x19jd1h0`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,$$css:!0},content:{kB7OPa:`x9f619`,kskxy:`xpnbb6b`,kVQacm:`xysyzu8`,kmVPX3:`x1b2ylru`,$$css:!0},sm:{kZKoxP:`x6k0iem`,$$css:!0},md:{kZKoxP:`x1ueg155`,$$css:!0},lg:{kZKoxP:`xssyfek`,$$css:!0},disabled:{kkrTdU:`xt0e3qv`,$$css:!0}};function iN({label:e,value:t,onChange:n,changeAction:r,children:i,triggerLabel:a,placeholder:o,isLabelHidden:s=!1,description:c,isOptional:l=!1,isRequired:u=!1,isDisabled:d=!1,isLoading:f=!1,status:p,statusVariant:m=`attached`,labelTooltip:h,size:g=`md`,variant:v=`input`,startIcon:y,width:b,placement:x=`below`,alignment:S=`start`,handleRef:C,onOpenChange:w,contentXstyle:T,xstyle:E,className:D,style:O,"data-testid":k,onClick:A,...j}){let M=Rc(),N=qM({isRequired:u,isOptional:l}),P=o??M(`@astryx.selector.placeholder`),F=v===`ghost`&&m===`attached`?`detached`:m,I=(0,_.useId)(),L=(0,_.useId)(),R=(0,_.useId)(),ee=(0,_.useId)(),z=(0,_.useId)(),B=[c?ee:null,p?.message?z:null].filter(e=>e!=null).join(` `)||void 0,V=(0,_.useRef)(null),[H,te]=(0,_.useTransition)(),[ne,re]=(0,_.useOptimistic)(t),ie=f||H,ae=ud({dialogLabel:e,hasCloseButton:!1,hasAutoFocus:!0,surfaceTarget:`complex-selector-popup`,onShow:(0,_.useCallback)(()=>{w?.(!0)},[w]),onHide:(0,_.useCallback)(()=>{V.current?.focus(),w?.(!1)},[w])}),U=ae.isOpen,oe=(0,_.useCallback)(()=>{d||(ae.isOpen?ae.hide():ae.show())},[d,ae]),se=(0,_.useCallback)(()=>{ae.hide()},[ae]);(0,_.useImperativeHandle)(C,()=>({open:()=>{d||ae.show()},close:()=>ae.hide(),toggle:()=>{d||(ae.isOpen?ae.hide():ae.show())},isOpen:()=>ae.isOpen}),[d,ae]);let ce=(0,_.useCallback)(e=>{n?.(e),r&&te(async()=>{re(e),await r(e)})},[r,n,re,te]),le=a??P,ue=Cu(y,{size:`sm`,color:`secondary`}),de=(0,K.jsx)(`div`,{id:R,...Sr(rN.content,T),children:i(ne,ce,se,{isOpen:U,isBusy:ie,triggerId:I,contentId:R})}),fe=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{ref:ae.triggerRef,"data-testid":k,...j,onClick:ca(A,oe),...oa(ba(`complex-selector`,{variant:v,size:g,status:p?.type??null}),Sr(RM.base,rN.triggerContainer,rN[g],Ha.focusWithin,v===`ghost`&&rN.triggerGhost,v===`ghost`&&ds.backgroundImage,d&&RM.disabled,v===`ghost`&&d&&rN.triggerGhostDisabled,d&&rN.disabled,a==null&&rN.placeholder,E),D,O),children:[Ea(ue)&&ue,(0,K.jsx)(`button`,{ref:V,id:I,type:`button`,"aria-haspopup":`dialog`,"aria-expanded":U,"aria-controls":R,"aria-describedby":B,"aria-labelledby":L,"aria-required":N?`true`:void 0,"aria-invalid":p?.type===`error`?`true`:void 0,"aria-busy":ie||void 0,disabled:d,onKeyDown:e=>{e.key===`ArrowDown`&&!U&&!d&&(e.preventDefault(),ae.show())},className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz xh6dtrn`,children:(0,K.jsx)(`span`,{className:`x1iyjqo2 xeuugli xb3r6kr xlyipyv xuxw1ft x1yc453h`,children:le})}),ie&&(0,K.jsx)($o,{size:`sm`}),(0,K.jsx)(xu,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:[rN.triggerIcon,rN.triggerIconRotation,U&&rN.triggerIconOpen],...ba(`complex-selector-indicator-icon`,{state:U?`expanded`:`collapsed`})})]}),ae.render(de,{placement:x,alignment:S,offset:Br[`--spacing-1`],xstyle:[rN.popover,co[x]]})]});return(0,K.jsx)(LM,{label:e,isLabelHidden:s,description:c,inputID:I,descriptionID:c?ee:void 0,labelID:L,isOptional:l,isRequired:u,isDisabled:d,status:p?{type:p.type,message:p.message,messageID:p.message?z:void 0}:void 0,statusVariant:F,labelTooltip:h,width:b,children:fe})}iN.displayName=`ComplexSelector`;function aN(e){let t=`${e.provider}/${e.id}`;return e.label===t?t:`${e.label} (${t})`}function oN({snapshot:e,model:t,pending:n,disabled:r,actions:i,onChooseModel:a,onClose:o}){let{t:s}=cr(),c=e?.thinking,l=n??c?.level??``,u=e?.preferences.hiddenThinkingLevels??[],d=(c?.available??[]).filter(e=>!u.some(t=>t===e)||e===l||e===c?.level),[f]=(0,_.useState)(c?.level??``),[p,m]=(0,_.useState)(null),h=(0,_.useRef)(null),g=(0,_.useRef)(null),v=e=>e?e[0].toUpperCase()+e.slice(1):s(`unknownState`),y=()=>{h.current=null,m(null)};(0,_.useEffect)(()=>(g.current?.focus(),()=>{h.current=null}),[]);let b=()=>{let e=h.current;if(y(),e===null||r||!c?.supported)return;let t=d[e];t&&t!==l&&i.selectThinking(t)},x=p??Math.max(0,d.indexOf(l)),S=p===null?l:d[x]??l;return(0,K.jsxs)(`div`,{className:`thinking-controls`,children:[(0,K.jsx)(`div`,{className:`thinking-strength`,"aria-live":`polite`,children:v(S)}),(0,K.jsxs)(`div`,{className:`thinking-slider`,style:{"--thinking-progress":`${d.length>1?x/(d.length-1)*100:0}%`},children:[(0,K.jsx)(`div`,{className:`thinking-slider-dots`,"aria-hidden":`true`,children:d.map((e,t)=>(0,K.jsx)(`span`,{"data-filled":t<=x},e))}),(0,K.jsx)(`input`,{ref:g,type:`range`,"aria-label":s(`thinkingLevel`),"aria-valuetext":v(S),min:0,max:Math.max(0,d.length-1),step:1,value:x,disabled:r||!c?.supported||d.length<2,onChange:e=>{h.current=Number(e.target.value),m(h.current)},onPointerUp:b,onPointerCancel:y,onBlur:b,onKeyUp:e=>{[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`,`PageUp`,`PageDown`].includes(e.key)&&b()},onKeyDown:e=>{e.key===`Escape`&&(y(),o(),e.preventDefault(),e.stopPropagation())}})]}),(0,K.jsxs)(`button`,{type:`button`,className:`thinking-model-link`,disabled:n!==null,title:s(`selectModel`),onClick:a,children:[(0,K.jsx)(`span`,{children:t?.name||t?.id||s(`selectModel`)}),(0,K.jsx)(ee,{"aria-hidden":`true`})]}),(0,K.jsx)(`button`,{type:`button`,className:`thinking-reset`,"aria-label":s(`resetThinking`,{level:v(f)}),title:s(`resetThinking`,{level:v(f)}),disabled:r||!d.includes(f)||l===f,onClick:()=>{y(),i.selectThinking(f)},children:(0,K.jsx)(ft,{"aria-hidden":`true`})}),c&&!d.includes(c.level)&&(0,K.jsx)(`p`,{className:`thinking-control-notice`,role:`status`,children:s(`thinkingLevelMismatch`)})]})}var sN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M37.9998%2023.021C33.7998%2025.2889%2029.5698%2027.3649%2024.8614%2028.3069C23.8114%2028.5154%2022.6474%2028.5154%2021.5809%2028.3714C20.5639%2028.2439%2020.0554%2027.3484%2020.4169%2026.4064C20.7619%2025.5289%2021.2209%2024.635%2021.8119%2023.9C23.0899%2022.3025%2024.5329%2020.849%2025.8289%2019.268C26.6203%2018.2991%2027.3335%2017.2689%2027.9618%2016.187C28.4208%2015.4205%2028.2078%2014.4935%2027.4038%2014.111C26.0584%2013.4556%2024.6154%2012.9936%2023.1889%2012.4986C23.0239%2012.4341%2022.7779%2012.6096%2022.4509%2012.7221C22.8604%2013.0881%2023.1559%2013.3596%2023.5654%2013.727C19.3339%2014.447%2015.3305%2015.467%2011.4455%2016.874C11.4275%2016.9535%2011.396%2017.0165%2011.411%2017.0495C11.9855%2017.927%2011.723%2018.5975%2010.886%2019.1405C10.5611%2019.3531%2010.2732%2019.6176%2010.034%2019.9235C12.593%2020.6735%2014.873%2020.243%2017.0539%2018.821C16.9234%2018.6305%2016.7914%2018.455%2016.6609%2018.263C17.4799%2018.407%2017.9719%2018.854%2018.0379%2019.556C18.0544%2019.7165%2017.9569%2019.8755%2017.9074%2020.036C17.7919%2019.907%2017.6449%2019.781%2017.5474%2019.6355C17.4799%2019.5395%2017.4634%2019.4285%2017.4154%2019.268C14.8235%2020.993%2012.035%2021.425%208.96751%2020.531C8.96751%2021.137%208.93451%2021.6485%208.98401%2022.1435C9.01701%2022.574%208.83701%2022.766%208.44401%2022.9895C7.55752%2023.5325%206.63803%2024.092%205.90003%2024.8105C5.01504%2025.6879%205.34354%2026.7589%206.54053%2027.2059C7.90102%2027.7159%209.329%2027.7309%2010.7555%2027.5569C12.4445%2027.3484%2014.1005%2027.0769%2015.9394%2026.8219C13.79%2027.8269%2011.6735%2028.5319%209.4445%2028.8169C7.88452%2029.0269%206.32753%2029.1379%204.78554%2028.6909C2.57156%2028.0684%201.58607%2026.4394%202.16057%2024.251C2.70206%2022.2065%204.01455%2020.5775%205.42454%2019.076C10.133%2014.078%2016.0864%2011.5401%2022.9744%2011.0286C24.5824%2010.9176%2026.2069%2011.1246%2027.7143%2011.7951C29.8308%2012.7536%2030.7173%2014.78%2029.6838%2016.826C29.0118%2018.1835%2028.0758%2019.4285%2027.1413%2020.6585C26.2234%2021.872%2025.1899%2022.9895%2024.2224%2024.155C23.9434%2024.506%2023.6809%2024.875%2023.4679%2025.2724C23.0569%2026.0224%2023.3359%2026.5174%2024.2059%2026.4394C26.0254%2026.2624%2027.8808%2026.1199%2029.6358%2025.6729C32.2098%2025.0174%2034.7193%2024.092%2037.2618%2023.2775C37.5243%2023.213%2037.7703%2023.117%2037.9998%2023.0225V23.021Z'%20fill='currentColor'/%3e%3c/svg%3e`,cN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.5835%2024.7904H25.7835C26.0754%2024.7904%2026.314%2025.0318%2026.314%2025.3277V27.8096C26.8199%2027.9343%2027.2691%2028.2255%2027.5896%2028.6362C27.9102%2029.047%2028.0833%2029.5536%2028.0813%2030.0746C28.0813%2031.3605%2027.0517%2032.4037%2025.7835%2032.4037C24.514%2032.4037%2023.4844%2031.3605%2023.4844%2030.0746C23.4844%2028.9741%2024.2399%2028.0509%2025.2531%2027.8082V25.865H21.5849V32.2237C21.5852%2032.3161%2021.5618%2032.407%2021.5169%2032.4877C21.4721%2032.5684%2021.4072%2032.6362%2021.3285%2032.6846L17.6603%2034.9224C17.577%2034.9733%2017.4813%2035%2017.3837%2034.9995C17.2862%2034.999%2017.1907%2034.9714%2017.108%2034.9197L10.3906%2030.7114C10.3131%2030.6628%2010.2493%2030.5952%2010.2052%2030.515C10.161%2030.4348%2010.138%2030.3447%2010.1384%2030.2532V25.8636L6.78241%2023.9136C6.70609%2023.8694%206.64181%2023.8071%206.59521%2023.7322C6.5486%2023.6573%206.52111%2023.5721%206.51514%2023.4841V23.4472V16.4626C6.51514%2016.2717%206.61468%2016.0944%206.77696%2015.999L10.1384%2014.0053V9.70163C10.1384%209.52572%2010.2229%209.36208%2010.3634%209.26253L10.392%209.24344L17.1107%205.07885C17.194%205.027%2017.2901%204.99951%2017.3882%204.99951C17.4863%204.99951%2017.5824%205.027%2017.6657%205.07885L21.3339%207.36296C21.4115%207.41162%2021.4753%207.47921%2021.5194%207.55938C21.5636%207.63955%2021.5866%207.72964%2021.5862%207.82115V13.9999H26.8445V11.3857C26.3384%2011.2609%2025.8889%2010.9696%2025.5684%2010.5585C25.2479%2010.1475%2025.0749%209.6406%2025.0772%209.11935C25.0772%207.83342%2026.1067%206.79023%2027.3749%206.79023C28.6445%206.79023%2029.6727%207.83342%2029.6727%209.11935C29.6727%2010.2198%2028.9186%2011.143%2027.9054%2011.3857V14.5371C27.9059%2014.6073%2027.8926%2014.6768%2027.8662%2014.7418C27.8399%2014.8068%2027.8009%2014.8659%2027.7516%2014.9158C27.7024%2014.9658%2027.6437%2015.0055%2027.5791%2015.0327C27.5144%2015.0599%2027.4451%2015.0741%2027.3749%2015.0744H21.5862V17.5372H30.6191C30.7351%2017.0302%2031.0192%2016.5773%2031.4252%2016.2522C31.8313%2015.9271%2032.3353%2015.749%2032.8554%2015.7467C34.1236%2015.7467%2035.1532%2016.7885%2035.1532%2018.0745C35.1532%2019.3604%2034.125%2020.4036%2032.8554%2020.4036C32.3351%2020.4012%2031.8309%2020.2229%2031.4249%2019.8975C31.0188%2019.5722%2030.7348%2019.119%2030.6191%2018.6117H21.5835V21.2531H28.3377L29.5854%2022.8622C29.9329%2022.659%2030.3283%2022.5522%2030.7309%2022.5527C32.0004%2022.5527%2033.0286%2023.5945%2033.0286%2024.8804C33.0286%2026.1664%2032.0004%2027.2096%2030.7309%2027.2096C29.4627%2027.2096%2028.4331%2026.1664%2028.4331%2024.8804C28.4331%2024.4086%2028.5722%2023.9695%2028.8095%2023.6027L27.8222%2022.3277H21.5835V24.7904ZM17.3875%206.16704L14.6016%207.89342V11.9407H13.5407V8.55071L11.1993%2010.003V14.019L14.0766%2015.8735L17.0316%2014.0135V10.9098H18.0925V14.3135C18.0925%2014.499%2017.9971%2014.6721%2017.8416%2014.7703L14.6466%2016.779V19.6167L16.5857%2020.9927L15.9775%2021.8736L14.0602%2020.5127L11.9738%2021.8831L11.397%2020.9831L13.5857%2019.5445V16.8308L10.6579%2014.9408L7.57606%2016.7681V19.0536L10.2652%2017.4322L10.8079%2018.3554L7.57606%2020.304V23.1363L10.5297%2024.8518L13.6252%2022.9863L14.1666%2023.9095L11.1993%2025.6973V29.9546L13.7575%2031.5569L16.9825%2029.6123L17.5253%2030.5369L14.7748%2032.1951L17.3903%2033.8328L20.5239%2031.9196V24.0377L14.0357%2027.9828L13.4902%2027.0623L20.5239%2022.7859V8.12115L17.3875%206.16704ZM25.7835%2028.8228C25.6198%2028.8237%2025.4579%2028.8568%2025.307%2028.9204C25.1561%2028.984%2025.0192%2029.0767%2024.9042%2029.1932C24.7892%2029.3097%2024.6983%2029.4478%2024.6367%2029.5995C24.5751%2029.7512%2024.5441%2029.9136%2024.5453%2030.0773C24.5453%2030.7687%2025.099%2031.3292%2025.7835%2031.3292C25.947%2031.3281%2026.1087%2031.2948%2026.2594%2031.2313C26.41%2031.1677%2026.5467%2031.0751%2026.6615%2030.9587C26.7764%2030.8424%2026.8672%2030.7045%2026.9287%2030.553C26.9903%2030.4016%2027.0215%2030.2395%2027.0204%2030.076C27.0216%2029.9123%2026.9906%2029.7501%2026.9291%2029.5985C26.8676%2029.4468%2026.7769%2029.3088%2026.662%2029.1923C26.5471%2029.0758%2026.4104%2028.9831%2026.2597%2028.9194C26.109%2028.8558%2025.9472%2028.8238%2025.7835%2028.8228ZM30.7336%2023.6272C30.5699%2023.6281%2030.4079%2023.6613%2030.257%2023.7249C30.1062%2023.7884%2029.9693%2023.8811%2029.8543%2023.9977C29.7393%2024.1142%2029.6484%2024.2523%2029.5868%2024.404C29.5252%2024.5557%2029.4942%2024.7181%2029.4954%2024.8818C29.4954%2025.5745%2030.0491%2026.1364%2030.7322%2026.1364C30.896%2026.1355%2031.0579%2026.1023%2031.2088%2026.0387C31.3597%2025.9752%2031.4966%2025.8825%2031.6116%2025.7659C31.7266%2025.6494%2031.8175%2025.5113%2031.8791%2025.3596C31.9406%2025.2079%2031.9717%2025.0455%2031.9704%2024.8818C31.9717%2024.7181%2031.9406%2024.5557%2031.8791%2024.404C31.8175%2024.2523%2031.7266%2024.1142%2031.6116%2023.9977C31.4966%2023.8811%2031.3597%2023.7884%2031.2088%2023.7249C31.0579%2023.6613%2030.8973%2023.6281%2030.7336%2023.6272ZM32.8541%2016.8226C32.6904%2016.8235%2032.5284%2016.8567%2032.3775%2016.9203C32.2266%2016.9838%2032.0898%2017.0765%2031.9747%2017.1931C31.8597%2017.3096%2031.7688%2017.4477%2031.7073%2017.5994C31.6457%2017.7511%2031.6146%2017.9135%2031.6159%2018.0772C31.6159%2018.7686%2032.1709%2019.329%2032.8541%2019.329C33.0176%2019.3279%2033.1793%2019.2947%2033.3299%2019.2311C33.4806%2019.1676%2033.6172%2019.075%2033.7321%2018.9586C33.8469%2018.8422%2033.9377%2018.7044%2033.9993%2018.5529C34.0609%2018.4014%2034.092%2018.2393%2034.0909%2018.0758C34.0922%2017.9122%2034.0612%2017.7499%2033.9997%2017.5983C33.9382%2017.4467%2033.8474%2017.3087%2033.7325%2017.1922C33.6177%2017.0757%2033.481%2016.9829%2033.3302%2016.9193C33.1795%2016.8556%2033.0177%2016.8223%2032.8541%2016.8213V16.8226ZM27.3736%207.86342C27.2099%207.86449%2027.0482%207.8978%2026.8974%207.96145C26.7467%208.02509%2026.61%208.11783%2026.4951%208.23434C26.3802%208.35086%2026.2895%208.48887%2026.228%208.64049C26.1665%208.79212%2026.1355%208.95437%2026.1367%209.11798C26.1367%209.81072%2026.6904%2010.3725%2027.3736%2010.3725C27.5373%2010.3717%2027.6992%2010.3385%2027.8501%2010.2749C28.001%2010.2113%2028.1379%2010.1186%2028.2529%2010.0021C28.3679%209.88558%2028.4588%209.7475%2028.5204%209.59579C28.582%209.44408%2028.613%209.28171%2028.6118%209.11798C28.613%208.95426%2028.582%208.79189%2028.5204%208.64018C28.4588%208.48847%2028.3679%208.35039%2028.2529%208.23386C28.1379%208.11733%2028.001%208.02462%2027.8501%207.96106C27.6992%207.89749%2027.5373%207.86432%2027.3736%207.86342Z'%20fill='currentColor'/%3e%3c/svg%3e`,lN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M26.9568%209.88184H22.1265L30.7753%2031.7848H35.4917L26.9568%209.88184ZM13.028%209.88184L4.4917%2031.7848H9.32203L11.2305%2027.1793H20.2166L22.0126%2031.6724H26.8444L18.0832%209.88184H13.028ZM12.5783%2023.1361L15.4987%2015.3853L18.5315%2023.1361H12.5783Z'%20fill='currentColor'/%3e%3c/svg%3e`,uN=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2040%2040'%3e%3cpath%20fill='currentColor'%20d='M33.0017%2034.7292C34.7884%2036.1587%2037.4682%2035.2056%2035.0115%2032.5854C27.6419%2024.9626%2029.2053%204%2020.049%204C10.8927%204%2012.456%2024.9626%205.08629%2032.5854C2.40641%2035.4438%205.3096%2036.1587%207.09621%2034.7292C14.0192%2029.7269%2013.5726%2020.913%2020.049%2020.913C26.5253%2020.913%2026.0787%2029.7269%2033.0017%2034.7292Z'/%3e%3c/svg%3e`,dN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.68%207.58398L11.296%2029.68L4%2029.6L12.144%2015.584L21.68%207.58398ZM22.8%209.32798L36%2032.416H11.584L26.464%2029.76L18.672%2020.496L22.8%209.32798Z'%20fill='currentColor'/%3e%3c/svg%3e`,fN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.14882%2013.5552C9.58082%2013.5552%2010.4448%2013.5336%2011.6544%2013.0368C13.0584%2012.4536%2015.8232%2011.4168%2017.832%2010.3368C19.236%209.5808%2019.8408%208.5872%2019.8408%207.248C19.8408%205.412%2018.3504%203.9%2016.4928%203.9H8.71682C6.06002%203.9%203.90002%206.06%203.90002%208.7168C3.90002%2011.3736%205.93042%2013.5552%209.14882%2013.5552Z'%20fill='currentColor'/%3e%3cpath%20d='M10.4664%2016.86C10.4664%2015.564%2011.244%2014.376%2012.4536%2013.8792L14.8944%2012.864C17.3784%2011.8488%2020.1%2013.6632%2020.1%2016.3416C20.1%2018.4152%2018.4152%2020.1%2016.3416%2020.1H13.6848C11.9136%2020.1%2010.4664%2018.6528%2010.4664%2016.86Z'%20fill='currentColor'/%3e%3cpath%20d='M6.68642%2014.1816C5.15282%2014.1816%203.90002%2015.4344%203.90002%2016.968V17.3352C3.90002%2018.8472%205.15282%2020.1%206.68642%2020.1C8.22003%2020.1%209.47283%2018.8472%209.47283%2017.3136V16.9464C9.45123%2015.4344%208.22003%2014.1816%206.68642%2014.1816Z'%20fill='currentColor'/%3e%3c/svg%3e`,pN=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2040%2040'%3e%3cpath%20fill='currentColor'%20d='M29.6214%2014.2072L20.9502%209.12249C20.6718%208.95917%2020.3282%208.95917%2020.0498%209.12249L11.3786%2014.2072C11.1445%2014.3445%2011%2014.5984%2011%2014.8733V25.1267C11%2025.4012%2011.1445%2025.6555%2011.3786%2025.7928L20.0498%2030.8775C20.3282%2031.0408%2020.6718%2031.0408%2020.9502%2030.8775L29.6214%2025.7928C29.8555%2025.6555%2030%2025.4016%2030%2025.1267V14.8733C30%2014.5988%2029.8555%2014.3445%2029.6214%2014.2072ZM29.0767%2015.2843L20.706%2030.0101C20.6494%2030.1093%2020.5%2030.0688%2020.5%2029.9538V20.3115C20.5%2020.1189%2020.3986%2019.9407%2020.2342%2019.8439L12.0124%2015.0226C11.9147%2014.9651%2011.9546%2014.8134%2012.0678%2014.8134H28.8093C29.047%2014.8134%2029.1956%2015.0751%2029.0767%2015.2843Z'/%3e%3c/svg%3e`,mN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M35.6638%209.91965C35.3251%209.75432%2035.1785%2010.0703%2034.9811%2010.2316C34.9131%2010.2836%2034.8558%2010.3516%2034.7985%2010.413C34.3025%2010.9423%2033.7238%2011.289%2032.9678%2011.2476C31.8625%2011.1863%2030.9186%2011.533%2030.0839%2012.3783C29.9066%2011.3356%2029.3173%2010.7143%2028.4213%2010.3143C27.9519%2010.1063%2027.4773%209.89965%2027.148%209.44766C26.9186%209.12633%2026.856%208.76767%2026.7413%208.41568C26.668%208.20235%2026.5946%207.98502%2026.3506%207.94902C26.084%207.90769%2025.98%208.13035%2025.876%208.31702C25.4587%209.07967%2025.2973%209.91965%2025.3133%2010.7703C25.3493%2012.6849%2026.1573%2014.2102%2027.764%2015.2942C27.9466%2015.4182%2027.9933%2015.5435%2027.9359%2015.7249C27.8266%2016.0982%2027.696%2016.4609%2027.5813%2016.8355C27.508%2017.0742%2027.3986%2017.1248%2027.1426%2017.0222C26.2777%2016.6504%2025.4919%2016.1164%2024.828%2015.4489C23.6854%2014.3449%2022.6534%2013.1263%2021.3654%2012.1716C21.067%2011.9511%2020.7606%2011.7416%2020.4468%2011.5436C19.1335%2010.2676%2020.6201%209.21967%2020.9641%209.09567C21.3241%208.965%2021.0881%208.51968%2019.9254%208.52501C18.7628%208.53035%2017.6988%208.91834%2016.3428%209.43699C16.1413%209.51421%2015.934%209.57529%2015.7229%209.61966C14.4557%209.38091%2013.1598%209.33506%2011.8789%209.48366C9.36565%209.76365%207.35902%2010.953%205.88305%2012.9809C4.10975%2015.4182%203.69243%2018.1888%204.20308%2021.0768C4.74041%2024.122%206.29504%2026.6433%208.683%2028.6139C11.1603%2030.6579%2014.0122%2031.6592%2017.2668%2031.4672C19.2428%2031.3539%2021.4441%2031.0886%2023.9254%2028.9873C24.552%2029.2993%2025.208%2029.4233%2026.2986%2029.5166C27.1386%2029.5953%2027.9466%2029.4766%2028.5719%2029.3459C29.5519%2029.1379%2029.4839%2028.23%2029.1306%2028.0646C26.2573%2026.726%2026.888%2027.2713%2026.3133%2026.83C27.7746%2025.102%2029.9746%2023.3074%2030.8359%2017.4928C30.9026%2017.0302%2030.8452%2016.7395%2030.8359%2016.3662C30.8306%2016.1395%2030.8826%2016.0502%2031.1426%2016.0249C31.8639%2015.95%2032.5637%2015.7349%2033.2025%2015.3915C35.0638%2014.3742%2035.8158%2012.7049%2035.9931%2010.7023C36.0198%2010.3956%2035.9878%2010.081%2035.6638%209.91965ZM19.4414%2027.9433C16.6562%2025.754%2015.3055%2025.0327%2014.7482%2025.0634C14.2256%2025.0954%2014.3202%2025.6913%2014.4349%2026.0807C14.5549%2026.4647%2014.7109%2026.7286%2014.9295%2027.066C15.0815%2027.2886%2015.1855%2027.6206%2014.7789%2027.87C13.8816%2028.4246%2012.3229%2027.6833%2012.2496%2027.6473C10.435%2026.578%208.91632%2025.1673%207.84834%2023.2381C6.81637%2021.3808%206.21638%2019.3888%206.11771%2017.2622C6.09105%2016.7475%206.24171%2016.5662%206.7537%2016.4729C7.42583%2016.3442%208.11451%2016.3267%208.79233%2016.4209C11.6349%2016.8368%2014.0536%2018.1075%2016.0828%2020.1194C17.2402%2021.2661%2018.1161%2022.6354%2019.0188%2023.974C19.9788%2025.3953%2021.0108%2026.75%2022.3254%2027.8593C22.7894%2028.2486%2023.1587%2028.5446%2023.5134%2028.7619C22.4441%2028.8819%2020.6601%2028.9086%2019.4414%2027.9433ZM20.7748%2019.3568C20.7745%2019.2906%2020.7904%2019.2253%2020.8211%2019.1666C20.8517%2019.1078%2020.8962%2019.0575%2020.9507%2019.0198C21.0052%2018.9821%2021.068%2018.9583%2021.1337%2018.9503C21.1995%2018.9424%2021.2662%2018.9505%2021.3281%2018.9741C21.407%2019.0024%2021.475%2019.0546%2021.5228%2019.1235C21.5706%2019.1923%2021.5958%2019.2743%2021.5947%2019.3581C21.5949%2019.4123%2021.5843%2019.4659%2021.5636%2019.5159C21.5428%2019.5659%2021.5123%2019.6113%2021.4738%2019.6494C21.4354%2019.6875%2021.3897%2019.7176%2021.3395%2019.7378C21.2893%2019.7581%2021.2356%2019.7682%2021.1814%2019.7675C21.1277%2019.7676%2021.0745%2019.7571%2021.0248%2019.7365C20.9752%2019.7158%2020.9302%2019.6855%2020.8925%2019.6473C20.8548%2019.609%2020.825%2019.5636%2020.805%2019.5138C20.785%2019.4639%2020.7739%2019.4105%2020.7748%2019.3568ZM24.9213%2021.4848C24.6547%2021.5928%2024.3893%2021.6861%2024.1347%2021.6981C23.7516%2021.7114%2023.3756%2021.5918%2023.0707%2021.3594C22.7054%2021.0528%2022.4441%2020.8821%2022.3347%2020.3488C22.297%2020.0881%2022.3042%2019.823%2022.3561%2019.5648C22.4494%2019.1288%2022.3454%2018.8488%2022.0374%2018.5955C21.7881%2018.3875%2021.4694%2018.3302%2021.1201%2018.3302C21.0005%2018.3232%2020.8843%2018.2875%2020.7814%2018.2262C20.6348%2018.1542%2020.5148%2017.9728%2020.6294%2017.7488C20.6668%2017.6768%2020.8428%2017.5008%2020.8854%2017.4688C21.3601%2017.1995%2021.9081%2017.2875%2022.4134%2017.4902C22.8827%2017.6822%2023.2374%2018.0342%2023.748%2018.5328C24.2694%2019.1341%2024.364%2019.3008%2024.6613%2019.7515C24.896%2020.1048%2025.1093%2020.4674%2025.2547%2020.8821C25.344%2021.1421%2025.2293%2021.3541%2024.9213%2021.4848Z'%20fill='currentColor'/%3e%3c/svg%3e`,hN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M14.45%205.74999L11.9991%2011.6956L9.54562%205.74999H7.97237L10.6604%2012.2495C10.7678%2012.5138%2010.9515%2012.7402%2011.1882%2012.8996C11.4248%2013.059%2011.7036%2013.1442%2011.9889%2013.1444C12.2742%2013.1446%2012.5531%2013.0597%2012.79%2012.9006C13.0268%2012.7415%2013.2109%2012.5154%2013.3186%2012.2512L16.0232%205.74999H14.45ZM15.4965%2014.808L19.98%2010.2195L19.3684%208.75911L14.4719%2013.7807C14.272%2013.9856%2014.1369%2014.2448%2014.0835%2014.5261C14.0301%2014.8073%2014.0608%2015.098%2014.1718%2015.3619C14.2807%2015.624%2014.4648%2015.848%2014.7008%2016.0056C14.9369%2016.1632%2015.2144%2016.2473%2015.4983%2016.2474L15.5%2016.25L22.5%2016.2325L21.8884%2014.7721L15.4983%2014.808H15.4965ZM4.02%2010.216L4.63162%208.75561L9.52813%2013.7772C9.93763%2014.1964%2010.0557%2014.8176%209.82825%2015.3584C9.71925%2015.6204%209.53511%2015.8443%209.29905%2016.0019C9.06299%2016.1595%208.78557%2016.2437%208.50175%2016.2439L1.50175%2016.2281L1.5%2016.2299L2.11163%2014.7695L8.50175%2014.8062L4.02%2010.216Z'%20fill='currentColor'/%3e%3c/svg%3e`,gN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M35.3993%2026.4544C34.2871%2028.3855%2027.8314%2032.9425%2020%2032.9425C12.1686%2032.9425%205.71288%2028.3855%204.60075%2026.4544C4.5427%2026.3532%204.50826%2026.2401%204.5%2026.1237V22.418C4.51199%2022.3209%204.53496%2022.2256%204.56846%2022.1338C5.04896%2020.9261%206.30833%2019.1733%207.93325%2018.7031C8.14896%2018.149%208.468%2017.3404%208.76508%2016.7437C8.71727%2016.2776%208.69485%2015.8094%208.69792%2015.3409C8.69792%2013.6217%209.06217%2012.113%2010.1601%2010.9906C10.6729%2010.4662%2011.3097%2010.0644%2012.064%209.76091C13.871%208.29357%2016.4453%207.05745%2019.9716%207.05745C23.4978%207.05745%2026.129%208.29357%2027.936%209.76091C28.6903%2010.0644%2029.3271%2010.4662%2029.8399%2010.9906C30.9378%2012.113%2031.3021%2013.6217%2031.3021%2015.3409C31.3021%2015.8162%2031.284%2016.2877%2031.2349%2016.7437C31.532%2017.3404%2031.851%2018.149%2032.0667%2018.7031C33.6917%2019.1733%2034.951%2020.9261%2035.4315%2022.1338C35.4677%2022.2248%2035.4908%2022.3205%2035.5%2022.418V26.1237C35.4917%2026.2401%2035.4573%2026.3532%2035.3993%2026.4544ZM20.2222%2018.7147H19.7778C19.6422%2018.945%2019.4889%2019.1644%2019.3193%2019.3709C18.3247%2020.5941%2016.8419%2021.2981%2014.7881%2021.2981C12.56%2021.2981%2010.9273%2020.8344%209.90304%2019.6719C9.86495%2019.6283%209.82833%2019.5835%209.79325%2019.5375L9.66667%2019.6719V28.1775C11.5202%2029.1837%2015.4972%2030.992%2020%2030.992C24.5028%2030.992%2028.4798%2029.1837%2030.3333%2028.1775V19.6719L30.2067%2019.5375C30.2067%2019.5375%2030.1641%2019.5957%2030.097%2019.6719C29.0727%2020.8344%2027.44%2021.2981%2025.2119%2021.2981C23.1581%2021.2981%2021.6753%2020.5941%2020.6807%2019.3709C20.5111%2019.1644%2020.3578%2018.945%2020.2222%2018.7147ZM23.2292%2022.9127C23.9383%2022.9127%2024.5208%2023.4952%2024.5208%2024.2043V26.7877C24.5208%2027.4968%2023.9383%2028.0793%2023.2292%2028.0793C22.52%2028.0793%2021.9375%2027.4968%2021.9375%2026.7877V24.2043C21.9375%2023.4952%2022.52%2022.9127%2023.2292%2022.9127ZM16.7708%2022.9127C17.48%2022.9127%2018.0625%2023.4952%2018.0625%2024.2043V26.7877C18.0625%2027.4968%2017.48%2028.0793%2016.7708%2028.0793C16.0617%2028.0793%2015.4792%2027.4968%2015.4792%2026.7877V24.2043C15.4792%2023.4952%2016.0617%2022.9127%2016.7708%2022.9127ZM21.0501%2014.9237C21.2258%2016.289%2021.5707%2017.3947%2022.1842%2018.149C22.7551%2018.8517%2023.649%2019.3606%2025.2119%2019.3606C27.2437%2019.3606%2028.1724%2018.9253%2028.6438%2018.3905C29.1398%2017.8287%2029.3646%2016.9051%2029.3646%2015.3409C29.3646%2013.8684%2029.0507%2012.9552%2028.454%2012.3455C27.8378%2011.7152%2026.7502%2011.2321%2024.8063%2011.0216C22.8856%2010.8136%2021.975%2011.1998%2021.5345%2011.7049C21.187%2012.1014%2020.97%2012.7485%2020.9688%2013.7431V13.7702C20.9688%2014.1121%2020.9959%2014.4966%2021.0501%2014.9237ZM18.9499%2014.9237C19.0041%2014.4966%2019.0312%2014.1117%2019.0312%2013.7689V13.7431C19.03%2012.7485%2018.813%2012.1014%2018.4655%2011.7049C18.025%2011.1998%2017.1144%2010.8136%2015.1937%2011.0216C13.2498%2011.2321%2012.1622%2011.7152%2011.546%2012.3455C10.9493%2012.9552%2010.6354%2013.8684%2010.6354%2015.3409C10.6354%2016.9051%2010.8615%2017.8287%2011.3562%2018.3905C11.8276%2018.9253%2012.7563%2019.3606%2014.7881%2019.3606C16.351%2019.3606%2017.2449%2018.8517%2017.8158%2018.149C18.4293%2017.3947%2018.7742%2016.289%2018.9499%2014.9237Z'%20fill='currentColor'/%3e%3c/svg%3e`,_N=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M37%2020.034C27.8809%2020.5837%2020.5808%2027.8809%2020.0326%2037H19.966C19.4163%2027.8809%2012.1177%2020.5837%203%2020.034V19.9674C12.1191%2019.4163%2019.4163%2012.1191%2019.966%203H20.0326C20.5822%2012.1191%2027.8809%2019.4163%2037%2019.9674V20.034Z'%20fill='currentColor'/%3e%3c/svg%3e`,vN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M20.056%204.50022C14.0839%204.44597%209.20616%209.15015%209.15036%2015.0106C9.09611%2020.8726%2013.8855%2025.6621%2019.8576%2025.7163H23.6085V21.7391H20.056C16.3252%2021.7825%2013.2671%2018.8468%2013.2237%2015.1827C13.1787%2011.5216%2016.1702%208.52086%2019.901%208.47746H20.056C23.7868%208.47746%2026.8108%2011.4457%2026.8216%2015.1083V24.8809C26.8216%2028.5109%2023.8085%2031.4683%2020.1211%2031.5132C18.3617%2031.5007%2016.6759%2030.8049%2015.42%2029.5726L12.551%2032.3905C14.5529%2034.3571%2017.239%2035.4715%2020.0451%2035.4998H20.1877C26.0823%2035.413%2030.8175%2030.7212%2030.85%2024.9351V14.8603C30.7059%209.0928%2025.9165%204.50022%2020.056%204.50022Z'%20fill='currentColor'/%3e%3c/svg%3e`,yN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M26.7365%207.70867C30.9594%2010.1097%2033.562%2014.5441%2033.562%2019.3448C33.562%2020.7468%2033.3436%2022.0995%2032.9378%2023.3705C33.2276%2023.3346%2033.5219%2023.3669%2033.7971%2023.4647C34.0723%2023.5626%2034.3208%2023.7233%2034.523%2023.9341C34.8338%2024.2495%2035.0303%2024.6597%2035.0814%2025.0996C35.1324%2025.5394%2035.0351%2025.9837%2034.8048%2026.3619C35.0922%2026.5944%2035.3008%2026.9044%2035.4079%2027.2525L35.4318%2027.3398C35.5164%2027.6526%2035.6009%2028.3121%2035.15%2028.9828C35.4938%2029.5042%2035.5431%2030.1608%2035.2811%2030.7244C34.9217%2031.5276%2034.0228%2032.1588%2032.2826%2032.838L31.9979%2032.9479L31.8133%2033.0156C31.1398%2033.2593%2030.5593%2033.4312%2030.3183%2033.5017L30.1971%2033.5355C28.9431%2033.8779%2027.6495%2034.0639%2026.3476%2034.0907C24.4876%2034.0907%2023.1067%2033.5834%2022.2289%2032.5872C20.7465%2032.8382%2019.2331%2032.8468%2017.748%2032.6126C16.8688%2033.5933%2015.4935%2034.0907%2013.6504%2034.0907C12.4424%2034.0666%2011.2411%2033.9044%2010.07%2033.6074L9.75858%2033.5228L9.37391%2033.4101C8.81508%2033.2406%208.26281%2033.0503%207.71825%2032.8394C5.97523%2032.1588%205.07625%2031.529%204.71693%2030.7244C4.45485%2030.1608%204.50416%2029.5028%204.84798%2028.9828C4.68566%2028.7453%204.57646%2028.4756%204.52782%2028.1921C4.47919%2027.9085%204.49227%2027.6178%204.56616%2027.3398C4.66339%2026.9552%204.88461%2026.6127%205.19602%2026.3619C4.96607%2025.9839%204.86892%2025.5399%204.91997%2025.1003C4.97102%2024.6607%205.16735%2024.2508%205.47783%2023.9355C5.80614%2023.5861%206.26268%2023.3846%206.76995%2023.362L6.87985%2023.3606C6.46754%2022.0619%206.2584%2020.7073%206.25986%2019.3448C6.25986%2014.5441%208.86242%2010.1097%2013.0854%207.70867C15.1666%206.52898%2017.518%205.90889%2019.9102%205.90889C22.3025%205.90889%2024.6553%206.52898%2026.7365%207.70867ZM8.99205%2023.8862C9.16818%2024.8542%2012.3132%2027.1975%2012.0075%2027.7006C11.7397%2028.1444%2010.8858%2027.3638%2010.6717%2027.1566L10.6139%2027.1003L10.3772%2026.8932C9.58668%2026.2182%207.13067%2024.2159%206.51631%2024.8754C5.91041%2025.5235%206.68399%2026.0858%208.00288%2026.8762L9.10759%2027.5343L9.29923%2027.6512C10.7717%2028.5573%2010.8774%2028.8349%2010.6378%2029.2195C10.3729%2029.6352%206.312%2026.2605%205.93155%2027.6935C5.5511%2029.1181%2010.077%2029.5309%209.79804%2030.5201C9.51622%2031.5064%206.60649%2028.6545%206.01469%2029.7634C5.41583%2030.8766%2010.1193%2032.1842%2010.1574%2032.1941L10.3828%2032.2504L10.6294%2032.3096C12.3583%2032.7098%2015.6527%2033.2255%2016.8786%2031.4585C17.8269%2030.0875%2017.7804%2029.0504%2016.5292%2027.7809L16.4488%2027.7006C15.1173%2026.3929%2014.3423%2024.4766%2014.3423%2024.4766L14.3183%2024.3949L14.2831%2024.2934C14.1676%2023.9834%2013.8829%2023.393%2013.3954%2023.4705C12.7472%2023.5734%2012.271%2025.1755%2013.5645%2026.1943L13.6349%2026.2478C15.0116%2027.2637%2013.3602%2027.9528%2012.8275%2027.0002L12.7458%2026.8537L12.5443%2026.5014C11.8919%2025.3756%2010.7379%2023.5269%2010.0939%2023.1239C9.34432%2022.6561%208.81592%2022.9154%208.99205%2023.8862ZM29.9055%2023.1239C29.1544%2023.5959%2027.7031%2026.0463%2027.1719%2027.0002C27.0805%2027.1684%2026.9358%2027.3014%2026.7606%2027.3785C26.5854%2027.4555%2026.3895%2027.4721%2026.2038%2027.4258C26.1115%2027.3997%2026.0266%2027.3525%2025.9558%2027.2877C25.9293%2027.2626%2025.9061%2027.2342%2025.8868%2027.2031L25.8671%2027.1637L25.8558%2027.1355L25.8459%2027.1087L25.8417%2027.0904L25.8375%2027.0665C25.8337%2027.0441%2025.8318%2027.0215%2025.8318%2026.9988C25.8318%2026.8297%2025.9319%2026.624%2026.1841%2026.3972C26.2207%2026.3633%2026.2602%2026.3309%2026.3025%2026.2985L26.3687%2026.2478C26.3997%2026.2253%2026.4293%2026.2027%2026.4575%2026.1788C27.7017%2025.1783%2027.2649%2023.6283%2026.6421%2023.4776L26.5984%2023.4691L26.5195%2023.4635C26.4902%2023.4638%2026.4609%2023.4667%2026.4321%2023.4719L26.3927%2023.479L26.3335%2023.4987L26.2785%2023.5227L26.2391%2023.5438L26.1996%2023.5706L26.1489%2023.6086L26.1165%2023.6368C25.8727%2023.8594%2025.7318%2024.2399%2025.6797%2024.4005L25.6571%2024.4766C25.6571%2024.4766%2024.9103%2026.3211%2023.6295%2027.6245L23.5534%2027.7006C23.0391%2028.205%2022.7136%2028.6728%2022.5642%2029.135C22.3627%2029.7507%2022.4712%2030.3581%2022.8601%2031.0415C22.9376%2031.1781%2023.025%2031.3162%2023.1236%2031.4585C24.3664%2033.2551%2027.7482%2032.6929%2029.456%2032.2899L29.859%2032.1913L30.2112%2032.087C30.6001%2031.9686%2031.2483%2031.7587%2031.9021%2031.4952L32.167%2031.3867L32.2586%2031.3472L32.3488%2031.3078L32.5235%2031.2289L32.6376%2031.1753C33.383%2030.8202%2033.996%2030.4102%2034.0383%2030.01L34.0397%2029.9593C34.0385%2029.8907%2034.0206%2029.8235%2033.9875%2029.7634C33.8551%2029.5154%2033.6057%2029.4647%2033.2957%2029.5267L33.2323%2029.5408C33.1703%2029.5549%2033.1055%2029.5746%2033.0406%2029.5972L32.904%2029.6465L32.8279%2029.6775C32.0402%2030.0016%2031.0834%2030.6709%2030.5635%2030.7272H30.572C30.5486%2030.7299%2030.525%2030.7314%2030.5015%2030.7315H30.4677L30.4339%2030.7272L30.4015%2030.7202C30.3056%2030.6976%2030.238%2030.6356%2030.2042%2030.5201C30.191%2030.4743%2030.1886%2030.4261%2030.1971%2030.3792C30.2845%2029.8931%2031.547%2029.5408%2032.6109%2029.0969L32.7039%2029.0575C33.4479%2028.7419%2034.0707%2028.3769%2034.0918%2027.8851V27.8288C34.0892%2027.7821%2034.0816%2027.7358%2034.0693%2027.6907C34.0016%2027.4371%2033.8227%2027.337%2033.562%2027.337C32.4559%2027.337%2029.9689%2029.2533%2029.4475%2029.2533C29.4123%2029.2533%2029.3799%2029.2435%2029.3658%2029.2195C29.3408%2029.1801%2029.3191%2029.1386%2029.301%2029.0955C29.1601%2028.7602%2029.3968%2028.4445%2030.7946%2027.5935L31.0891%2027.4159C31.8472%2026.965%2032.5122%2026.5874%2032.9786%2026.245C33.3873%2025.9463%2033.648%2025.6729%2033.6874%2025.3995L33.6916%2025.3601C33.7029%2025.2009%2033.6381%2025.0402%2033.4845%2024.8754C33.4561%2024.8447%2033.4228%2024.819%2033.3859%2024.7993L33.338%2024.7781L33.3196%2024.7711C33.2605%2024.7517%2033.1987%2024.7422%2033.1365%2024.7429C32.9082%2024.7429%2032.6165%2024.8415%2032.2981%2024.9965C31.4005%2025.4376%2030.2817%2026.338%2029.7251%2026.8072L29.3742%2027.1101L29.3277%2027.1566C29.215%2027.2666%2028.9219%2027.5371%2028.6331%2027.7006L28.533%2027.7527L28.4753%2027.7795C28.4202%2027.8031%2028.3625%2027.8202%2028.3034%2027.8302H28.3104C28.2959%2027.8322%2028.2813%2027.8337%2028.2667%2027.8344L28.2808%2027.833L28.2625%2027.8344C28.1512%2027.8415%2028.0582%2027.8048%2027.9948%2027.7006C27.9792%2027.6727%2027.9723%2027.6408%2027.975%2027.609C28.0131%2026.9537%2030.8411%2024.8035%2031.0074%2023.8862L31.02%2023.8186C31.1609%2022.9027%2030.6382%2022.6674%2029.9055%2023.1239ZM19.9123%207.29581C13.1516%207.29581%207.67034%2012.6911%207.67034%2019.3434C7.67034%2020.3184%207.7873%2021.2653%208.00852%2022.1728L8.01979%2022.1601C8.37488%2021.7402%208.88214%2021.5119%209.45282%2021.5119C9.95304%2021.5232%2010.4378%2021.6768%2010.852%2021.9515C11.162%2022.1488%2011.5072%2022.4926%2011.8595%2022.9294C12.2273%2022.4053%2012.8318%2022.0868%2013.4799%2022.077C14.6805%2022.077%2015.4061%2023.1028%2015.6809%2024.0257L15.7471%2024.1736L15.8317%2024.3526C16.1022%2024.9106%2016.6701%2025.9575%2017.4422%2026.7198C18.9359%2028.1853%2019.3078%2029.7%2018.5695%2031.3219C19.5178%2031.4242%2020.4747%2031.4176%2021.4215%2031.3021C20.7099%2029.724%2021.0551%2028.2444%2022.4642%2026.8128L22.5572%2026.7198C23.5365%2025.756%2024.1875%2024.3385%2024.3213%2024.0257C24.5961%2023.1028%2025.3189%2022.077%2026.5195%2022.077C27.1676%2022.0868%2027.7721%2022.4053%2028.1399%2022.9294C28.4922%2022.4926%2028.8374%2022.1502%2029.1516%2021.9515C29.5658%2021.6763%2030.0494%2021.5239%2030.5466%2021.5119C31.0496%2021.5119%2031.5076%2021.6895%2031.85%2022.0192C32.0472%2021.1596%2032.1529%2020.2649%2032.1529%2019.3448C32.1529%2012.6911%2026.6716%207.29581%2019.9123%207.29581ZM22.529%2019.8732L23.1476%2019.5744C23.9268%2019.2025%2024.4016%2019.0348%2024.4016%2019.7886C24.4016%2021.3287%2023.3152%2024.3089%2019.956%2024.385H19.6968C16.4207%2024.3117%2015.3061%2021.4823%2015.2497%2019.9112L15.2483%2019.7886C15.2483%2018.2288%2017.2943%2020.6143%2019.8278%2020.6143C20.8367%2020.6143%2021.7709%2020.2311%2022.529%2019.8732ZM28.1892%2015.4445C28.8233%2015.4445%2029.3348%2015.9489%2029.3348%2016.5717C29.3348%2017.1931%2028.8219%2017.699%2028.1892%2017.699C28.0401%2017.7001%2027.8922%2017.6718%2027.754%2017.6158C27.6157%2017.5597%2027.4899%2017.477%2027.3837%2017.3723C27.2774%2017.2676%2027.1928%2017.1431%2027.1347%2017.0057C27.0766%2016.8683%2027.0462%2016.7209%2027.0451%2016.5717C27.0451%2015.9489%2027.558%2015.4445%2028.1892%2015.4445ZM11.8102%2015.4445C12.4415%2015.4445%2012.9544%2015.9489%2012.9544%2016.5717C12.9544%2017.1931%2012.4415%2017.699%2011.8102%2017.699C11.6609%2017.7003%2011.5129%2017.6721%2011.3745%2017.6162C11.2361%2017.5602%2011.1101%2017.4775%2011.0037%2017.3728C10.8973%2017.2681%2010.8126%2017.1435%2010.7544%2017.006C10.6962%2016.8686%2010.6657%2016.721%2010.6646%2016.5717C10.6646%2015.9489%2011.1775%2015.4445%2011.8102%2015.4445ZM22.7868%2014.2594C23.2377%2013.7184%2023.9789%2013.4985%2024.6609%2013.7043C25.3415%2013.91%2025.8304%2014.499%2025.8981%2015.1979C25.9657%2015.8954%2025.5993%2016.5647%2024.9695%2016.893C24.5158%2017.1297%2024.3396%2016.2209%2023.8887%2016.0687L23.8916%2016.0645C23.4872%2015.9264%2022.8038%2016.5745%2022.5882%2016.1758C22.425%2015.8734%2022.3565%2015.529%2022.3917%2015.1872C22.4269%2014.8455%2022.5655%2014.5222%2022.7868%2014.2594ZM16.6954%2014.2594C17.1492%2014.8005%2017.2267%2015.5558%2016.8927%2016.1758C16.6785%2016.5745%2015.9909%2015.9264%2015.5893%2016.0645L15.5935%2016.0687C15.4414%2016.1194%2015.3202%2016.2575%2015.2089%2016.4069L15.0426%2016.6394C14.8876%2016.8507%2014.7326%2017.0085%2014.5114%2016.893C14.2053%2016.7349%2013.9535%2016.4889%2013.7882%2016.1866C13.623%2015.8843%2013.552%2015.5395%2013.5842%2015.1965C13.6518%2014.499%2014.1408%2013.91%2014.8214%2013.7043C15.1538%2013.6037%2015.5085%2013.6026%2015.8415%2013.7013C16.1746%2013.7999%2016.4714%2013.994%2016.6954%2014.2594Z'%20fill='currentColor'/%3e%3c/svg%3e`,bN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M3.51531%2015.81L10.908%2017.7878C10.8981%2018.3134%2010.9136%2018.8392%2010.9545%2019.3633L15.5704%2020.5979C14.2013%2021.163%2012.7171%2021.3928%2011.2413%2021.2683L11.1018%2021.2559L11.0677%2021.2528L11.0026%2021.2458L10.9297%2021.238C10.8891%2021.2332%2010.8486%2021.228%2010.808%2021.2225L10.7251%2021.2117L10.6399%2021.1993C10.557%2021.1872%2010.4743%2021.1741%2010.3919%2021.1598L10.3593%2021.1536L10.3012%2021.1435L10.2183%2021.128L10.164%2021.1164L10.0919%2021.1016L10.0338%2021.0892L9.96019%2021.0737L9.88501%2021.0559L9.81216%2021.0389L9.75946%2021.0257L9.69126%2021.0086L9.62151%2020.99L9.54789%2020.9707L9.48434%2020.9528L9.39986%2020.9296L9.35181%2020.9141L9.28671%2020.8947L9.21464%2020.873L9.13326%2020.8467L9.08831%2020.8319L9.02631%2020.8118L8.95656%2020.7878L8.90541%2020.7692C8.89403%2020.7653%208.88267%2020.7615%208.87131%2020.7575L8.81861%2020.7382L8.74034%2020.7095L8.69617%2020.6924L8.63417%2020.6692L8.56674%2020.6421L8.49854%2020.6149L8.43732%2020.5901L8.36369%2020.5591L8.31487%2020.5374L8.26604%2020.5165C8.25543%2020.5119%208.24484%2020.5073%208.23427%2020.5026L8.18312%2020.4793L8.10329%2020.4429L8.06299%2020.4243L7.98859%2020.3886L7.94054%2020.3654L7.87544%2020.3344L7.80879%2020.3003L7.73672%2020.2639L7.69642%2020.2429L7.61659%2020.2003L7.57242%2020.1771L7.52747%2020.1523C7.51556%2020.1456%207.50367%2020.1389%207.49182%2020.1321L7.41897%2020.091L7.37247%2020.0647L7.33294%2020.0414L7.27714%2020.0097L7.21359%2019.9709L7.14152%2019.9275L7.10122%2019.9027L7.03612%2019.8616L6.98885%2019.8314L6.92762%2019.7927L6.87337%2019.7562L6.8323%2019.7291C6.81831%2019.7199%206.80436%2019.7106%206.79045%2019.7012L6.75635%2019.678L6.72225%2019.6547C6.71188%2019.6475%206.70155%2019.6403%206.69125%2019.633L6.64707%2019.602L6.58817%2019.5602L6.5347%2019.5214L6.47735%2019.4796L6.43395%2019.447L6.37505%2019.4028L6.31615%2019.3571L6.2495%2019.3052L6.21462%2019.2781L6.16502%2019.2378L6.10767%2019.1913L6.0387%2019.1347L6.00305%2019.1045L5.9674%2019.0742C5.95625%2019.0647%205.94515%2019.0552%205.93407%2019.0456L5.8992%2019.0146L5.85192%2018.9735L5.79767%2018.9255L5.74497%2018.8789L5.69692%2018.834L5.645%2018.786L5.60392%2018.7472L5.53572%2018.6821C5.51002%2018.6572%205.48444%2018.6321%205.459%2018.6069L5.43653%2018.5852L5.40475%2018.5527L5.35128%2018.4984L5.31253%2018.4589L5.27378%2018.4178C5.2295%2018.3724%205.18609%2018.3262%205.14358%2018.2791L5.08158%2018.2109L5.03353%2018.1567L4.9785%2018.0947L4.94595%2018.0567L4.90488%2018.0086L4.85993%2017.9559L4.82428%2017.9125C4.81728%2017.904%204.8103%2017.8955%204.80335%2017.887L4.76848%2017.8443L4.71733%2017.7808L4.68555%2017.7405L4.6468%2017.6909L4.6313%2017.6715C4.18786%2017.0967%203.81331%2016.4719%203.51531%2015.81ZM2.72481%2011.3196L11.5234%2013.6733C11.3761%2014.1864%2011.2547%2014.7065%2011.1599%2015.2318L19.543%2017.4747C19.1266%2018.0449%2018.6469%2018.5662%2018.1132%2019.0285L3.20918%2015.0404L3.19678%2015.0047L3.16966%2014.9241C3.15647%2014.8847%203.14356%2014.8452%203.13091%2014.8056L3.12548%2014.7877C3.06583%2014.5981%203.01233%2014.4066%202.96506%2014.2135L2.94181%2014.1158L2.92786%2014.0538L2.91158%2013.9786L2.89763%2013.9159L2.88368%2013.8461L2.87051%2013.781L2.85656%2013.7082C2.83641%2013.5989%202.81781%2013.4888%202.80153%2013.378L2.78836%2013.2866L2.77983%2013.2222L2.76976%2013.1432C2.76457%2013.1016%202.75966%2013.06%202.75503%2013.0184L2.75116%2012.982C2.69326%2012.4297%202.68444%2011.8734%202.72481%2011.3196ZM3.95938%207.32839L13.2191%209.80528C12.9339%2010.2742%2012.6727%2010.7593%2012.4363%2011.2584L21.1899%2013.6004C21.0799%2014.2359%2020.9047%2014.8497%2020.6722%2015.4333L11.721%2013.0386L2.79611%2010.6516L2.80773%2010.5741L2.81393%2010.5361L2.82168%2010.4842L2.83331%2010.4168L2.84726%2010.3408C2.86741%2010.2261%202.89066%2010.1122%202.91546%209.99825L2.93716%209.90215L2.95266%209.83628L2.97126%209.7611C2.98831%209.69135%203.00613%209.6216%203.02551%209.5534L3.04721%209.47435L3.06503%209.41003L3.08828%209.33253L3.10766%209.26898L3.13091%209.19458L3.15106%209.13103L3.17508%209.05741C3.37577%208.45541%203.63808%207.87573%203.95783%207.32761L3.95938%207.32839ZM7.40192%203.9184L16.1478%206.25734C15.6862%206.67623%2015.2494%207.12157%2014.8396%207.59111L20.9024%209.21318C21.1093%209.87348%2021.2449%2010.5648%2021.3%2011.2785L4.33215%206.74016L4.36703%206.68979L4.38795%206.65879L4.41895%206.61616L4.4546%206.56579L4.49723%206.50689L4.53908%206.45109L4.58868%206.38444L4.62743%206.33406L4.6716%206.27749L4.71423%206.22324L4.76073%206.16589L4.80335%206.11241L4.85373%206.05274L4.89558%206.00159L4.94673%205.94192L4.9878%205.89542L5.0436%205.83187L5.08468%205.78537L5.1366%205.72802L5.17845%205.68307L5.23503%205.62262L5.27998%205.57612L5.3288%205.52419L5.459%205.39244L5.5365%205.31649L5.58222%205.27309L5.64112%205.21807C6.17525%204.71752%206.76621%204.28132%207.40192%203.9184ZM12.0132%202.7001H12.0883L12.1519%202.70088L12.2054%202.70165L12.2472%202.7032L12.2999%202.70475L12.3356%202.70553L12.3945%202.70785L12.4309%202.7094L12.4774%202.71173L12.5192%202.71328L12.5867%202.71715L12.668%202.72258L12.7796%202.7311L12.8478%202.73653L12.8819%202.73963L12.9416%202.74583L13.0052%202.75203L13.0416%202.7559L13.1206%202.7652L13.1594%202.76985L13.2431%202.7807L13.3059%202.78845L13.3384%202.7931L13.3888%202.80085L13.5492%202.82565L13.6035%202.83495L13.6538%202.84348L13.7623%202.86363L13.8336%202.87758L13.9189%202.89462L13.9545%202.90237L14.0126%202.91477L14.0444%202.92252L14.0925%202.9326L14.125%202.94035L14.1754%202.95197L14.2134%202.96127L14.2684%202.97445L14.3428%202.99305L14.4296%203.0163L14.5172%203.03955L14.6047%203.06435L14.6435%203.07597L14.6977%203.09147L14.7582%203.11007L14.8148%203.1279L14.8535%203.1403L14.8923%203.1527L14.9512%203.17207L15.0279%203.19765L15.1069%203.22555L15.1441%203.23872L15.1937%203.25655L15.2658%203.2829L15.3511%203.31467L15.441%203.34955L15.5185%203.38055L15.5549%203.39605L15.6014%203.41465L15.6332%203.4286L15.682%203.44875L15.713%203.4627L15.7572%203.48207L15.8424%203.51927L15.9199%203.55492L15.9773%203.58205L16.0354%203.60995L16.0819%203.63165L16.1532%203.6673L16.2237%203.70217L16.3028%203.74247L16.3438%203.76417L16.3818%203.78432L16.4175%203.80292L16.464%203.8285L16.4957%203.84555L16.536%203.86802L16.6042%203.90677L16.6864%203.95327L16.7538%203.9928L16.798%204.01915L16.8391%204.04395L16.9135%204.08967L16.9817%204.1323L17.0576%204.18035L17.0855%204.19895L17.1351%204.23072L17.2002%204.27412L17.2312%204.29505L17.2793%204.3276L17.3273%204.36092L17.3451%204.3741C17.387%204.40277%2017.4288%204.43222%2017.4699%204.46244L17.5342%204.50894L17.5846%204.54614L17.628%204.57947L17.6947%204.62984L17.7582%204.67944L17.7892%204.70269L17.828%204.73447L17.8946%204.78794L17.9558%204.83832L18.0217%204.89334C18.5735%205.35834%2019.0703%205.88767%2019.5012%206.46736L8.29704%203.47045L8.34509%203.44952L8.39547%203.42782L8.45824%203.40147L8.52489%203.37435C8.61247%203.33947%208.70082%203.3046%208.78916%203.27282L8.86356%203.2457L8.93564%203.22012L9.00074%203.19687L9.07514%203.17285C9.14256%203.1496%209.21154%203.1279%209.27974%203.10697L9.35026%203.08605L9.41691%203.06667L9.49596%203.04342L9.56184%203.0256L9.63934%203.00545L9.70599%202.98685L9.77574%202.96902L9.84626%202.95197L9.91989%202.93492L9.98964%202.91942L10.0656%202.90315L10.1361%202.88765L10.2097%202.8737L10.281%202.85975L10.3585%202.8458L10.4291%202.8334L10.505%202.82023L10.5763%202.80938L10.6515%202.79775L10.7228%202.78768L10.8018%202.7776L10.8724%202.7683L10.9537%202.759L11.0235%202.75125L11.1049%202.7435C11.1769%202.73575%2011.249%202.72955%2011.3219%202.7249L11.404%202.7187L11.4738%202.71483L11.559%202.71018L11.6311%202.70708L11.7086%202.70398L11.7838%202.70243L11.8605%202.70088L12.0132%202.69933V2.7001Z'%20fill='currentColor'/%3e%3c/svg%3e`,xN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M27.1942%209.03509C24.4881%209.03509%2022.3726%2011.0731%2020.4574%2013.6623C17.8258%2010.3114%2015.6255%209.03509%2012.9925%209.03509C7.62404%209.03509%203.51001%2016.0234%203.51001%2023.4181C3.51001%2028.0453%205.74831%2030.9649%209.49831%2030.9649C12.1971%2030.9649%2014.1387%2029.693%2017.5904%2023.6594C17.5904%2023.6594%2019.029%2021.1199%2020.0173%2019.3699C20.3643%2019.9293%2020.7298%2020.5327%2021.1138%2021.1798L22.7322%2023.902C25.8843%2029.1769%2027.6416%2030.9649%2030.8229%2030.9649C34.4778%2030.9649%2036.51%2028.0058%2036.51%2023.2822C36.51%2015.538%2032.3039%209.03509%2027.1942%209.03509ZM14.9574%2022.0263C12.1606%2026.4123%2011.1928%2027.3962%209.63574%2027.3962C8.03194%2027.3962%207.07872%2025.9883%207.07872%2023.4781C7.07872%2018.1096%209.75562%2012.6199%2012.9471%2012.6199C14.6752%2012.6199%2016.1197%2013.617%2018.3316%2016.7836C16.2308%2020.0058%2014.9574%2022.0263%2014.9574%2022.0263ZM25.5202%2021.4751L23.5831%2018.2456C23.0969%2017.4514%2022.5938%2016.6676%2022.0743%2015.8947C23.8185%2013.2032%2025.2556%2011.8611%2026.9676%2011.8611C30.5202%2011.8611%2033.3638%2017.095%2033.3638%2023.5219C33.3638%2025.9722%2032.5612%2027.3947%2030.8989%2027.3947C29.3053%2027.3947%2028.5451%2026.3421%2025.5188%2021.4737'%20fill='currentColor'/%3e%3c/svg%3e`,SN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M17.8758%209.20865C17.8758%208.59461%2017.3777%208.09634%2016.7663%208.09634C16.155%208.09634%2015.6567%208.59575%2015.6567%209.20865V27.6446C15.6567%2029.0714%2014.4985%2030.2324%2013.0755%2030.2324C11.6523%2030.2324%2010.4941%2029.0714%2010.4941%2027.6446V15.8167C10.4941%2015.2027%209.99591%2014.7044%209.38453%2014.7044C8.77316%2014.7044%208.275%2015.2038%208.275%2015.8167V20.8301C8.275%2022.2567%207.11678%2023.4179%205.69364%2023.4179C4.2705%2023.4179%203.1123%2022.2567%203.1123%2020.8301V19.0129C3.1123%2018.6054%203.44177%2018.2752%203.84822%2018.2752C4.25467%2018.2752%204.58413%2018.6054%204.58413%2019.0129V20.8301C4.58413%2021.4441%205.08227%2021.9424%205.69364%2021.9424C6.30502%2021.9424%206.80317%2021.443%206.80317%2020.8301V15.8167C6.80317%2014.39%207.96139%2013.2289%209.38453%2013.2289C10.8077%2013.2289%2011.9659%2014.39%2011.9659%2015.8167V27.6446C11.9659%2028.2587%2012.4641%2028.7569%2013.0755%2028.7569C13.6868%2028.7569%2014.1849%2028.2575%2014.1849%2027.6446V20.4123V9.20865C14.1849%207.78194%2015.3431%206.62082%2016.7663%206.62082C18.1894%206.62082%2019.3476%207.78194%2019.3476%209.20865V24.4746C19.3476%2024.8821%2019.0182%2025.2123%2018.6117%2025.2123C18.2053%2025.2123%2017.8758%2024.8821%2017.8758%2024.4746V9.20865ZM31.531%2013.2289C30.1079%2013.2289%2028.9496%2014.39%2028.9496%2015.8167V25.6969C28.9496%2026.311%2028.4515%2026.8093%2027.8401%2026.8093C27.2287%2026.8093%2026.7306%2026.3099%2026.7306%2025.6969V9.20865C26.7306%207.78194%2025.5723%206.62082%2024.1492%206.62082C22.7261%206.62082%2021.5679%207.78194%2021.5679%209.20865V30.1383C21.5679%2030.7523%2021.0697%2031.2506%2020.4583%2031.2506C19.8469%2031.2506%2019.3488%2030.7511%2019.3488%2030.1383V27.5471C19.3488%2027.1396%2019.0194%2026.8093%2018.6129%2026.8093C18.2065%2026.8093%2017.877%2027.1396%2017.877%2027.5471V30.1383C17.877%2031.565%2019.0352%2032.7261%2020.4583%2032.7261C21.8815%2032.7261%2023.0397%2031.565%2023.0397%2030.1383V9.20865C23.0397%208.59461%2023.5378%208.09634%2024.1492%208.09634C24.7605%208.09634%2025.2587%208.59575%2025.2587%209.20865V25.6969C25.2587%2027.1237%2026.417%2028.2848%2027.8401%2028.2848C29.2632%2028.2848%2030.4215%2027.1237%2030.4215%2025.6969V15.8167C30.4215%2015.2027%2030.9196%2014.7044%2031.531%2014.7044C32.1424%2014.7044%2032.6405%2015.2038%2032.6405%2015.8167V24.4746C32.6405%2024.8821%2032.97%2025.2123%2033.3764%2025.2123C33.7829%2025.2123%2034.1123%2024.8821%2034.1123%2024.4746V15.8167C34.1123%2014.39%2032.9541%2013.2289%2031.531%2013.2289Z'%20fill='currentColor'/%3e%3c/svg%3e`,CN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M8.92783%208.88101H13.357V13.3088H17.7861V17.738H17.7835H22.2152V13.3088H26.6418V8.88101H31.0722V26.5949H35.5V31.0241H22.2139V26.5962H17.7861V22.1671H13.3557V26.5949L17.7861%2026.5962V31.0241H4.5V26.5949H8.92783V8.88101ZM22.2139%2026.5962H26.6418V22.1671H22.2152V26.5962H22.2139Z'%20fill='currentColor'/%3e%3c/svg%3e`,wN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M5.85893%2026.3499L18.1801%2029.6463C18.1635%2030.5223%2018.1894%2031.3987%2018.2576%2032.2722L25.9507%2034.3298C23.669%2035.2716%2021.1952%2035.6547%2018.7355%2035.4471L18.503%2035.4265L18.4462%2035.4213L18.3377%2035.4097L18.2163%2035.3968C18.1486%2035.3886%2018.081%2035.38%2018.0135%2035.3709L17.8753%2035.3528L17.7332%2035.3322C17.5951%2035.3121%2017.4573%2035.2901%2017.3198%2035.2663L17.2656%2035.256L17.1687%2035.2392L17.0305%2035.2133L16.9401%2035.194L16.82%2035.1694L16.7231%2035.1488L16.6004%2035.1229L16.4751%2035.0932L16.3537%2035.0648L16.2659%2035.0428L16.1522%2035.0144L16.0359%2034.9834L15.9132%2034.9511L15.8073%2034.9214L15.6665%2034.8827L15.5864%2034.8568L15.4779%2034.8245L15.3578%2034.7884L15.2222%2034.7445L15.1473%2034.7199L15.0439%2034.6863L14.9277%2034.6463L14.8424%2034.6153C14.8235%2034.6089%2014.8045%2034.6025%2014.7856%2034.5959L14.6978%2034.5636L14.5673%2034.5158L14.4937%2034.4874L14.3904%2034.4487L14.278%2034.4035L14.1643%2034.3583L14.0623%2034.3169L13.9396%2034.2653L13.8582%2034.2291L13.7768%2034.1942C13.7591%2034.1865%2013.7415%2034.1788%2013.7239%2034.171L13.6386%2034.1322L13.5056%2034.0715L13.4384%2034.0405L13.3144%2033.9811L13.2343%2033.9423L13.1258%2033.8907L13.0147%2033.8338L12.8946%2033.7731L12.8274%2033.7383L12.6944%2033.6672L12.6208%2033.6285L12.5459%2033.5871C12.526%2033.576%2012.5062%2033.5648%2012.4864%2033.5536L12.365%2033.4851L12.2875%2033.4412L12.2217%2033.4024L12.1287%2033.3495L12.0227%2033.2849L11.9026%2033.2126L11.8354%2033.1712L11.7269%2033.1028L11.6482%2033.0524L11.5461%2032.9878L11.4557%2032.9271L11.3872%2032.8819C11.3639%2032.8665%2011.3407%2032.851%2011.3175%2032.8354L11.2607%2032.7966L11.2038%2032.7579C11.1866%2032.7459%2011.1693%2032.7338%2011.1522%2032.7217L11.0785%2032.6701L10.9804%2032.6003L10.8912%2032.5357L10.7957%2032.466L10.7233%2032.4117L10.6252%2032.3381L10.527%2032.2619L10.4159%2032.1753L10.3578%2032.1301L10.2751%2032.063L10.1795%2031.9855L10.0646%2031.8912L10.0052%2031.8408L9.94575%2031.7904C9.92717%2031.7746%209.90866%2031.7586%209.8902%2031.7426L9.83208%2031.691L9.75329%2031.6225L9.66287%2031.5424L9.57504%2031.4649L9.49496%2031.39L9.40841%2031.3099L9.33996%2031.2453L9.22629%2031.1368C9.18345%2031.0953%209.14082%2031.0535%209.09842%2031.0116L9.06096%2030.9754L9.008%2030.9211L8.91887%2030.8307L8.85429%2030.7648L8.78971%2030.6964C8.71592%2030.6207%208.64357%2030.5436%208.57271%2030.4652L8.46938%2030.3515L8.38929%2030.2611L8.29758%2030.1578L8.24333%2030.0945L8.17488%2030.0144L8.09996%2029.9266L8.04054%2029.8542C8.02888%2029.8401%208.01725%2029.8258%208.00567%2029.8116L7.94754%2029.7406L7.86229%2029.6346L7.80934%2029.5675L7.74475%2029.4848L7.71892%2029.4525C6.97985%2028.4945%206.3556%2027.4532%205.85893%2026.3499ZM4.54143%2018.8661L19.2057%2022.7888C18.9602%2023.6439%2018.758%2024.5109%2018.5999%2025.3864L32.5718%2029.1244C31.8777%2030.0748%2031.0782%2030.9436%2030.1887%2031.7142L5.34872%2025.0673L5.32805%2025.0079L5.28284%2024.8736C5.26087%2024.8078%205.23934%2024.742%205.21826%2024.676L5.20922%2024.6462C5.1098%2024.3302%205.02063%2024.011%204.94184%2023.6891L4.90309%2023.5264L4.87984%2023.423L4.85272%2023.2978L4.82947%2023.1931L4.80622%2023.0769L4.78426%2022.9684L4.76101%2022.847C4.72743%2022.6648%204.69643%2022.4814%204.6693%2022.2967L4.64735%2022.1443L4.63314%2022.0371L4.61635%2021.9053C4.6077%2021.8361%204.59952%2021.7668%204.5918%2021.6974L4.58535%2021.6367C4.48884%2020.7162%204.47414%2019.7891%204.54143%2018.8661ZM6.59905%2012.214L22.0318%2016.3421C21.5565%2017.1236%2021.1212%2017.9322%2020.7273%2018.764L35.3166%2022.6674C35.1332%2023.7266%2034.8413%2024.7496%2034.4538%2025.7222L19.5351%2021.731L4.66026%2017.7526L4.67964%2017.6235L4.68997%2017.5602L4.70289%2017.4736L4.72226%2017.3613L4.74551%2017.2347C4.7791%2017.0435%204.81785%2016.8536%204.85918%2016.6638L4.89534%2016.5036L4.92118%2016.3938L4.95218%2016.2685C4.98059%2016.1523%205.0103%2016.036%205.04259%2015.9224L5.07876%2015.7906L5.10847%2015.6834L5.14722%2015.5542L5.17951%2015.4483L5.21826%2015.3243L5.25184%2015.2184L5.29189%2015.0957C5.62637%2014.0924%206.06355%2013.1262%206.59646%2012.2127L6.59905%2012.214ZM12.3366%206.53068L26.913%2010.4289C26.1438%2011.1271%2025.4158%2011.8693%2024.7327%2012.6519L34.8374%2015.3553C35.1823%2016.4558%2035.4083%2017.608%2035.5%2018.7976L7.22034%2011.2336L7.27846%2011.1497L7.31334%2011.098L7.365%2011.027L7.42442%2010.943L7.49546%2010.8448L7.56521%2010.7518L7.64788%2010.6407L7.71246%2010.5568L7.78609%2010.4625L7.85713%2010.3721L7.93463%2010.2765L8.00567%2010.1874L8.08963%2010.0879L8.15938%2010.0027L8.24463%209.90321L8.31308%209.82571L8.40608%209.71979L8.47454%209.64229L8.56108%209.54671L8.63083%209.47179L8.72512%209.37104L8.80004%209.29354L8.88142%209.207L9.09842%208.98742L9.22758%208.86084L9.30379%208.7885L9.40196%208.69679C10.2922%207.86254%2011.2771%207.13554%2012.3366%206.53068ZM20.022%204.50018H20.1473L20.2532%204.50147L20.3423%204.50277L20.4121%204.50535L20.4999%204.50793L20.5593%204.50922L20.6575%204.5131L20.7182%204.51568L20.7957%204.51956L20.8655%204.52214L20.9778%204.5286L21.1135%204.53764L21.2995%204.55185L21.4131%204.56089L21.47%204.56606L21.5694%204.57639L21.6753%204.58672L21.736%204.59318L21.8678%204.60868L21.9324%204.61643L22.0719%204.63452L22.1765%204.64743L22.2308%204.65518L22.3147%204.6681L22.5821%204.70943L22.6725%204.72493L22.7565%204.73914L22.9373%204.77272L23.0561%204.79597L23.1982%204.82439L23.2576%204.83731L23.3545%204.85797L23.4075%204.87089L23.4875%204.88768L23.5418%204.9006L23.6257%204.91997L23.689%204.93547L23.7807%204.95743L23.9047%204.98843L24.0494%205.02718L24.1954%205.06593L24.3413%205.10726L24.4059%205.12664L24.4963%205.15247L24.5971%205.18347L24.6914%205.21318L24.756%205.23385L24.8205%205.25451L24.9187%205.28681L25.0466%205.32943L25.1783%205.37593L25.2403%205.39789L25.323%205.4276L25.4431%205.47151L25.5852%205.52447L25.735%205.5826L25.8642%205.63426L25.9249%205.6601L26.0024%205.6911L26.0554%205.71435L26.1367%205.74793L26.1884%205.77118L26.262%205.80347L26.4041%205.86547L26.5333%205.92489L26.6289%205.97009L26.7257%206.01659L26.8032%206.05276L26.9221%206.11218L27.0396%206.1703L27.1714%206.23747L27.2398%206.27364L27.3031%206.30722L27.3625%206.33822L27.44%206.38084L27.493%206.40926L27.5602%206.44672L27.6738%206.5113L27.8107%206.5888L27.9231%206.65468L27.9967%206.69859L28.0652%206.73993L28.1892%206.81613L28.3029%206.88718L28.4294%206.96726L28.4759%206.99826L28.5586%207.05122L28.6671%207.12355L28.7188%207.15842L28.7989%207.21267L28.8789%207.26822L28.9086%207.29017C28.9784%207.33797%2029.0481%207.38705%2029.1166%207.43742L29.2238%207.51492L29.3078%207.57692L29.3801%207.63246L29.4912%207.71642L29.5971%207.79909L29.6488%207.83784L29.7134%207.8908L29.8244%207.97992L29.9265%208.06388L30.0363%208.15559C30.9559%208.93059%2031.7839%209.81279%2032.5021%2010.779L13.8285%205.7841L13.9086%205.74922L13.9925%205.71305L14.0971%205.66914L14.2082%205.62393C14.3542%205.5658%2014.5014%205.50768%2014.6487%205.45472L14.7727%205.40951L14.8928%205.36689L15.0013%205.32814L15.1253%205.2881C15.2377%205.24935%2015.3526%205.21318%2015.4663%205.17831L15.5839%205.14343L15.6949%205.11114L15.8267%205.07239L15.9365%205.04268L16.0656%205.0091L16.1767%204.9781L16.293%204.94839L16.4105%204.91997L16.5332%204.89156L16.6495%204.86572L16.7761%204.8386L16.8936%204.81276L17.0163%204.78951L17.1351%204.76627L17.2643%204.74302L17.3818%204.72235L17.5084%204.70039L17.6273%204.68231L17.7526%204.66293L17.8714%204.64614L18.0031%204.62935L18.1207%204.61385L18.2563%204.59835L18.3726%204.58543L18.5082%204.57252C18.6283%204.5596%2018.7484%204.54927%2018.8698%204.54152L19.0068%204.53118L19.123%204.52472L19.2651%204.51697L19.3852%204.51181L19.5144%204.50664L19.6397%204.50406L19.7675%204.50147L20.022%204.49889V4.50018Z'%20fill='currentColor'/%3e%3c/svg%3e`,TN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M16.1801%2015.8791V14.0283C16.3472%2014.0155%2016.5271%2014.0026%2016.7199%2014.0026C21.7966%2013.8356%2025.1254%2018.3596%2025.1254%2018.3596C25.1254%2018.3596%2021.5267%2023.3463%2017.671%2023.3463C17.1569%2023.3463%2016.6557%2023.2692%2016.1801%2023.1021V17.4728C18.1465%2017.7298%2018.545%2018.591%2019.7274%2020.5702L22.375%2018.3468C22.375%2018.3468%2020.4343%2015.8277%2017.1955%2015.8277C16.8356%2015.8277%2016.5014%2015.8405%2016.1801%2015.8791ZM16.1801%209.75492V12.5246C16.3472%2012.5118%2016.5271%2012.4989%2016.7199%2012.4861C23.763%2012.2547%2028.377%2018.2696%2028.377%2018.2696C28.377%2018.2696%2023.0819%2024.683%2017.5939%2024.683C17.0798%2024.683%2016.6171%2024.6444%2016.1801%2024.5545V26.2767C16.5528%2026.3152%2016.9384%2026.341%2017.3625%2026.341C22.4649%2026.341%2026.1664%2023.7448%2029.7523%2020.6473C30.3435%2021.1229%2032.7597%2022.2796%2033.261%2022.7937C29.8679%2025.6341%2021.9251%2027.9346%2017.4396%2027.9346C17.0155%2027.9346%2016.5914%2027.9089%2016.1801%2027.8704V30.2866H35.6001V9.75492H16.1801ZM16.1801%2023.1021V24.5545C11.4376%2023.7191%2010.1266%2018.7966%2010.1266%2018.7966C10.1266%2018.7966%2012.4015%2016.2775%2016.1801%2015.8791V17.4728H16.1673C14.188%2017.2414%2012.6329%2019.0922%2012.6329%2019.0922C12.6329%2019.0922%2013.5068%2022.2025%2016.1801%2023.1021ZM7.77464%2018.591C7.77464%2018.591%2010.5765%2014.4525%2016.1801%2014.0283V12.5246C9.9724%2013.0259%204.6001%2018.2696%204.6001%2018.2696C4.6001%2018.2696%207.64612%2027.0735%2016.1801%2027.8575V26.2767C9.90814%2025.4798%207.77464%2018.591%207.77464%2018.591Z'%20fill='currentColor'/%3e%3c/svg%3e`,EN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M32.8377%2017.282C33.2127%2016.25%2033.3072%2015.218%2033.2127%2014.1875C33.1197%2013.1571%2032.7447%2012.1251%2032.2752%2011.1876C31.4322%209.78209%2030.2127%208.6571%2028.8072%208.0001C27.3072%207.34461%2025.7127%207.15711%2024.1197%207.53211C23.3698%206.78212%2022.5253%206.12512%2021.5878%205.65713C20.6503%205.18913%2019.5253%205.00013%2018.4948%205.00013C16.8851%204.99074%2015.3125%205.48246%2013.9948%206.40712C12.6824%207.34311%2011.7449%208.6571%2011.2754%2010.1571C10.1504%2010.4376%209.21289%2010.9071%208.27539%2011.4696C7.4324%2012.1251%206.77541%2012.9696%206.21291%2013.8126C5.36992%2015.2195%205.08792%2016.8125%205.27542%2018.407C5.46399%2019.9968%206.11605%2021.496%207.1504%2022.718C6.79608%2023.7086%206.66795%2024.7659%206.77541%2025.8124C6.86991%2026.8444%207.2449%2027.8749%207.7129%2028.8124C8.55739%2030.2194%209.77538%2031.3444%2011.1824%2031.9999C12.6824%2032.6569%2014.2753%2032.8444%2015.8698%2032.4694C16.6198%2033.2194%2017.4628%2033.8749%2018.4003%2034.3444C19.3378%2034.8139%2020.4628%2034.9999%2021.4948%2034.9999C23.1043%2035.0097%2024.6769%2034.5185%2025.9947%2033.5944C27.3072%2032.6569%2028.2447%2031.3444%2028.7127%2029.8444C29.7719%2029.6432%2030.7682%2029.1934%2031.6197%2028.5319C32.4627%2027.8749%2033.2127%2027.1249%2033.6822%2026.1874C34.5251%2024.7819%2034.8071%2023.1875%2034.6196%2021.5945C34.4322%2020%2033.8697%2018.5015%2032.8377%2017.282ZM21.5878%2033.0304C20.0878%2033.0304%2018.9628%2032.5609%2017.9323%2031.7179C17.9323%2031.7179%2018.0253%2031.6234%2018.1198%2031.6234L24.1197%2028.1554C24.2862%2028.0803%2024.4196%2027.9469%2024.4947%2027.7804C24.5698%2027.636%2024.6021%2027.4731%2024.5877%2027.3109V18.875L27.1197%2020.375V27.3124C27.1455%2028.0547%2027.0215%2028.7945%2026.755%2029.4878C26.4885%2030.181%2026.085%2030.8134%2025.5687%2031.3473C25.0523%2031.8811%2024.4337%2032.3054%2023.7497%2032.5949C23.0658%2032.8843%2022.3305%2033.0314%2021.5878%2033.0304ZM9.49488%2027.8749C8.83789%2026.7499%208.55739%2025.4374%208.83789%2024.125C8.83789%2024.125%208.93239%2024.2195%209.02539%2024.2195L15.0253%2027.6874C15.1693%2027.7638%2015.3325%2027.7966%2015.4948%2027.7819C15.6823%2027.7819%2015.8698%2027.7819%2015.9628%2027.6874L23.2753%2023.4695V26.3749L17.1823%2029.9374C16.5506%2030.3042%2015.8527%2030.5427%2015.1287%2030.6393C14.4046%2030.7358%2013.6686%2030.6884%2012.9629%2030.4999C11.4629%2030.1249%2010.2449%2029.1874%209.49488%2027.8749ZM7.9004%2014.8445C8.56239%2013.7234%209.58826%2012.8627%2010.8074%2012.4056V19.532C10.8074%2019.718%2010.8074%2019.907%2010.9004%2020C10.9755%2020.1665%2011.1089%2020.2998%2011.2754%2020.375L18.5878%2024.5944L16.0573%2026.0944L10.0574%2022.625C9.41842%2022.2639%208.85742%2021.7797%208.40684%2021.2004C7.95627%2020.6211%207.62506%2019.9582%207.4324%2019.25C7.05741%2017.8445%207.1504%2016.157%207.9004%2014.8445ZM28.6197%2019.625L21.3073%2015.407L23.8377%2013.9071L29.8377%2017.375C30.7752%2017.9375%2031.5252%2018.6875%2031.9947%2019.625C32.4642%2020.5625%2032.7447%2021.5945%2032.6502%2022.7195C32.5603%2023.7755%2032.1699%2024.7837%2031.5252%2025.6249C30.8697%2026.4694%2030.0252%2027.1249%2028.9947%2027.4999V20.375C28.9947%2020.1875%2028.9947%2020%2028.9002%2019.907C28.9002%2019.907%2028.8072%2019.718%2028.6197%2019.625ZM31.1502%2015.875C31.1502%2015.875%2031.0572%2015.782%2030.9627%2015.782L24.9627%2012.3126C24.7752%2012.2196%2024.6822%2012.2196%2024.4947%2012.2196C24.3072%2012.2196%2024.1197%2012.2196%2024.0252%2012.3126L16.7128%2016.532V13.6251L22.8073%2010.0626C23.7448%209.50009%2024.7752%209.31259%2025.9002%209.31259C26.9322%209.31259%2027.9627%209.68759%2028.9002%2010.3446C29.7447%2011.0001%2030.4947%2011.8446%2030.8697%2012.7821C31.2447%2013.7196%2031.3377%2014.8445%2031.1502%2015.875ZM15.4003%2021.125L12.8699%2019.625V12.5946C12.8699%2011.5626%2013.1503%2010.4376%2013.7128%209.59459C14.2753%208.6571%2015.1198%208.0001%2016.0573%207.53211C17.0127%207.05249%2018.0956%206.88812%2019.1503%207.06261C20.1823%207.15711%2021.2128%207.62511%2022.0573%208.2821C22.0573%208.2821%2021.9628%208.3751%2021.8698%208.3751L15.8698%2011.8446C15.7033%2011.9197%2015.57%2012.0531%2015.4948%2012.2196C15.4003%2012.4071%2015.4003%2012.5001%2015.4003%2012.6876V21.125ZM16.7128%2018.125L19.9948%2016.25L23.2753%2018.125V21.875L19.9948%2023.75L16.7128%2021.875V18.125Z'%20fill='currentColor'/%3e%3c/svg%3e`,DN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M728.039%20234C819.325%20234%20893.323%20308.62%20893.323%20400.668C893.323%20492.716%20819.325%20567.336%20728.039%20567.336L891.984%20732.656C912.81%20753.655%20898.061%20789.56%20868.613%20789.56H397.472C245.333%20789.56%20122%20665.193%20122%20511.78C122%20358.367%20245.333%20234%20397.472%20234H728.039ZM397.472%20345.112C306.189%20345.112%20232.189%20419.732%20232.189%20511.78C232.189%20603.828%20306.189%20678.448%20397.472%20678.448C488.756%20678.448%20562.756%20603.828%20562.756%20511.78C562.756%20419.732%20488.756%20345.112%20397.472%20345.112Z'%20fill='currentColor'%20transform='scale(0.0234375)'/%3e%3c/svg%3e`,ON=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20opacity='0.25'%20d='M27.539%2018.922C29.2526%2018.922%2030.8959%2018.2413%2032.1076%2017.0296C33.3193%2015.8179%2034%2014.1746%2034%2012.461C34%2010.7474%2033.3193%209.10406%2032.1076%207.89238C30.8959%206.68071%2029.2526%206%2027.539%206C25.8254%206%2024.1821%206.68071%2022.9704%207.89238C21.7587%209.10406%2021.078%2010.7474%2021.078%2012.461C21.078%2014.1746%2021.7587%2015.8179%2022.9704%2017.0296C24.1821%2018.2413%2025.8254%2018.922%2027.539%2018.922ZM27.539%2034C29.2526%2034%2030.8959%2033.3193%2032.1076%2032.1076C33.3193%2030.8959%2034%2029.2526%2034%2027.539C34%2025.8254%2033.3193%2024.1821%2032.1076%2022.9704C30.8959%2021.7587%2029.2526%2021.078%2027.539%2021.078C25.8254%2021.078%2024.1821%2021.7587%2022.9704%2022.9704C21.7587%2024.1821%2021.078%2025.8254%2021.078%2027.539C21.078%2029.2526%2021.7587%2030.8959%2022.9704%2032.1076C24.1821%2033.3193%2025.8254%2034%2027.539%2034ZM12.461%2034C14.1746%2034%2015.8179%2033.3193%2017.0296%2032.1076C18.2413%2030.8959%2018.922%2029.2526%2018.922%2027.539C18.922%2025.8254%2018.2413%2024.1821%2017.0296%2022.9704C15.8179%2021.7587%2014.1746%2021.078%2012.461%2021.078C10.7474%2021.078%209.10406%2021.7587%207.89238%2022.9704C6.68071%2024.1821%206%2025.8254%206%2027.539C6%2029.2526%206.68071%2030.8959%207.89238%2032.1076C9.10406%2033.3193%2010.7474%2034%2012.461%2034Z'%20fill='currentColor'/%3e%3cpath%20d='M12.461%2018.922C16.0293%2018.922%2018.922%2016.0293%2018.922%2012.461C18.922%208.89269%2016.0293%206%2012.461%206C8.89269%206%206%208.89269%206%2012.461C6%2016.0293%208.89269%2018.922%2012.461%2018.922Z'%20fill='currentColor'/%3e%3c/svg%3e`,kN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12.4579%2015.6036L26.1529%2035H20.0656L6.37059%2015.6036H12.4579ZM12.4524%2026.3764L15.4974%2030.6909L12.4551%2035H6.36377L12.4524%2026.3764ZM33.6365%207.15727V35H28.647V14.2236L33.6365%207.15727ZM33.6365%205L20.0656%2024.2205L17.0206%2019.9073L27.5451%205H33.6365Z'%20fill='currentColor'/%3e%3c/svg%3e`,AN=`data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2040%2040'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M20.1312%207.50002L17.4088%2011.1913H5.81625L8.5375%207.50002H20.1325H20.1312ZM34.0675%2028.81L31.3475%2032.5H19.795L22.5125%2028.81H34.0675ZM35%207.50002L16.58%2032.5H5L23.42%207.50002H35Z'%20fill='currentColor'/%3e%3c/svg%3e`,jN={alibaba:sN,"alibaba-cn":sN,"amazon-bedrock":cN,anthropic:lN,"google-antigravity":uN,azure:dN,"azure-openai-responses":dN,cohere:fN,cursor:pN,deepseek:mN,fireworks:hN,"fireworks-ai":hN,"github-copilot":gN,google:_N,"google-gemini-cli":_N,"google-vertex":_N,groq:vN,huggingface:yN,"kimi-coding":bN,"kimi-for-coding":bN,meta:xN,minimax:SN,"minimax-cn":SN,mistral:CN,moonshot:wN,moonshotai:wN,nvidia:TN,openai:EN,"openai-codex":EN,openrouter:DN,together:ON,togetherai:ON,xai:kN,zai:AN,"z-ai":AN},MN={anthropic:`#c8795a`,deepseek:`#4d6bfe`,google:`#4285f4`,"google-gemini-cli":`#4285f4`,"google-vertex":`#4285f4`,"google-antigravity":`#6387ed`,meta:`#1685f8`,azure:`#168cda`,"azure-openai-responses":`#168cda`,"amazon-bedrock":`#e99b32`,alibaba:`#ed7d31`,"alibaba-cn":`#ed7d31`,mistral:`#ef8b31`,nvidia:`#76b900`,cohere:`#659a81`,groq:`#ef6847`};function NN({id:e}){let t=Object.hasOwn(jN,e)?jN[e]:void 0;return(0,K.jsx)(`span`,{className:`models-provider-icon${t?``:` models-provider-connection`}`,"aria-hidden":`true`,style:t?{maskImage:`url("${t}")`,color:Object.hasOwn(MN,e)?MN[e]:void 0}:void 0,children:!t&&(0,K.jsx)(gt,{strokeWidth:1.75})})}var PN=250;function FN(e){let{t}=cr(),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(!1),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useId)(),p=(0,_.useRef)([]),m=e.draftModel??e.currentModel,h=e.thinkingDisabledReason===`thinkingInactiveHint`?void 0:e.snapshot?.thinking,g=h?.supported===!0,v=e.thinkingPendingLevel??h?.level??`off`,y=(i??(g?`thinking`:`models`))===`thinking`,b=e.snapshot?.models??[],x=(e.snapshot?.truncation.modelsOmitted??0)>0,S=b.length>0||x,C=n.trim(),w=e.modelSearch.query===C,E=x&&!!C&&(!w||e.modelSearch.status===`loading`),D=C?x?w?e.modelSearch.models:[]:b.filter(e=>[e.provider,e.id,e.name,e.label].some(e=>e.toLocaleLowerCase().includes(C.toLocaleLowerCase()))):b,O=new Map;for(let e of D){let t=O.get(e.provider);t?t.push(e):O.set(e.provider,[e])}let k=[...O.values()].flat(),A=e.actions.searchModels,j=e.modelSearch.query,M=e.modelSearch.status;(0,_.useEffect)(()=>{if(!x||!C||j===C&&M!==`idle`)return;let e=window.setTimeout(()=>{A(C)},PN);return()=>window.clearTimeout(e)},[x,C,A,j,M]);let N=()=>{r(``),e.actions.clearModelSearch()},P=(t,n)=>{e.actions.selectModel(`${t.provider}/${t.id}`),n()},F=m?aN(m):t(e.snapshot?S?`selectModel`:`configureModels`:`loadingModels`),L=!e.snapshot||e.sessionSwitching||e.modelSelectionPending||e.promptAdmissionPending||!e.workspaceDraft&&!!e.snapshot?.selectedSession&&!cj(e.snapshot)||e.liveRunning;(0,_.useEffect)(()=>{if(!o){c.current=!1;return}e.thinkingNeedsSession&&(m||y)&&!c.current&&(c.current=!0,e.actions.prepareSession())},[o,y,m,e.thinkingNeedsSession,e.actions]),(0,_.useEffect)(()=>{if(!o||y)return;let e=requestAnimationFrame(()=>d.current?.focus());return()=>cancelAnimationFrame(e)},[o,y]),(0,_.useEffect)(()=>{if(!o)return;let e=e=>{let t=e.target;l.current=t instanceof Element&&!t.closest(`.astryx-complex-selector-popup, .model-picker`)?t.closest(`button:not(:disabled), input:not(:disabled), textarea:not(:disabled), select:not(:disabled), a[href], [tabindex], [contenteditable='true']`):null};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[o]);let R=JSON.stringify([e.snapshot?.currentSessionId,e.snapshot?.currentSessionPath,m?.provider,m?.id]),ee=(0,_.useRef)(R);(0,_.useEffect)(()=>{y&&ee.current!==R&&!c.current&&u.current?.close(),ee.current=R,e.thinkingNeedsSession||(c.current=!1)},[R,y,e.thinkingNeedsSession]),(0,_.useEffect)(()=>{L&&!c.current&&u.current?.close()},[L]);let z=(0,_.useRef)(e.openRequest);return(0,_.useEffect)(()=>{e.openRequest!==z.current&&(z.current=e.openRequest,e.openRequest&&!L&&(a(`models`),u.current?.open()))},[e.openRequest,L]),(0,K.jsx)(iN,{className:`model-selector model-picker`,label:g?`${F}, ${t(`thinkingLevel`)}: ${v}`:F,isLabelHidden:!0,value:m?`${m.provider}/${m.id}`:``,triggerLabel:(0,K.jsxs)(`span`,{className:`model-thinking-label`,title:F,children:[m&&(0,K.jsx)(NN,{id:m.provider}),(0,K.jsx)(`span`,{className:`model-picker-label`,children:m?.name||m?.id||F}),g&&(0,K.jsx)(`span`,{className:`model-picker-thinking`,children:v[0].toUpperCase()+v.slice(1)})]}),variant:`ghost`,size:`sm`,placement:`above`,alignment:`end`,isDisabled:L,isLoading:e.modelSelectionPending,handleRef:u,onOpenChange:e=>{s(e),e||(l.current?.isConnected&&l.current.focus({preventScroll:!0}),l.current=null,N(),a(null))},children:(i,s,c)=>o&&e.thinkingNeedsSession&&(m||y)?(0,K.jsx)(`p`,{className:`thinking-preparing`,role:`status`,children:t(`switchingSession`)}):o&&y?(0,K.jsx)(oN,{snapshot:e.snapshot,model:m,pending:e.thinkingPendingLevel??null,disabled:L||!!e.thinkingDisabledReason,actions:e.actions,onClose:c,onChooseModel:()=>a(`models`)},R):(0,K.jsxs)(`div`,{className:`model-search-panel ${x?`searchable`:``}`,children:[g&&(0,K.jsxs)(`button`,{type:`button`,className:`model-thinking-back`,onClick:()=>a(`thinking`),children:[(0,K.jsx)(T,{"aria-hidden":`true`}),t(`thinkingLevel`)]}),x&&(0,K.jsx)(`p`,{className:`model-search-truncation`,role:`status`,children:t(`modelsTruncated`,{shown:b.length,omitted:e.snapshot?.truncation.modelsOmitted??0})}),e.snapshot&&!S&&(0,K.jsx)(`p`,{className:`model-search-status`,role:`status`,children:t(`noModels`)}),S&&(0,K.jsxs)(`label`,{className:`model-search-input`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`sr-only`,children:t(`searchModels`)}),(0,K.jsx)(`input`,{ref:d,"aria-controls":f,value:n,placeholder:t(`searchModelsPlaceholder`),onChange:t=>{let n=t.currentTarget.value;r(n),n.trim()||e.actions.clearModelSearch()},onKeyDown:e=>{e.nativeEvent.isComposing||e.keyCode===229||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),c()):e.key===`ArrowDown`&&k.length&&(e.preventDefault(),e.stopPropagation(),p.current[0]?.focus()))}})]}),E&&(0,K.jsx)(`p`,{className:`model-search-status`,role:`status`,children:t(`searchingModels`)}),x&&C&&w&&e.modelSearch.status===`error`&&(0,K.jsxs)(`p`,{className:`model-search-status model-search-error`,role:`alert`,children:[e.modelSearch.error??t(`modelSearchFailed`),(0,K.jsx)(`button`,{type:`button`,className:`model-search-retry`,"aria-label":t(`retryModelSearch`),title:t(`retryModelSearch`),onClick:()=>void A(C),children:(0,K.jsx)(ft,{"aria-hidden":`true`})})]}),S&&C&&(!x||w&&e.modelSearch.status===`ready`)&&k.length===0&&(0,K.jsx)(`p`,{className:`model-search-status`,role:`status`,children:t(`noMatchingModels`)}),x&&C&&w&&e.modelSearch.status===`ready`&&e.modelSearch.matchesOmitted>0&&(0,K.jsx)(`p`,{className:`model-search-status`,role:`status`,children:t(`modelSearchTruncated`,{omitted:e.modelSearch.matchesOmitted})}),S&&(0,K.jsx)(`div`,{className:`model-search-options`,id:f,role:`listbox`,"aria-label":t(`selectModel`),"aria-busy":E,children:k.map((t,n)=>{let r=m?.provider===t.provider&&m.id===t.id;return(0,K.jsxs)(_.Fragment,{children:[(n===0||k[n-1]?.provider!==t.provider)&&(0,K.jsx)(`div`,{className:`model-provider-heading`,"aria-hidden":`true`,children:t.provider}),(0,K.jsxs)(`button`,{className:`model-search-option`,type:`button`,disabled:e.thinkingPendingLevel!=null,role:`option`,"aria-selected":r,"aria-label":aN(t),title:aN(t),ref:e=>{p.current[n]=e},onClick:()=>P(t,c),onKeyDownCapture:e=>{if(e.nativeEvent.isComposing||e.keyCode===229)return;if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),c();return}if(e.key===`ArrowUp`&&n===0){e.preventDefault(),e.stopPropagation(),d.current?.focus();return}let t=e.key===`ArrowDown`?Math.min(n+1,k.length-1):e.key===`ArrowUp`?Math.max(n-1,0):e.key===`Home`?0:e.key===`End`?k.length-1:null;t!==null&&t!==n&&(e.preventDefault(),e.stopPropagation(),p.current[t]?.focus())},children:[(0,K.jsx)(NN,{id:t.provider}),(0,K.jsxs)(`span`,{className:`model-menu-item-text`,children:[(0,K.jsx)(`span`,{className:`model-menu-item-label`,children:t.name||t.id}),t.name&&t.name!==t.id&&(0,K.jsx)(`span`,{className:`model-menu-item-sub`,children:t.id})]}),r&&(0,K.jsx)(I,{"aria-hidden":`true`})]})]},`${t.provider}/${t.id}`)})}),e.onOpenProviders&&(0,K.jsxs)(K.Fragment,{children:[m&&h&&!g&&(0,K.jsx)(`p`,{className:`model-search-status`,children:t(`modelThinkingNotEnabled`)}),(0,K.jsxs)(`button`,{className:`model-settings-command`,type:`button`,onClick:()=>{c(),e.onOpenProviders?.()},children:[(0,K.jsx)(_t,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:t(`openModelSettings`)})]})]})]})})}var IN=`openpi-slash-command-list`;function LN(e){return`openpi-slash-command-${e}`}function RN(e,t){let n=t.trim().toLocaleLowerCase(),r=n?e.filter(e=>e.name.toLocaleLowerCase().includes(n)):[],i=n?r.length>0?r:e.filter(e=>[e.description,e.source].some(e=>e?.toLocaleLowerCase().includes(n))):[...e];return[...i.filter(e=>e.availability===`available`),...i.filter(e=>e.availability===`unsupported`)]}function zN({source:e}){return e===`extension`?(0,K.jsx)(ut,{}):e===`prompt`?(0,K.jsx)(Se,{}):(0,K.jsx)(St,{})}function BN(e){let{t}=cr(),n=(0,_.useRef)(null);(0,_.useLayoutEffect)(()=>{let t=n.current,r=t?.parentElement;if(!t||!r||!e.preferBelow)return;let i=()=>{let e=window.visualViewport,n=e?.offsetTop??0,i=e?.height??window.innerHeight,a=n+i,o=r.getBoundingClientRect(),s=Math.max(0,a-o.bottom-8-12),c=Math.max(0,o.top-n-8-12),l=s>=Math.min(t.scrollHeight,224,i*.32)||s>=c?`below`:`above`,u=l===`below`?s:c;t.dataset.placement=l,t.style.setProperty(`--slash-command-available-height`,`${Math.floor(u)}px`)};i();let a=new ResizeObserver(i);return a.observe(t),a.observe(r),window.addEventListener(`resize`,i),window.visualViewport?.addEventListener(`resize`,i),window.visualViewport?.addEventListener(`scroll`,i),()=>{a.disconnect(),window.removeEventListener(`resize`,i),window.visualViewport?.removeEventListener(`resize`,i),window.visualViewport?.removeEventListener(`scroll`,i)}},[e.preferBelow]);let r=e.commands[e.activeIndex];return(0,_.useEffect)(()=>{r&&(n.current?.querySelector(`[data-command-index="${e.activeIndex}"]`))?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[r,e.activeIndex]),e.draft?(0,K.jsx)(`div`,{ref:n,className:`slash-command-menu slash-command-state`,role:`status`,children:t(`commandSessionRequired`)}):e.commandDiscovery.status===`idle`||e.commandDiscovery.status===`loading`?(0,K.jsx)(`div`,{ref:n,className:`slash-command-menu slash-command-state`,role:`status`,children:t(`commandsLoading`)}):e.commandDiscovery.status===`error`?(0,K.jsxs)(`div`,{ref:n,className:`slash-command-menu slash-command-state`,role:`alert`,children:[(0,K.jsx)(`strong`,{children:t(`commandsUnavailable`)}),(0,K.jsx)(`span`,{children:e.commandDiscovery.error})]}):e.commandDiscovery.status===`ready`&&e.commands.length===0?(0,K.jsx)(`div`,{ref:n,className:`slash-command-menu slash-command-state`,role:`status`,children:t(`commandsNoMatch`)}):(0,K.jsxs)(`div`,{ref:n,className:`slash-command-menu`,children:[(0,K.jsx)(`div`,{id:IN,role:`listbox`,"aria-label":t(`commands`),children:e.commands.map((n,r)=>{let i=n.availability===`unsupported`;return(0,K.jsxs)(`button`,{id:LN(r),"data-command-index":r,className:`slash-command-option`,type:`button`,role:`option`,"aria-selected":r===e.activeIndex,"aria-disabled":i,disabled:i,onMouseEnter:()=>e.onSelect(r),onMouseDown:e=>e.preventDefault(),onClick:()=>e.onComplete(n),children:[(0,K.jsx)(`span`,{className:`slash-command-icon`,children:(0,K.jsx)(zN,{source:n.source})}),(0,K.jsxs)(`span`,{className:`slash-command-copy`,children:[(0,K.jsxs)(`span`,{className:`slash-command-heading`,children:[(0,K.jsxs)(`strong`,{children:[`/`,n.name]}),(0,K.jsx)(`span`,{children:t(`commandSource_${n.source}`)})]}),n.description&&(0,K.jsx)(`span`,{children:n.description}),i&&(0,K.jsx)(`span`,{children:t(`commandUnavailable_${n.unavailableReason??`not_integrated`}`)}),n.support&&(0,K.jsx)(`span`,{children:t(`commandSupport_${n.support}`)})]}),(0,K.jsx)(`span`,{className:`slash-command-support`,children:i?t(`commandUnsupported`):n.action?t(`commandOpensPanel`):n.argumentHint?t(`commandAcceptsArguments`):null})]},`${n.source}:${n.name}`)})}),e.commandDiscovery.commandsOmitted>0&&(0,K.jsx)(`div`,{className:`slash-command-bounded`,role:`status`,children:t(`commandsBounded`,{count:e.commandDiscovery.commandsOmitted})})]})}function VN(e){return{key:JSON.stringify([`workspace`,e]),kind:`workspace`,workspacePath:e}}function HN(e){return{key:JSON.stringify([`session`,e.id,e.path]),kind:`session`,workspacePath:e.cwd,sessionId:e.id,sessionPath:e.path}}function UN(e){let{t}=cr(),n=e.snapshot?.selectedSession,r=e.selectedPath===void 0?n?.path??null:e.selectedPath,i=n?.path===r?n.path:null,a=!e.workspaceDraft&&!e.sessionSwitching&&n&&i?HN(n):null,[o]=(0,_.useState)(()=>Sj(xj())),s=(0,_.useSyncExternalStore)(o.subscribe,o.storageState),c=(0,_.useRef)(a??VN(e.selectedWorkspace)),l=e.workspaceDraft||!n&&!e.snapshot?.currentSessionId?VN(e.selectedWorkspace):a??c.current,[u,d]=(0,_.useState)(()=>o.read(c.current.key)),f=(0,_.useRef)(u);f.current=u;let{prompt:p,images:m,files:h=[],caret:g}=u,v=p.trim().length,y=v>qd,b=l.key,x=(0,_.useRef)(new Map),S=(0,_.useRef)(null),C=(0,_.useRef)(!1),w=e.modelSearch??{query:``,status:`idle`,models:[],totalMatches:0,matchesOmitted:0,error:null},[T,E]=(0,_.useState)(!1),[D,O]=(0,_.useState)(!1),[A,j]=(0,_.useState)(0),[M,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(null),[L,R]=(0,_.useState)(null),[ee,z]=(0,_.useState)(0),B=(0,_.useMemo)(()=>new lf,[]),V=(0,_.useRef)(null),H=(0,_.useRef)(b);(0,_.useEffect)(()=>{H.current!==b&&(H.current=b,F(null))},[b]);let[te,ne]=(0,_.useState)(!1),[re,ie]=(0,_.useState)(null),[ae,U]=(0,_.useState)(null),[oe,se]=(0,_.useState)(!1),[ce,le]=(0,_.useState)(null),[ue,pe]=(0,_.useState)(null),me=(0,_.useRef)(null),W=(0,_.useRef)(null),he=(0,_.useRef)(null),ge=(0,_.useRef)(null),_e=(0,_.useRef)(!1),ve=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=!0;return o.ready.then(()=>{if(!e)return;let t=o.read(c.current.key);f.current=t,C.current=!0,d(t)}),()=>{e=!1}},[o]),(0,_.useEffect)(()=>{let e=e=>{!ge.current&&!Array.from(x.current.values()).some(e=>e.pending)&&!(o.storageState().status!==`saved`&&(o.hasContent()||o.hasUnsavedChanges()))||(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[o]),(0,_.useLayoutEffect)(()=>{let e=me.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`,e.style.overflowY=e.scrollHeight>220?`auto`:`hidden`,C.current&&(C.current=!1,e.setSelectionRange(g,g)))},[p,g]),(0,_.useEffect)(()=>{if(M||!_e.current)return;_e.current=!1;let e=window.setTimeout(()=>{me.current?.focus(),me.current?.setSelectionRange(g,g)},0);return()=>window.clearTimeout(e)},[g,M]);let ye=(0,_.useRef)(null),be=(0,_.useRef)(!1);(0,_.useLayoutEffect)(()=>{let n=c.current;if(n.key===l.key)return;W.current=null;let r=o.read(l.key),i=!1;if(n.kind===`workspace`&&l.kind===`session`&&n.workspacePath===l.workspacePath&&e.createdSession?.sessionId===l.sessionId&&e.createdSession.sessionPath===l.sessionPath&&e.createdSession.workspacePath===l.workspacePath&&o.move(n.key,l.key)){r=f.current;let e=ge.current;e?.ownerKey===n.key&&(e.ownerKey=l.key);let t=x.current.get(n.key);t&&(x.current.delete(n.key),t.owner=l,x.current.set(l.key,t))}else{if(n.kind===`session`&&l.kind===`workspace`&&n.workspacePath===l.workspacePath&&e.workspaceDraft&&e.sessionSwitching&&!r.prompt&&r.images.length===0&&!r.files?.length){let{prompt:e,images:t,files:n,caret:a}=f.current,s=o.edit(l.key,r,{prompt:e,images:t,files:n,caret:a});s?r=s:i=!0}ge.current?.controller.abort(),ge.current=null,ne(!1)}c.current=l,f.current=r,C.current=!0,_e.current=!1,d(r),ie(i?t(`draftLimit`):null),U(null),pe(null),se(!1),N(!1),O(!0)},[o,l,e.workspaceDraft,e.sessionSwitching,e.createdSession,t]),(0,_.useLayoutEffect)(()=>()=>{ge.current?.controller.abort(),ge.current=null},[]);let xe=(0,_.useCallback)((e,n=b)=>{if(c.current.key!==n)return!1;let r=f.current,i=o.edit(n,r,e);return i?(i.revision!==r.revision&&(x.current.get(n)?.pending||x.current.delete(n),ie(e=>e===t(`draftLimit`)?null:e)),e.prompt!==void 0&&(!e.prompt.trim()||e.prompt.startsWith(`/`))&&(W.current=null),f.current=i,d(i),!0):(ie(t(`draftLimit`)),!1)},[o,b,t]);(0,_.useEffect)(()=>{let t=W.current;t&&(e.workspaceDraft||e.snapshot?.runtime.plan!==`ready`||e.snapshot.runtime.planRevision!==t.planRevision||e.snapshot.currentSessionId!==t.sessionId||e.snapshot.selectedSession?.path!==t.sessionPath||r!==t.sessionPath)&&(W.current=null)},[e.snapshot?.runtime.plan,e.snapshot?.runtime.planRevision,e.snapshot?.currentSessionId,e.snapshot?.selectedSession?.path,e.workspaceDraft,r]);let Ce=!!(!e.workspaceDraft&&n?.id&&cj(e.snapshot,n)&&r===n.path),we=!!(e.selectedWorkspace&&(e.workspaceDraft||!n&&!e.snapshot?.currentSessionId)),Te=!!(!e.workspaceDraft&&n&&r===n.path),G=Te||we,Ee=Ce&&e.snapshot?.selectedExecution?.sessionId===n?.id&&e.snapshot?.selectedExecution?.sessionPath===n?.path&&e.snapshot?.selectedExecution?.compaction?.state===`running`,Oe=!e.workspaceDraft&&(Ce?e.snapshot?.runtime.status===`running`||e.liveRunning:e.snapshot?.selectedExecution?.sessionId===n?.id&&e.snapshot?.selectedExecution?.sessionPath===n?.path&&e.snapshot?.selectedExecution?.status===`running`),ke=Ce&&Oe&&!!(e.activeTurn??e.snapshot?.runtime.activeTurn),Ae=e.activeTurn??e.snapshot?.runtime.activeTurn,je=Ce&&Oe&&!Ee&&!e.turnCancellationPending&&Ae?.sessionId===n?.id&&!!Ae?.commandId,Ne=ue?.ownerKey===b?ue:null,Pe=e.sessionSwitching||!!e.planSelectionPending||!G&&!!e.selectedWorkspace,Fe=e.commandDiscovery??{sessionId:null,status:`idle`,commands:[],totalAvailable:0,commandsOmitted:0,error:null},Ie=/^\/[^\s/]*$/u.test(p)&&g>0,Le=T&&Ie&&!D&&G&&!e.sessionSwitching,Re=Ce?n?.id:null,Be=Ie?p.slice(1):``,Ve=(0,_.useMemo)(()=>RN(Fe.commands,Be),[Be,Fe.commands]),He=Le&&!e.workspaceDraft&&Fe.status===`ready`&&Ve.length>0,Ue=Ce&&!p.trim()&&!e.sessionSwitching,We=G&&!!e.selectedWorkspace&&!e.sessionSwitching&&!e.planSelectionPending,Ge=(0,_.useRef)(e.addSourcesRequest?.revision??0);(0,_.useEffect)(()=>{let r=e.addSourcesRequest;if(!(!r||r.revision===Ge.current)&&(Ge.current=r.revision,!(!We||n?.id!==r.sessionId||n.path!==r.path))){if(r.feedback){let{filePath:e,side:n,line:i,code:a}=r.feedback,o=`${eN(e)} — ${t(n===`new`?`sourceFeedbackNew`:`sourceFeedbackOld`,{path:e,line:i})}\n> ${a.split(` `).join(` > `)}`,s=f.current.prompt,l=`${s}${s?` -`:``}${o}`;if(!xe({prompt:l,caret:l.length}))return;F(null),O(!0),queueMicrotask(()=>{c.current.key===b&&(me.current?.focus(),me.current?.setSelectionRange(l.length,l.length))});return}V.current?.focus(),F(`files`)}},[e.addSourcesRequest,We,n?.id,n?.path,b,t,xe]),(0,_.useEffect)(()=>{We||(_e.current=!1,N(!1))},[We]);let Ke=async e=>{if(!We||c.current.key!==b)return;let n=[...e];if(n.length===0)return;let r=ge.current;if(f.current.images.length+(f.current.files?.length??0)+(r?.files.length??0)+n.length>8){ie(t(`fileAttachmentCount`,{count:8}));return}if(r){r.files.push(...n);return}let i={ownerKey:c.current.key,files:n,staged:[],stagedFiles:[],controller:new AbortController};ge.current=i,ne(!0),ie(null);try{for(let e of i.files){let n=/^image\/(?:png|jpeg|gif|webp)$/iu.test(e.type);try{if(n||=!!of(new Uint8Array(await e.slice(0,12).arrayBuffer())),!n){let t=await dM(e,i.controller.signal);if(ge.current!==i||c.current.key!==i.ownerKey)return;if([...f.current.files??[],...i.stagedFiles].reduce((e,t)=>e+t.size,t.size)>52428800)throw Error(`file-total-size`);i.stagedFiles.push(t);continue}if(f.current.images.length+i.staged.length>=8)throw Error(`image-count`);let t=await cf(e);if(ge.current!==i||c.current.key!==i.ownerKey)return;if([...f.current.images,...i.staged].reduce((e,t)=>e+t.size,t.size)>33554432)throw Error(`image-total-size`);i.staged.push(t)}catch(r){if(ge.current!==i)return;let a=r instanceof Error?r.message:`image-type`,o=a===`file-size`||a===`file-total-size`?t(`fileAttachmentTooLarge`):a===`image-count`?t(`imageAttachmentCount`,{count:8}):t(n?a===`image-size`?`imageAttachmentTooLarge`:a===`image-total-size`?`imageAttachmentTotalTooLarge`:a===`image-read`?`imageAttachmentReadFailed`:`imageAttachmentUnsupported`:`fileAttachmentReadFailed`);ie(`${e.name||t(`attachedImage`)}: ${o}`)}}(i.staged.length>0||i.stagedFiles.length>0)&&xe({images:[...f.current.images,...i.staged],files:[...f.current.files??[],...i.stagedFiles]},i.ownerKey)}finally{ge.current===i&&(ge.current=null,ne(!1),he.current&&(he.current.value=``))}};(0,_.useEffect)(()=>{let t=Le&&!be.current;be.current=Le,!(!Le||e.workspaceDraft||!Re||Fe.status!==`idle`&&!(t&&Fe.status===`error`))&&e.actions.discoverCommands()},[Fe.status,Le,e.actions,e.workspaceDraft,Re]),(0,_.useEffect)(()=>{let e=Ve.findIndex(e=>e.availability===`available`);j(e)},[Ve]),(0,_.useEffect)(()=>{let n=e.promptAdmissionRecovery??e.restoredPromptDraft;if(!n||ye.current===n.commandId)return;ye.current=n.commandId,S.current=null;let r=JSON.stringify([`session`,n.sessionId,n.sessionPath]),i=x.current.get(r),a=n.images??[];if(i?.content.trim()===n.content&&i.images.length===a.length&&i.images.every((e,t)=>e.data===a[t]?.data&&e.mimeType===a[t]?.mimeType&&e.name===a[t]?.name)){S.current={commandId:n.commandId,key:r,revision:i.revision};return}let s=c.current.key===r?f.current:o.read(r);if(s.prompt||s.images.length>0||s.files?.length)return;let l=(n.images??[]).map(e=>({...e,id:globalThis.crypto?.randomUUID?.()??`${n.commandId}-${e.name}`,name:e.name??t(`attachedImage`),size:atob(e.data).length,previewUrl:`data:${e.mimeType};base64,${e.data}`})),u=o.edit(r,s,{prompt:n.content,images:l,caret:n.content.length});if(!u){c.current.key===r&&ie(t(`draftLimit`));return}S.current={commandId:n.commandId,key:r,revision:u.revision},c.current.key===r&&(f.current=u,d(u)),e.restoredPromptDraft?.commandId===n.commandId&&e.actions.acknowledgeRestoredPromptDraft(n.commandId)},[o,e.actions,e.promptAdmissionRecovery,e.restoredPromptDraft,t]),(0,_.useEffect)(()=>{let t=e.promptAdmissionResolution;if(!t)return;let n=S.current,r=JSON.stringify([`session`,t.sessionId,t.sessionPath]),i=x.current.get(r),a=t.images??[],s=i?.content.trim()===t.content&&i.images.length===a.length&&i.images.every((e,t)=>e.data===a[t]?.data&&e.mimeType===a[t]?.mimeType&&e.name===a[t]?.name),l=n?.key===r&&n.commandId===t.commandId?n.revision:s?i.revision:void 0;if(l!==void 0){let e=o.clear(r,l);e&&c.current.key===r&&(f.current=e,d(e))}n?.commandId===t.commandId&&(S.current=null),e.actions.acknowledgePromptAdmissionResolution(t.commandId)},[o,e.actions,e.promptAdmissionResolution]);let qe=async(n,r=!1,i,a)=>{if(x.current.get(c.current.key)?.pending||ge.current||e.planSelectionPending)return;if(!e.selectedWorkspace){await e.actions.chooseWorkspace();return}if(b!==c.current.key)return;let s=f.current,l={revision:s.revision,owner:c.current,pending:!0,content:s.prompt,images:s.images};x.current.set(l.owner.key,l);let u=!1,p=!1;try{let m=s.prompt,h=null;if(Te&&!Ce&&(h=await e.actions.prepareSession(),!h||l.owner.kind!==`session`||h.sessionId!==l.owner.sessionId||h.sessionPath!==l.owner.sessionPath||c.current.key!==l.owner.key))return;if(s.files?.length){if(p=!0,ne(!0),ie(null),h??=await e.actions.prepareSession(),!h?.sessionPath)return;let n=await B.uploadPromptFiles(h.sessionId,h.sessionPath,s.files.map(({name:e,data:t,mimeType:n,text:r})=>({name:e,data:t,mimeType:n,...r===void 0?{}:{text:r}})));if(n.sessionId!==h.sessionId||n.sessionPath!==h.sessionPath||c.current.key!==l.owner.key||n.files.length!==s.files.length||n.files.some((e,t)=>e.name!==s.files?.[t]?.name||e.size!==s.files?.[t]?.size))return;let r=n.files.map((e,n)=>`${JSON.stringify(e.name)}: ${YM(e.path,e.path)}${e.textPath?`\n ${t(`fileAttachmentExtractedContent`)}${s.files?.[n]?.extraction===`truncated`?` (${t(`fileAttachmentTextTruncated`)})`:``}: ${YM(e.textPath,e.textPath)}`:``}`).join(` +`:``}${o}`;if(!xe({prompt:l,caret:l.length}))return;F(null),O(!0),queueMicrotask(()=>{c.current.key===b&&(me.current?.focus(),me.current?.setSelectionRange(l.length,l.length))});return}V.current?.focus(),F(`files`)}},[e.addSourcesRequest,We,n?.id,n?.path,b,t,xe]),(0,_.useEffect)(()=>{We||(_e.current=!1,N(!1))},[We]);let Ke=async e=>{if(!We||c.current.key!==b)return;let n=[...e];if(n.length===0)return;let r=ge.current;if(f.current.images.length+(f.current.files?.length??0)+(r?.files.length??0)+n.length>8){ie(t(`fileAttachmentCount`,{count:8}));return}if(r){r.files.push(...n);return}let i={ownerKey:c.current.key,files:n,staged:[],stagedFiles:[],controller:new AbortController};ge.current=i,ne(!0),ie(null);try{for(let e of i.files){let n=/^image\/(?:png|jpeg|gif|webp)$/iu.test(e.type);try{if(n||=!!df(new Uint8Array(await e.slice(0,12).arrayBuffer())),!n){let t=await gM(e,i.controller.signal);if(ge.current!==i||c.current.key!==i.ownerKey)return;if([...f.current.files??[],...i.stagedFiles].reduce((e,t)=>e+t.size,t.size)>52428800)throw Error(`file-total-size`);i.stagedFiles.push(t);continue}if(f.current.images.length+i.staged.length>=8)throw Error(`image-count`);let t=await pf(e);if(ge.current!==i||c.current.key!==i.ownerKey)return;if([...f.current.images,...i.staged].reduce((e,t)=>e+t.size,t.size)>33554432)throw Error(`image-total-size`);i.staged.push(t)}catch(r){if(ge.current!==i)return;let a=r instanceof Error?r.message:`image-type`,o=a===`file-size`||a===`file-total-size`?t(`fileAttachmentTooLarge`):a===`image-count`?t(`imageAttachmentCount`,{count:8}):t(n?a===`image-size`?`imageAttachmentTooLarge`:a===`image-total-size`?`imageAttachmentTotalTooLarge`:a===`image-read`?`imageAttachmentReadFailed`:`imageAttachmentUnsupported`:`fileAttachmentReadFailed`);ie(`${e.name||t(`attachedImage`)}: ${o}`)}}(i.staged.length>0||i.stagedFiles.length>0)&&xe({images:[...f.current.images,...i.staged],files:[...f.current.files??[],...i.stagedFiles]},i.ownerKey)}finally{ge.current===i&&(ge.current=null,ne(!1),he.current&&(he.current.value=``))}};(0,_.useEffect)(()=>{let t=Le&&!be.current;be.current=Le,!(!Le||e.workspaceDraft||!Re||Fe.status!==`idle`&&!(t&&Fe.status===`error`))&&e.actions.discoverCommands()},[Fe.status,Le,e.actions,e.workspaceDraft,Re]),(0,_.useEffect)(()=>{let e=Ve.findIndex(e=>e.availability===`available`);j(e)},[Ve]),(0,_.useEffect)(()=>{let n=e.promptAdmissionRecovery??e.restoredPromptDraft;if(!n||ye.current===n.commandId)return;ye.current=n.commandId,S.current=null;let r=JSON.stringify([`session`,n.sessionId,n.sessionPath]),i=x.current.get(r),a=n.images??[];if(i?.content.trim()===n.content&&i.images.length===a.length&&i.images.every((e,t)=>e.data===a[t]?.data&&e.mimeType===a[t]?.mimeType&&e.name===a[t]?.name)){S.current={commandId:n.commandId,key:r,revision:i.revision};return}let s=c.current.key===r?f.current:o.read(r);if(s.prompt||s.images.length>0||s.files?.length)return;let l=(n.images??[]).map(e=>({...e,id:globalThis.crypto?.randomUUID?.()??`${n.commandId}-${e.name}`,name:e.name??t(`attachedImage`),size:atob(e.data).length,previewUrl:`data:${e.mimeType};base64,${e.data}`})),u=o.edit(r,s,{prompt:n.content,images:l,caret:n.content.length});if(!u){c.current.key===r&&ie(t(`draftLimit`));return}S.current={commandId:n.commandId,key:r,revision:u.revision},c.current.key===r&&(f.current=u,d(u)),e.restoredPromptDraft?.commandId===n.commandId&&e.actions.acknowledgeRestoredPromptDraft(n.commandId)},[o,e.actions,e.promptAdmissionRecovery,e.restoredPromptDraft,t]),(0,_.useEffect)(()=>{let t=e.promptAdmissionResolution;if(!t)return;let n=S.current,r=JSON.stringify([`session`,t.sessionId,t.sessionPath]),i=x.current.get(r),a=t.images??[],s=i?.content.trim()===t.content&&i.images.length===a.length&&i.images.every((e,t)=>e.data===a[t]?.data&&e.mimeType===a[t]?.mimeType&&e.name===a[t]?.name),l=n?.key===r&&n.commandId===t.commandId?n.revision:s?i.revision:void 0;if(l!==void 0){let e=o.clear(r,l);e&&c.current.key===r&&(f.current=e,d(e))}n?.commandId===t.commandId&&(S.current=null),e.actions.acknowledgePromptAdmissionResolution(t.commandId)},[o,e.actions,e.promptAdmissionResolution]);let qe=async(n,r=!1,i,a)=>{if(x.current.get(c.current.key)?.pending||ge.current||e.planSelectionPending)return;if(!e.selectedWorkspace){await e.actions.chooseWorkspace();return}if(b!==c.current.key)return;let s=f.current,l={revision:s.revision,owner:c.current,pending:!0,content:s.prompt,images:s.images};x.current.set(l.owner.key,l);let u=!1,p=!1;try{let m=s.prompt,h=null;if(Te&&!Ce&&(h=await e.actions.prepareSession(),!h||l.owner.kind!==`session`||h.sessionId!==l.owner.sessionId||h.sessionPath!==l.owner.sessionPath||c.current.key!==l.owner.key))return;if(s.files?.length){if(p=!0,ne(!0),ie(null),h??=await e.actions.prepareSession(),!h?.sessionPath)return;let n=await B.uploadPromptFiles(h.sessionId,h.sessionPath,s.files.map(({name:e,data:t,mimeType:n,text:r})=>({name:e,data:t,mimeType:n,...r===void 0?{}:{text:r}})));if(n.sessionId!==h.sessionId||n.sessionPath!==h.sessionPath||c.current.key!==l.owner.key||n.files.length!==s.files.length||n.files.some((e,t)=>e.name!==s.files?.[t]?.name||e.size!==s.files?.[t]?.size))return;let r=n.files.map((e,n)=>`${JSON.stringify(e.name)}: ${eN(e.path,e.path)}${e.textPath?`\n ${t(`fileAttachmentExtractedContent`)}${s.files?.[n]?.extraction===`truncated`?` (${t(`fileAttachmentTextTruncated`)})`:``}: ${eN(e.textPath,e.textPath)}`:``}`).join(` `);if(m=`${m.trim()}${m.trim()?` -`:``}${t(`fileAttachmentPromptLabel`)}\n${r}`,m.length>12e3){ie(t(`fileAttachmentPromptTooLong`));return}l.content=m}if(u=h?await n(m,s.images,i,a,h):a?await n(m,s.images,i,a):i?await n(m,s.images.length>0||r?s.images:void 0,i):r||s.images.length>0?await n(m,s.images):await n(m),u){a?.streamingBehavior===`steer`&&pe(null),i===W.current&&(W.current=null);let e=o.clear(l.owner.key,l.revision);e&&c.current.key===l.owner.key&&(f.current=e,d(e),ie(null))}}catch(e){c.current.key===l.owner.key&&ie(e instanceof Error?e.message:t(`fileAttachmentReadFailed`))}finally{p&&c.current.key===l.owner.key&&!ge.current&&ne(!1),l.pending=!1;let e=o.read(l.owner.key);(u||!e.prompt&&e.images.length===0&&!e.files?.length)&&x.current.get(l.owner.key)===l&&x.current.delete(l.owner.key)}},Je=async n=>{if(n?.preventDefault(),!G||e.sessionSwitching||e.modelSelectionPending||e.planSelectionPending||e.thinkingPendingLevel!==null||e.promptAdmissionPending||e.promptAdmissionRecovery||e.promptAdmissionResolution||y||!p.trim()&&m.length===0&&h.length===0||ge.current)return;if(Ne&&(!je||Ae?.commandId!==Ne.expectedTurnCommandId||W.current)){U(t(`steerStaleTurn`));return}let r=/^\/([^\s/]+)/u.exec(p.trim())?.[1],i=Fe.commands.find(e=>e.name===r);if(i?.availability===`unsupported`){U(`/${i.name}: ${t(`commandUnavailable_${i.unavailableReason??`not_integrated`}`)}`);return}if(i?.action){if(p.trim()!==`/${i.name}`||m.length>0||h.length>0){U(t(`commandPanelArguments`));return}if(e.onCommandAction?.(i.action)!==!0){U(t(`commandPanelUnavailable`));return}xe({prompt:``,caret:0}),U(null);return}U(null),await qe(e.actions.sendPrompt,!1,W.current??void 0,Ne?{streamingBehavior:`steer`,expectedTurnCommandId:Ne.expectedTurnCommandId}:void 0)},Ye=()=>{if(!(!Ce||e.sessionSwitching||e.modelSelectionPending||e.thinkingPendingLevel!==null||y))return qe(e.actions.sendPromptAsNew,!0)},Xe=e=>{if(e.availability!==`available`)return;let t=`/${e.name} `;xe({prompt:t,caret:t.length})&&(U(null),O(!0),queueMicrotask(()=>{c.current.key===b&&(me.current?.focus(),me.current?.setSelectionRange(t.length,t.length))}))},Ze=e=>{if(!Ve.length)return;let t=A;for(let n=0;n{let n=ve.current,r=f.current;if(!n||n.ownerKey!==b||n.ownerKey!==c.current.key||n.revision!==r.revision)return t(`fileReferenceDraftChanged`);let i=r.prompt.slice(0,n.start),a=r.prompt.slice(n.end),o=YM(e),s=i&&!/\s$/u.test(i)?` `:``,l=`${i}${s}${o}${a&&!/^\s/u.test(a)?` `:``}${a}`,u=i.length+s.length+o.length;if(!xe({prompt:l,caret:u}))return t(`draftLimit`);_e.current=!0},et=()=>{let e=f.current,t=me.current,n=Math.min(Math.max(t?.selectionStart??e.caret,0),e.prompt.length);ve.current={ownerKey:b,revision:e.revision,start:n,end:Math.min(Math.max(t?.selectionEnd??n,n),e.prompt.length)},N(!0)},tt=[...(e.snapshot?.workspaces??[]).map(t=>({id:t.path,label:t.name,icon:(0,K.jsx)(De,{}),endContent:t.path===e.selectedWorkspace?(0,K.jsx)(I,{}):void 0,onClick:()=>e.actions.setWorkspace(t.path)})),{type:`divider`},{id:`add`,label:t(`addWorkspaceMenu`),icon:(0,K.jsx)(lt,{}),onClick:()=>void e.actions.chooseWorkspace()}],nt=e.draftModel??e.snapshot?.models.find(e=>e.current),rt=e.snapshot?.workspaces.find(t=>t.path===e.selectedWorkspace)?.name??(e.selectedWorkspace?QA(e.selectedWorkspace):t(`selectWorkspace`)),it=e.snapshot?.sessions.find(e=>e.path===i),at=Ce?ZA(it??{},n?.id??t(`untitledSession`)):we?t(`newSession`):n?ZA(it??{},n.id):t(`newSession`),ot=e.sessionSwitching?t(`switchingSession`):e.selectedWorkspace?Ce&&e.snapshot?.runtime.planHasPrompt&&[`planning`,`ready`].includes(e.snapshot.runtime.plan??``)?t(`promptPlanMessage`):e.landing?t(`promptTask`):t(Te?`promptMessage`:`promptReadonly`):t(`promptStart`),st=e.snapshot?.thinking,ct=st?.level??null,ut=e.thinkingPendingLevel??null,dt=st?.supported??!1,ft=!!e.selectedWorkspace&&!Ce&&(we||!n),pt=st?!st.available.includes(ct??``):!1,mt=st?!dt&&!ft?`thinkingUnsupportedHint`:!Ce&&!ft?`thinkingInactiveHint`:Oe?`thinkingLockedRunning`:e.modelSelectionPending?`thinkingModelPendingHint`:null:null,ht=e.snapshot?.selectedExecution,gt=n&&ht&&ht.sessionId===n.id&&ht.sessionPath===n.path?ht.pendingFollowUps:void 0,_t=gt??(Ce?e.pendingFollowUpsReceipt:null),vt=n&&ht?.sessionId===n.id&&ht.sessionPath===n.path?ht.pendingSteering:void 0,yt=vt??(Ce?e.pendingSteeringReceipt:null),bt=vt===void 0?[]:ht?.steeringMessages??[],xt=!e.workspaceDraft&&!e.sessionSwitching&&bt.length>0,St=gt===void 0?[]:ht?.queuedMessages??[],Ct=new Map,wt=St.map(e=>{let t=Ct.get(e)??0;return Ct.set(e,t+1),{message:e,key:`${e}:${t}`}}),Tt=!e.workspaceDraft&&!e.sessionSwitching&>!==void 0&&St.length>0,Dt=Ee?t(`compactionDraftHelp`):e.promptAdmissionPending&&!ke?t(`promptPending`):e.modelSelectionPending?t(`thinkingModelPendingHint`):e.thinkingPendingLevel===null?e.workspaceDraft?t(`enterHint`):e.turnCancellationPending?t(`stoppingTurn`):e.turnTerminalStatus===`cancelled`?t(`stoppedTurn`):!xt&&(yt??0)>0?t(`pendingSteeringHint`,{count:yt}):!Tt&&(Ce&&e.pendingFollowUpsReceipt!==null||(_t??0)>0)?(_t??0)>0?t(`pendingFollowUpsHint`,{count:_t??0}):t(`acceptedHint`):t(G?Oe?Ne?`steeringHint`:`queuedHint`:`enterHint`:`activeOnlyHint`):t(`thinkingPendingHint`),kt=G&&(Ee||e.promptAdmissionPending&&!ke||e.modelSelectionPending||e.thinkingPendingLevel!==null||e.turnCancellationPending||e.turnTerminalStatus===`cancelled`||!Tt&&Ce&&e.pendingFollowUpsReceipt!==null||!Tt&&(_t??0)>0||!xt&&(yt??0)>0||Oe&&!!(p.trim()||m.length||h.length)),At=L===b,jt=(e=!1)=>{F(null),e&&V.current?.focus()},Mt=e=>()=>{F(null),e()},Nt=async r=>{if(!(!Ce||!n||At||e.sessionSwitching)){R(b);try{r===`compact`?await B.compactSession(n.id,n.path):await B.updatePromptQueue(n.id,n.path,r),await e.actions.refreshSnapshot()}catch(e){c.current.key===b&&U(e instanceof Error?e.message:t(`commandPanelUnavailable`))}finally{R(e=>e===b?null:e)}}},Pt=P===`files`?[{id:`back`,section:t(`composerAdd`),label:t(`composerBack`),icon:(0,K.jsx)(de,{}),onClick:()=>F(`main`)},{id:`file-upload`,section:t(`composerAdd`),label:t(`addFiles`),description:t(`fileAttachmentDescription`),icon:(0,K.jsx)(Se,{}),disabled:te||m.length+h.length>=8,onClick:Mt(()=>{he.current&&(he.current.accept=``,he.current.click())})},{id:`image`,section:t(`composerAdd`),label:t(`addImages`),description:t(`imageAttachmentDescription`),icon:(0,K.jsx)(Me,{}),disabled:te||m.length>=8,onClick:Mt(()=>{he.current&&(he.current.accept=`image/png,image/jpeg,image/gif,image/webp`,he.current.click())})},{id:`workspace-file`,section:t(`composerAdd`),label:t(`fileReference`),icon:(0,K.jsx)(Se,{}),onClick:Mt(et)}]:[{id:`file`,section:t(`composerAdd`),label:t(`composerFile`),alias:`file`,icon:(0,K.jsx)(Se,{}),onClick:()=>F(`files`)},{id:`goal`,section:t(`composerAdd`),label:t(`composerGoal`),alias:`goal`,description:t(`composerGoalDescription`),icon:(0,K.jsx)(Ot,{}),disabled:!Ue,onClick:Mt(()=>{xe({prompt:`/goal `,caret:6})&&(O(!0),queueMicrotask(()=>me.current?.focus()))})},{id:`plan`,section:t(`composerAdd`),label:t(`composerPlan`),alias:`plan`,description:t(`composerPlanDescription`),icon:(0,K.jsx)(ze,{}),disabled:!Ce||Oe||e.planSelectionPending||e.promptAdmissionPending,onClick:Mt(()=>void e.actions.selectPlanMode(e.snapshot?.runtime.plan===`inactive`))},{id:`compact`,section:t(`composerCommands`),label:t(`composerCompact`),alias:`compact`,description:t(`composerCompactDescription`),icon:(0,K.jsx)(Qe,{}),disabled:!Ce||Oe||At||e.promptAdmissionPending||(_t??0)>0,onClick:Mt(()=>void Nt(`compact`))},{id:`model`,section:t(`composerCommands`),label:t(`composerModel`),alias:`model`,description:t(`composerModelDescription`),icon:(0,K.jsx)(fe,{}),disabled:!Ce&&!we||Oe||e.modelSelectionPending,onClick:Mt(()=>z(e=>e+1))}];return(0,K.jsxs)(`div`,{className:`composer-dock`,children:[Ce&&e.snapshot?.runtime.plan===`ready`&&!e.sessionSwitching&&(0,K.jsx)(`div`,{className:`plan-mode-bar`,children:(0,K.jsx)(`button`,{type:`button`,disabled:Oe||te||!!ge.current||e.planSelectionPending||e.promptAdmissionPending||!!e.promptAdmissionRecovery,onClick:()=>{if((p.trim()||m.length>0||h.length>0)&&!window.confirm(t(`planImplementationReplaceDraft`)))return;let n=f.current.revision,r=c.current.key;e.actions.preparePlanImplementation().then(e=>{!e||f.current.revision!==n||c.current.key!==r||xe({prompt:e.prompt,images:[],caret:e.prompt.length},r)&&(W.current={sessionId:e.sessionId,sessionPath:e.sessionPath,planRevision:e.planRevision},ie(null),me.current?.focus())})},children:t(`planModeImplement`)})}),!Ce&&!e.workspaceDraft&&!e.sessionSwitching&&n&&r===n.path&&(0,K.jsxs)(`div`,{className:`composer-session-notice`,children:[(0,K.jsx)(`span`,{children:t(`activateViewedSessionHint`)}),(0,K.jsx)(`button`,{type:`button`,className:`secondary`,onClick:()=>void e.actions.selectSession(n.path),children:t(`activateViewedSession`)})]}),Ce&&(0,K.jsx)(lj,{snapshot:e.snapshot,observed:e.activityObserved,onInspectTerminal:e.onInspect,onInspectSubagent:e.onInspectSubagent}),e.accessory,e.landing&&(0,K.jsx)(`div`,{className:`workspace-picker-row`,children:(0,K.jsx)(jA,{className:`workspace-picker-menu`,button:{label:e.selectedWorkspace?QA(e.selectedWorkspace):t(`selectWorkspace`),icon:(0,K.jsx)(De,{}),size:`md`,variant:`ghost`,className:`workspace-picker`},items:tt,menuWidth:240,placement:`above`,alignment:`start`,hasChevron:!0})}),e.promptAdmissionRecovery&&(0,K.jsxs)(`section`,{className:`prompt-recovery`,role:`alert`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:t(`promptAdmissionUnknown`)}),(0,K.jsx)(`span`,{children:e.promptAdmissionRecovery.phase===`checking`?t(`promptAdmissionCheckingDetail`):e.promptAdmissionRecovery.phase===`verification-failed`?t(`promptAdmissionVerificationFailedDetail`):t(`promptAdmissionUnknownDetail`)})]}),(0,K.jsxs)(`div`,{className:`prompt-recovery-actions`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:e.promptAdmissionRecovery.phase===`submitting`,onClick:e.actions.abandonPromptAdmission,children:t(`abandonAdmission`)}),e.promptAdmissionRecovery.phase===`verification-failed`&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>void e.actions.checkPromptAdmissionRecovery(),children:t(`retryAdmissionCheck`)}),e.promptAdmissionRecovery.retryable&&(0,K.jsx)(`button`,{type:`button`,disabled:!Ce||e.sessionSwitching||e.modelSelectionPending||e.thinkingPendingLevel!==null||e.promptAdmissionRecovery.phase!==`ready`,onClick:()=>void e.actions.retryPromptAdmission(),children:t(`retryOriginalAdmission`)}),(0,K.jsx)(`button`,{type:`button`,className:`primary`,disabled:te||!Ce||e.sessionSwitching||e.modelSelectionPending||e.thinkingPendingLevel!==null||y||e.promptAdmissionRecovery.phase!==`ready`||!p.trim()&&m.length===0&&h.length===0,onClick:()=>void Ye(),children:e.promptAdmissionRecovery.phase===`submitting`?t(`sendingAsNew`):t(`sendAsNew`)})]})]}),Tt&&(0,K.jsxs)(`section`,{className:`composer-queue`,"aria-label":t(`pendingFollowUpsHint`,{count:gt}),children:[(0,K.jsxs)(`div`,{className:`composer-queue-status`,role:`status`,children:[(0,K.jsx)(`span`,{children:t(ht?.promptQueueBlocked?`compactionQueueBlocked`:Ee?`compactionQueueWaiting`:`queuedHint`)}),Ce&&(0,K.jsxs)(`span`,{children:[ht?.promptQueueBlocked&&(0,K.jsx)(`button`,{type:`button`,disabled:At||Ee,onClick:()=>void Nt(`retry`),children:t(`retryPrompt`)}),(0,K.jsx)(`button`,{type:`button`,disabled:At,onClick:()=>void Nt(`clear`),children:t(`clearPromptQueue`)})]})]}),(0,K.jsx)(`ul`,{children:wt.map(({message:e,key:r})=>{let i=`${n?.id}\0${n?.path}\0${r}`,a=ce===i,o=e||t(`queuedImage`),s=t(a?`queuedMessageCollapse`:`queuedMessageExpand`);return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,className:`composer-queue-row ${a?`expanded`:``}`,"aria-expanded":a,"aria-label":`${s}: ${a?o:ej(o,80)}`,title:s,onClick:()=>le(a?null:i),children:[(0,K.jsx)(de,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:o})]})},r)})}),gt>St.length&&(0,K.jsx)(`small`,{children:t(`queuedMore`,{count:gt-St.length})})]}),xt&&(0,K.jsxs)(`section`,{className:`composer-queue`,"aria-label":t(`steeringMessagesTitle`),children:[(0,K.jsxs)(`div`,{className:`composer-queue-status`,role:`status`,children:[(0,K.jsx)(`span`,{children:t(`pendingSteeringHint`,{count:yt})}),Ce&&(0,K.jsx)(`button`,{type:`button`,disabled:At,onClick:()=>void Nt(`clear`),children:t(`clearPromptQueue`)})]}),(0,K.jsx)(`ul`,{children:bt.map((e,r)=>{let i=`${n?.id}\0${n?.path}\0steer:${r}:${e}`,a=ce===i,o=e||t(`queuedImage`),s=t(a?`queuedMessageCollapse`:`queuedMessageExpand`);return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,className:`composer-queue-row ${a?`expanded`:``}`,"aria-expanded":a,"aria-label":`${s}: ${a?o:ej(o,80)}`,title:s,onClick:()=>le(a?null:i),children:[(0,K.jsx)(de,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:o})]})},i)})}),(yt??0)>bt.length&&(0,K.jsx)(`small`,{children:t(`queuedMore`,{count:(yt??0)-bt.length})})]}),(0,K.jsxs)(`form`,{className:`composer composer-m02 ${e.selectedWorkspace?``:`dormant`} ${oe?`is-dragging`:``}`,onSubmit:e=>void Je(e),onDragEnter:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),We&&se(!0))},onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),We&&(e.dataTransfer.dropEffect=`copy`,se(!0)))},onDragLeave:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||se(!1)},onDrop:e=>{se(!1),e.dataTransfer.files.length!==0&&(e.preventDefault(),We&&Ke(e.dataTransfer.files))},children:[P&&(0,K.jsx)(ZM,{items:Pt,onClose:jt},P),!e.selectedWorkspace&&(0,K.jsxs)(`div`,{className:`composer-dormant-cta`,"aria-hidden":`true`,children:[(0,K.jsx)(De,{}),(0,K.jsx)(`span`,{children:ot})]}),!e.selectedWorkspace&&(0,K.jsx)(`button`,{className:`dormant-overlay`,type:`button`,"aria-label":t(`selectWorkspace`),onClick:()=>void e.actions.chooseWorkspace()}),(0,K.jsx)(`input`,{ref:he,className:`sr-only`,type:`file`,multiple:!0,tabIndex:-1,"aria-hidden":`true`,onChange:e=>{e.currentTarget.files&&Ke(e.currentTarget.files)}}),(0,K.jsx)(iM,{ownerKey:b,images:m,onRemove:e=>{xe({images:f.current.images.filter(t=>t.id!==e)})&&ie(null)}}),(0,K.jsx)(aM,{ownerKey:b,files:h,onRemove:e=>{xe({files:(f.current.files??[]).filter(t=>t.id!==e)})&&ie(null)}}),re&&(0,K.jsx)(`p`,{className:`composer-attachment-error`,role:`alert`,children:re}),s.status===`failed`&&(0,K.jsxs)(`p`,{className:`composer-attachment-error`,role:`status`,children:[t(`draftStorageUnavailable`),` `,(0,K.jsx)(`button`,{type:`button`,onClick:()=>{o.retryStorage().then(()=>{let e=o.read(c.current.key);f.current=e,C.current=!0,d(e)})},children:t(`draftStorageRetry`)})]}),s.invalid&&(0,K.jsx)(`p`,{className:`composer-attachment-error`,role:`status`,children:t(`draftStorageInvalid`)}),te&&(0,K.jsx)(`p`,{role:`status`,children:t(`imageAttachmentsLoading`)}),ae&&(0,K.jsx)(`p`,{className:`composer-attachment-error`,role:`alert`,children:ae}),y&&(0,K.jsx)(`p`,{id:`composer-prompt-length-error`,className:`composer-attachment-error`,role:`alert`,children:t(`promptTooLong`,{count:v,limit:12e3})}),oe&&(0,K.jsxs)(`div`,{className:`composer-drop-overlay`,"aria-hidden":`true`,children:[(0,K.jsx)(Me,{}),(0,K.jsx)(`span`,{children:t(`dropImagesHere`)})]}),(0,K.jsx)(`textarea`,{ref:me,value:p,rows:1,disabled:Pe,readOnly:!e.selectedWorkspace,"aria-label":t(`describeTask`),"aria-invalid":y||void 0,"aria-describedby":y?`composer-prompt-length-error`:void 0,"aria-autocomplete":`list`,"aria-controls":He?jN:void 0,"aria-activedescendant":He&&Ve[A]?MN(A):void 0,placeholder:ot,onChange:e=>{xe({prompt:e.target.value,caret:e.target.selectionStart})&&(U(null),O(!1))},onClick:e=>xe({caret:e.currentTarget.selectionStart}),onSelect:e=>xe({caret:e.currentTarget.selectionStart}),onFocus:()=>{E(!0),O(!1)},onBlur:()=>E(!1),onPaste:e=>{if(!We)return;let t=Array.from(e.clipboardData.files);if(t.length===0)for(let n of Array.from(e.clipboardData.items??[])){let e=n.kind===`file`?n.getAsFile():null;e&&t.push(e)}t.length!==0&&(e.clipboardData.getData(`text/plain`)||e.preventDefault(),Ke(t))},onKeyDown:e=>{if(!e.nativeEvent.isComposing){if(Le){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),Ze(e.key===`ArrowDown`?1:-1);return}if(e.key===`Escape`){e.preventDefault(),O(!0);return}if(e.key===`Tab`){let t=Ve[A];!e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&t?.availability===`available`&&(e.preventDefault(),Xe(t));return}if(e.key===`Enter`&&!e.shiftKey){let t=Ve[A];if(t){e.preventDefault(),Xe(t);return}if(Ve.length>0){e.preventDefault();return}}}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Je())}}}),Le&&(0,K.jsx)(FN,{activeIndex:A,commandDiscovery:Fe,commands:Ve,draft:!!e.workspaceDraft,preferBelow:e.landing,onComplete:Xe,onSelect:j}),(0,K.jsxs)(`div`,{className:`composer-toolbar`,children:[(0,K.jsxs)(`div`,{className:`composer-toolbar-context`,children:[We&&(0,K.jsx)(`button`,{ref:V,type:`button`,className:`composer-context-trigger icon-button`,"aria-label":t(`addContext`),"aria-haspopup":`menu`,"aria-expanded":P!==null,"aria-controls":P?`composer-action-menu`:void 0,onClick:()=>{O(!0),F(P?null:`main`)},children:(0,K.jsx)(lt,{})}),!e.landing&&(0,K.jsxs)(`span`,{className:`composer-workspace-label`,title:`${rt} / ${at}`,children:[(0,K.jsx)(De,{}),rt]}),Ce&&e.snapshot?.runtime.plan&&e.snapshot.runtime.plan!==`inactive`&&(0,K.jsx)(`span`,{className:`composer-plan-chip`,children:t(`planMode_${e.snapshot.runtime.plan}`)})]}),(0,K.jsxs)(`div`,{className:`composer-toolbar-controls`,children:[(je||Ne)&&(0,K.jsx)(jA,{button:{label:t(Ne?`steerCurrentTurn`:`sendNextTurn`),variant:`ghost`,size:`sm`,isDisabled:e.promptAdmissionPending||!!e.promptAdmissionRecovery},items:[{id:`followUp`,label:t(`sendNextTurn`),onClick:()=>{pe(null),U(null)}},{id:`steer`,label:t(`steerCurrentTurn`),isDisabled:!je,onClick:()=>{!je||!Ae||(pe({ownerKey:b,expectedTurnCommandId:Ae.commandId}),U(null))}}],placement:`above`,alignment:`end`,hasChevron:!0}),(0,K.jsx)(`div`,{className:`model-picker-wrap`,hidden:!!(n&&!Ce&&!e.workspaceDraft),title:mt?t(mt):void 0,"data-level":ct??`none`,"data-pending":ut!==null,"data-warning":pt,children:(0,K.jsx)(AN,{snapshot:e.snapshot,openRequest:ee,currentModel:nt,draftModel:e.draftModel,modelSearch:w,modelSelectionPending:!!e.modelSelectionPending,promptAdmissionPending:e.promptAdmissionPending,sessionSwitching:e.sessionSwitching,liveRunning:Oe,workspaceDraft:!!e.workspaceDraft,thinkingPendingLevel:ut,thinkingNeedsSession:ft,thinkingDisabledReason:mt,onOpenProviders:e.onOpenProviders,actions:e.actions})}),ke&&(0,K.jsx)(Cd,{content:t(`stopTurn`),placement:`above`,children:(0,K.jsx)(`button`,{className:`send-button`,type:`button`,"aria-label":t(`stopTurn`),disabled:e.turnCancellationPending||e.sessionSwitching,onClick:()=>void e.actions.cancelActiveTurn(),children:(0,K.jsx)(Et,{})})}),(!ke||!!(p.trim()||m.length||h.length))&&(0,K.jsx)(Cd,{content:t(Ee?`compactionDraftHelp`:`send`),placement:`above`,children:(0,K.jsx)(`button`,{className:`send-button`,type:`submit`,"aria-label":t(`send`),disabled:te||e.sessionSwitching||e.modelSelectionPending||e.thinkingPendingLevel!==null||!G||!e.selectedWorkspace||e.promptAdmissionPending||y||e.planSelectionPending||!!e.promptAdmissionRecovery||!!e.promptAdmissionResolution||!p.trim()&&m.length===0&&h.length===0,children:(0,K.jsx)(k,{})})})]})]}),(0,K.jsx)(`div`,{className:`composer-hint`,"data-visible":kt,"aria-live":`polite`,children:G?Dt:null})]}),(0,K.jsx)(JM,{open:M,sessionId:Ce?n?.id:void 0,onClose:()=>N(!1),onInsert:$e})]})}function zN({target:e,onClose:t,onOpenProviders:n}){let{t:r}=cr(),i=(0,_.useMemo)(()=>new rf,[]),[a,o]=(0,_.useState)(0),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(null),p=e=>{f(null),wd(e).then(e=>f(e?`copied`:`failed`))};(0,_.useEffect)(()=>{let t=new AbortController;return c(null),u(null),f(null),(async()=>{let n={errors:[]};if(e.terminalId)try{let a=await i.terminalDetail(e.sessionId,e.terminalId,t.signal);if(a.sessionId!==e.sessionId||a.detail.id!==e.terminalId)throw Error(r(`inspectionChanged`));n.terminal=a.detail}catch(e){n.errors.push(e instanceof Error?e.message:r(`inspectionUnavailable`))}else{let[a,o]=await Promise.allSettled([i.thinking(e.sessionId,t.signal),i.trust(e.sessionId,t.signal)]);a.status===`fulfilled`&&a.value.sessionId===e.sessionId?n.thinking=a.value:n.errors.push(r(`thinkingUnavailable`)),o.status===`fulfilled`&&(o.value.workspace===void 0||o.value.workspace===e.cwd)?n.trust=o.value:n.errors.push(r(`trustUnavailable`))}t.signal.aborted||(c(n),u(new Date().toLocaleTimeString()))})(),()=>t.abort()},[i,e,a,r]);let m=e.terminalId?r(`terminalDetails`):r(`runtimeStatus`),h=s?.terminal;return(0,K.jsx)($j,{isOpen:!0,onOpenChange:e=>!e&&t(),width:640,"aria-label":m,children:(0,K.jsxs)(`section`,{className:`inspection-panel`,children:[(0,K.jsxs)(`header`,{className:`inspection-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:m}),(0,K.jsx)(`p`,{className:`inspection-subtitle`,children:e.cwd})]}),(0,K.jsxs)(`div`,{className:`inspection-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":r(`refreshStatus`),disabled:!s,onClick:()=>o(e=>e+1),children:(0,K.jsx)(dt,{})}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":r(`close`),onClick:t,children:(0,K.jsx)(Lt,{})})]})]}),d&&(0,K.jsx)(`p`,{role:`status`,children:r(d===`copied`?`copiedMessage`:`copyFailed`)}),s?(0,K.jsxs)(K.Fragment,{children:[s.errors.map(e=>(0,K.jsx)(`p`,{className:`inspection-warning`,role:`alert`,children:e},e)),h?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`inspection-section`,children:[(0,K.jsx)(`h3`,{children:h.title||h.id}),(0,K.jsxs)(`dl`,{children:[(0,K.jsx)(`dt`,{children:r(`executionState`)}),(0,K.jsx)(`dd`,{children:r(`execution_${h.status}`,{defaultValue:h.status})}),(0,K.jsx)(`dt`,{children:r(`terminalCommand`)}),(0,K.jsxs)(`dd`,{children:[(0,K.jsx)(`code`,{children:h.command}),(0,K.jsx)(`button`,{type:`button`,className:`inspection-copy`,"aria-label":r(`copyTerminalCommand`),title:r(`copyTerminalCommand`),onClick:()=>p(h.command),children:(0,K.jsx)(oe,{"aria-hidden":`true`})})]}),(0,K.jsx)(`dt`,{children:r(`terminalDirectory`)}),(0,K.jsx)(`dd`,{children:h.cwd}),(0,K.jsx)(`dt`,{children:r(`startedAt`)}),(0,K.jsx)(`dd`,{children:new Date(h.createdAt).toLocaleString()}),h.status!==`running`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{children:r(`exitCode`)}),(0,K.jsx)(`dd`,{children:h.exitCode??r(`unknownState`)})]})]}),h.errorText&&(0,K.jsx)(`p`,{className:`inspection-warning`,children:h.errorText}),h.truncated&&(0,K.jsx)(`p`,{className:`inspection-note`,children:r(`detailTruncated`)})]}),[`stdout`,`stderr`].map(e=>(0,K.jsxs)(`section`,{className:`inspection-section`,children:[(0,K.jsxs)(`div`,{className:`inspection-stream-heading`,children:[(0,K.jsx)(`h3`,{children:r(e===`stdout`?`standardOutput`:`standardError`)}),(0,K.jsx)(`button`,{type:`button`,className:`inspection-copy`,disabled:!h[e].text,"aria-label":r(`copyVisibleOutput`,{stream:r(e===`stdout`?`standardOutput`:`standardError`)}),title:r(`copyVisibleOutput`,{stream:r(e===`stdout`?`standardOutput`:`standardError`)}),onClick:()=>p(h[e].text),children:(0,K.jsx)(oe,{"aria-hidden":`true`})})]}),(0,K.jsx)(`section`,{className:`terminal-evidence`,tabIndex:0,"aria-label":r(e===`stdout`?`standardOutput`:`standardError`),children:(0,K.jsx)(`pre`,{children:h[e].text||r(`noOutput`)})}),h[e].truncated&&(0,K.jsx)(`p`,{className:`inspection-note`,children:r(`outputTruncated`,{count:h[e].omittedBytes})}),h[e].recoveryAvailable&&(0,K.jsx)(`p`,{className:`inspection-note`,children:r(`outputRecovery`)})]},e))]}):!e.terminalId&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{className:`inspection-section`,children:[(0,K.jsx)(`h3`,{children:r(`modelAndThinking`)}),(0,K.jsxs)(`dl`,{children:[(0,K.jsx)(`dt`,{children:r(`selectedModel`)}),(0,K.jsx)(`dd`,{children:e.model||r(`noModels`)}),(0,K.jsx)(`dt`,{children:r(`thinkingLevel`)}),(0,K.jsx)(`dd`,{children:s.thinking?.supported===!1?r(`thinkingUnsupported`):s.thinking?.level??r(`unknownState`)}),!!s.thinking?.available.length&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{children:r(`availableThinking`)}),(0,K.jsx)(`dd`,{children:s.thinking?.available.join(` · `)})]})]}),s.thinking?.supported===!1&&(0,K.jsx)(`p`,{className:`inspection-note`,children:r(`thinkingUnsupportedHint`)}),s.thinking&&s.thinking.supported!==!1&&!s.thinking.available.includes(s.thinking.level)&&(0,K.jsx)(`p`,{className:`inspection-warning`,role:`status`,children:r(`thinkingLevelMismatch`)})]}),(0,K.jsxs)(`section`,{className:`inspection-section`,children:[(0,K.jsx)(`h3`,{children:r(`projectTrust`)}),(0,K.jsx)(`p`,{children:r(`trust_${s.trust?.state??`unknown`}`)}),(0,K.jsxs)(`dl`,{children:[(0,K.jsx)(`dt`,{children:r(`savedTrustDecision`)}),(0,K.jsx)(`dd`,{children:r(`trustDecision_${s.trust?.decision??`unknown`}`)}),(0,K.jsx)(`dt`,{children:r(`activeSessionTrust`)}),(0,K.jsx)(`dd`,{children:s.trust?.sessionTrusted===!0?r(`trustActiveYes`):s.trust?.sessionTrusted===!1?r(`trustActiveNo`):r(`unknownState`)})]}),s.trust?.refreshRequired===!0&&(0,K.jsx)(`p`,{className:`inspection-warning`,children:r(`trustRefreshNeeded`)})]}),n&&(0,K.jsxs)(`button`,{type:`button`,className:`inspection-provider-link`,"aria-label":r(`openProviderSettings`),onClick:n,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:r(`providerAvailability`)}),(0,K.jsx)(`small`,{children:r(`authNotVerified`)})]}),r(`openProviderSettings`)]}),(0,K.jsxs)(`div`,{className:`inspection-setup`,children:[(0,K.jsx)(`p`,{className:`inspection-note`,children:r(`configurationViaPi`)}),(0,K.jsx)(`code`,{children:`/openpi-setup`}),(0,K.jsx)(`button`,{type:`button`,className:`inspection-copy`,"aria-label":r(`copySetupCommand`),title:r(`copySetupCommand`),onClick:()=>p(`/openpi-setup`),children:(0,K.jsx)(oe,{"aria-hidden":`true`})})]})]}),(0,K.jsx)(`p`,{className:`inspection-updated`,children:r(`statusCaptured`,{time:l})})]}):(0,K.jsx)(`p`,{role:`status`,children:r(`inspectionLoading`)})]})})}var BN=32,VN=1048576;function HN(e){return e.drafts.reduce((e,t)=>e+Od(t.custom)+Object.values(t.notes).reduce((e,t)=>e+Od(t),0),0)}function UN(e,t,n){if(!(n.submission||n.drafts.some(e=>e.choice!==null||e.custom||Object.values(e.notes).some(Boolean))))return e.delete(t),!0;let r=e.get(t);if(!r&&e.size>=BN)return!1;let i=r?HN(r):0,a=HN(n),o=Array.from(e.values()).reduce((e,t)=>e+HN(t),0);return a>i&&o-i+a>VN?!1:(e.set(t,n),!0)}function WN(e,t,n,r){for(let[i,a]of e)a.sessionId===t&&a.sessionPath===n&&a.requestId!==r&&e.delete(i)}function GN({request:e,answer:t,onSettled:n,connected:r=!0,sessionPath:i=``,workingCache:a}){let{t:o}=cr(),s=(0,_.useId)(),c=(0,_.useMemo)(()=>new Map,[]),l=a??c,u=JSON.stringify([e.sessionId,i,e.requestId]),[d,f]=(0,_.useState)(()=>l.get(u)??{sessionId:e.sessionId,sessionPath:i,requestId:e.requestId,drafts:e.questions.map(()=>({choice:null,custom:``,notes:{}})),index:0,review:!1,submission:null}),p=(0,_.useRef)(d),{drafts:m,index:h,review:g,submission:v}=d,[y,b]=(0,_.useState)(!!d.submission),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(!1),D=(0,_.useRef)(!1),O=!!v,k=(0,_.useRef)(null),A=(0,_.useRef)(null),j=e.questions[h],M=m[h],N=C||O||!r,P=m.some(e=>e.choice===`custom`?!kd(e.custom):typeof e.choice==`number`&&!kd(e.notes[e.choice]??``)),F=m.every(e=>e.choice!==null)&&!P,L=(t,n)=>e.handoff?o(n===0?`handoffDone`:`handoffUnable`):t;(0,_.useEffect)(()=>()=>k.current?.abort(),[]);let R=e=>UN(l,u,e)?(p.current=e,f(e),S(!1),!0):(S(!0),!1),ee=(e,t=!1)=>{R({...p.current,index:e,review:t}),requestAnimationFrame(()=>A.current?.focus())},z=e=>{let t=p.current;R({...t,drafts:t.drafts.map((n,r)=>r===t.index?{...n,...e}:n)})},B=()=>e.questions.map((e,t)=>{let n=m[t];if(n.choice===`custom`)return n.custom.trim()?{id:e.id,custom:n.custom}:{id:e.id,rephrase:!0};let r=typeof n.choice==`number`?e.options[n.choice]?.label:void 0;return{id:e.id,selected:r,...typeof n.choice==`number`&&n.notes[n.choice]?.trim()?{note:n.notes[n.choice]}:{}}}),V=async(i=!1)=>{if(D.current||!r||!i&&!O&&!F)return;let a=p.current.submission??{answers:i?null:B()};if(!R({...p.current,submission:a}))return;D.current=!0,w(!0),b(!1);let o=new AbortController;k.current=o;try{let r=await t(e,a.answers,o.signal);o.signal.aborted||(l.delete(u),n(r))}catch{o.signal.aborted||b(!0)}finally{o.signal.aborted||(D.current=!1,w(!1))}};return(0,K.jsxs)(`section`,{className:`question-card`,"aria-labelledby":`${s}-title`,"aria-busy":C,children:[(0,K.jsxs)(`header`,{className:`question-card-header`,children:[(0,K.jsxs)(`span`,{className:`question-eyebrow`,children:[(0,K.jsx)(Je,{"aria-hidden":`true`}),o(e.handoff?`handoffWaiting`:`questionWaiting`)]}),(0,K.jsx)(`span`,{className:`question-count`,children:g?o(e.handoff?`handoffReview`:`questionReview`):o(`questionProgress`,{current:h+1,total:e.questions.length})}),(0,K.jsx)(`button`,{type:`button`,className:`question-icon`,"aria-label":o(`questionDismiss`),title:o(`questionDismiss`),disabled:N,onClick:()=>void V(!0),children:(0,K.jsx)(Lt,{})})]}),(0,K.jsxs)(`div`,{className:`question-card-body`,children:[(0,K.jsx)(`h2`,{id:`${s}-title`,ref:A,tabIndex:-1,children:g?o(`questionReviewTitle`):j.question}),e.handoff&&(0,K.jsxs)(`div`,{className:`handoff-instructions`,children:[(0,K.jsx)(`p`,{children:e.handoff.instructions}),(0,K.jsxs)(`p`,{className:`question-help`,children:[o(`handoffSignal`),` `,e.handoff.completionSignal]}),(0,K.jsx)(`p`,{className:`question-help`,children:o(`handoffVerify`)})]}),g?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`question-help`,children:o(`questionReviewHelp`)}),(0,K.jsx)(`ol`,{className:`question-review-list`,children:e.questions.map((e,t)=>{let n=m[t];return(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`question-review-label`,children:e.header}),(0,K.jsx)(`p`,{children:typeof n.choice==`number`?L(e.options[n.choice]?.label,n.choice):n.custom.trim()||o(`questionRephrase`)}),typeof n.choice==`number`&&n.notes[n.choice]?.trim()&&(0,K.jsx)(`p`,{className:`question-help`,children:n.notes[n.choice]})]}),(0,K.jsx)(`button`,{type:`button`,className:`question-icon`,"aria-label":o(`questionEdit`,{question:e.header}),disabled:N,onClick:()=>ee(t),children:(0,K.jsx)(at,{})})]},e.id)})})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`fieldset`,{disabled:N,className:`question-choices`,children:[(0,K.jsx)(`legend`,{className:`sr-only`,children:j.header}),j.options.map((t,n)=>(0,K.jsxs)(`label`,{className:`question-choice ${M.choice===n?`is-selected`:``}`,children:[(0,K.jsx)(`input`,{className:`question-radio`,type:`radio`,name:`${s}-${j.id}`,checked:M.choice===n,onChange:()=>z({choice:n})}),(0,K.jsx)(`span`,{className:`question-choice-number`,"aria-hidden":`true`,children:n+1}),(0,K.jsxs)(`span`,{className:`question-choice-copy`,children:[(0,K.jsx)(`strong`,{children:L(t.label,n)}),(0,K.jsx)(`span`,{children:e.handoff?o(n===0?`handoffDoneHelp`:`handoffUnableHelp`):t.description})]})]},t.label))]}),typeof M.choice==`number`&&(0,K.jsxs)(`div`,{className:`question-extras`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`question-note-toggle`,disabled:N,"aria-expanded":!!M.notesExpanded,"aria-controls":M.notesExpanded?`${s}-notes`:void 0,onClick:()=>z({notesExpanded:!M.notesExpanded}),children:[(0,K.jsx)(at,{"aria-hidden":`true`}),o(`questionNotes`)]}),typeof M.choice==`number`&&j.options[M.choice]?.preview&&(0,K.jsxs)(`details`,{className:`question-preview-disclosure`,children:[(0,K.jsx)(`summary`,{children:o(`questionPreview`)}),(0,K.jsx)(`pre`,{className:`question-preview`,children:j.options[M.choice].preview})]},`${j.id}-${M.choice}`)]}),(M.choice===`custom`||typeof M.choice==`number`&&M.notesExpanded)&&(0,K.jsxs)(`label`,{className:`question-notes`,id:`${s}-notes`,children:[(0,K.jsx)(`span`,{className:`sr-only`,id:`${s}-answer-label`,children:M.choice===`custom`?o(`questionYourAnswer`):o(`questionNotes`)}),(0,K.jsx)(`textarea`,{rows:1,disabled:N,value:M.choice===`custom`?M.custom:M.notes[M.choice]??``,onChange:e=>M.choice===`custom`?z({custom:e.target.value}):typeof M.choice==`number`&&z({notes:{...M.notes,[M.choice]:e.target.value}}),"aria-invalid":P,"aria-labelledby":`${s}-answer-label`,"aria-describedby":[P?`${s}-limit`:``,M.choice===`custom`?`${s}-custom-help`:``].filter(Boolean).join(` `)||void 0,placeholder:M.choice===`custom`?o(`questionCustomPlaceholder`):o(`questionNotesPlaceholder`)}),M.choice===`custom`&&(0,K.jsx)(`span`,{className:`question-help`,id:`${s}-custom-help`,children:o(`questionCustomHelp`)})]})]}),P&&(0,K.jsx)(`p`,{className:`question-error`,id:`${s}-limit`,role:`alert`,children:o(`questionLimit`,{count:8e3})}),x&&(0,K.jsx)(`p`,{className:`question-error`,role:`alert`,children:o(`questionDraftLimit`)}),!r&&(0,K.jsx)(`p`,{className:`question-help`,role:`status`,children:o(`questionDisconnected`)}),y&&(0,K.jsx)(`p`,{className:`question-error`,role:`alert`,children:o(`questionUncertain`)})]}),(0,K.jsxs)(`footer`,{className:`question-card-footer`,children:[!g&&!e.handoff&&(0,K.jsxs)(`label`,{className:`question-custom ${M.choice===`custom`?`is-selected`:``} ${N?`is-disabled`:``}`,children:[(0,K.jsx)(`input`,{className:`question-radio`,type:`radio`,name:`${s}-${j.id}`,checked:M.choice===`custom`,disabled:N,onChange:()=>z({choice:`custom`})}),(0,K.jsx)(`span`,{className:`question-choice-number`,"aria-hidden":`true`,children:(0,K.jsx)(at,{})}),(0,K.jsx)(`span`,{children:o(`questionCustom`)})]}),(0,K.jsxs)(`div`,{className:`question-actions`,children:[(g||h>0)&&(0,K.jsxs)(`button`,{type:`button`,className:`question-secondary`,disabled:N||!g&&h===0,onClick:()=>ee(g?e.questions.length-1:h-1),children:[(0,K.jsx)(T,{}),o(`questionBack`)]}),!O&&(0,K.jsx)(`button`,{type:`button`,className:`question-secondary question-skip`,disabled:N,title:o(`questionDismiss`),onClick:()=>void V(!0),children:o(`questionSkip`)}),O?(0,K.jsxs)(`button`,{type:`button`,className:`question-primary`,disabled:C||!r,onClick:()=>void V(),children:[(0,K.jsx)(ft,{}),o(C?`questionSubmitting`:`questionRetry`)]}):g?(0,K.jsxs)(`button`,{type:`button`,className:`question-primary`,disabled:N||!F,onClick:()=>void V(),children:[(0,K.jsx)(I,{}),o(e.handoff?`handoffSubmit`:`questionSubmit`)]}):(0,K.jsxs)(`button`,{type:`button`,className:`question-primary`,disabled:N||M.choice===null||P,onClick:()=>ee(hnew rf,[]),s=(0,_.useMemo)(()=>new Map,[]),c=i??s,[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(0),v=(0,_.useRef)(null),y=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=new AbortController;return o.pendingQuestions(e,t.signal).then(({pending:n})=>{if(t.signal.aborted)return;let i=n?.requestId===v.current?null:n;y.current=i?.requestId??null,m(!1),WN(c,e,r,n?.requestId),u(i),n&&n.requestId!==v.current&&f(null)},()=>{t.signal.aborted||m(!0)}),()=>t.abort()},[o,e,r,c,t,h]),!l&&!d&&!p?null:(0,K.jsx)(`div`,{className:`question-panel`,children:l?(0,K.jsx)(GN,{request:l,connected:n,sessionPath:r,workingCache:c,answer:(e,t,n)=>o.answerQuestions(e,t,n),onSettled:e=>{y.current===l.requestId&&(y.current=null,v.current=l.requestId,u(null),f(e.state===`answered`?null:e),g(e=>e+1))}},l.requestId):d?(0,K.jsxs)(`div`,{className:`question-receipt`,role:`status`,children:[(0,K.jsx)(I,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:a(`questionState_${d.state}`)}),(0,K.jsx)(`button`,{type:`button`,className:`question-icon`,"aria-label":a(`questionCloseReceipt`),onClick:()=>f(null),children:(0,K.jsx)(Lt,{})})]}):(0,K.jsxs)(`div`,{className:`question-receipt`,role:`alert`,children:[(0,K.jsx)(`span`,{children:a(`questionLoadFailed`)}),(0,K.jsx)(`button`,{type:`button`,className:`question-secondary`,onClick:()=>g(e=>e+1),children:a(`questionRetryLoad`)})]})})}function qN(e,t,{active:n=!0,running:r=!1,initialSource:i=`unstaged`,initialBaseRef:a}={}){let{t:o}=cr(),s=(0,_.useMemo)(()=>new rf,[]),c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(!1),d=(0,_.useRef)({active:n,running:r});d.current={active:n,running:r};let[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(null),y=e?.id,b=e?.path,[x,S]=(0,_.useState)({sessionId:y,sessionPath:b,source:i,baseRef:a}),C=x.sessionId===y&&x.sessionPath===b?x.source:i,w=x.sessionId===y&&x.sessionPath===b?x.baseRef:a,T=(0,_.useCallback)(e=>{S({sessionId:y,sessionPath:b,source:e,baseRef:w})},[y,b,w]),E=(0,_.useCallback)(e=>{S({sessionId:y,sessionPath:b,source:`branch`,baseRef:e})},[y,b]);(0,_.useLayoutEffect)(()=>{p(null),v(null),h(!!y)},[y,b,C,w]);let D=(0,_.useCallback)(async()=>{if(!y||!b||document.visibilityState===`hidden`)return;if(c.current){u.current=!0;return}let e=new AbortController;c.current=e,h(!0),v(null);try{let t=await s.gitReview(y,b,e.signal,{source:C,offset:`0`,...C===`branch`&&w?{baseRef:w}:{}});e.signal.aborted||(t.ok||v(o(t.reason===`not_git_repository`?`gitReviewNotRepository`:t.reason===`baseline_unavailable`?`gitReviewBaselineUnavailable`:t.reason===`base_branch_unavailable`?`gitReviewBaseUnavailable`:t.reason===`invalid_base_branch`?`gitReviewBaseInvalid`:`gitReviewFailed`)),p(e=>!t.ok&&e?.ok?t.branches?{...e,branches:t.branches}:e:t.ok&&e?.ok&&t.snapshot.revision===e.snapshot.revision?JSON.stringify(t.branches)===JSON.stringify(e.branches)?e:{...e,branches:t.branches}:t))}catch(t){e.signal.aborted||v(t instanceof Error?t.message:`Git review unavailable`)}finally{if(!e.signal.aborted&&(c.current=null,h(!1),u.current)){u.current=!1;let e=d.current;(e.active||!e.running)&&l.current===null&&(l.current=window.setTimeout(()=>{l.current=null,D()},e.active?200:2e3))}}},[s,y,b,C,w,o]),O=(0,_.useCallback)(async()=>{if(!y||!b||!f?.ok||f.snapshot.nextOffset===void 0||c.current)return;let e=f.snapshot,t=new AbortController;c.current=t,h(!0),v(null);try{let n=await s.gitReview(y,b,t.signal,{source:C,offset:String(e.nextOffset),revision:e.revision,...C===`branch`&&w?{baseRef:w}:{}});if(t.signal.aborted)return;if(!n.ok||n.snapshot.revision!==e.revision)throw Error(o(!n.ok&&n.reason===`revision_changed`?`gitReviewChanged`:`gitReviewFailed`));p({...n,snapshot:{...n.snapshot,files:[...e.files,...n.snapshot.files],additions:e.additions+n.snapshot.additions,deletions:e.deletions+n.snapshot.deletions}})}catch(e){t.signal.aborted||v(e instanceof Error?e.message:o(`gitReviewFailed`))}finally{t.signal.aborted||(c.current=null,h(!1))}},[s,y,b,C,w,f,o]),k=(0,_.useCallback)(async(e,t,n)=>{if(!y||!b)return;let r=await s.gitReview(y,b,t,{source:C,file:e,revision:n,...C===`branch`&&w?{baseRef:w}:{}});if(!r.ok||r.summaryRevision!==n)throw(r.ok||r.reason===`revision_changed`)&&!t.aborted&&D(),Error(o(!r.ok&&r.reason!==`revision_changed`?`gitReviewFailed`:`gitReviewChanged`));return r.snapshot.files.find(t=>t.path===e)},[s,y,b,C,w,D,o]);return(0,_.useEffect)(()=>{if(y)return l.current=window.setTimeout(()=>{l.current=null,D()},200),()=>{l.current!==null&&window.clearTimeout(l.current),l.current=null,u.current=!1,c.current?.abort(),c.current=null}},[D,y]),(0,_.useEffect)(()=>{n&&l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[n]),(0,_.useEffect)(()=>{if(!n&&r){l.current!==null&&window.clearTimeout(l.current),l.current=null,u.current=!1;return}!y||l.current!==null||(l.current=window.setTimeout(()=>{l.current=null,D()},n?200:2e3))},[D,t,n,r,y]),(0,_.useEffect)(()=>{if(!y)return;let e=()=>{let e=d.current;(e.active||!e.running)&&D()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}},[D,y]),(0,_.useMemo)(()=>({result:f,loading:m,error:g,refresh:D,source:C,setSource:T,baseRef:w,setBaseRef:E,readFile:k,loadMore:O}),[f,m,g,D,C,T,w,E,k,O])}function JN({notice:e,actions:t}){let{t:n}=cr(),r=(0,_.useRef)(!1),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=()=>t.dismissArchiveNotice(e.key),l=async n=>{if(!r.current){r.current=!0,a(n),s(!1);try{(n===`undo`?await t.unarchiveSession(e.path):await t.selectSession(e.path,e.sessionId))===!1?s(!0):c()}catch{s(!0)}finally{r.current=!1,a(null)}}};return(0,K.jsx)(`div`,{className:`archive-notification`,"data-session-path":e.path,children:(0,K.jsx)(Zu,{type:`info`,body:n(`archiveNoticeTitle`),isAutoHide:!i&&!o,autoHideDuration:8e3,onDismiss:c,renderContent:()=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(C,{className:`archive-notification-icon`,"aria-hidden":`true`}),(0,K.jsxs)(`div`,{className:`archive-notification-copy`,children:[(0,K.jsx)(`strong`,{children:n(`archiveNoticeTitle`)}),(0,K.jsx)(`span`,{title:e.title,children:e.title}),o&&(0,K.jsx)(`span`,{className:`archive-notification-error`,role:`alert`,children:n(`archiveNoticeFailed`)})]}),(0,K.jsx)(`button`,{type:`button`,disabled:i!==null,onClick:()=>void l(`view`),children:n(`archiveNoticeView`)}),(0,K.jsxs)(`button`,{type:`button`,className:`archive-notification-undo`,disabled:i!==null,onClick:()=>void l(`undo`),children:[i===`undo`&&(0,K.jsx)(He,{className:`archive-notification-spinner`,"aria-hidden":`true`}),n(`archiveNoticeUndo`)]}),(0,K.jsx)(`button`,{type:`button`,className:`archive-notification-close`,"aria-label":n(`close`),onClick:c,children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]})})})}function YN({notices:e,actions:t}){return e.length?(0,K.jsx)(`div`,{className:`archive-notifications`,children:e.map(e=>(0,K.jsx)(JN,{notice:e,actions:t},e.key))}):null}function XN(e){let t=e?.closest(`.session-row, .workspace-group`),n=e?.closest(`.session-sidebar`),r=t?.dataset.sessionKey,i=Array.from(n?.querySelectorAll(`.session, .workspace-label, .workspace-heading-label`)??[]),a=i.findIndex(e=>t?.contains(e)),o=a<0?i:[...i.slice(a+1),...i.slice(0,a).reverse()];return()=>requestAnimationFrame(()=>{!n?.isConnected||document.querySelector(`dialog[open]`)||[e,r==null?null:Array.from(n.querySelectorAll(`.session-row`)).find(e=>e.dataset.sessionKey===r)?.querySelector(`.menu-action-button`),...o,n.querySelector(`.new-session-button`)].find(e=>e?.isConnected&&!e.closest(`[hidden], [inert]`)&&e.checkVisibility?.()!==!1)?.focus({preventScroll:!0})})}function ZN({session:e,archived:t,connected:n,pinSaving:r,restoring:i,movementItems:a,client:o,actions:s,onRename:c,onPin:l,onRead:u,onArchive:d,onNotice:f}){let{t:p}=cr(),m=(0,_.useRef)(null),h=(0,_.useRef)(!0),g=(0,_.useRef)(0),v=(0,_.useRef)(!1),[y,b]=(0,_.useState)(!1),[x,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(!1),[D,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(null),[M,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(null),[I,L]=(0,_.useState)(!1),[R,ee]=(0,_.useState)(!1),z=e.execution?.status===`running`||e.execution?.waitingForInput,B=(e.execution?.pendingFollowUps??0)+(e.execution?.pendingSteering??0)>0,V=n?z||B?p(`sidebarActionRunning`):void 0:p(`sidebarActionDisconnected`),H=t?p(`sidebarForkArchived`):n?A?.local===!1?p(`sidebarForkUnavailable`):void 0:p(`sidebarActionDisconnected`),te=P!==null&&(P.path!==e.path||P.id!==e.id),ne=e.pinOrder!==void 0,re=()=>XN(m.current?.querySelector(`button`)??null),ie=()=>{let t=new URL(`/`,window.location.origin);return t.searchParams.set(`sessionPath`,e.path),t.searchParams.set(`sessionId`,e.id),t.href};(0,_.useEffect)(()=>(h.current=!0,()=>{h.current=!1,g.current++}),[]);let ae=(0,_.useRef)({id:e.id,path:e.path});(0,_.useEffect)(()=>{(ae.current.id!==e.id||ae.current.path!==e.path)&&(ae.current={id:e.id,path:e.path},b(!1),w(null),j(null))},[e.id,e.path]),(0,_.useEffect)(()=>{if(!y||!e.cwd||!n)return;let t=++g.current;return w(null),E(!1),o.sessionOpenTargets(e.path,e.id).then(e=>{h.current&&g.current===t&&w(e.targets)}).catch(()=>{h.current&&g.current===t&&E(!0)}),()=>{g.current++}},[o,n,y,e.cwd,e.id,e.path]),(0,_.useEffect)(()=>{if(!y||t||!n)return;let r=!1;return j(null),N(!1),Promise.resolve().then(()=>o.sessionForkOptions(e.path,e.id)).then(e=>{r||j(e)}).catch(()=>{r||N(!0)}),()=>{r=!0}},[t,o,n,y,e.id,e.path]);let U=()=>{b(!1),queueMicrotask(c)},oe=()=>{let e=re();l().then(e,e)},se=()=>{let e=re();d().then(e,e)},ce=async t=>{try{let n=await wd(t===`link`?ie():t===`cwd`?e.cwd:(await o.sessionMarkdown(e.path,e.id)).markdown);f(p(n?`sidebarCopied`:`sidebarCopyFailed`),!n)}catch{f(p(`sidebarCopyFailed`),!0)}},le=async(t=`local`)=>{if(!(D||H)&&!(t===`worktree`&&!A?.worktree)){k(!0);try{t===`worktree`?await s.forkConversation(e.path,e.id,t):await s.forkConversation(e.path,e.id)}catch{f(p(`sidebarForkFailed`),!0)}finally{h.current&&k(!1)}}},de=()=>{if(v.current)return;let e=P?.restoreFocus;F(null),e?.()},fe=async()=>{if(!(!P||v.current||V||te)){v.current=!0,L(!0),ee(!1);try{await s.deleteSession(P.path,P.id,P.commandId)?(h.current&&F(null),P.restoreFocus()):h.current&&ee(!0)}catch{h.current&&ee(!0)}finally{v.current=!1,h.current&&L(!1)}}},pe=[{id:`rename`,label:p(`sidebarRename`),icon:(0,K.jsx)(at,{}),isDisabled:!n,onClick:U},...t?[]:[{id:`pin`,label:p(ne?`sidebarUnpin`:`sidebarPin`),icon:ne?(0,K.jsx)(ot,{}):(0,K.jsx)(st,{}),isDisabled:r||!n,onClick:oe},{id:`read`,label:p(e.unread?`markConversationRead`:`markConversationUnread`),icon:(0,K.jsx)(_e,{}),isDisabled:!e.readRevision||!n,onClick:()=>void u()}],...a.length?[{type:`divider`},...a]:[],...t?[]:[{type:`divider`},{id:`fork`,label:H?(0,K.jsxs)(`span`,{className:`sidebar-menu-unavailable`,children:[(0,K.jsx)(`span`,{children:p(`sidebarFork`)}),(0,K.jsx)(`small`,{children:H})]}):p(`sidebarFork`),icon:(0,K.jsx)(Ae,{}),isDisabled:!!H||D,items:[{id:`fork-local`,label:p(D?`forkSessionPending`:e.worktree?`sidebarForkSameWorktree`:`sidebarForkLocal`),icon:(0,K.jsx)(et,{}),onClick:()=>void le()},...A?.worktree?[{id:`fork-worktree`,label:p(`sidebarForkWorktree`),icon:(0,K.jsx)(jt,{className:`sidebar-worktree-icon`}),onClick:()=>void le(`worktree`)}]:A===null?[{id:`fork-worktree-loading`,label:p(M?`sidebarForkOptionsFailed`:`sidebarForkOptionsLoading`),isDisabled:!0}]:[]]}],{type:`divider`},{id:`copy`,label:p(`sidebarCopy`),icon:(0,K.jsx)(ue,{}),items:[{id:`copy-link`,label:p(`sidebarCopyLink`),onClick:()=>void ce(`link`)},{id:`copy-markdown`,label:p(`sidebarCopyMarkdown`),isDisabled:!n,onClick:()=>void ce(`markdown`)},{id:`copy-cwd`,label:p(`sidebarCopyCwd`),isDisabled:!e.cwd,onClick:()=>void ce(`cwd`)}]},{type:`divider`},{id:`new-window`,label:p(`sidebarNewWindow`),icon:(0,K.jsx)(Ct,{}),onClick:()=>{window.open(ie(),`_blank`,`noopener,noreferrer`)}},...e.cwd&&n&&(x==null||x.length>0)?[{id:`open-in`,label:p(`sidebarOpenIn`),icon:(0,K.jsx)(O,{}),items:x?.map(t=>({id:t.id,label:t.label,onClick:()=>{o.openSessionIn(e.path,e.id,t.id).catch(()=>f(p(`sidebarOpenFailed`),!0))}}))??[{id:`open-in-loading`,label:p(T?`sidebarAppsFailed`:`sidebarAppsLoading`),isDisabled:!0}]}]:[],{type:`divider`},{id:t?`restore`:`archive`,label:p(i?`restoringConversation`:t?`sidebarRestore`:`sidebarArchive`),icon:t?(0,K.jsx)(S,{}):(0,K.jsx)(C,{}),isDisabled:i||!!V,description:V,onClick:se},{id:`delete`,label:p(`sidebarDelete`),icon:(0,K.jsx)(kt,{}),isDisabled:!!V,description:V,onClick:()=>{let t=re();queueMicrotask(()=>{h.current&&(ee(!1),F({commandId:crypto.randomUUID(),path:e.path,id:e.id,name:ZA(e,p(`untitledSession`)),restoreFocus:t}))})}}];return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`astryx-menu-trigger`,ref:m,children:(0,K.jsx)(jA,{className:`sidebar-action-menu sidebar-conversation-menu`,button:{label:p(`conversationOptions`),icon:(0,K.jsx)(W,{}),isIconOnly:!0,size:`sm`,variant:`ghost`,className:`menu-action-button`},items:y?pe:[],menuWidth:248,placement:`below`,alignment:`start`,hasChevron:!1,isMenuOpen:y,onOpenChange:b})}),P&&(0,K.jsx)($j,{isOpen:P!==null,onOpenChange:e=>{e||de()},purpose:`form`,width:420,"aria-label":p(`sidebarDeleteTitle`),children:(0,K.jsxs)(`form`,{className:`openpi-dialog sidebar-delete-dialog`,onSubmit:e=>{e.preventDefault(),fe()},children:[(0,K.jsx)(`strong`,{children:p(`sidebarDeleteTitle`)}),(0,K.jsx)(`p`,{children:p(`sidebarDeleteDescription`,{name:P?.name})}),(R||te)&&(0,K.jsx)(`p`,{className:`sidebar-dialog-error`,role:`alert`,children:p(te?`sessionLinkUnavailable`:`sidebarDeleteFailed`)}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,"data-autofocus":!0,disabled:I,onClick:de,children:p(`cancel`)}),(0,K.jsx)(`button`,{type:`submit`,className:`danger`,disabled:I||!!V||te,children:p(I?`sidebarDeleting`:`sidebarDeleteConfirm`)})]})]})})]})}var QN=e=>JSON.stringify([`session`,e.id,e.path]),$N=e=>JSON.stringify([`message`,e.sessionId,e.sessionPath,e.messageId,e.source,e.lineOffset]);function eP({open:e,initialQuery:t,initialIncludeArchived:n,sessions:r,workspaces:i,onClose:a,onCreateSession:o,onOpenSession:s,onOpenMessage:c}){let{t:l}=cr(),u=(0,_.useMemo)(()=>new rf,[]),[d,f]=(0,_.useState)(t),p=n,[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(0),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(null),[D,O]=(0,_.useState)(null),k=(0,_.useRef)(null),A=(0,_.useId)(),j=(0,_.useRef)(null);(0,_.useEffect)(()=>(e&&(f(t),h(null),S(!1),w(null),E(null)),()=>{j.current?.abort(),j.current=null}),[e,t]);let M=d.trim(),N=(0,_.useMemo)(()=>new Map(i?.map(e=>[e.path,e.name])),[i]),P=(0,_.useMemo)(()=>{if(!e||!s)return[];let t=M.toLocaleLowerCase();return(r??[]).filter(e=>e.archived&&!p?!1:!t||`${ZA(e,l(`untitledSession`))} ${e.cwd} ${N.get(e.cwd)??``}`.toLocaleLowerCase().includes(t)).sort((e,t)=>t.modified.localeCompare(e.modified)||e.path.localeCompare(t.path))},[e,r,N,M,p,s,l]),F=M?[{name:`transcriptSearchSessions`,sessions:P.slice(0,9)}]:[{name:`pinnedConversations`,sessions:P.filter(e=>e.pinOrder!==void 0).sort((e,t)=>(e.pinOrder??0)-(t.pinOrder??0))},{name:`transcriptSearchRecent`,sessions:P.filter(e=>e.pinOrder===void 0).slice(0,10)}];(0,_.useLayoutEffect)(()=>{j.current?.abort(),j.current=null,E(null),w(null),O(null)},[e,M,p,y]),(0,_.useEffect)(()=>{if(!e||!M){v(!1),S(!1);return}let t=new AbortController;v(!0),S(!1);let n=window.setTimeout(()=>{u.searchTranscripts(M,{includeArchived:p,signal:t.signal}).then(e=>{t.signal.aborted||h({query:M,revision:y,includeArchived:p,response:e})}).catch(()=>{t.signal.aborted||S(!0)}).finally(()=>{t.signal.aborted||v(!1)})},250);return()=>{window.clearTimeout(n),t.abort()}},[u,e,M,p,y]);let I=m?.query===M&&m.revision===y&&m.includeArchived===p?m.response:null,L=[...F.flatMap(e=>e.sessions.map(QN)),...M?I?.matches.map($N)??[]:[]],R=D!==null&&L.includes(D)?D:L[0],ee=e=>`${A}-${encodeURIComponent(e)}`,z=R?ee(R):void 0;(0,_.useLayoutEffect)(()=>{e&&z&&document.getElementById(z)?.scrollIntoView?.({block:`nearest`})},[e,z]);let B=async(e,t,n)=>{if(j.current)return;O(e),k.current?.focus({preventScroll:!0});let r=new AbortController;j.current=r,E(e),w(null);try{let e=await t(r.signal);if(r.signal.aborted)return;e===!1?w(n):a()}catch{r.signal.aborted||w(n)}finally{j.current===r&&(j.current=null,E(null))}};return(0,K.jsx)($j,{isOpen:e,onOpenChange:e=>!e&&a(),purpose:`info`,width:`min(520px, 92vw)`,maxHeight:`calc(var(--transcript-search-list-height) + 64px)`,padding:0,className:`transcript-search-modal`,"aria-label":l(`transcriptSearch`),children:e&&(0,K.jsxs)(`div`,{className:`transcript-search-dialog`,children:[(0,K.jsx)(`h2`,{className:`transcript-search-sr-only`,children:l(`transcriptSearch`)}),(0,K.jsx)(`input`,{ref:k,className:`transcript-search-input`,"data-autofocus":!0,type:`search`,maxLength:200,value:d,"aria-label":l(`transcriptSearch`),"aria-autocomplete":`list`,"aria-controls":A,"aria-activedescendant":z,placeholder:l(`transcriptSearchPlaceholder`),autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>f(e.target.value),onKeyDown:e=>{if(e.nativeEvent.isComposing||e.nativeEvent.keyCode===229||![`ArrowDown`,`ArrowUp`,`Home`,`End`,`Enter`].includes(e.key)||T!==null)return;if(!R||!z){e.key===`Enter`&&!M&&o&&(e.preventDefault(),a(),o());return}e.preventDefault();let t=L.indexOf(R);if(e.key===`Enter`){document.getElementById(z)?.click();return}let n=e.key===`Home`?0:e.key===`End`?L.length-1:e.key===`ArrowDown`?Math.min(t+1,L.length-1):Math.max(t-1,0);O(L[n]??null)}}),(0,K.jsx)(`span`,{className:`transcript-search-sr-only`,role:`status`,children:g?l(`transcriptSearching`):null}),(0,K.jsxs)(`div`,{className:`transcript-search-groups`,children:[(0,K.jsx)(`div`,{id:A,role:`listbox`,"aria-label":l(`transcriptSearch`),children:F.filter(e=>e.sessions.length>0||M&&I?.matches.length).map(e=>(0,K.jsxs)(`fieldset`,{"aria-label":l(e.name),children:[(0,K.jsxs)(`h3`,{children:[l(e.name),g&&(0,K.jsx)(He,{className:`is-spinning`,"aria-hidden":`true`})]}),(0,K.jsxs)(`ul`,{className:`transcript-search-results`,role:`presentation`,children:[s&&e.sessions.map(e=>{let t=ZA(e,l(`untitledSession`)),n=QN(e),r=e.ungrouped?l(`ungrouped`):N.get(e.cwd)||QA(e.cwd);return(0,K.jsx)(`li`,{role:`presentation`,children:(0,K.jsxs)(`button`,{id:ee(n),role:`option`,"aria-selected":n===R,tabIndex:-1,type:`button`,disabled:T!==null,"aria-label":l(`transcriptSearchSessionResult`,{session:t}),onPointerMove:()=>O(n),onMouseDown:e=>e.preventDefault(),onClick:()=>void B(n,t=>s(e.path,t),`transcriptSearchSessionOpenFailed`),children:[(0,K.jsx)(`span`,{className:`transcript-search-accessory`,"aria-hidden":`true`,children:T===n?(0,K.jsx)(He,{className:`is-spinning`}):e.unread?(0,K.jsx)(ae,{className:`transcript-search-unread`}):null}),(0,K.jsx)(`span`,{className:`transcript-search-result-body`,children:(0,K.jsxs)(`span`,{className:`transcript-search-result-line`,children:[(0,K.jsx)(`span`,{className:`transcript-search-title`,title:t,children:t}),(0,K.jsx)(`span`,{className:`transcript-search-project`,title:e.cwd,children:r})]})})]})},n)}),M&&I?.matches.map(e=>{let t=e.sessionName||l(`untitledSession`),n=l(`transcriptSearchSource_${e.source}`),r=$N(e);return(0,K.jsx)(`li`,{role:`presentation`,children:(0,K.jsxs)(`button`,{id:ee(r),role:`option`,"aria-selected":r===R,tabIndex:-1,type:`button`,disabled:T!==null,"aria-label":l(`transcriptSearchResult`,{session:t,source:n}),onPointerMove:()=>O(r),onMouseDown:e=>e.preventDefault(),onClick:()=>void B(r,t=>c({sessionId:e.sessionId,sessionPath:e.sessionPath,entryId:e.messageId},t),`transcriptSearchOpenFailed`),children:[(0,K.jsx)(`span`,{className:`transcript-search-accessory`,"aria-hidden":`true`,children:T===r&&(0,K.jsx)(He,{className:`is-spinning`})}),(0,K.jsxs)(`span`,{className:`transcript-search-result-body`,children:[(0,K.jsxs)(`span`,{className:`transcript-search-result-line`,children:[(0,K.jsx)(`span`,{className:`transcript-search-title`,title:t,children:t}),(0,K.jsx)(`span`,{className:`transcript-search-project`,title:e.workspace??n,children:e.workspace?N.get(e.workspace)||QA(e.workspace):n})]}),(0,K.jsx)(`span`,{className:`transcript-search-snippet`,children:e.snippet})]})]})},r)})]})]},e.name))}),!M&&!P.length&&(0,K.jsxs)(`div`,{className:`transcript-search-empty-history`,children:[(0,K.jsx)(`p`,{children:l(`noConversations`)}),o&&(0,K.jsx)(`button`,{className:`transcript-search-create`,type:`button`,onClick:()=>{a(),o()},children:l(`newSession`)})]}),M&&!P.length&&!I?.matches.length&&(g?(0,K.jsx)(`div`,{className:`transcript-search-feedback`,"aria-hidden":`true`,children:(0,K.jsx)(He,{className:`is-spinning`})}):I&&!x?(0,K.jsx)(`div`,{className:`transcript-search-feedback`,role:`status`,children:l(`transcriptSearchEmpty`)}):null),x&&(0,K.jsxs)(`p`,{className:`transcript-search-error`,role:`alert`,children:[l(`transcriptSearchFailed`),(0,K.jsx)(`button`,{type:`button`,onClick:()=>b(e=>e+1),children:l(`transcriptSearchRetry`)})]}),C&&(0,K.jsx)(`p`,{className:`transcript-search-error`,role:`alert`,children:l(C)}),I?.partial&&(0,K.jsx)(`p`,{className:`transcript-search-partial`,children:l(`transcriptSearchPartial`)})]})]})})}function tP({workspace:e,client:t,actions:n,connected:r,onClose:i}){let{t:a}=cr(),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(0),[g,v]=(0,_.useState)(null),[y,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(!1),T=(0,_.useRef)(0),E=(0,_.useRef)(null),D=(0,_.useRef)(!1),O=(0,_.useRef)(!0),k=(0,_.useCallback)(async n=>{let r=++T.current;d(!0),p(null);try{let i=await t.workspaceWorktrees(e,n);if(!O.current||r!==T.current)return;if(i.truncated&&!i.nextCursor)throw Error(`Missing worktree continuation`);s(e=>{let t=n?[...e]:[];for(let e of i.worktrees)t.some(t=>t.worktreePath===e.worktreePath&&t.sessionId===e.sessionId&&t.sessionPath===e.sessionPath)||t.push(e);return t}),l(i.nextCursor),h(e=>(n?e:0)+i.unavailable)}catch(e){O.current&&r===T.current&&p(e instanceof tf&&e.code===`WORKTREE_LIST_CHANGED`?`changed`:`failed`)}finally{O.current&&r===T.current&&d(!1)}},[t,e]);(0,_.useEffect)(()=>(O.current=!0,k(),()=>{O.current=!1,T.current++}),[k]);let A=async()=>{if(!(!g||D.current||!r)){D.current=!0,w(!0);try{let e=await n.releaseSessionWorktree(g);if(!O.current)return;b(e),S(!1),e.state===`removed`&&s(e=>e.filter(e=>e.worktreePath!==g.worktreePath||e.sessionId!==g.sessionId||e.sessionPath!==g.sessionPath))}catch{O.current&&(S(!0),b(null))}finally{D.current=!1,O.current&&w(!1)}}};(0,_.useEffect)(()=>{g&&!C&&E.current?.focus()},[g,C]);let j=()=>{D.current||i()};return(0,K.jsx)($j,{isOpen:!0,onOpenChange:e=>{e||j()},purpose:`form`,width:560,"aria-label":a(`managedWorktrees`),children:(0,K.jsxs)(`div`,{className:`openpi-dialog`,children:[(0,K.jsx)(`strong`,{children:a(`managedWorktrees`)}),(0,K.jsx)(`p`,{className:`sidebar-dialog-path`,children:e}),(0,K.jsx)(`p`,{children:a(`managedWorktreesDescription`)}),g?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`sidebar-dialog-path`,children:g.worktreePath}),(0,K.jsx)(`p`,{children:a(`managedWorktreeConfirm`)}),(y||x)&&(0,K.jsxs)(`p`,{role:`status`,className:y?.state===`removed`?void 0:`sidebar-dialog-error`,children:[a(y?.state===`removed`?`managedWorktreeRemoved`:y?.state===`preserved`?`managedWorktreePreserved`:y?.state===`uncertain`?`managedWorktreeUncertainTerminal`:`managedWorktreeUncertain`),y?.reason&&(0,K.jsxs)(K.Fragment,{children:[` `,y.reason]})]}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,"data-autofocus":!0,ref:E,disabled:C,onClick:()=>{v(null),b(null),S(!1)},children:a(`managedWorktreesBack`)}),y?.state!==`removed`&&y?.state!==`uncertain`&&(0,K.jsx)(`button`,{type:`button`,className:`danger`,disabled:C||!r,onClick:()=>void A(),children:a(C?`managedWorktreeRemoving`:y||x?`managedWorktreesRetry`:`managedWorktreeRemove`)})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`managed-worktrees-list`,children:o.map(e=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`sidebar-dialog-path`,children:e.worktreePath}),(0,K.jsx)(`button`,{type:`button`,disabled:!r||u||!!f,onClick:()=>{v(e),b(null),S(!1)},children:a(`managedWorktreeReview`)})]},JSON.stringify([e.worktreePath,e.sessionId,e.sessionPath])))}),!u&&!f&&!o.length&&(0,K.jsx)(`p`,{children:a(`managedWorktreesEmpty`)}),m>0&&(0,K.jsx)(`p`,{children:a(`managedWorktreesUnavailable`,{count:m})}),f&&(0,K.jsx)(`p`,{role:`alert`,children:a(f===`changed`?`managedWorktreesChanged`:`managedWorktreesLoadFailed`)}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,"data-autofocus":!0,onClick:j,children:a(`close`)}),f&&(0,K.jsx)(`button`,{type:`button`,disabled:u||!r,onClick:()=>void k(f===`changed`?void 0:c),children:a(f===`changed`?`managedWorktreesRefresh`:`managedWorktreesRetry`)}),c&&!f&&(0,K.jsx)(`button`,{type:`button`,disabled:u||!r,onClick:()=>void k(c),children:a(`managedWorktreesMore`)}),u&&(0,K.jsx)(`span`,{role:`status`,children:a(`loading`)})]})]})]})})}function nP(e){return e.workspacePath??e.cwd}function rP(e,t,n){return e[t+(n?2:-1)]??null}function iP(e,t,n){return e[t+ +!!n]??null}function aP(e,t){return e>t.top+t.height/2}function oP(e){let t=e.execution?.lastTurn;return JSON.stringify(t?[e.path,e.id,t.commandId,t.finishedAt]:[e.path,e.id])}function sP(e){return e.firstUnread?.type===`turn`?e.firstUnread.finishedAt:e.execution?.lastTurn?.finishedAt??Date.parse(e.modified)}function cP(e){return JSON.stringify([e.path,e.id])}function lP(e,t=!0){return t&&e.execution?.waitingForInput?0:e.unread?1:t&&e.execution?.status===`running`?2:3}function uP({items:e,label:t,alignment:n=`start`}){return(0,K.jsx)(`span`,{className:`astryx-menu-trigger`,children:(0,K.jsx)(jA,{className:`sidebar-action-menu`,button:{label:t,icon:(0,K.jsx)(W,{}),isIconOnly:!0,size:`sm`,variant:`ghost`,className:`menu-action-button`},items:e,menuWidth:240,placement:`below`,alignment:n,hasChevron:!1})})}function dP(e){let{t}=cr(),n=(0,_.useRef)(null),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(10),[p,m]=(0,_.useState)(!0),[h,g]=(0,_.useState)(new Set),v=(0,_.useRef)(null),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(!1),[E,D]=(0,_.useState)(!1),[O,j]=(0,_.useState)(new Set),[M,P]=(0,_.useState)(10),[F,R]=(0,_.useState)(!1),[ee,z]=(0,_.useState)(null),[B,H]=(0,_.useState)(!1),te=(0,_.useRef)(new Set),ne=(0,_.useRef)(null),[re,ie]=(0,_.useState)(null),[U,oe]=(0,_.useState)(``),[se,ce]=(0,_.useState)(!1),le=(0,_.useRef)(null),ue=(0,_.useRef)(null),de=(0,_.useRef)(null),fe=(0,_.useRef)(null),pe=(0,_.useRef)(null),me=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!ee)return;let e=window.setTimeout(()=>z(null),5e3);return()=>window.clearTimeout(e)},[ee]);let W=e.snapshot,he=W?.selectedSession?.path===e.selectedPath?e.selectedPath:null,ge=W?.sessions.find(e=>e.path===W.selectedSession?.path&&e.id===W.selectedSession?.id),_e=oP(ge??{id:``,path:``});(0,_.useEffect)(()=>{e.selectedPath,ne.current=null},[_e,e.selectedPath]),(0,_.useEffect)(()=>{if(!e.sessionViewVisible||!ge||e.selectedPath!==ge.path||ne.current===_e||e.connected===!1)return;let t=!0,n=()=>{document.visibilityState!==`visible`||!document.hasFocus()||document.querySelector(`dialog[open]`)||ne.current!==_e&&(ne.current=_e,!(!ge.unread||!ge.readRevision)&&e.actions.setSessionRead(ge.path,ge.id,!0,ge.readRevision).catch(()=>{t&&R(!0)}))};return n(),document.addEventListener(`visibilitychange`,n),window.addEventListener(`focus`,n),document.addEventListener(`close`,n,!0),()=>{t=!1,document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`focus`,n),document.removeEventListener(`close`,n,!0)}},[_e,ge,e.sessionViewVisible,e.selectedPath,e.connected,e.actions]);let ve=(0,_.useMemo)(()=>new rf,[]),[ye,be]=(0,_.useState)(!1),[xe,Se]=(0,_.useState)(!1),[Ce,we]=(0,_.useState)(!1),Te=(0,_.useRef)(!1),Ee=(0,_.useRef)(null),Oe=(0,_.useRef)(!1),[ke,Ae]=(0,_.useState)(!1),je=(0,_.useRef)(null),[Me,Ne]=(0,_.useState)(null),[Pe,Fe]=(0,_.useState)(null),[Ie,Le]=(0,_.useState)(!1),[Re,ze]=(0,_.useState)(!1),Ve=W?.preferences.pinnedSort??`manual`,We=W?.preferences.sidebarGrouping??`project`,Ge=W?.preferences.chatsSort??`updated`,Ke=(W?.sessions??[]).filter(e=>e.pinOrder!==void 0&&!e.archived).sort((e,t)=>(Ve===`updated`?t.modified.localeCompare(e.modified):0)||e.pinOrder-t.pinOrder).filter(n=>{let r=W?.workspaces.find(e=>e.path===nP(n));return`${ZA(n,t(`untitledSession`))} ${n.cwd} ${r?.name??``}`.toLowerCase().includes(e.query.trim().toLowerCase())}),qe=async e=>{if(!Te.current){Te.current=!0,we(!0),ze(!1);try{await e()}catch{ze(!0)}finally{Te.current=!1,we(!1)}}},Je=(t,n,r)=>qe(()=>e.actions.setSessionPin(t.path,t.id,n,r)),Ye=(t,n,r)=>qe(()=>e.actions.setSidebarPin(t,n,r)),Xe=t=>qe(async()=>{await ve.savePreferences(t),await e.actions.refreshSnapshot()}),Ze=async(t,n)=>{if(!t.readRevision)return;let r=oP(t);if(!te.current.has(r)){t.path===e.selectedPath&&(ne.current=r),te.current.add(r),R(!1);try{await e.actions.setSessionRead(t.path,t.id,n,t.readRevision)}catch{R(!0)}finally{te.current.delete(r)}}},Qe=e.query.trim(),$e=JSON.stringify([ye,Qe]),et=(0,_.useRef)({key:$e});et.current.key!==$e&&(et.current={key:$e});let nt=(0,_.useRef)(!1),[rt,it]=(0,_.useState)(null),[at,ot]=(0,_.useState)(!1),[ct,ut]=(0,_.useState)(null),ft=(0,_.useRef)(null),pt=rt?.query===Qe?rt:null,mt=ct?.query===Qe?ct:null,gt=(0,_.useCallback)(async(e,t)=>{if(!ye)return;ft.current?.abort();let n=new AbortController;ft.current=n,ot(!0),ut(null);try{let r=await ve.listArchivedSessions({query:Qe,...e?{cursor:e}:{},limit:25},n.signal);if(n.signal.aborted||ft.current!==n)return;let i=[...r.sessions];for(;!e&&t!==void 0&&i.length!i.some(t=>t.path===e.path));if(i.push(...e),!e.length)break}it(t=>({...r,query:Qe,sessions:e&&t?.query===Qe?[...t.sessions,...i.filter(e=>!t.sessions.some(t=>t.path===e.path))]:i}))}catch(r){!n.signal.aborted&&ft.current===n&&ut({query:Qe,kind:r instanceof tf&&r.code===`ARCHIVED_SESSION_CURSOR_STALE`?`stale`:`failed`,...e?{cursor:e}:{},...t===void 0?{}:{retainedCount:t}})}finally{ft.current===n&&(ft.current=null,ot(!1))}},[Qe,ye,ve]),[_t,yt]=(0,_.useState)(new Set),[bt,xt]=(0,_.useState)(new Set),St=(0,_.useRef)(new Set),[Ct,Tt]=(0,_.useState)(!1),[Et,Dt]=(0,_.useState)(!1),Ot=(0,_.useRef)(!1),[At,jt]=(0,_.useState)(!1),Mt=(0,_.useRef)(!1),[Nt,Pt]=(0,_.useState)(!1),[Ft,It]=(0,_.useState)(!1),Rt=(0,_.useRef)(!1),zt=async t=>{if(St.current.has(t))return;St.current.add(t),xt(new Set(St.current)),Tt(!1);let n=et.current;try{let r=await e.actions.unarchiveSession(t);if(!nt.current||et.current!==n)return;r?(it(e=>e?{...e,sessions:e.sessions.filter(e=>e.path!==t)}:null),await gt()):Tt(!0)}finally{St.current.delete(t),nt.current&&xt(new Set(St.current))}};(0,_.useEffect)(()=>(nt.current=!0,()=>{nt.current=!1}),[]),(0,_.useEffect)(()=>(Tt(!1),ut(null),ye&&(it(e=>e?.query===Qe?e:null),gt()),()=>{ft.current?.abort(),ft.current=null}),[Qe,ye,gt]),(0,_.useEffect)(()=>{if(e.searchOpen)return le.current?.focus(),()=>ue.current?.focus()},[e.searchOpen]),(0,_.useEffect)(()=>{if(e.mobileOpen)return pe.current?.focus(),()=>{let t=e.returnFocusRef?.current;t?.checkVisibility()&&t.focus()}},[e.mobileOpen,e.returnFocusRef]),(0,_.useEffect)(()=>{e.mobileOpen&&document.activeElement===document.body&&!document.querySelector(`dialog:modal`)&&pe.current?.focus()}),(0,_.useEffect)(()=>{a&&(de.current?.focus(),de.current?.select())},[a]);let Bt=(0,_.useMemo)(()=>{let n=e.query.trim().toLowerCase(),r=ye?pt?.sessions??[]:W?.sessions??[],i=(e,i)=>r.filter(r=>!!r.archived===ye&&(ye||r.pinOrder===void 0)&&(e===`__ungrouped__`?r.ungrouped:nP(r)===e&&!r.ungrouped)&&(!n||ye||i||`${ZA(r,t(`untitledSession`))} ${r.cwd}`.toLowerCase().includes(n))),a=[...W?.workspaces??[]];for(let e of r)!e.ungrouped&&!a.some(t=>t.path===nP(e))&&a.push({path:nP(e),name:nP(e),current:!1});return[...a.map(e=>{let t=!!n&&`${e.name} ${e.path}`.toLowerCase().includes(n);return{...e,showPath:a.some(t=>t.path!==e.path&&t.name===e.name),sessions:i(e.path,t),ungrouped:!1,matches:t}}),{path:`__ungrouped__`,name:t(`ungrouped`),current:!1,sessions:i(`__ungrouped__`,!1),ungrouped:!0,pinOrder:void 0,showPath:!1,matches:!1}].filter(e=>e.sessions.length>0||!ye&&!e.ungrouped&&(!n||e.matches))},[ye,e.query,pt,W,t]),Vt=e=>[...e].sort((e,t)=>(Ge===`manual`?(e.order??2**53-1)-(t.order??2**53-1):0)||t.modified.localeCompare(e.modified)||e.path.localeCompare(t.path)),Ht=(e,t)=>{if(e.length<=t+1)return e;let n=e.slice(0,t),r=e.find(e=>e.path===he&&e.id===W?.selectedSession?.id);return r&&!n.includes(r)&&n.push(r),n},Ut=Bt.filter(e=>!e.ungrouped),Wt=Ut.filter(e=>e.pinOrder!==void 0),Gt=[...Ke.map(e=>({kind:`session`,session:e,pinOrder:e.pinOrder})),...Wt.map(e=>({kind:`workspace`,project:e,pinOrder:e.pinOrder}))].sort((e,t)=>{let n=e=>e.kind===`session`?e.session.modified:e.project.sessions.reduce((e,t)=>t.modified>e?t.modified:e,``);return(Ve===`updated`?n(t).localeCompare(n(e)):0)||e.pinOrder-t.pinOrder}),Kt=e=>e.kind===`session`?{kind:`session`,path:e.session.path,id:e.session.id}:{kind:`workspace`,path:e.project.path},qt=Ut.filter(e=>e.pinOrder===void 0),Jt=y||e.query.trim()||ye||qt.length<=6?qt:qt.slice(0,5),Yt=qt.find(e=>ge?.path===he&&e.path===(ge?nP(ge):void 0));Yt&&!Jt.includes(Yt)&&Jt.push(Yt);let Xt=Vt((W?.sessions??[]).filter(n=>!n.archived&&n.pinOrder===void 0&&!W?.workspaces.some(e=>e.pinOrder!==void 0&&e.path===nP(n))&&(We===`list`||W?.preferences.projectsInRecents!==!1||n.ungrouped||!Ut.some(e=>e.path===nP(n)))&&(!e.query.trim()||`${ZA(n,t(`untitledSession`))} ${n.cwd} ${W?.workspaces.find(e=>e.path===nP(n))?.name??``}`.toLowerCase().includes(e.query.trim().toLowerCase())))),Zt=e.query.trim()?Xt:Ht(Xt,M),Qt=t=>lP(t,e.connected)<3,$t=new Date;$t.setHours(0,0,0,0),$t.setDate($t.getDate()-6);let en=(W?.sessions??[]).filter(e=>!e.archived&&(Qt(e)||h.has(cP(e))||[`completed`,`failed`].includes(e.execution?.lastTurn?.outcome??``)&&(e.execution?.lastTurn?.finishedAt??0)>=$t.getTime())),tn=new Map([...h].map((e,t)=>[e,t])),nn=en.filter(e=>Qt(e)||h.has(cP(e))).sort((t,n)=>(tn.get(cP(t))??1/0)-(tn.get(cP(n))??1/0)||lP(t,e.connected)-lP(n,e.connected)||n.modified.localeCompare(t.modified)),rn=new Set(nn.map(e=>e.path)),an=en.filter(e=>!p||!rn.has(e.path)).sort((e,t)=>sP(t)-sP(e)),on=p?nn.slice(0,d):[],sn=an.slice(0,Math.max(0,d-on.length)),cn=en.length>on.length+sn.length;(0,_.useEffect)(()=>{let e=me.current;if(!l||!cn||!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(([e])=>{e?.isIntersecting&&(t.disconnect(),f(d+10))},{root:e.closest(`.sidebar-navigation`)});return t.observe(e),()=>t.disconnect()},[l,cn,d]),(0,_.useEffect)(()=>{if(!l){v.current=null,g(e=>e.size?new Set:e),f(10);return}let t=v.current??{openedAt:Date.now(),sessions:new Set((W?.sessions??[]).map(cP))},n=(W?.sessions??[]).filter(t=>!t.archived&&lP(t,e.connected)<3).sort((t,n)=>lP(t,e.connected)-lP(n,e.connected)||n.modified.localeCompare(t.modified)),r=n.filter(e=>!t.sessions.has(cP(e))&&Date.parse(e.created)>=t.openedAt);for(let e of W?.sessions??[])t.sessions.add(cP(e));v.current=t,g(e=>{let t=new Set([...r.map(cP),...e,...n.map(cP)]);return t.size===e.size?e:t})},[l,W?.sessions,e.connected]);let ln=(W?.sessions??[]).filter(e=>!e.archived&&e.unread),un=ln.filter(e=>e.readRevision),dn=p?nn.filter(e=>e.unread&&e.readRevision):[],fn=async e=>{if(!B){H(!0);try{await Promise.all(e.map(e=>Ze(e,!0)))}finally{H(!1)}}},pn=he?ge?nP(ge):W?.selectedSession?.cwd:null,mn=!!(W?.truncation.sessionsOmitted||W?.truncation.workspacesOmitted),hn=e=>{Ot.current||(oe(e.name),ce(!1),o(e))},gn=async()=>{let t=U.trim();if(!a||!t||t===a.name||Ot.current)return;let n=a,r=et.current,i=pt?.sessions.length??25;Ot.current=!0,Dt(!0),ce(!1);try{if(n.kind===`workspace`?await e.actions.renameWorkspace(n.path,t):await e.actions.renameSession(n.path,t),!nt.current)return;o(null),n.kind===`session`&&ye&&et.current===r&>(void 0,i)}catch{nt.current&&ce(!0)}finally{Ot.current=!1,nt.current&&Dt(!1)}},_n=async()=>{if(!re||Mt.current)return;let t=re;Mt.current=!0,jt(!0),Pt(!1);try{let n=await e.actions.removeWorkspace(t.path);if(!nt.current)return;n?ie(null):Pt(!0)}catch{nt.current&&Pt(!0)}finally{Mt.current=!1,nt.current&&jt(!1)}},vn=async t=>{if(Rt.current)return;let n=et.current;Rt.current=!0,It(!0);try{if(!t){await e.actions.chooseWorkspace();return}let r=await e.actions.createSession(t);if(!nt.current||et.current!==n||!r?.sessionId||!r.sessionPath||r.workspacePath!==t)return;be(!1),u(!1),e.actions.setQuery(``)}catch{}finally{Rt.current=!1,nt.current&&It(!1)}},yn=(0,_.useCallback)(()=>{(Ee.current||je.current)&&(Oe.current=!0),Ee.current=null,je.current=null,Ae(!1),Fe(null),Ne(null)},[]);(0,_.useEffect)(()=>{let e=e=>{e.key!==`Escape`||!Ee.current&&!je.current||(e.preventDefault(),yn())},t=()=>{(Ee.current||je.current)&&yn()};return window.addEventListener(`keydown`,e,!0),window.addEventListener(`blur`,t),()=>{window.removeEventListener(`keydown`,e,!0),window.removeEventListener(`blur`,t)}},[yn]);let bn=(e,t)=>{let n=Gt[e];if(!n)return;let r=rP(Gt,e,t);Ye(Kt(n),!0,r?Kt(r):null)},xn=e=>Ve===`manual`?[{id:`move-up`,label:t(`movePinUp`),icon:(0,K.jsx)(k,{}),isDisabled:Ce||e<=0,onClick:()=>bn(e,!1)},{id:`move-down`,label:t(`movePinDown`),icon:(0,K.jsx)(w,{}),isDisabled:Ce||e===Gt.length-1,onClick:()=>bn(e,!0)}]:[],Sn=[{id:`updated`,label:t(`pinnedRecentlyUpdated`),endContent:Ge===`updated`?(0,K.jsx)(I,{size:16}):void 0,isDisabled:Ce,onClick:()=>void Xe({chatsSort:`updated`})},{id:`manual`,label:t(`pinnedManualOrder`),endContent:Ge===`manual`?(0,K.jsx)(I,{size:16}):void 0,isDisabled:Ce,onClick:()=>void Xe({chatsSort:`manual`})}],Cn=[{id:`updated`,label:t(`pinnedRecentlyUpdated`),endContent:Ve===`updated`?(0,K.jsx)(I,{size:16}):void 0,isDisabled:Ce,onClick:()=>void Xe({pinnedSort:`updated`})},{id:`manual`,label:t(`pinnedManualOrder`),endContent:Ve===`manual`?(0,K.jsx)(I,{size:16}):void 0,isDisabled:Ce,onClick:()=>void Xe({pinnedSort:`manual`})}],wn=[{label:t(`sidebarGroupBy`),items:[{label:t(`sidebarByProject`),endContent:We===`project`?(0,K.jsx)(I,{size:16}):void 0,isDisabled:Ce,onClick:()=>void Xe({sidebarGrouping:`project`})},{label:t(`sidebarFlatList`),endContent:We===`list`?(0,K.jsx)(I,{size:16}):void 0,isDisabled:Ce,onClick:()=>void Xe({sidebarGrouping:`list`})}]},{label:t(`sidebarChatSort`),items:Sn}],Tn=[...wn,...We===`project`?[{label:t(`sidebarShow`),items:[{label:t(`sidebarProjectsInRecents`),endContent:W?.preferences.projectsInRecents===!1?void 0:(0,K.jsx)(I,{size:16}),isDisabled:Ce,onClick:()=>void Xe({projectsInRecents:W?.preferences.projectsInRecents===!1})}]}]:[]],En=(0,K.jsxs)(`div`,{className:`sidebar-section-actions is-always-visible`,children:[(0,K.jsx)(uP,{label:t(`sidebarActivityOptions`),items:[{type:`section`,title:t(`sidebarShow`),items:[{label:t(`sidebarPriority`),endContent:p?(0,K.jsx)(I,{size:16}):void 0,onClick:()=>m(e=>!e)}]},{type:`divider`},{label:t(`sidebarMarkAllRead`),icon:(0,K.jsx)(Ue,{}),isDisabled:B||!dn.length,onClick:()=>void fn(dn)}]}),p&&nn.some(e=>!Qt(e))&&(0,K.jsx)(Cd,{content:t(`sidebarClearRead`),children:(0,K.jsx)(`button`,{className:`icon-button`,type:`button`,"aria-label":t(`sidebarClearRead`),onClick:()=>g(new Set(nn.filter(Qt).map(cP))),children:(0,K.jsx)(N,{"aria-hidden":`true`})})})]}),Dn=(n,r=!1,i)=>{let a=Gt.findIndex(e=>e.kind===`session`&&e.session.path===n.path&&e.session.id===n.id),o={kind:`session`,path:n.path,id:n.id},s=n.pinOrder!==void 0,c=e.connected!==!1&&n.execution?.status===`running`,u=e.connected!==!1&&n.execution?.waitingForInput,d=n.firstUnread?.type===`turn`?n.firstUnread.outcome:n.execution?.lastTurn?.outcome,f=u?`attention`:c?`running`:n.unread?d===`failed`?`attention`:d===`completed`?`completed`:`unread`:void 0,p=f===`running`?He:f===`attention`?V:ae,m=e.connected===!1?0:n.execution?.pendingFollowUps??0,h=n.path===he&&n.id===W?.selectedSession?.id,g=f===`attention`?u?`waiting`:`failed`:f===`running`&&n.execution?.compacting?`compacting`:f,_=[...g?[t(`sidebarState_`+g)]:[],...m>0?[t(`pendingFollowUpsHint`,{count:m})]:[]].join(` · `),v=i?.sessions.findIndex(e=>e.path===n.path&&e.id===n.id)??-1,y=!ye&&!r&&Ge===`manual`&&!!i,b=t=>qe(()=>e.actions.setSessionOrder(n.path,n.id,t?{path:t.path,id:t.id}:null)),x=r?xn(a):y&&i?[{id:`move-up`,label:t(`movePinUp`),icon:(0,K.jsx)(k,{}),isDisabled:Ce||v<=0,onClick:()=>void b(rP(i.sessions,v,!1))},{id:`move-down`,label:t(`movePinDown`),icon:(0,K.jsx)(w,{}),isDisabled:Ce||v===i.sessions.length-1,onClick:()=>void b(rP(i.sessions,v,!0))}]:[];return(0,K.jsxs)(`li`,{className:`session-row `+(n.unread?`is-unread `:``)+(Pe===n.path?Ie?`is-pin-drop-after`:`is-pin-drop-target`:``),"aria-label":ZA(n,t(`untitledSession`)),"data-session-key":JSON.stringify([n.path,n.id]),draggable:!Ce&&!e.query.trim()&&(r?Ve===`manual`:y),onDragStart:e=>{if(e.stopPropagation(),r&&Ve===`manual`)Ee.current=o;else if(y&&i)je.current={path:n.path,id:n.id,scope:i.key};else{e.preventDefault();return}Ae(!0),Oe.current=!0,e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id)},onDragOver:e=>{if(!(r&&Ve===`manual`&&Ee.current)&&!(y&&je.current?.scope===i?.key))return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,Fe(n.path),Ne(null);let t=e.currentTarget.getBoundingClientRect();Le(aP(e.clientY,t))},onDragEnd:yn,onDrop:t=>{let n=t.currentTarget.getBoundingClientRect(),s=aP(t.clientY,n);if(r&&Ve===`manual`&&Ee.current){t.preventDefault(),t.stopPropagation();let e=Gt[a+1];Ye(Ee.current,!0,s?e?Kt(e):null:o)}else if(y&&i&&je.current?.scope===i.key){t.preventDefault(),t.stopPropagation();let n=je.current,r=iP(i.sessions,v,s);qe(()=>e.actions.setSessionOrder(n.path,n.id,r?{path:r.path,id:r.id}:null))}else return;yn()},children:[(0,K.jsxs)(`button`,{className:`session `+(h?`active`:``),type:`button`,"aria-current":h?`page`:void 0,"aria-label":[ZA(n,t(`untitledSession`)),n.path,_].filter(Boolean).join(` · `),onClick:()=>{h&&n.unread&&e.sessionViewVisible&&e.connected!==!1&&Ze(n,!0),e.actions.selectSession(n.path)},onDoubleClick:r=>{h&&e.connected!==!1&&r.target instanceof Element&&r.target.closest(`.session-title`)&&hn({kind:`session`,path:n.path,name:ZA(n,t(`untitledSession`))})},children:[(0,K.jsxs)(`span`,{className:`session-copy`,children:[(0,K.jsx)(`span`,{className:`session-title`,title:ZA(n,t(`untitledSession`)),children:ZA(n,t(`untitledSession`))}),l&&(0,K.jsxs)(`span`,{className:`session-project`,children:[(0,K.jsx)(De,{"aria-hidden":`true`}),W?.workspaces.find(e=>e.path===nP(n))?.name??$A(nP(n))]})]}),_&&(0,K.jsx)(Cd,{content:_,children:(0,K.jsxs)(`span`,{className:`session-status`,"aria-hidden":`true`,children:[f&&(0,K.jsx)(p,{className:`session-state session-state-`+f}),m>0&&(0,K.jsxs)(`span`,{className:`session-queue`,children:[(0,K.jsx)(Be,{}),(0,K.jsx)(`span`,{children:m>99?`99+`:m})]})]})})]}),!ye&&(0,K.jsx)(Cd,{content:t(s?`unpinConversation`:`pinConversation`),children:(0,K.jsx)(`button`,{type:`button`,className:`session-pin-button`,"aria-label":t(s?`unpinConversation`:`pinConversation`),disabled:Ce,onClick:e=>{let t=XN(e.currentTarget);Je(n,!s).finally(t)},children:(0,K.jsx)(st,{"aria-hidden":`true`,fill:s?`currentColor`:`none`})})}),(0,K.jsx)(ZN,{session:n,archived:ye,connected:e.connected!==!1,pinSaving:Ce,restoring:bt.has(n.path),movementItems:x,client:ve,actions:e.actions,onRename:()=>hn({kind:`session`,path:n.path,name:ZA(n,t(`untitledSession`))}),onPin:()=>Je(n,!s),onRead:()=>Ze(n,!!n.unread),onArchive:()=>ye?zt(n.path):e.actions.archiveSession(n.path),onNotice:(e,t=!1)=>z({message:e,error:t})})]},n.path)},On=(r,a=!1)=>{let o=(ye?_t:e.collapsed).has(r.path)&&!e.query.trim(),s=!r.ungrouped&&pn===r.path,c=Gt.findIndex(e=>e.kind===`workspace`&&e.project.path===r.path),l=qt.findIndex(e=>e.path===r.path),u=!ye&&!r.ungrouped&&!Ce&&!e.query.trim(),d=t=>qe(()=>e.actions.setWorkspaceOrder(r.path,rP(qt,l,t)?.path??null)),f={kind:`workspace`,path:r.path},p=Vt(r.sessions),m=un.filter(e=>!e.ungrouped&&nP(e)===r.path),h=ye||!!e.query.trim()||O.has(r.path)||p.length<=6,g=[...ye?[]:[{id:`pin`,label:t(a?`unpinWorkspace`:`pinWorkspace`),icon:(0,K.jsx)(st,{}),isDisabled:Ce,onClick:()=>void Ye(f,!a)},{id:`mark-read`,label:t(`sidebarMarkAllRead`),icon:(0,K.jsx)(Ue,{}),isDisabled:B||!m.length,onClick:()=>void fn(m)}],...a?xn(c):ye?[]:[{id:`move-up`,label:t(`movePinUp`),icon:(0,K.jsx)(k,{}),isDisabled:!u||l<=0,onClick:()=>void d(!1)},{id:`move-down`,label:t(`movePinDown`),icon:(0,K.jsx)(w,{}),isDisabled:!u||l===qt.length-1,onClick:()=>void d(!0)}],...r.ungrouped?[]:[{id:`managed-worktrees`,label:t(`managedWorktrees`),icon:(0,K.jsx)(De,{}),isDisabled:e.connected===!1,onClick:()=>{let e=Array.from(fe.current?.querySelectorAll(`.workspace-group`)??[]).find(e=>e.dataset.workspaceKey===r.path);n.current=XN(e?.querySelector(`.workspace-row-actions .menu-action-button`)??null),queueMicrotask(()=>i(r.path))}}],{id:`rename`,label:t(`renameWorkspace`),icon:(0,K.jsx)(wt,{}),onClick:()=>hn({kind:`workspace`,path:r.path,name:r.name})},{id:`remove`,label:t(`removeWorkspace`),icon:(0,K.jsx)(kt,{}),variant:`destructive`,onClick:()=>{Pt(!1),ie({path:r.path,name:r.name})}}];return(0,K.jsxs)(`section`,{className:`workspace-group `+(o?`collapsed `:``)+(s?`is-active-workspace `:``)+(Me===r.path?Ie?`is-pin-drop-after`:`is-pin-drop-target`:``),"data-workspace-key":r.path,"aria-label":r.name,onDragOver:e=>{if(!u||!Ee.current||(a?Ve!==`manual`:Ee.current.kind!==`workspace`))return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,Ne(r.path),Fe(null);let t=e.currentTarget.getBoundingClientRect();Le(aP(e.clientY,t))},onDragEnd:yn,onDragLeave:e=>{(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&Ne(null)},onDrop:t=>{if(!u||!Ee.current||(a?Ve!==`manual`:Ee.current.kind!==`workspace`))return;t.preventDefault(),t.stopPropagation();let n=t.currentTarget.getBoundingClientRect(),i=aP(t.clientY,n),o=Ee.current;if(o.kind!==`workspace`||o.path!==r.path)if(a){let e=Gt[c+1];Ye(o,!0,i?e?Kt(e):null:f)}else qe(()=>e.actions.setWorkspaceOrder(o.path,i?qt[l+1]?.path??null:r.path));yn()},children:[(0,K.jsxs)(`div`,{className:`workspace-button`,draggable:u&&(!a||Ve===`manual`),onDragStart:e=>{if(!u||a&&Ve!==`manual`||e.target instanceof Element&&e.target.closest(`.workspace-row-actions`)){e.preventDefault();return}Ee.current=f,requestAnimationFrame(()=>{nt.current&&Ee.current===f&&Ae(!0)}),Oe.current=!0,e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,r.path)},children:[(0,K.jsxs)(`button`,{className:`workspace-label`,type:`button`,"aria-expanded":!o,"aria-current":s?`location`:void 0,disabled:!!e.query.trim(),title:r.ungrouped?void 0:r.path,onClick:()=>{ye?yt(e=>{let t=new Set(e);return t.has(r.path)?t.delete(r.path):t.add(r.path),t}):e.actions.toggleWorkspace(r.path)},children:[(0,K.jsx)(`span`,{className:`workspace-toggle`,"aria-hidden":`true`,children:o?(0,K.jsx)(De,{className:`workspace-folder`}):(0,K.jsx)(G,{className:`workspace-folder`})}),(0,K.jsxs)(`span`,{className:`workspace-identity`,children:[(0,K.jsx)(`strong`,{children:r.name}),r.showPath&&(0,K.jsx)(`small`,{children:$A(r.path)})]})]}),!r.ungrouped&&(0,K.jsxs)(`span`,{className:`workspace-row-actions`,children:[(0,K.jsx)(uP,{label:t(`workspaceOptions`),items:g}),(0,K.jsx)(Cd,{content:t(`newSession`),children:(0,K.jsx)(`button`,{className:`workspace-action`,type:`button`,"aria-label":t(`newSession`)+` `+r.name,disabled:Ft,"aria-busy":Ft||void 0,onClick:()=>void vn(r.path),children:(0,K.jsx)(wt,{})})})]})]}),!o&&!p.length&&!ye&&!e.query.trim()&&!mn&&(0,K.jsx)(`p`,{className:`workspace-empty`,children:t(`noConversations`)}),!o&&p.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`ul`,{className:`workspace-sessions`,children:(h?p:Ht(p,5)).map(e=>Dn(e,!1,{key:r.path,sessions:p}))}),!ye&&!e.query.trim()&&p.length>6&&(0,K.jsx)(`button`,{className:`sidebar-show-more is-indented`,type:`button`,"aria-expanded":O.has(r.path),onClick:()=>j(e=>{let t=new Set(e);return t.has(r.path)?t.delete(r.path):t.add(r.path),t}),children:t(O.has(r.path)?`sidebarShowLess`:`sidebarShowMore`)})]})]},r.path)},kn=new Map,An=new Date,jn=new Date(An);jn.setDate(An.getDate()-1);for(let e of sn){let n=new Date(sP(e)),r=n.toDateString()===An.toDateString()?t(`sidebarToday`):n.toDateString()===jn.toDateString()?t(`sidebarYesterday`):Number.isFinite(n.getTime())?n.toLocaleDateString(void 0,{weekday:`long`}):t(`sidebarEarlier`);kn.set(r,[...kn.get(r)??[],e])}return(0,K.jsxs)(`div`,{ref:fe,id:`session-sidebar`,className:`session-sidebar`,role:e.mobileOpen?`dialog`:`complementary`,"aria-modal":e.mobileOpen||void 0,"aria-label":`Session navigation`,tabIndex:e.mobileOpen?-1:void 0,onPointerDownCapture:()=>{!Ee.current&&!je.current&&(Oe.current=!1)},onClickCapture:e=>{e.detail!==0&&Oe.current&&(e.preventDefault(),e.stopPropagation(),Oe.current=!1)},onKeyDown:t=>{if(!e.mobileOpen||t.defaultPrevented||t.target instanceof Element&&(t.target.closest(`dialog`)||t.key!==`Tab`&&t.target.closest(`[role="menu"]`))||t.key===`Escape`&&fe.current?.querySelector(`[aria-haspopup="menu"][aria-expanded="true"]`)||(t.key===`Escape`&&!t.nativeEvent.isComposing&&(t.preventDefault(),e.actions.closeMobileSidebar()),t.key!==`Tab`))return;let n=Array.from(fe.current?.querySelectorAll(`button, input, select, textarea, a[href], [tabindex]`)??[]).filter(e=>e.tabIndex>=0&&!e.matches(`:disabled`)&&e.checkVisibility({visibilityProperty:!0})),r=t.shiftKey?n.at(-1):n[0],i=t.shiftKey?n[0]:n.at(-1);(document.activeElement===fe.current||document.activeElement===i)&&(t.preventDefault(),r?.focus())},children:[(0,K.jsxs)(`div`,{className:`sidebar-brand`,children:[(0,K.jsx)(`span`,{className:`sidebar-brand-title`,children:`OpenPI`}),(0,K.jsxs)(`div`,{className:`sidebar-header-actions`,children:[(0,K.jsx)(Cd,{content:t(l?`sidebarViewChats`:`sidebarViewActivity`),children:(0,K.jsxs)(`button`,{className:`icon-button sidebar-activity-toggle`,type:`button`,"aria-label":t(l?`sidebarViewChats`:`sidebarViewActivity`),"aria-pressed":l,onClick:()=>{be(!1),u(e=>!e)},children:[(0,K.jsx)(A,{"aria-hidden":`true`}),ln.length>0&&(0,K.jsx)(`span`,{className:`sidebar-unread-dot`})]})}),(0,K.jsx)(Cd,{content:t(`searchConversations`),children:(0,K.jsx)(`button`,{ref:ue,className:`icon-button`,type:`button`,"aria-label":t(`searchConversations`),onClick:()=>c(!0),children:(0,K.jsx)(ht,{"aria-hidden":`true`})})}),(0,K.jsx)(Cd,{content:t(`collapseSidebar`),placement:`end`,children:(0,K.jsx)(`button`,{ref:pe,className:`collapse-button sidebar-mobile-close`,type:`button`,"aria-label":t(`collapseSidebar`),onClick:()=>e.mobileOpen?e.actions.closeMobileSidebar():e.actions.toggleSidebar(!1),children:(0,K.jsx)(tt,{})})})]})]}),(0,K.jsxs)(`button`,{className:`new-session-button`,type:`button`,"aria-label":t(`newSession`),title:t(`newSession`),disabled:Ft,"aria-busy":Ft||void 0,onClick:()=>void vn(e.selectedWorkspace),children:[(0,K.jsx)(wt,{}),(0,K.jsx)(`span`,{children:t(`newSession`)})]}),(0,K.jsx)(eP,{open:s,initialQuery:e.query,initialIncludeArchived:ye,sessions:W?.sessions??[],workspaces:W?.workspaces??[],onClose:()=>c(!1),onOpenMessage:e.actions.navigateToMessage,onOpenSession:t=>e.actions.selectSession(t),onCreateSession:()=>void vn(e.selectedWorkspace)}),(0,K.jsxs)(`div`,{className:`sidebar-navigation`,children:[ee&&(0,K.jsx)(`p`,{className:`sidebar-scope-note sidebar-action-feedback`,role:ee.error?`alert`:`status`,children:ee.message}),Re&&(0,K.jsx)(`p`,{className:`sidebar-scope-note`,role:`alert`,children:t(`sidebarSaveFailed`)}),F&&(0,K.jsx)(`p`,{className:`sidebar-scope-note`,role:`alert`,children:t(`sidebarReadFailed`)}),l?(0,K.jsxs)(`section`,{className:`sidebar-activity`,"aria-label":t(`sidebarActivity`),children:[p&&(0,K.jsxs)(`section`,{"aria-label":t(`sidebarPriority`),children:[(0,K.jsxs)(`div`,{className:`sidebar-section-heading`,children:[(0,K.jsx)(`h2`,{className:`sidebar-section-label`,children:t(`sidebarPriority`)}),En]}),(0,K.jsx)(`ul`,{className:`sidebar-activity-sessions`,children:on.map(e=>Dn(e))}),!on.length&&(0,K.jsx)(`p`,{className:`sidebar-activity-empty`,children:t(`sidebarActivityEmpty`)})]}),[...kn].map(([e,t],n)=>(0,K.jsxs)(`section`,{"aria-label":e,children:[(0,K.jsxs)(`div`,{className:`sidebar-section-heading`,children:[(0,K.jsx)(`h2`,{className:`sidebar-section-label`,children:e}),!p&&n===0&&En]}),(0,K.jsx)(`ul`,{className:`sidebar-activity-sessions`,children:t.map(e=>Dn(e))})]},e)),!p&&!kn.size&&(0,K.jsxs)(`section`,{"aria-label":t(`sidebarToday`),children:[(0,K.jsxs)(`div`,{className:`sidebar-section-heading`,children:[(0,K.jsx)(`h2`,{className:`sidebar-section-label`,children:t(`sidebarToday`)}),En]}),(0,K.jsx)(`p`,{className:`sidebar-activity-empty`,children:t(`sidebarActivityEmpty`)})]}),cn&&(0,K.jsx)(`div`,{ref:me,className:`sidebar-activity-tail`,role:`status`,"aria-label":t(`loading`),children:(0,K.jsx)(He,{"aria-hidden":`true`})})]}):(0,K.jsxs)(K.Fragment,{children:[!ye&&(Gt.length>0||ke&&Ee.current&&Ve===`manual`)&&(0,K.jsxs)(`section`,{className:`pinned-section `+(Me===`pinned-tail`?`is-pin-drop-after`:``),"aria-label":t(`pinnedConversations`),onDragOver:t=>{Ce||Ve!==`manual`||!Ee.current||e.query.trim()||(t.preventDefault(),t.dataTransfer.dropEffect=`move`,Ne(`pinned-tail`),Fe(null))},onDragLeave:e=>{(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&Ne(null)},onDrop:t=>{Ce||Ve!==`manual`||!Ee.current||e.query.trim()||(t.preventDefault(),t.stopPropagation(),Ye(Ee.current,!0,null),yn())},children:[(0,K.jsxs)(`div`,{className:`sidebar-section-heading`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`workspace-heading-label`,"aria-expanded":!xe||!!e.query.trim(),onClick:()=>Se(e=>!e),children:[t(`pinnedConversations`),(0,K.jsx)(L,{className:xe&&!e.query.trim()?`is-collapsed`:``,"aria-hidden":`true`})]}),(0,K.jsx)(`div`,{className:`sidebar-section-actions`,children:(0,K.jsx)(uP,{label:t(`pinnedOptions`),items:Cn,alignment:`end`})})]}),ke&&Ve===`manual`&&(Gt.length===0||xe)&&(0,K.jsx)(`p`,{className:`sidebar-drop-hint`,children:t(`sidebarDropPin`)}),(!xe||!!e.query.trim())&&(0,K.jsx)(`ul`,{className:`pinned-sessions`,children:Gt.map(e=>e.kind===`session`?Dn(e.session,!0):(0,K.jsx)(`li`,{className:`pinned-workspace`,children:On(e.project,!0)},e.project.path))})]}),(ye||We===`project`||e.searchOpen)&&(0,K.jsxs)(`div`,{className:`workspace-heading sidebar-section-heading `+(e.searchOpen?`is-searching`:``),children:[(0,K.jsxs)(`button`,{type:`button`,className:`workspace-heading-label`,"aria-label":t(ye?`currentConversations`:`sidebarProjects`),"aria-expanded":ye?void 0:!x||!!e.query.trim(),onClick:()=>ye?be(!1):S(e=>!e),children:[ye&&(0,K.jsx)(T,{"aria-hidden":`true`}),t(ye?`archivedConversations`:`sidebarProjects`),!ye&&(0,K.jsx)(L,{className:x&&!e.query.trim()?`is-collapsed`:``,"aria-hidden":`true`})]}),(0,K.jsxs)(`div`,{className:`session-search`,children:[(0,K.jsx)(ht,{}),(0,K.jsx)(`input`,{ref:le,type:`search`,value:e.query,placeholder:t(`searchPlaceholder`),maxLength:ye?160:void 0,"aria-label":t(`searchConversations`),onChange:t=>e.actions.setQuery(t.target.value)}),(0,K.jsx)(`button`,{type:`button`,"aria-label":t(`closeSearch`),onClick:()=>e.actions.setSearchOpen(!1),children:(0,K.jsx)(Lt,{})})]}),(0,K.jsxs)(`div`,{className:`workspace-actions sidebar-section-actions`,children:[!ye&&(0,K.jsx)(uP,{label:t(`sidebarProjectOptions`),items:wn}),ye&&(0,K.jsx)(Cd,{content:t(`sidebarFilterList`),children:(0,K.jsx)(`button`,{className:`icon-button`,type:`button`,"aria-label":t(`sidebarFilterList`),onClick:()=>e.actions.setSearchOpen(!0),children:(0,K.jsx)(ht,{})})}),!ye&&(0,K.jsx)(Cd,{content:t(`addWorkspace`),children:(0,K.jsx)(`button`,{className:`icon-button`,type:`button`,"aria-label":t(`addWorkspace`),onClick:()=>void e.actions.chooseWorkspace(),children:(0,K.jsx)(lt,{})})})]})]}),e.searchOpen&&(0,K.jsxs)(`button`,{type:`button`,className:`sidebar-content-search`,onClick:()=>c(!0),children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),t(`transcriptSearch`)]}),ye&&(0,K.jsxs)(`div`,{className:`sidebar-archive-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":t(`refreshArchives`),title:t(`refreshArchives`),disabled:at,onClick:()=>void gt(),children:(0,K.jsx)(dt,{"aria-hidden":`true`})}),at&&(0,K.jsx)(`span`,{role:`status`,children:t(`loadingArchives`)})]}),ye&&mt&&(0,K.jsxs)(`div`,{className:`sidebar-scope-note`,role:`alert`,children:[(0,K.jsx)(`p`,{children:t(mt.kind===`stale`?`archiveCursorStale`:`archiveLoadFailed`)}),(0,K.jsx)(`button`,{type:`button`,disabled:at,onClick:()=>void gt(mt.kind===`stale`?void 0:mt.cursor,mt.retainedCount),children:t(mt.kind===`stale`?`refreshArchives`:`retryArchives`)})]}),ye&&!!pt?.truncation.recordsUnscanned&&(0,K.jsx)(`p`,{className:`sidebar-scope-note`,children:t(`archiveScanBounded`,{count:pt?.truncation.recordsUnscanned})}),!ye&&mn&&(0,K.jsx)(`p`,{className:`sidebar-scope-note`,children:t(`loadedHistoryBounded`,{sessions:W?.truncation.sessionsOmitted,workspaces:W?.truncation.workspacesOmitted})}),ye&&Ct&&(0,K.jsx)(`p`,{className:`sidebar-scope-note`,role:`alert`,children:t(`restoreFailed`)}),(0,K.jsxs)(`div`,{className:`workspace-tree`,children:[(ye?Bt:We===`project`&&(!x||e.query.trim())?Jt:[]).map(e=>On(e)),!ye&&We===`project`&&ke&&Ee.current?.kind===`workspace`&&!e.query.trim()&&(0,K.jsx)(`section`,{className:`sidebar-project-tail `+(Me===`project-tail`?`is-pin-drop-target`:``),"aria-label":t(`sidebarDropProjectLast`),onDragOver:e=>{Ce||Ee.current?.kind!==`workspace`||(e.preventDefault(),e.dataTransfer.dropEffect=`move`,Ne(`project-tail`),Fe(null))},onDragLeave:e=>{(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&Ne(null)},onDrop:t=>{if(Ce||Ee.current?.kind!==`workspace`)return;t.preventDefault();let n=Ee.current;qe(()=>e.actions.setWorkspaceOrder(n.path,null)),yn()},children:t(`sidebarDropProjectLast`)}),!ye&&We===`project`&&!x&&!e.query.trim()&&qt.length>6&&(0,K.jsx)(`button`,{className:`sidebar-show-more`,type:`button`,"aria-expanded":y,onClick:()=>b(e=>!e),children:t(y?`sidebarShowLess`:`sidebarShowMore`)}),!ye&&(0,K.jsxs)(`section`,{className:`sidebar-recents`,"aria-label":t(`sidebarRecent`),children:[(0,K.jsxs)(`div`,{className:`sidebar-section-heading`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`workspace-heading-label`,"aria-expanded":!E||!!e.query.trim(),onClick:()=>D(e=>!e),children:[t(`sidebarRecent`),(0,K.jsx)(L,{className:E&&!e.query.trim()?`is-collapsed`:``,"aria-hidden":`true`})]}),(0,K.jsx)(`div`,{className:`sidebar-section-actions`,children:(0,K.jsx)(uP,{label:t(`sidebarRecentOptions`),items:Tn})})]}),(!E||!!e.query.trim())&&(0,K.jsx)(`ul`,{className:`recent-sessions`,children:Zt.map(e=>Dn(e,!1,{key:`recent`,sessions:Xt}))}),!E&&Zt.lengthP(e=>e+10),children:t(`sidebarShowMore`)})]}),(ye?!Bt.length:!Gt.length&&!Xt.length&&(We===`list`||!qt.length))&&(0,K.jsx)(`div`,{className:`empty`,hidden:ye&&(at||!!mt),children:e.query.trim()?t(ye&&pt?.truncation.recordsUnscanned?`noMatchingScannedArchives`:!ye&&mn?`noMatchingLoaded`:`noMatching`):t(ye?pt?.truncation.recordsUnscanned?`noScannedArchives`:`noArchivedSessions`:`noSessions`)}),ye&&pt?.nextCursor&&mt?.kind!==`stale`&&(0,K.jsx)(`button`,{type:`button`,className:`sidebar-archive-more`,disabled:at,onClick:()=>void gt(pt.nextCursor),children:t(`moreArchives`)})]})]})]}),(0,K.jsxs)(`div`,{className:`sidebar-footer`,children:[(0,K.jsxs)(`button`,{className:`sidebar-settings-button sidebar-archive-toggle`,type:`button`,"aria-label":t(`archivedConversations`),"aria-pressed":ye,title:t(`archivedConversations`),onClick:()=>{u(!1),be(e=>!e)},children:[(0,K.jsx)(C,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:t(`archivedConversations`)})]}),(0,K.jsxs)(`button`,{className:`sidebar-settings-button`,type:`button`,"aria-label":t(`settings`),title:t(`settings`),"data-provider-settings-trigger":!0,disabled:e.settingsDisabled,onClick:e.onOpenSettings,children:[(0,K.jsx)(vt,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:t(`settings`)})]})]}),(0,K.jsx)($j,{isOpen:!!a,onOpenChange:e=>!e&&!Ot.current&&o(null),purpose:`form`,width:400,"aria-label":a?.kind===`workspace`?t(`renameWorkspace`):t(`renameConversation`),children:(0,K.jsxs)(`form`,{className:`openpi-dialog`,onSubmit:e=>{e.preventDefault(),gn()},children:[(0,K.jsx)(`strong`,{children:a?.kind===`workspace`?t(`renameWorkspace`):t(`renameConversation`)}),(0,K.jsx)(`input`,{ref:de,value:U,maxLength:80,disabled:Et,"aria-label":a?.kind===`workspace`?t(`workspaceName`):t(`conversationName`),onChange:e=>oe(e.target.value)}),se&&(0,K.jsx)(`p`,{className:`sidebar-dialog-error`,role:`alert`,children:t(`renameFailed`)}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:Et,onClick:()=>{Ot.current||o(null)},children:t(`cancel`)}),(0,K.jsx)(`button`,{type:`submit`,className:`primary`,disabled:Et||!U.trim()||U.trim()===a?.name,children:t(Et?`savingName`:`save`)})]})]})}),r&&(0,K.jsx)(tP,{workspace:r,client:ve,actions:e.actions,connected:e.connected!==!1,onClose:()=>{i(null),n.current?.()}},r),(0,K.jsx)($j,{isOpen:!!re,onOpenChange:e=>!e&&!Mt.current&&ie(null),purpose:`form`,width:440,"aria-label":t(`removeWorkspace`),children:(0,K.jsxs)(`div`,{className:`openpi-dialog`,children:[(0,K.jsx)(`strong`,{children:t(`removeWorkspace`)}),(0,K.jsx)(`p`,{className:`sidebar-dialog-path`,children:re?.path}),(0,K.jsxs)(`p`,{children:[re?.name,`:`,t(`workspaceDeleteConfirm`)]}),Nt&&(0,K.jsx)(`p`,{className:`sidebar-dialog-error`,role:`alert`,children:t(`workspaceRemoveFailed`)}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:At,onClick:()=>{Mt.current||ie(null)},children:t(`cancel`)}),(0,K.jsx)(`button`,{type:`button`,className:`danger`,disabled:At,onClick:()=>void _n(),children:t(At?`removingWorkspace`:`removeWorkspace`)})]})]})})]})}var fP=(0,_.createContext)(null);fP.displayName=`LayoutAreaContext`;var pP=(0,_.createContext)({hasHeader:!1,hasFooter:!1,hasStart:!1,hasEnd:!1});pP.displayName=`LayoutSlotsContext`;var mP={center:{kGNEyG:`x6s0dn4`,$$css:!0},end:{kGNEyG:`xuk3077`,$$css:!0},start:{kGNEyG:`x1cy8zhl`,$$css:!0},stretch:{kGNEyG:`x1qjc9v5`,$$css:!0}},hP={start:{kjj79g:`x1nhvcw1`,$$css:!0},center:{kjj79g:`xl56j7k`,$$css:!0},end:{kjj79g:`x13a6bvl`,$$css:!0},between:{kjj79g:`x1qughib`,$$css:!0},around:{kjj79g:`x1l1ennw`,$$css:!0},evenly:{kjj79g:`xaw8158`,$$css:!0}},gP={horizontal:{kXwgrk:`x1q0g3np`,$$css:!0},vertical:{kXwgrk:`xdt5ytf`,$$css:!0}},_P={nowrap:{kwnvtZ:`xozqiw3`,$$css:!0},wrap:{kwnvtZ:`x1a02dak`,$$css:!0},"wrap-reverse":{kwnvtZ:`x8hhl5t`,$$css:!0}},vP={stack:{k1xSpc:`x78zum5`,$$css:!0}},yP={0:{k1C7PZ:`x1o57wo1`,khm7nJ:`x6yxi7o`,$$css:!0},1:{k1C7PZ:`x1lfs0n9`,khm7nJ:`x1ngg2t4`,$$css:!0},2:{k1C7PZ:`xak3so`,khm7nJ:`x1x7z4sm`,$$css:!0},3:{k1C7PZ:`xewh9hi`,khm7nJ:`x4olc9o`,$$css:!0},4:{k1C7PZ:`xty4p9g`,khm7nJ:`xtx9w7w`,$$css:!0},5:{k1C7PZ:`x1eqhezk`,khm7nJ:`x1iu6piu`,$$css:!0},6:{k1C7PZ:`x3qlgwd`,khm7nJ:`xczp1bk`,$$css:!0},8:{k1C7PZ:`xicv188`,khm7nJ:`xgx0vcf`,$$css:!0},10:{k1C7PZ:`x1p37tyl`,khm7nJ:`x1xpicb7`,$$css:!0},"0.5":{k1C7PZ:`x1kihgfc`,khm7nJ:`x1tw44j4`,$$css:!0},"1.5":{k1C7PZ:`x1thn6ci`,khm7nJ:`xhq53yo`,$$css:!0}};function bP({crossAlign:e,direction:t,gap:n,mainAlign:r,wrap:i}){return[vP.stack,gP[t],n!=null&&yP[n],e!=null&&mP[e],r!=null&&hP[r],i!=null&&_P[i]]}var xP={reset:{kAzted:`x2lwn1j`,k7Eaqz:`xeuugli`,$$css:!0}},SP={center:{kSGwAc:`xamitd3`,$$css:!0},end:{kSGwAc:`xpvyfi4`,$$css:!0},start:{kSGwAc:`xqcrz7y`,$$css:!0},stretch:{kSGwAc:`xkh2ocl`,$$css:!0}},CP={fill:{kzQI83:`x1iyjqo2`,$$css:!0},static:{kzQI83:`x1c4vz4f`,kmuXW:`x2lah0s`,$$css:!0}};function wP({crossAlignSelf:e,size:t}={}){return[xP.reset,CP[t??`static`],e!=null&&SP[e]]}var TP={layoutOuter:{keTefX:`xojxgvx`,k71WvV:`x1fcf3bl`,keoZOQ:`x1sa9bsh`,k1K539:`x6h7pi7`,$$css:!0},layoutInner:{"--container-padding-inline-start":`xrhngw9`,"--container-padding-inline-end":`xjsfl84`,"--container-padding-block-start":`x1047aw6`,"--container-padding-block-end":`xax9j7h`,$$css:!0},fill:{kZKoxP:`x12qplqi`,kskxy:`xenllk4`,$$css:!0},auto:{kAzted:`x1us19tq`,$$css:!0},middle:{kUk6DE:`x98rzlu`,kAzted:`x2lwn1j`,$$css:!0},fullBleed:{"--layout-padding-outer-x":`x1wbjvqu`,"--layout-padding-outer-y":`xzxxx64`,$$css:!0}},EP={kzqmXN:`xh8yej3`,kUOVxO:`xvueqy4`,$$css:!0},DP={contentWidthVar:e=>[{"--layout-content-width":(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`x4906uf`,$$css:!0},{"--x---layout-content-width":(typeof e==`number`?`${e}px`:e)==null?void 0:typeof e==`number`?`${e}px`:e}],contentWidth:e=>[EP,{ks0D6T:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`xf68679`,$$css:!0},{"--x-maxWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e)}]};function OP({area:e,children:t}){return t==null?null:(0,K.jsx)(fP,{value:e,children:t})}var kP={"x-default-marker":`x-default-marker`,$$css:!0};function AP({children:e,content:t,contentWidth:n,defaultHasDividers:r,end:i,footer:a,header:o,height:s=`fill`,padding:c,ref:l,start:u,xstyle:d,className:f,style:p}){let m=s===`fill`,h=t??e,g=(0,_.useMemo)(()=>r==null?null:{defaultHasDividers:r},[r]),v=o!=null,y=a!=null,b=u!=null,x=i!=null,S=(0,_.useMemo)(()=>({hasHeader:v,hasFooter:y,hasStart:b,hasEnd:x}),[v,y,b,x]),C=(0,K.jsx)(pP,{value:S,children:(0,K.jsx)(`div`,{ref:l,...oa(ba(`layout`,{height:s}),Sr(TP.layoutOuter,m?TP.fill:TP.auto,d),f,p),children:(0,K.jsxs)(`div`,{...Sr(kP,TP.layoutInner,...bP({direction:`vertical`}),m?TP.fill:TP.auto,c===0&&TP.fullBleed,c!=null&&oi[c],c!=null&&si[c],n!=null&&DP.contentWidthVar(n)),children:[(0,K.jsx)(OP,{area:`header`,children:o}),(0,K.jsxs)(`div`,{...Sr(...bP({direction:`horizontal`}),TP.middle,n!=null&&DP.contentWidth(n)),children:[(0,K.jsx)(OP,{area:`start`,children:u}),(0,K.jsx)(`div`,{...Sr(...wP({size:`fill`})),children:(0,K.jsx)(OP,{area:`content`,children:h})}),(0,K.jsx)(OP,{area:`end`,children:i})]}),(0,K.jsx)(OP,{area:`footer`,children:a})]})})});return g==null?C:(0,K.jsx)(eM,{value:g,children:C})}AP.displayName=`Layout`;var jP={content:{kB7OPa:`x9f619`,kZKoxP:`x5yr21d`,kUk6DE:`x98rzlu`,kAzted:`x2lwn1j`,kVQacm:`x7giv3`,kZCmMZ:`xwjyata`,kwRFfy:`x1peupej`,kLKAdn:`xqty4a x1ioh5az`,kGO01o:`xg476vw xsg11nj`,"--container-padding-inline-start":`x408pgh`,"--container-padding-inline-end":`xikqloz`,"--container-padding-block-start":`xjmgx01`,"--container-padding-block-end":`xi9ns85`,$$css:!0},noStart:{kZCmMZ:`x139j0dd`,"--container-padding-inline-start":`xdvaxxn`,"--container-padding-inline-end":`xqpvj4r`,$$css:!0},noEnd:{kwRFfy:`xpc6k2p`,$$css:!0},noHeader:{kLKAdn:`x81pis9`,"--container-padding-block-start":`xzz8v79`,$$css:!0},noFooter:{kGO01o:`xon7vh3`,"--container-padding-block-end":`x1xjq73n`,$$css:!0},scrollable:{kVQacm:`xysyzu8`,$$css:!0},fullBleed:{kZCmMZ:`x1c1uobl`,kwRFfy:`xyri2b`,kLKAdn:`xexx8yu`,kGO01o:`x18d9i69`,"--container-padding-inline-start":`xrhngw9`,"--container-padding-inline-end":`xjsfl84`,"--container-padding-block-start":`x1047aw6`,"--container-padding-block-end":`xax9j7h`,$$css:!0}};function MP({children:e,isScrollable:t=!0,padding:n,label:r,role:i,xstyle:a,className:o,style:s,ref:c,...l}){let{hasHeader:u,hasFooter:d,hasStart:f,hasEnd:p}=(0,_.use)(pP),m=n===0;return(0,K.jsx)(`div`,{ref:c,role:i,"aria-label":r,...oa(ba(`layout-content`),Sr(jP.content,!f&&!m&&n==null&&jP.noStart,!p&&!m&&n==null&&jP.noEnd,!u&&!m&&n==null&&jP.noHeader,!d&&!m&&n==null&&jP.noFooter,t&&jP.scrollable,m&&jP.fullBleed,n!=null&&ni[n],n!=null&&ri[n],n!=null&&ii[n],n!=null&&ai[n],a),o,s),...l,children:e})}MP.displayName=`LayoutContent`;var NP={footer:{kmuXW:`x2lah0s`,$$css:!0},inner:{kB7OPa:`x9f619`,ks0D6T:`xjl2t3p`,kUOVxO:`xvueqy4`,kZCmMZ:`x139j0dd`,kwRFfy:`xpc6k2p`,kLKAdn:`xqty4a`,kGO01o:`xon7vh3`,"--container-padding-inline-start":`xdvaxxn`,"--container-padding-inline-end":`xqpvj4r`,"--container-padding-block-start":`xjmgx01`,"--container-padding-block-end":`x1xjq73n`,$$css:!0},fullBleed:{kZCmMZ:`x1c1uobl`,kwRFfy:`xyri2b`,kLKAdn:`xexx8yu`,kGO01o:`x18d9i69`,"--container-padding-inline-start":`xrhngw9`,"--container-padding-inline-end":`xjsfl84`,"--container-padding-block-start":`x1047aw6`,"--container-padding-block-end":`xax9j7h`,$$css:!0},divider:{kEafiO:`x178xt8z`,kPef9Z:`x13fuv20`,kLZC3w:`x1pc3f07`,$$css:!0}},PP={sizing:e=>[{kZKoxP:e==null?e:`x16ye13r`,$$css:!0},{"--x-height":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]};function FP({children:e,hasDivider:t,height:n,label:r,padding:i,role:a,xstyle:o,className:s,style:c,ref:l,...u}){let d=(0,_.use)(eM),f=t??d?.defaultHasDividers??!1,p=i===0;return(0,K.jsx)(`div`,{ref:l,role:a,"aria-label":r,"data-divider":f||void 0,...oa(ba(`layout-footer`),Sr(NP.footer,PP.sizing(n??null),f&&NP.divider,o),s,c),...u,children:(0,K.jsx)(`div`,{...Sr(NP.inner,p&&NP.fullBleed,i!=null&&ni[i],i!=null&&ri[i],i!=null&&ii[i],i!=null&&ai[i]),children:e})})}FP.displayName=`LayoutFooter`;var IP={scrollable:{kVQacm:`xysyzu8`,$$css:!0}};function LP({direction:e=`vertical`,hAlign:t,vAlign:n,justify:r,align:i,gap:a,padding:o,paddingInline:s,paddingInlineStart:c,paddingInlineEnd:l,paddingBlock:u,paddingBlockStart:d,paddingBlockEnd:f,isScrollable:p,width:m,height:h,maxWidth:g,minHeight:v,wrap:y,as:b=`div`,xstyle:x,className:S,style:C,children:w,ref:T,...E}){let D=t??(e===`horizontal`?r:i),O=n??(e===`horizontal`?i:r),k=e===`horizontal`?D:O,A=e===`horizontal`?O:D,j=c??s??o,M=l??s??o,N=d??u??o,P=f??u??o,F=Sr(...bP({direction:e,crossAlign:A,mainAlign:k,gap:a,wrap:y}),j!=null&&ci[j],M!=null&&li[M],N!=null&&ui[N],P!=null&&di[P],p&&IP.scrollable,x),I={...m!=null&&{width:typeof m==`number`?`${m}px`:m},...h!=null&&{height:typeof h==`number`?`${h}px`:h},...g!=null&&{maxWidth:typeof g==`number`?`${g}px`:g},...v!=null&&{minHeight:typeof v==`number`?`${v}px`:v}};return(0,_.createElement)(b,{ref:T,...oa(ba(`stack`,{direction:e,gap:a,wrap:y}),F,S,{...C,...I}),...E},w)}LP.displayName=`Stack`;function RP({ref:e,justify:t,align:n,hAlign:r,vAlign:i,...a}){return(0,K.jsx)(LP,{...a,direction:`horizontal`,hAlign:r??t,vAlign:i??n,ref:e})}RP.displayName=`HStack`;function zP({ref:e,justify:t,align:n,hAlign:r,vAlign:i,...a}){return(0,K.jsx)(LP,{...a,direction:`vertical`,hAlign:r??n,vAlign:i??t,ref:e})}zP.displayName=`VStack`;var BP=`(max-width: 640px)`,VP={action:{ks0D6T:`x193iq5w`,k7Eaqz:`xeuugli`,$$css:!0},stackedAction:{kzqmXN:`xh8yej3`,$$css:!0}};function HP({ref:e,isOpen:t,isInline:n,onOpenChange:r,title:i,description:a,cancelLabel:o,actionLabel:s,actionVariant:c=`destructive`,isActionLoading:l,onAction:u,width:d=400,xstyle:f,className:p,style:m,"data-testid":h,...g}){let v=Rc(),y=o??v(`@astryx.alertDialog.cancel`),b=(0,_.useId)(),x=(0,_.useId)(),S=Wl(BP),C=(0,_.useCallback)(()=>{r(!1)},[r]),w=[VP.action,S&&VP.stackedAction],T=(0,K.jsx)(qc,{variant:`ghost`,label:y,onClick:C,xstyle:w,"data-autofocus":!0},`cancel`),E=(0,K.jsx)(qc,{variant:c,label:s,onClick:u,isLoading:l,xstyle:w},`action`);return(0,K.jsx)($j,{...g,ref:e,isOpen:t,isInline:n,onOpenChange:r,width:d,purpose:`form`,role:n?`group`:`alertdialog`,"aria-labelledby":b,"aria-describedby":x,...oa(ba(`alert-dialog`),{className:p,style:m}),xstyle:f,"data-testid":h,children:(0,K.jsx)(AP,{content:(0,K.jsxs)(MP,{children:[(0,K.jsx)(rM,{level:2,id:b,children:i}),(0,K.jsx)(zo,{type:`body`,color:`secondary`,id:x,children:a})]}),footer:(0,K.jsx)(FP,{children:(0,K.jsx)(LP,{direction:S?`vertical`:`horizontal`,gap:2,hAlign:S?`stretch`:`end`,wrap:S?`nowrap`:`wrap`,children:S?[E,T]:[T,E]})})})})}HP.displayName=`AlertDialog`;var UP={x1iwu4tg:`x1iwu4tg`,$$css:!0},WP={sm:{kzqmXN:`x1td3qas`,kZKoxP:`x1qx5ct2`,$$css:!0},md:{kzqmXN:`x100vrsf`,kZKoxP:`xxk0z11`,$$css:!0}},GP={sm:{kzqmXN:`x1td3qas`,kZKoxP:`x1qx5ct2`,$$css:!0},md:{kzqmXN:`x100vrsf`,kZKoxP:`xxk0z11`,$$css:!0}},KP={sm:{kzqmXN:`x1td3qas`,kZKoxP:`x1qx5ct2`,kmVPX3:`x1i3ajwb`,$$css:!0},md:{kzqmXN:`x100vrsf`,kZKoxP:`xxk0z11`,kmVPX3:`xfawy5m`,$$css:!0}},qP={sm:{kzqmXN:`x6jxa94`,kZKoxP:`x1v9usgg`,k3aq6I:`xbryuvx`,$$css:!0},md:{kzqmXN:`x1kky2od`,kZKoxP:`xlup9mm`,k3aq6I:`xbryuvx`,$$css:!0}},JP={sm:{kzqmXN:`x1kky2od`,kZKoxP:`xlup9mm`,k3aq6I:`xv5t66b xi9aj42`,$$css:!0},md:{kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,k3aq6I:`x15481yp x12xz5k6`,$$css:!0}},YP={sm:{kAzted:`xisnujt`,$$css:!0},md:{kAzted:`xjwf9q1`,$$css:!0}},XP={container:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,$$css:!0},containerLabelHidden:{kOIVth:`xxhr3t`,$$css:!0},containerSpread:{kjj79g:`x1qughib`,kzqmXN:`xh8yej3`,$$css:!0},statusGap:{keoZOQ:`xtbrsbv`,$$css:!0},switchWrapper:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kmuXW:`x2lah0s`,kHBbk8:`xc8icb0`,$$css:!0},input:{kVAEAm:`x10l6tqk`,kogj98:`x1ghz6dp`,kmVPX3:`x1717udv`,kSiTet:`xg01cxk`,kkrTdU:`x1ypdohk x16khyan`,kY2c9j:`x1vjfegm`,k7Eaqz:`xkagaj0`,kAzted:`x80b3aj`,k87sOh:`xijlfn0`,kLqNvP:`x1hsn8va`,k3aq6I:`x8i4i9p`,$$css:!0},inputDisabled:{kkrTdU:`xt0e3qv`,$$css:!0},inputBusy:{kfzvcC:`x47corl`,$$css:!0},track:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kaIpWk:`xjspbzw`,k1ekBW:`x15406qy`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kB7OPa:`x9f619`,kMzoRj:`xc342km x13rsnn2`,ksu8eU:`xng3xce xx61lck`,kVAM5u:`x1w1tqly`,$$css:!0},trackFocus:{kI3sdo:`x1a2a7pz xafswnp`,kInvED:`xwz5zln`,$$css:!0},trackOff:{kWkggS:`xspzpui x1a8ae7b x9yvj25`,$$css:!0},trackOn:{kWkggS:`x1ewilqj xcgwt1n x1jzqe4`,$$css:!0},trackDisabled:{kSiTet:`xbyyjgo`,kVAM5u:`xmnqt3w`,$$css:!0},trackDisabledOff:{kWkggS:`xspzpui`,$$css:!0},thumb:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kaIpWk:`xjspbzw`,k1ekBW:`xh3q6i0`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},thumbOff:{kWkggS:`x10xzikg xwvh9j7`,$$css:!0},thumbOn:{kWkggS:`x10xzikg x1sir5s4`,$$css:!0},labelWrapper:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,kjj79g:`xl56j7k`,$$css:!0}},ZP={width:e=>[{kzqmXN:e==null?e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]};function QP({label:e,isLabelHidden:t=!1,description:n,onChange:r,changeAction:i,isLoading:a=!1,value:o,isDisabled:s=!1,htmlName:c,disabledMessage:l,isOptional:u=!1,isRequired:d=!1,onFocus:f,onBlur:p,labelIcon:m,labelTooltip:h,labelPosition:g=`end`,labelSpacing:v=`hug`,status:y,size:b=`md`,width:x,xstyle:S,className:C,style:w,ref:T,...E}){let D=(0,_.useId)(),O=(0,_.useId)(),k=(0,_.useId)(),A=HM({isRequired:d,isOptional:u}),[,j]=(0,_.useTransition)(),[M,N]=(0,_.useOptimistic)(o),P=a||M!==o,F=M===!0,I=s&&!!l,L=po({placement:`above`,focusTrigger:`always`,isEnabled:I}),R=[];n&&R.push(O),y?.message&&R.push(k),I&&R.push(L.describedBy);let ee=R.length>0?R.join(` `):void 0,z=(0,K.jsxs)(`div`,{...Sr(XP.switchWrapper,WP[b]),children:[(0,K.jsx)(`input`,{ref:Ao(T,L.positionRef),id:D,type:`checkbox`,role:`switch`,name:s?void 0:c,checked:F,disabled:s&&!I,"aria-disabled":I?`true`:void 0,form:I?``:void 0,required:d,"aria-required":A?`true`:void 0,onChange:e=>{if(s||P)return;let t=e.target.checked;r?.(t,e),i&&!e.defaultPrevented&&j(async()=>{N(t),await i(t,e)})},onFocus:f,onBlur:p,"aria-describedby":ee,"aria-invalid":y?.type===`error`||void 0,"aria-busy":P||void 0,...Sr(XP.input,GP[b],s&&XP.inputDisabled,P&&XP.inputBusy)}),(0,K.jsx)(`div`,{"aria-hidden":`true`,...oa(ba(`switch`,{checked:F?`checked`:null,disabled:s?`disabled`:null,size:b}),Sr(XP.track,KP[b],F?XP.trackOn:XP.trackOff,!s&&XP.trackFocus,s&&XP.trackDisabled,s&&!F&&XP.trackDisabledOff)),children:(0,K.jsx)(`div`,{...oa(ba(`switch-thumb`,{checked:F?`checked`:null,size:b}),Sr(XP.thumb,F?JP[b]:qP[b],F?XP.thumbOn:XP.thumbOff)),children:P&&(0,K.jsx)($o,{size:`sm`})})}),P&&(0,K.jsx)(es,{role:`status`,children:`Loading`})]}),B=(0,K.jsx)(`div`,{...Sr(XP.labelWrapper,YP[b]),children:(0,K.jsx)(TM,{...ba(`switch-label`),label:e,inputID:D,isLabelHidden:t,isDisabled:s,isOptional:u,isRequired:d,labelIcon:m,labelTooltip:h,description:n,descriptionID:O})});return(0,K.jsxs)(`div`,{...oa(ba(`switch-field`,{labelPosition:g===`end`?void 0:g,labelSpacing:v===`hug`?void 0:v}),Sr(x!=null&&ZP.width(x),S),C,w),...E,children:[(0,K.jsxs)(`div`,{ref:e=>{L.interactionRef(e)},...Sr(XP.container,t&&XP.containerLabelHidden,v===`spread`&&XP.containerSpread,!s&&UP),children:[` `,g===`start`?(0,K.jsxs)(K.Fragment,{children:[B,z]}):(0,K.jsxs)(K.Fragment,{children:[z,B]})]}),y?.message&&(0,K.jsx)(kM,{type:y.type,message:y.message,id:k,variant:`detached`,xstyle:XP.statusGap}),I&&L.renderTooltip(l)]})}QP.displayName=`Switch`;var $P=[`chrome`,`edge`,`brave`,`chromium`,`safari`,`firefox`],eF=[`embedded`,...$P],tF=e=>$P.some(t=>t===e);function nF(){let[e,t]=(0,_.useState)(),n=(0,_.useRef)(void 0),r=(0,_.useRef)(!1),i=(0,_.useRef)(!0),a=(0,_.useRef)(void 0),o=(0,_.useCallback)(()=>{a.current?.(),a.current=void 0,n.current?.close(),n.current=void 0,i.current&&t(void 0)},[]);return(0,_.useEffect)(()=>(i.current=!0,window.addEventListener(`pagehide`,o),()=>{i.current=!1,window.removeEventListener(`pagehide`,o),o()}),[o]),{container:e,open:async()=>{if(n.current&&!n.current.closed)return n.current.focus(),!0;if(r.current)return!1;r.current=!0;try{let e=window.documentPictureInPicture,r=e?await e.requestWindow({width:460,height:740}):window.open(`about:blank`,`_blank`,`popup,width=460,height=740`);if(!r)return!1;if(!i.current)return r.close(),!1;n.current=r,r.document.title=`OpenPI Browser Bridge`;let o=()=>{r.document.documentElement.lang=document.documentElement.lang,r.document.documentElement.dataset.theme=document.documentElement.dataset.theme,r.document.documentElement.style.cssText=document.documentElement.style.cssText};o(),r.document.documentElement.classList.add(`browser-guide-window`);for(let e of document.styleSheets)try{let t=r.document.createElement(`style`);t.textContent=[...e.cssRules].map(e=>e.cssText).join(` -`),r.document.head.append(t)}catch{if(!e.href)continue;let t=r.document.createElement(`link`);t.rel=`stylesheet`,t.href=e.href,r.document.head.append(t)}let s=r.document.createElement(`main`);s.className=`browser-settings browser-settings-detached`,r.document.body.append(s);let c=new MutationObserver(o);c.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`,`style`,`lang`]});let l=()=>{c.disconnect(),n.current===r&&(n.current=void 0,a.current=void 0,i.current&&t(void 0))};return r.addEventListener(`pagehide`,l,{once:!0}),a.current=()=>{c.disconnect(),r.removeEventListener(`pagehide`,l)},t(s),!0}catch{return o(),!1}finally{r.current=!1}},close:o,isOpen:()=>!!(n.current&&!n.current.closed)}}var rF={chrome:`Chrome`,edge:`Microsoft Edge`,brave:`Brave`,chromium:`Chromium`,safari:`Safari`,firefox:`Firefox`};function iF({browser:e}){return(0,K.jsx)(`span`,{className:`browser-settings-mark ${e}`,"aria-hidden":`true`,children:e===`chrome`||e===`chromium`?(0,K.jsx)(`i`,{}):(0,K.jsx)(me,{})})}function aF({onConfigure:e,setupPending:t=!1}){let{t:n}=cr(),r=nF(),i=(0,_.useRef)(r.isOpen);i.current=r.isOpen;let[a,o]=(0,_.useState)(),[s,c]=(0,_.useState)(),[l,u]=(0,_.useState)(!1),d=l||t,[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(),[g,v]=(0,_.useState)(`chrome`),[y,b]=(0,_.useState)(1),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(),D=(0,_.useRef)(0),O=(0,_.useRef)(null),k=(0,_.useRef)(null),A=(0,_.useRef)(!0);(0,_.useEffect)(()=>{m&&(O.current?.scrollIntoView?.({block:`nearest`}),k.current?.focus({preventScroll:!0}))},[m,y,r.container]);let j=(0,_.useCallback)(async()=>{let e=++D.current;try{let t=await new rf().request(`/api/settings/browser`);return A.current&&e===D.current&&(o(t),c(void 0)),t}catch(t){A.current&&e===D.current&&c(t instanceof Error?t.message:String(t));return}},[]);(0,_.useEffect)(()=>{A.current=!0,j();let e=setInterval(()=>{(document.visibilityState===`visible`||i.current())&&j()},3e3),t=()=>void j();return window.addEventListener(`focus`,t),()=>{A.current=!1,clearInterval(e),window.removeEventListener(`focus`,t)}},[j]);let M=async t=>{u(!0),c(void 0),w(void 0),++D.current;try{let r=await e(`Configure browser access: ${[t.control===void 0?void 0:`browser_control=${t.control}`,t.embedded===void 0?void 0:`browser_embedded=${t.embedded}`,t.defaultBrowser===void 0?void 0:`browser_default=${JSON.stringify(t.defaultBrowser)}`,t.externalBrowsers===void 0?void 0:`browser_external=${JSON.stringify(t.externalBrowsers)}`].filter(e=>e!==void 0).join(`, `)}. Preserve all other settings.`);if(!A.current)return;if(!r)throw Error(n(`setupRequestFailed`));w(n(`setupRequestAccepted`))}catch(e){await j(),A.current&&c(e instanceof Error?e.message:String(e))}finally{A.current&&u(!1)}},N=async(e,t)=>{u(!0),c(void 0),w(void 0);try{if(await new rf().request(`/api/settings/browser/action`,{method:`POST`,body:JSON.stringify({browser:e,action:t})}),A.current)return t===`folder`&&w(n(`browserFolderOpened`)),!0}catch(e){A.current&&c(e instanceof Error?e.message:String(e))}finally{A.current&&u(!1)}return!1},P=e=>e===`embedded`?n(`browserEmbedded`):rF[e];if(!a)return(0,K.jsxs)(`div`,{className:`browser-settings-load`,role:s?`alert`:`status`,children:[(0,K.jsx)(me,{}),(0,K.jsx)(`p`,{children:s||n(`browserLoading`)}),s&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>void j(),children:n(`browserCheck`)})]});let{config:F}=a,R=a.profiles.find(e=>e.current&&e.connected&&e.version===a.extensionVersion),z=e=>a.profiles.filter(t=>t.connected&&t.version===a.extensionVersion&&(e===`embedded`?t.current&&![`safari`,`firefox`].includes(t.browser):t.browser===e)),B=e=>e===`embedded`?F.embedded:F.externalBrowsers.includes(e),V=(e,t)=>e===`embedded`?{embedded:t}:{externalBrowsers:t?[...new Set([...F.externalBrowsers,e])]:F.externalBrowsers.filter(t=>t!==e)},H=e=>{h(e),b(1),w(void 0),S(!1),v(e===`embedded`?R&&![`safari`,`firefox`].includes(R.browser)?R.browser:`chrome`:e)},ne=e=>{let t=z(e).length>0,r=e===`embedded`||a.browsers.some(t=>t.id===e&&t.installed),i=a.profiles.some(t=>t.connected&&t.version!==a.extensionVersion&&(e===`embedded`?t.current&&![`safari`,`firefox`].includes(t.browser):t.browser===e));return(0,K.jsxs)(`div`,{className:`browser-settings-row`,children:[(0,K.jsx)(iF,{browser:e}),(0,K.jsxs)(`div`,{className:`browser-settings-description`,children:[(0,K.jsx)(`strong`,{children:P(e)}),(0,K.jsx)(`span`,{className:t?`connected`:``,children:t?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`i`,{}),n(`browserConnected`)]}):n(i?`browserUpdateNeeded`:r?`browserNeedsSetup`:`browserNotFound`)})]}),(0,K.jsx)(`button`,{className:`browser-settings-button`,type:`button`,disabled:l,"aria-label":n(t?`browserManageNamed`:`browserSetupNamed`,{browser:P(e)}),onClick:()=>H(e),children:n(t?`browserManage`:`browserSetUp`)}),(0,K.jsx)(QP,{label:n(`browserAllowNamed`,{browser:P(e)}),isLabelHidden:!0,size:`sm`,value:B(e),isDisabled:d,onChange:t=>void M(V(e,t))})]},e)},re=m!==void 0&&z(m).length>0,ie=a.browsers.some(e=>e.id===g&&e.installed),ae=g===`safari`||g===`firefox`,U=ae?a.portableExtensionPath??a.extensionPath:a.extensionPath,oe=g===`firefox`?`${U.replace(/[\\/]+$/,``)}/manifest.json`:U,se=g===`safari`?n(`browserSafariSettings`):g===`firefox`?`about:debugging#/runtime/this-firefox`:`${g===`edge`?`edge`:g===`brave`?`brave`:`chrome`}://extensions/`,ce=n(g===`safari`?`browserSafariDeveloper`:g===`firefox`?`browserFirefoxThis`:`browserDeveloperMode`),le=n(g===`safari`?`browserSafariTemporary`:g===`firefox`?`browserFirefoxTemporary`:`browserLoadUnpacked`),de=[n(`browserStepOpen`),ce,n(`browserStepAdd`),n(`browserStepConnect`)];return(0,K.jsxs)(`div`,{className:`browser-settings`,children:[(0,K.jsxs)(`header`,{className:`browser-settings-heading`,children:[(0,K.jsx)(`h2`,{children:n(`browserSettings`)}),(0,K.jsx)(`p`,{children:n(`browserSettingsIntro`)})]}),(0,K.jsxs)(`div`,{className:`browser-settings-card browser-settings-main-card`,children:[(0,K.jsxs)(`div`,{className:`browser-settings-control`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:n(`browserControl`)}),(0,K.jsx)(`p`,{children:n(`browserControlHint`)})]}),(0,K.jsx)(QP,{label:n(`browserControl`),isLabelHidden:!0,size:`sm`,value:F.control,isDisabled:d,onChange:e=>void M({control:e})})]}),(0,K.jsxs)(`div`,{className:`browser-settings-default`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{htmlFor:`browser-default`,children:n(`browserDefault`)}),(0,K.jsx)(`p`,{children:n(`browserDefaultHint`)})]}),(0,K.jsx)(`select`,{id:`browser-default`,value:F.defaultBrowser,disabled:d,onChange:e=>void M({defaultBrowser:e.target.value}),children:eF.map(e=>(0,K.jsxs)(`option`,{value:e,disabled:!B(e),children:[P(e),B(e)?``:` · ${n(`browserBlocked`)}`]},e))})]})]}),!B(F.defaultBrowser)&&(0,K.jsx)(`p`,{className:`browser-settings-warning`,role:`status`,children:n(`browserDefaultBlocked`)}),(0,K.jsxs)(`div`,{className:`browser-settings-section-heading`,children:[(0,K.jsx)(`h3`,{children:n(`browserAllowedTitle`)}),(0,K.jsx)(`span`,{children:!F.control&&n(`browserOffHint`)})]}),(0,K.jsxs)(`div`,{className:`browser-settings-card`,children:[ne(`embedded`),ne(`chrome`),(0,K.jsxs)(`details`,{className:`browser-settings-more`,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(ee,{}),n(`browserMore`)]}),$P.filter(e=>e!==`chrome`).map(ne)]})]}),(0,K.jsx)(`p`,{className:`browser-settings-example`,children:n(`browserSpeakHint`)}),r.container&&(0,K.jsxs)(`div`,{className:`browser-settings-guide-placeholder`,role:`status`,children:[(0,K.jsx)(`p`,{children:n(`browserGuideDetached`)}),(0,K.jsx)(`button`,{type:`button`,className:`browser-settings-button`,onClick:()=>void r.open(),children:n(`browserShowGuide`)}),(0,K.jsx)(`button`,{type:`button`,className:`browser-settings-text-button`,onClick:r.close,children:n(`browserGuideInline`)})]}),m!==void 0&&(e=>r.container?(0,Rt.createPortal)(e,r.container):e)((0,K.jsxs)(`section`,{ref:O,className:`browser-settings-guide`,"aria-label":n(`browserGuideTitle`,{browser:P(m)}),children:[(0,K.jsxs)(`div`,{className:`browser-settings-guide-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{children:n(re?`browserConnectionTitle`:`browserGuideEyebrow`)}),(0,K.jsx)(`h3`,{children:n(`browserGuideTitle`,{browser:P(m)})})]}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,disabled:l,"aria-label":n(`browserCloseGuide`),onClick:()=>{r.close(),h(void 0)},children:(0,K.jsx)(Lt,{})})]}),!r.container&&!re&&(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-text-button`,onClick:async()=>{await r.open()||w(n(`browserGuideBlocked`))},children:[(0,K.jsx)(he,{}),n(`browserGuidePopout`)]}),re?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`browser-settings-ready`,children:[(0,K.jsx)(te,{}),n(`browserConnectionReady`)]}),(0,K.jsx)(`p`,{children:m===`embedded`?n(`browserEmbeddedDetail`):n(`browserExternalDetail`,{browser:P(m)})}),(0,K.jsxs)(`div`,{className:`browser-settings-guide-actions`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-button`,disabled:l,onClick:()=>void N(m===`embedded`?R.browser:m,`manage`),children:[n(`browserManageExtension`),(0,K.jsx)(he,{})]}),(!B(m)||!F.control)&&(0,K.jsx)(`button`,{type:`button`,className:`browser-settings-primary`,disabled:d,onClick:()=>void M({control:!0,...V(m,!0)}),children:n(`browserAllowUse`)}),B(m)&&F.defaultBrowser!==m&&(0,K.jsx)(`button`,{type:`button`,className:`browser-settings-button`,disabled:d,onClick:()=>void M({defaultBrowser:m}),children:n(`browserMakeDefault`)})]})]}):(0,K.jsxs)(K.Fragment,{children:[m===`embedded`&&(0,K.jsxs)(`label`,{className:`browser-settings-install-browser`,children:[n(`browserInstallIn`),(0,K.jsx)(`select`,{value:g,disabled:l,onChange:e=>{v(e.target.value),b(1),S(!1),w(void 0)},children:$P.filter(e=>![`safari`,`firefox`].includes(e)).map(e=>(0,K.jsx)(`option`,{value:e,children:rF[e]},e))})]}),(0,K.jsx)(`ol`,{className:`browser-settings-progress`,"aria-label":n(`browserSetupSteps`),children:de.map((e,t)=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,"aria-current":y===t+1?`step`:void 0,"aria-label":n(`browserStepLabel`,{step:t+1,label:e}),disabled:l,onClick:()=>{b(t+1),w(void 0)},children:[(0,K.jsx)(`span`,{children:t+1}),e]})},e))}),(0,K.jsxs)(`div`,{className:`browser-settings-wizard`,"aria-live":`polite`,children:[(0,K.jsx)(`span`,{className:`browser-settings-step-count`,children:n(`browserStepCount`,{step:y,total:de.length})}),(0,K.jsx)(`h4`,{ref:k,tabIndex:-1,children:n(y===1?`browserOpenManagerTitle`:y===2?g===`safari`?`browserSafariDeveloperTitle`:g===`firefox`?`browserFirefoxDeveloperTitle`:`browserDeveloperTitle`:y===3?`browserInstallTitle`:`browserConnectTitle`,{browser:rF[g]})}),(0,K.jsx)(`p`,{children:n(y===1?g===`safari`?`browserSafariOpenHint`:`browserOpenManagerHint`:y===2?g===`safari`?`browserSafariDeveloperHint`:g===`firefox`?`browserFirefoxDeveloperHint`:`browserDeveloperHint`:y===3?g===`safari`?`browserSafariLoadHint`:g===`firefox`?`browserFirefoxLoadHint`:`browserLoadHint`:`browserConnectHint`,{browser:rF[g]})}),y===1&&(0,K.jsxs)(`div`,{className:`browser-settings-address`,children:[(0,K.jsx)(iF,{browser:g}),(0,K.jsx)(`code`,{children:se})]}),(y===2||y===3)&&(0,K.jsxs)(`figure`,{className:`browser-settings-illustration ${g}`,children:[(0,K.jsx)(`figcaption`,{children:n(`browserIllustration`,{browser:rF[g]})}),(0,K.jsxs)(`div`,{className:`browser-settings-demo`,"aria-hidden":`true`,children:[(0,K.jsxs)(`div`,{className:`browser-settings-demo-bar`,children:[(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`code`,{children:se})]}),(0,K.jsxs)(`div`,{className:`browser-settings-demo-heading`,children:[(0,K.jsx)(`span`,{children:n(`browserExtensions`)}),(0,K.jsxs)(`span`,{className:`browser-settings-demo-toggle ${y===2?`highlight`:``}`,children:[y===2&&(0,K.jsx)(`b`,{className:`browser-settings-target-number`,children:`2`}),ce,g!==`firefox`&&(0,K.jsx)(`i`,{})]})]}),(0,K.jsxs)(`div`,{className:`browser-settings-demo-toolbar`,children:[(0,K.jsxs)(`span`,{className:y===3?`highlight`:``,children:[y===3&&(0,K.jsx)(`b`,{className:`browser-settings-target-number`,children:`3`}),le]}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{})]})]})]}),y===3&&(0,K.jsxs)(`div`,{className:`browser-settings-folder`,children:[(0,K.jsxs)(`div`,{className:`browser-settings-folder-heading`,children:[(0,K.jsx)(G,{}),(0,K.jsx)(`strong`,{children:ae?`browser-extension-portable`:`browser-extension`}),(0,K.jsx)(`span`,{children:n(`browserFolderBundled`)})]}),(0,K.jsx)(`div`,{className:`browser-settings-path`,children:(0,K.jsx)(`code`,{children:oe})}),(0,K.jsxs)(`div`,{className:`browser-settings-guide-actions`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-button`,onClick:async e=>{let t=await wd(oe,e.currentTarget.ownerDocument);S(t),t||w(n(`browserCopyFailed`))},children:[x?(0,K.jsx)(I,{}):(0,K.jsx)(ue,{}),n(x?`browserPathCopied`:`browserCopyPath`)]}),(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-button`,disabled:l,onClick:()=>void N(g,`folder`),children:[(0,K.jsx)(G,{}),n(`browserOpenFolder`)]})]}),(0,K.jsx)(`p`,{children:n(navigator.userAgent.includes(`Mac`)?`browserChooseFolderMac`:`browserChooseFolderOther`)})]}),y===4&&(0,K.jsxs)(`div`,{className:`browser-settings-waiting`,role:`status`,children:[(0,K.jsx)(dt,{}),(0,K.jsx)(`span`,{children:n(`browserWaiting`)})]}),!ie&&(0,K.jsx)(`p`,{className:`browser-settings-warning`,children:n(`browserInstallBrowserFirst`,{browser:rF[g]})}),(0,K.jsxs)(`div`,{className:`browser-settings-wizard-actions`,children:[y>1&&(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-button`,disabled:l,onClick:()=>{b(y-1),w(void 0)},children:[(0,K.jsx)(T,{}),n(`browserPreviousStep`)]}),y===1&&(0,K.jsx)(`button`,{type:`button`,className:`browser-settings-text-button`,disabled:l,onClick:()=>b(4),children:n(`browserAlreadyInstalled`)}),y<4?(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-primary`,disabled:l||!ie,onClick:async()=>{y===1&&!r.isOpen()&&(await r.open()||w(n(`browserGuideBlocked`))),(y===2||await N(g,y===1?`manage`:`connect`))&&b(y+1)},children:[n(y===1?`browserOpenManager`:y===2?g===`firefox`?`browserFirefoxDone`:`browserDeveloperDone`:`browserInstalledConnect`,{browser:rF[g]}),y===2?(0,K.jsx)(E,{}):(0,K.jsx)(he,{})]}):(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-primary`,disabled:l||f,onClick:async()=>{p(!0);let e=await j();if(A.current){p(!1);let t=e?.profiles.some(t=>t.connected&&t.version===e.extensionVersion&&(m===`embedded`?t.current&&![`safari`,`firefox`].includes(t.browser):t.browser===m));w(n(t?`browserConnectionReady`:`browserNotConnectedYet`))}},children:[(0,K.jsx)(dt,{className:f?`settings-spin`:``}),n(`browserCheck`)]})]}),y===4?(0,K.jsxs)(`div`,{className:`browser-settings-connect-help`,children:[(0,K.jsx)(`p`,{children:n(`browserAllowHint`)}),(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-text-button`,disabled:l||!ie,onClick:()=>void N(g,`connect`),children:[n(`browserOpenIn`,{browser:rF[g]}),(0,K.jsx)(he,{})]})]}):y>1&&(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-text-button`,disabled:l||!ie,onClick:()=>void N(g,`manage`),children:[n(`browserReopenManager`),(0,K.jsx)(he,{})]})]})]}),(0,K.jsxs)(`details`,{className:`browser-settings-help`,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(L,{}),n(`browserHelp`)]}),(0,K.jsx)(`p`,{children:n(`browserReloadHint`)}),(0,K.jsx)(`p`,{children:n(`browserSupportedHint`)})]}),s&&(0,K.jsx)(`div`,{className:`browser-settings-error`,role:`alert`,children:s}),(0,K.jsx)(`div`,{className:`browser-settings-feedback`,role:`status`,"aria-live":`polite`,children:l?n(`browserSaving`):C})]})),!m&&s&&(0,K.jsxs)(`div`,{className:`browser-settings-error`,role:`alert`,children:[s,(0,K.jsx)(`button`,{type:`button`,onClick:()=>void j(),children:n(`browserCheck`)})]}),(0,K.jsx)(`div`,{className:`browser-settings-feedback`,role:`status`,"aria-live":`polite`,children:!m&&(l?n(`browserSaving`):C)})]})}function oF({label:e,value:t,options:n,disabled:r,onChange:i}){return(0,K.jsx)(jA,{button:{label:n.find(e=>e.value===t)?.label??t,"aria-label":e,variant:`secondary`,size:`sm`,className:`configuration-menu-trigger`,isDisabled:r},className:`configuration-menu`,menuWidth:`min(360px, calc(100vw - 32px))`,alignment:`end`,items:n.map(e=>({id:e.value,label:e.label,isDisabled:r,description:e.description?(0,K.jsx)(`span`,{className:`configuration-option-description`,children:e.description}):void 0,endContent:t===e.value?(0,K.jsx)(I,{"aria-hidden":`true`}):void 0,onClick:()=>{e.value!==t&&i(e.value)}}))})}function sF({catalog:e,error:t,pending:n,preferencePending:r,onConfigure:i,onUpdatePreferences:a,onRefresh:o,onOpenRuntimeStatus:s}){let{t:c}=cr(),l=e?.setupWritable===!1||!!e?.resources.diagnostics.settingsErrors,u=n||r||!!t||!!e?.resources.diagnostics.settingsErrors,d=e?.setup.ui.webHiddenThinkingLevels??[],f=(e?.thinking?.available??[]).filter(e=>[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`].includes(e)),p=e?.setup.response?.verbosity??`default`,m=e?.setup.response?.reasoningSummary??`default`;return(0,K.jsxs)(`section`,{className:`settings-configuration-panel`,children:[(0,K.jsxs)(`header`,{className:`settings-page-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{children:c(`configurationSettings`)}),(0,K.jsx)(`p`,{children:c(`configurationIntro`)})]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":c(`refreshStatus`),onClick:o,children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]}),t&&(0,K.jsx)(`p`,{className:`inspection-warning`,role:`alert`,children:t}),!e&&!t&&(0,K.jsx)(`p`,{role:`status`,children:c(`settingsCatalogLoading`)}),l&&(0,K.jsxs)(`p`,{className:`inspection-warning`,role:`alert`,children:[c(`configurationReadFailure`),e?.setupDiagnostics?.map(e=>(0,K.jsxs)(`span`,{children:[e.path,`: `,e.message]},`${e.path}:${e.message}`))]}),e&&!l&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`configuration-scope`,children:[(0,K.jsxs)(`span`,{className:`configuration-scope-label`,children:[(0,K.jsx)(Nt,{"aria-hidden":`true`}),c(`configurationUserScope`)]}),(0,K.jsx)(`span`,{children:c(`configurationSetupHint`)})]}),(0,K.jsxs)(`div`,{className:`configuration-group`,children:[(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`configurationApproval`)}),(0,K.jsx)(`p`,{children:c(`configurationApprovalDetail`)})]}),(0,K.jsx)(`span`,{className:`configuration-readonly`,children:c(`configurationPiPermissions`)})]}),(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`configurationSandbox`)}),(0,K.jsx)(`p`,{children:c(`configurationSandboxDetail`)})]}),(0,K.jsx)(`span`,{className:`configuration-readonly`,children:c(`configurationSandboxUnavailable`)})]}),(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`webSearchSettings`)}),(0,K.jsx)(`p`,{children:c(`configurationSearchDetail`)}),e.webSearch?.available!==!0&&(0,K.jsx)(`p`,{children:c(`webSearchUnsupported`)})]}),(0,K.jsx)(`div`,{className:`configuration-control`,children:(0,K.jsx)(oF,{label:c(`webSearchSettings`),value:e.setup.webSearch?.enabled===!0?`on`:`off`,options:[{value:`off`,label:c(`disabled`),description:c(`configurationSearchOff`)},{value:`on`,label:c(`enabled`),description:c(`configurationSearchOn`)}],disabled:u,onChange:e=>{i(c(e===`on`?`webSearchNativeRequest`:`webSearchDisableRequest`))}})})]}),(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`configurationVerbosity`)}),(0,K.jsx)(`p`,{children:c(`configurationVerbosityDetail`)}),e.responseSupport?.verbosity!==!0&&(0,K.jsx)(`p`,{children:c(`configurationResponsesUnavailable`)})]}),(0,K.jsx)(`div`,{className:`configuration-control`,children:(0,K.jsx)(oF,{label:c(`configurationVerbosity`),value:p,options:[`default`,`low`,`medium`,`high`].map(e=>({value:e,label:c(`configurationVerbosity_${e}`),description:e==="default"?void 0:c(`configurationVerbosityHelp_${e}`)})),disabled:u||e.responseSupport?.verbosity!==!0,onChange:e=>{i(c(`configurationVerbosityRequest`,{value:e}))}})})]}),(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`configurationSummary`)}),(0,K.jsx)(`p`,{children:c(`configurationSummaryDetail`)}),e.responseSupport?.reasoningSummary!==!0&&(0,K.jsx)(`p`,{children:c(`configurationSummaryUnavailable`)})]}),(0,K.jsx)(`div`,{className:`configuration-control`,children:(0,K.jsx)(oF,{label:c(`configurationSummary`),value:m,options:[`default`,`auto`,`concise`,`detailed`,`none`].map(e=>({value:e,label:c(`configurationSummary_${e}`),description:e==="default"?void 0:c(`configurationSummaryHelp_${e}`)})),disabled:u||e.responseSupport?.reasoningSummary!==!0,onChange:e=>{i(c(`configurationSummaryRequest`,{value:e}))}})})]})]}),(0,K.jsxs)(`section`,{className:`configuration-section`,children:[(0,K.jsx)(`h2`,{children:c(`configurationModelFeatures`)}),(0,K.jsx)(`div`,{className:`configuration-group`,children:(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`configurationReasoningLevels`)}),(0,K.jsx)(`p`,{children:c(`configurationReasoningDetail`)})]}),(0,K.jsx)(`div`,{className:`configuration-control`,children:(0,K.jsx)(jA,{button:{label:c(`configurationReasoningCount`,{count:f.filter(e=>!d.includes(e)).length}),"aria-label":c(`configurationReasoningLevels`),variant:`secondary`,size:`sm`,className:`configuration-menu-trigger`,isDisabled:u||f.length===0},className:`configuration-level-menu`,menuWidth:`min(240px, calc(100vw - 32px))`,alignment:`end`,children:f.map(e=>(0,K.jsx)(XA,{label:e,value:!d.includes(e),isDisabled:u,endContent:(0,K.jsx)(`span`,{className:`configuration-check`,children:!d.includes(e)&&(0,K.jsx)(I,{"aria-hidden":`true`})}),onChange:t=>{a({thinkingLevelVisibility:{level:e,visible:t}})}},e))})})]})})]}),(0,K.jsxs)(`section`,{className:`configuration-section`,children:[(0,K.jsx)(`h2`,{children:c(`configurationDependencies`)}),(0,K.jsx)(`div`,{className:`configuration-group`,children:(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`configurationEnvironment`)}),(0,K.jsx)(`p`,{children:c(`configurationEnvironmentDetail`)})]}),(0,K.jsxs)(`button`,{type:`button`,className:`configuration-runtime-button`,onClick:s,children:[c(`configurationRuntimeStatus`),(0,K.jsx)(O,{"aria-hidden":`true`})]})]})})]})]})]})}function cF({catalog:e,error:t,pending:n,onConfigure:r,onRefresh:i}){let{t:a}=cr(),o=e?.setup.webSearch?.enabled===!0,s=e?.webSearch?.available===!0,c=n||!e||!!t||!!e?.resources.diagnostics.settingsErrors;return(0,K.jsxs)(`section`,{className:`settings-general-panel settings-web-search-panel`,children:[(0,K.jsxs)(`header`,{className:`settings-page-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{children:a(`webSearchSettings`)}),(0,K.jsx)(`p`,{children:a(`webSearchIntro`)})]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":a(`refreshStatus`),onClick:i,children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]}),t&&(0,K.jsx)(`p`,{className:`inspection-warning`,role:`alert`,children:t}),!e&&!t&&(0,K.jsx)(`p`,{role:`status`,children:a(`settingsCatalogLoading`)}),(0,K.jsxs)(`section`,{className:`settings-section-block`,children:[(0,K.jsxs)(`div`,{className:`settings-detail-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`h2`,{children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),a(`webSearchCurrentModel`)]}),(0,K.jsx)(`p`,{children:a(`webSearchNativeDetail`)})]}),(0,K.jsx)(`span`,{className:`settings-status-badge`,children:a(o?`enabled`:`disabled`)})]}),(0,K.jsxs)(`dl`,{className:`settings-detail-metadata`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:a(`source`)}),(0,K.jsx)(`dd`,{children:a(`webSearchCurrentModel`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:a(`model`)}),(0,K.jsx)(`dd`,{children:e?.webSearch?.model?`${e.webSearch.provider} / ${e.webSearch.model}`:a(`unavailable`)})]})]}),(0,K.jsx)(`p`,{className:`settings-resource-caption`,children:a(`webSearchDefaultOff`)}),(0,K.jsx)(`p`,{role:`status`,className:`settings-resource-caption`,children:a(s?`webSearchSupported`:`webSearchUnsupported`)})]}),(0,K.jsx)(`section`,{className:`settings-section-block settings-chat-controls`,children:(0,K.jsx)(qc,{label:a(o?`webSearchDisable`:`webSearchEnable`),variant:`secondary`,size:`sm`,isDisabled:c,isLoading:n,onClick:()=>void r(a(o?`webSearchDisableRequest`:`webSearchNativeRequest`))})})]})}var lF={wrapper:{k8WAf4:`xu0wf1k`,kg3NbH:`x7a5moj`,$$css:!0},icon:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kmuXW:`x2lah0s`,$$css:!0}};function uF({ref:e,label:t,clearLabel:n,placeholder:r,value:i,onValueChange:a,onKeyDown:o,onFocus:s,onBlur:c,onContainerKeyDown:l,xstyle:u,className:d,style:f,...p}){let[m,h]=(0,_.useState)(!1);(0,_.useEffect)(()=>{Zi()},[]);let g=(0,_.useCallback)(e=>{h(Qi()===`keyboard`),s?.(e)},[s]),v=(0,_.useCallback)(e=>{h(!1),c?.(e)},[c]),y=(0,_.useCallback)(()=>{a(``),typeof e==`object`&&e?.current&&e.current.focus()},[a,e]);return(0,K.jsx)(`div`,{onKeyDown:l,...oa(Sr(lF.wrapper,u),d,f),children:(0,K.jsxs)(`div`,{"data-keyboard-focus":m?`true`:void 0,...{0:{className:`x9f619 x78zum5 x6s0dn4 x1txdalj xh8yej3 x1vofgu7 xf314gf xh6dtrn xkdsq27 xuedmi6 x12w9bfk xlr8y92`},1:{className:`x9f619 x78zum5 x6s0dn4 x1txdalj xh8yej3 x1vofgu7 xf314gf xh6dtrn xkdsq27 xuedmi6 x12w9bfk xlr8y92 x1gnnqk1 x1btxeh5`}}[!!m<<0],children:[(0,K.jsx)(xu,{icon:`search`,size:`sm`,color:`secondary`,xstyle:lF.icon}),(0,K.jsx)(`input`,{ref:e,type:`text`,"aria-label":t,placeholder:r,value:i,onChange:e=>a(e.target.value),onKeyDown:o,onFocus:g,onBlur:v,className:`x1iyjqo2 xs83m0k xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w x1tgivj0 x9ynric xcr08ib xdk3u5w x1kq96og x1a2a7pz xeyghm5`,...p}),i!==``&&(0,K.jsx)(zM,{label:n,onClick:y})]})})}uF.displayName=`PanelSearchInput`;function dF(e){return typeof e==`string`||!(`type`in e)}function fF(e){return typeof e==`object`&&`type`in e&&e.type===`divider`}function pF(e){return typeof e==`object`&&`type`in e&&e.type===`section`}function mF(e){return typeof e==`string`?{value:e,label:e}:{...e,label:e.label??e.value}}function hF(e){let t=[];for(let n of e)if(dF(n))t.push(mF(n));else if(pF(n))for(let e of n.options)t.push(mF(e));return t}var gF=1;function _F(e){let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t}function vF({isOpen:e,selectedItemIndex:t,listboxId:n,listboxRef:r,anchorRef:i}){let[a,o]=(0,_.useState)(0),[s,c]=(0,_.useState)(!1),l=(0,_.useCallback)((e,t)=>{o(e),c(t)},[]);return wu(()=>{if(!e){l(0,!1);return}if(!r.current||!i.current){l(0,!0);return}let a=`${n}-item-${t>=0?t:0}`,o=document.getElementById(a);if(!o){l(0,!0);return}let s=r.current,c=i.current.getBoundingClientRect(),u=s.offsetHeight;if(u<=0){l(0,!0);return}let d=_F(o)-_F(s)-s.scrollTop+o.offsetHeight/2,f=c.top+c.height/2-d-gF,p=window.innerHeight,m=Math.max(0,p-u),h=Math.min(Math.max(f,0),m),g=Math.max(0,c.bottom-h);l(g,!0)},[e,t,n,r,i,l]),{offset:a,isPositioned:s}}function yF({selectableItems:e,value:t,isDisabled:n=!1,isOpen:r,hasSearch:i=!1,onOpen:a,onClose:o,onSelect:s,onClear:c,onSearchSeed:l,wasJustDismissed:u,listboxId:d}){let[f,p]=(0,_.useState)(-1),m=(0,_.useCallback)(e=>`${d}-item-${e}`,[d]),h=(0,_.useCallback)(()=>e.map((e,t)=>e.disabled?-1:t).filter(e=>e>=0),[e]),g=(0,_.useCallback)(()=>e.findIndex(e=>e.value===t),[e,t]),v=(0,_.useCallback)(()=>{p(-1),o()},[o]),y=(0,_.useCallback)(e=>{e.disabled||(s?.(e.value),v())},[s,v]),b=(0,_.useCallback)(()=>{if(!(n||u?.())){if(r)v();else if(a(),!i){let e=g();p(e>=0?e:0)}}},[n,u,r,a,v,g,i]),x=(0,_.useCallback)((e,t)=>{e.disabled||p(t)},[]);return{highlightedIndex:f,setHighlightedIndex:p,getItemId:m,onTriggerClick:b,onKeyDown:(0,_.useCallback)(o=>{if(n)return;let s=h();switch(o.key){case`ArrowDown`:if(o.preventDefault(),!r)a(),p(0);else{let e=s.indexOf(f),t=Math.min(e+1,s.length-1);p(s[t]??f)}break;case`ArrowUp`:if(o.preventDefault(),!r)a(),p(e.length-1);else{let e=s.indexOf(f),t=Math.max(e-1,0);p(s[t]??f)}break;case` `:if(i)break;case`Enter`:if(o.preventDefault(),r&&f>=0){let t=e[f];t&&!t.disabled&&y(t)}else if(!r&&(a(),!i)){let e=g();p(e>=0?e:0)}break;case`Escape`:r&&(o.preventDefault(),v());break;case`Tab`:r&&v();break;case`Home`:o.preventDefault(),r&&s.length>0&&p(s[0]);break;case`End`:o.preventDefault(),r&&s.length>0&&p(s[s.length-1]);break;case`PageUp`:o.preventDefault(),r&&s.length>0&&p(s[0]);break;case`PageDown`:o.preventDefault(),r&&s.length>0&&p(s[s.length-1]);break;case`Delete`:case`Backspace`:!i&&!r&&c!=null&&t!=null&&(o.preventDefault(),c());break;default:i&&l&&o.key.length===1&&!o.ctrlKey&&!o.metaKey&&(r||a(),l(o.key))}},[n,r,a,v,e,f,y,g,h,i,c,l,t]),onItemSelect:y,onItemMouseEnter:x}}var bF=(0,_.createContext)(`stacked`);bF.displayName=`SelectorRowLayoutContext`;function xF(){return(0,_.use)(bF)}var SF={root:{k8WAf4:`xt970qd`,kg3NbH:`xnjsko4`,kaIpWk:`x2u8bby`,$$css:!0}};function CF({icon:e,label:t,description:n,layout:r,endContent:i,xstyle:a,className:o,style:s}){let c=xF();return(0,K.jsx)(qk,{startContent:e?Cu(e,{size:`sm`,color:`secondary`}):void 0,label:t,description:n,layout:c===`inline`?`inline`:r,endContent:i,xstyle:[SF.root,a],...oa(ba(`selector-option`),{className:o,style:s})})}CF.displayName=`SelectorOption`;var wF={triggerContainer:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xrrkdod`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib xdk3u5w`,kLWn49:`x7acx1w`,kMwMTN:`x1tgivj0`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},triggerPlaceholder:{kMwMTN:`xv1l7n4`,$$css:!0},triggerInGroup:{kAzted:`x2lwn1j`,k8WAf4:`xt970qd`,$$css:!0},triggerIcon:{kmuXW:`x2lah0s`,$$css:!0},triggerIconRotation:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,k3nNDw:`x1g0ag68`,$$css:!0},triggerIconOpen:{k3aq6I:`x19jd1h0`,$$css:!0},triggerGhost:{kzqmXN:`x14atkfc`,kMzoRj:`xc342km`,kWkggS:`xjbqb8w`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4`,$$css:!0},triggerGhostDisabled:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q`,$$css:!0},statusButton:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kaIpWk:`xh6dtrn`,$$css:!0},searchRowInput:{kg3NbH:`x2hg6jq`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,$$css:!0},divider:{kqGvvJ:`xsq74q5`,$$css:!0},item:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,kmVPX3:`xlsj2fj`,kaIpWk:`xh6dtrn`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},itemHighlighted:{kWkggS:`x1lmrjuc`,$$css:!0},itemSelected:{k63SB2:`x1e4wzip`,$$css:!0},itemDisabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0}},TF={sm:{kAzted:`x1gdqauq`,k8WAf4:`x1ecmfrv`,$$css:!0},md:{kAzted:`x1uogy3y`,k8WAf4:`x1ioay2v`,$$css:!0},lg:{kAzted:`x1xf4nls`,k8WAf4:`x1vn5h1t`,$$css:!0}},EF={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}},DF={warning:`warning`,error:`error`,success:`success`},OF={warning:`warning`,error:`error`,success:`success`},kF={warning:`@astryx.input.statusButton.warning`,error:`@astryx.input.statusButton.error`,success:`@astryx.input.statusButton.success`};function AF({option:e}){return(0,K.jsx)(CF,{icon:e.icon,label:e.label??e.value,description:e.description})}function jF(e,t){return!t||(e.label??e.value).toLowerCase().includes(t.toLowerCase())}function MF(e,t){return t?e.filter(e=>jF(e,t)):e}function NF(e){let t=Rc(),{label:n,isLabelHidden:r=!1,description:i,isOptional:a=!1,isRequired:o=!1,isDisabled:s=!1,disabledMessage:c,options:l,value:u,onChange:d,changeAction:f,isLoading:p=!1,placeholder:m,size:h,variant:g=`input`,status:v,statusVariant:y=`attached`,labelTooltip:b,startIcon:x,htmlName:S,renderOption:C,renderValue:w,indicatorPosition:T=`end`,hasSearch:E=!1,searchPlaceholder:D,emptyText:O,emptySearchText:k,placement:A,isDefaultOpen:j=!1,"data-testid":M,width:N,xstyle:P,className:F,style:I,hasClear:L,id:R,...ee}=e,z=HM({isRequired:o,isOptional:a}),B=m??t(`@astryx.selector.placeholder`),V=D??t(`@astryx.selector.searchPlaceholder`),H=O??t(`@astryx.selector.empty`),te=k??t(`@astryx.selector.emptySearchResults`),ne=L===!0,re=as(h,`md`),ie=g===`ghost`&&y===`attached`?`detached`:y,ae=u===null?void 0:u,U=(0,_.useId)(),oe=R??U,se=(0,_.useId)(),ce=(0,_.useId)(),le=(0,_.useId)(),ue=(0,_.useId)(),de=(0,_.useId)(),fe=(0,_.useRef)(null),pe=(0,_.useRef)(null),me=(0,_.useRef)(null),W=WM(),[he,ge]=(0,_.useState)(``),_e=(0,_.useRef)(``),ve=he.length>0,[,ye]=(0,_.useTransition)(),[be,xe]=(0,_.useOptimistic)(ae),Se=p||be!==ae,Ce=so(),we=typeof H==`string`?H:t(`@astryx.selector.empty`),Te=typeof te==`string`?te:t(`@astryx.selector.emptySearchResults`),G=s&&!!c,Ee=po({placement:`above`,focusTrigger:`always`,isEnabled:G}),De=po({placement:`above`,isEnabled:ie===`tooltip`&&!!v?.message}),{ariaLabelledBy:Oe,ariaDescribedBy:ke}=Oa(ue,[i?ce:null,!W&&ie!==`tooltip`&&v?.message?le:null,ie===`tooltip`&&v?.message?De.describedBy:null,G?Ee.describedBy:null],W),Ae=(0,_.useMemo)(()=>hF(l),[l]),je=(0,_.useMemo)(()=>MF(Ae,he),[Ae,he]),Me=(0,_.useMemo)(()=>Ae.findIndex(e=>e.value===be),[Ae,be]),Ne=(0,_.useMemo)(()=>Me>=0?Ae[Me]:void 0,[Ae,Me]),Pe=(0,_.useRef)(null),Fe=(0,_.useRef)(()=>{}),Ie=dd({onHide:(0,_.useCallback)(()=>{ge(``),_e.current=``,Fe.current(),Ce(``),pe.current?.focus()},[Ce]),hasLightDismiss:!0,hasCloseButton:!1,hasAutoFocus:!1,role:`none`,surfaceTarget:`selector-popup`}),Le=yi(Ie.id,Ie.isOpen);(0,_.useEffect)(()=>{j&&Ie.show()},[]);let Re=(0,_.useCallback)(e=>{if(e.length===0){Ce(``);return}if(p){Ce(``);return}let n=MF(Ae,e).length;Ce(n===0?Te:t(`@astryx.selector.resultCount`,{count:n}))},[Ce,p,Ae,Te,t]),ze=(0,_.useCallback)(e=>{ge(e),_e.current=e,Re(e)},[Re]),Be=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!(Ie.isOpen&&!p&&he===``&&Ae.length===0)){Be.current=null;return}Be.current!==we&&(Be.current=we,Ce(we))},[Ie.isOpen,p,he,Ae.length,we,Ce]);let Ve=A==null&&!E,{offset:He,isPositioned:Ue}=vF({isOpen:Ie.isOpen&&Ve,selectedItemIndex:Me,listboxId:se,listboxRef:Pe,anchorRef:fe}),We=Ve?He:0,Ge=!Ve||Ue,Ke=A??`below`,qe=We>0?{marginBlockStart:`-${We}px`}:void 0,Je=(0,_.useCallback)(()=>{Fe.current(),d?.(null),f&&ye(async()=>{xe(void 0),await f(null)})},[d,f,ye,xe]),Ye=(0,_.useCallback)(e=>{let t=_e.current+e;_e.current=t,ge(t),Re(t)},[Re]),Xe=(0,_.useCallback)(e=>{d?.(e),f&&ye(async()=>{xe(e),await f(e)})},[d,f,ye,xe]),{highlightedIndex:Ze,setHighlightedIndex:Qe,getItemId:$e,onTriggerClick:et,onKeyDown:tt,onItemSelect:nt,onItemMouseEnter:rt}=yF({selectableItems:je,wasJustDismissed:Ie.wasJustDismissed,value:be,isDisabled:s,isOpen:Ie.isOpen,hasSearch:E,onOpen:(0,_.useCallback)(()=>{Ie.show(),E&&requestAnimationFrame(()=>{let e=me.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))})},[Ie,E]),onClose:Ie.hide,onSelect:Xe,onClear:ne?Je:void 0,onSearchSeed:Ye,listboxId:se}),it=_A({getItemLabels:()=>Ae.map(e=>e.label??e.value),isDisabled:e=>Ae[e]?.disabled===!0,getCurrentIndex:()=>Ie.isOpen?Ze:Me,onMatch:e=>{let t=Ae[e];Ie.isOpen?Qe(e):t.value!==be&&(Xe(t.value),Ce(t.label??t.value))}});Fe.current=it.reset;let at=(0,_.useCallback)(e=>{if(!s&&!E&&it.onKeyDown(e)){e.preventDefault();return}tt(e)},[s,E,it,tt]);(0,_.useEffect)(()=>{!Ie.isOpen||Ze<0||document.getElementById($e(Ze))?.scrollIntoView?.({block:`nearest`})},[Ie.isOpen,Ze,$e]);let ot=(0,_.useCallback)(e=>{e.stopPropagation(),Je()},[Je]),st=(0,_.useCallback)(()=>E?(0,K.jsx)(uF,{ref:me,id:de,label:t(`@astryx.selector.searchOptions`),clearLabel:t(`@astryx.textInput.clearLabel`,{label:t(`@astryx.selector.searchOptions`)}),...ba(`selector-search`),xstyle:g!==`ghost`&&wF.searchRowInput,role:`combobox`,"aria-expanded":Ie.isOpen,"aria-controls":se,"aria-autocomplete":`list`,"aria-activedescendant":Ie.isOpen&&Ze>=0?$e(Ze):void 0,value:he,onValueChange:ze,onContainerKeyDown:e=>{e.target!==me.current&&e.key===`Tab`&&!e.shiftKey&&tt(e)},onKeyDown:e=>{if(!Di(e.nativeEvent)){if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Enter`||e.key===`Escape`){tt(e);return}e.key===`Tab`&&(e.shiftKey||!ve)&&tt(e)}},placeholder:V}):null,[E,de,se,he,ve,V,ze,tt,Ie.isOpen,Ze,$e,g,t]),ct=JA(`check`),lt=(0,_.useCallback)((e,t)=>{let n=t===Ze,r=e.value===ae,i=(0,K.jsx)(`span`,{className:`x3nfvp2 x6s0dn4 xl56j7k x2lah0s xgomdpo`,children:(0,K.jsx)(ct,{state:r?`checked`:`unchecked`,size:`sm`,isDisabled:e.disabled??!1,...ba(`selector-check`)})}),a=(0,K.jsx)(`span`,{className:`x78zum5 x6s0dn4 x1txdalj x98rzlu xeuugli`,children:C?C(e):(0,K.jsx)(AF,{option:e})}),o=T===`start`?(0,K.jsxs)(K.Fragment,{children:[i,a]}):(0,K.jsxs)(K.Fragment,{children:[a,i]});return(0,K.jsx)(`div`,{id:$e(t),role:`option`,"aria-selected":r,"aria-disabled":e.disabled,onClick:()=>nt(e),onMouseEnter:()=>rt(e,t),...oa(ba(`selector-option-row`,{size:re,selected:r?`selected`:null,disabled:e.disabled?`disabled`:null}),Sr(wF.item,EF[re],n&&wF.itemHighlighted,r&&wF.itemSelected,e.disabled&&wF.itemDisabled)),children:o},e.value)},[C,T,Ze,re,ae,$e,nt,rt,ct]),ut=(0,_.useCallback)(()=>{let e=E&&!!he;if(je.length===0&&!p)return[(0,K.jsx)(`div`,{role:`presentation`,...oa(ba(`selector-empty-state`),{className:`x1b2ylru x2b8uid xv1l7n4 x9ynric xcr08ib`}),children:e?te:H},`empty`)];let t=0,n=[];for(let r=0;r{fe.current=e,Ie.triggerRef(e),Ee.ref(e)},onClick:et,"data-testid":M,...oa(ba(`selector`,{variant:g,size:re,status:v?.type??null,disabled:s?`disabled`:null}),Sr(NM.base,wF.triggerContainer,TF[re],g===`ghost`&&wF.triggerGhost,g===`ghost`&&ds.backgroundImage,g===`ghost`&&Ha.focusWithin,s&&NM.disabled,g===`ghost`&&s&&wF.triggerGhostDisabled,!Ne&&wF.triggerPlaceholder,g!==`ghost`&&v&&PM[v.type],g!==`ghost`&&v&&!s&&FM[v.type],g!==`ghost`&&W&&VM.inGroup,W&&wF.triggerInGroup,P),F,I),children:[x&&Cu(x,{size:`sm`,color:`secondary`}),W&&(0,K.jsx)(es,{id:ue,children:n}),(0,K.jsx)(`button`,{ref:pe,id:oe,type:`button`,role:E?void 0:`combobox`,...ee,"aria-haspopup":`listbox`,"aria-expanded":Ie.isOpen,"aria-controls":se,"aria-activedescendant":!E&&Ie.isOpen&&Ze>=0?$e(Ze):void 0,"aria-describedby":ke,"aria-labelledby":Oe,"aria-required":z?`true`:void 0,"aria-invalid":v?.type===`error`?`true`:void 0,"aria-busy":Se||void 0,disabled:s&&!G,"aria-disabled":G?`true`:void 0,onKeyDown:at,tabIndex:s&&!G?-1:0,...{0:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz`},1:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz xkh2ocl`}}[!!W<<0],children:pt}),S!=null&&(0,K.jsx)(`input`,{type:`hidden`,name:S,value:u??``,disabled:s}),Se&&(0,K.jsx)($o,{size:`sm`}),ne&&u!=null&&!s&&(0,K.jsx)(BM,{...Le,label:t(`@astryx.selector.clearLabel`,{label:n}),onClick:ot,iconClassName:pa(`selector-clear-icon`)}),dt?ft?(0,K.jsx)(`button`,{ref:De.ref,type:`button`,"aria-label":t(kF[v.type]),"aria-describedby":De.describedBy,...Le,onClick:e=>e.stopPropagation(),...Sr(Ha.focusVisible,wF.statusButton),children:(0,K.jsx)(xu,{icon:DF[v.type],size:`sm`,color:OF[v.type],xstyle:wF.triggerIcon})}):(0,K.jsx)(xu,{icon:DF[v.type],size:`sm`,color:OF[v.type],xstyle:wF.triggerIcon}):(0,K.jsx)(xu,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:[wF.triggerIcon,wF.triggerIconRotation,Ie.isOpen&&wF.triggerIconOpen],...ba(`selector-indicator-icon`,{state:Ie.isOpen?`expanded`:`collapsed`})})]}),Ie.render(E?(0,K.jsxs)(`div`,{children:[st(),(0,K.jsx)(iA,{}),(0,K.jsx)(`div`,{ref:Pe,id:se,role:`listbox`,"aria-labelledby":oe,...{0:{className:`x9f619 xuyqlj2 x1odjw0f xu0wf1k x7a5moj x1hc1fzr x1ey1afo`},1:{className:`x9f619 xuyqlj2 x1odjw0f xu0wf1k x1hc1fzr x1ey1afo x2hg6jq`}}[(g!==`ghost`)<<0],children:ut()})]}):(0,K.jsx)(`div`,{ref:Pe,id:se,role:`listbox`,"aria-labelledby":oe,...{0:{className:`x9f619 xuyqlj2 x1odjw0f xu0wf1k x7a5moj x1hc1fzr x1ey1afo`},2:{className:`x9f619 xuyqlj2 x1odjw0f xu0wf1k x1hc1fzr x1ey1afo x2hg6jq`},1:{className:`x9f619 xuyqlj2 x1odjw0f xu0wf1k x7a5moj xg01cxk xq2gx43`},3:{className:`x9f619 xuyqlj2 x1odjw0f xu0wf1k x2hg6jq xg01cxk xq2gx43`}}[(g!==`ghost`)<<1|!Ge<<0],children:ut()}),{placement:Ke,alignment:`start`,offset:Ve?void 0:Br[`--spacing-1`],xstyle:[wF.popover,co[Ke]],style:qe}),ft&&De.renderTooltip(v?.message??``),G&&Ee.renderTooltip(c)]});return W?mt:(0,K.jsx)(MM,{label:n,isLabelHidden:r,description:i,inputID:oe,descriptionID:i?ce:void 0,isOptional:a,isRequired:o,isDisabled:s,status:v?{type:v.type,message:v.message,messageID:v.message?le:void 0}:void 0,statusVariant:ie,labelTooltip:b,width:N,children:mt})}NF.displayName=`Selector`;function PF(e){return e?.status===`running`||e?.status===`cancelling`}function FF({sessionId:e,auth:t,busy:n,onSaving:r,onAuthenticated:i,onReload:a}){let{t:o}=cr(),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(0),[v,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(!1),E=(0,_.useRef)(!1),D=(0,_.useRef)(null),k=(0,_.useRef)(!1),A=(0,_.useRef)(null),j=(0,_.useRef)({onSaving:r,onAuthenticated:i});j.current={onSaving:r,onAuthenticated:i};let M=PF(s),N=t.id,P=`${e}:${N}`,F=(0,_.useRef)({key:P});F.current.key!==P&&(F.current={key:P});let L=F.current,R=(0,_.useCallback)((t,n)=>{if(t&&(t.sessionId!==e||t.provider!==N||n&&t.id!==n))throw Error(`Login ownership changed`);if(n&&!t)throw Error(`Login status unavailable`);if(!E.current||F.current!==L){t&&PF(t)&&new rf().cancelProviderLogin(e,t.id).catch(()=>void 0);return}D.current=t,c(t),m(!1),t?.status===`succeeded`&&!t.refreshRequired&&A.current!==t.id&&(A.current=t.id,j.current.onAuthenticated())},[e,N,L]);(0,_.useEffect)(()=>{E.current=!0,D.current=null,k.current=!1,A.current=null,c(null),u(!1),f(!1),m(!1),x(!1),T(!1);let t=new AbortController;return new rf().providerLogin(e,void 0,t.signal).then(e=>{!t.signal.aborted&&e?.provider===N&&PF(e)&&R(e)}).catch(()=>void 0),()=>{E.current=!1,t.abort();let n=D.current;n&&PF(n)&&new rf().cancelProviderLogin(e,n.id).catch(()=>void 0),j.current.onSaving(!1)}},[e,N,R]),(0,_.useEffect)(()=>{j.current.onSaving(M||l)},[M,l]);let ee=s?.prompt?.id;(0,_.useEffect)(()=>{y(``)},[ee]);let z=s?.id;(0,_.useEffect)(()=>{x(!1)},[z]),(0,_.useEffect)(()=>{if(!M||!z)return;let t=new AbortController,n=0,r=async()=>{try{let i=await new rf().providerLogin(e,z,t.signal);if(t.signal.aborted)return;R(i,z),PF(i)&&(n=window.setTimeout(()=>void r(),900))}catch{t.signal.aborted||m(!0)}};return r(),()=>{t.abort(),clearTimeout(n)}},[e,R,z,M,h]);let B=async e=>{if(!k.current){k.current=!0,u(!0),f(!1);try{R(await e())}catch{E.current&&F.current===L&&f(!0)}finally{F.current===L&&(k.current=!1,E.current&&u(!1))}}},V=()=>{n||M||B(()=>new rf().startProviderLogin(e,N))},H=t=>{let n=s?.prompt;if(!s||!n)return;let r=s.id;B(()=>new rf().respondProviderLogin(e,r,n.id,t))},te=async()=>{try{let t=await new rf().providerLogin(e,s?.id);R(t,s?.id),E.current&&F.current===L&&(f(!1),g(e=>e+1))}catch{E.current&&F.current===L&&f(!0)}},ne=s?.prompt,re=s?.auth||s?.device,ie=ne&&ne.type!==`select`&&(0,K.jsxs)(`div`,{className:`models-login-input`,children:[(0,K.jsxs)(`label`,{className:`models-field`,children:[ne.type===`manual_code`?o(`accountLoginPaste`):ne.message,(0,K.jsx)(`input`,{type:ne.type===`secret`||ne.type===`manual_code`?`password`:`text`,autoComplete:`off`,spellCheck:!1,value:v,maxLength:8192,placeholder:ne.placeholder,disabled:l||s.status!==`running`,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key!==`Enter`||e.nativeEvent.isComposing||(e.preventDefault(),(ne.type===`text`||v.trim())&&H(v))}})]}),(0,K.jsx)(`button`,{type:`button`,className:`models-button primary`,disabled:l||ne.type!==`text`&&!v.trim()||s.status!==`running`,onClick:()=>H(v),children:o(`accountLoginContinue`)})]});return(0,K.jsxs)(`div`,{className:`models-account-login`,children:[!M&&!w&&(!s||[`failed`,`expired`,`cancelled`].includes(s.status))&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`models-login-intro`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:N===`openai`?o(`accountLoginChatGPT`):N===`anthropic`?o(`accountLoginClaude`):t.loginLabel||t.name}),(0,K.jsx)(`p`,{className:`models-hint`,children:o(t.subscription?`accountLoginExisting`:`accountLoginIntro`)})]})}),(0,K.jsxs)(`div`,{className:`models-login-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`models-button primary`,disabled:n||l||d,onClick:V,children:o(t.subscription?`accountLoginAgain`:`accountLoginStart`)}),t.subscription&&(0,K.jsx)(`button`,{type:`button`,className:`models-link`,disabled:n||l,onClick:()=>C(!0),children:o(`accountLogout`)})]})]}),M&&(0,K.jsxs)(`div`,{className:`models-login-flow`,children:[(0,K.jsxs)(`div`,{className:`models-login-status`,role:`status`,children:[(0,K.jsx)(He,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:o(s?.status===`cancelling`?`accountLoginCancelling`:re?`accountLoginWaiting`:ne?`accountLoginChoose`:`accountLoginStarting`)})]}),re&&(0,K.jsx)(`p`,{className:`models-hint`,children:o(s?.device?`accountLoginDeviceHelp`:`accountLoginBrowserHelp`)}),s?.device&&(0,K.jsxs)(`div`,{className:`models-device-code`,children:[(0,K.jsx)(`code`,{children:s.device.code}),(0,K.jsx)(`button`,{type:`button`,className:`models-icon`,"aria-label":o(`accountLoginCopyCode`),onClick:()=>{s.device&&navigator.clipboard.writeText(s.device.code).then(()=>{E.current&&F.current===L&&x(!0)}).catch(()=>{E.current&&F.current===L&&x(!1)})},children:b?(0,K.jsx)(I,{}):(0,K.jsx)(ue,{})})]}),re&&(0,K.jsxs)(`a`,{className:`models-button primary models-login-open`,href:s?.device?.url||s?.auth?.url,target:`_blank`,rel:`noopener noreferrer`,children:[o(`accountLoginOpen`),(0,K.jsx)(O,{"aria-hidden":`true`})]}),ne?.type===`select`&&(0,K.jsx)(`fieldset`,{className:`models-login-options`,"aria-label":ne.message,children:ne.options?.map(e=>{let t=[`openai`,`openai-codex`].includes(N)&&[`browser`,`device_code`].includes(e.id);return(0,K.jsxs)(`button`,{type:`button`,className:`models-login-option`,disabled:l||s?.status!==`running`,onClick:()=>H(e.id),children:[(0,K.jsx)(`strong`,{children:t?o(e.id===`browser`?`accountLoginBrowser`:`accountLoginDevice`):e.label}),(t||e.description)&&(0,K.jsx)(`span`,{children:t?o(e.id===`browser`?`accountLoginBrowserOption`:`accountLoginDeviceOption`):e.description})]},e.id)})}),ne?.type===`manual_code`&&re?(0,K.jsxs)(`details`,{className:`models-login-fallback`,children:[(0,K.jsx)(`summary`,{children:o(`accountLoginFallback`)}),(0,K.jsx)(`p`,{className:`models-hint`,children:o(`accountLoginRemoteHelp`)}),ie]}):ie,s?.messages.map(e=>(0,K.jsxs)(`div`,{className:`models-hint`,children:[(0,K.jsx)(`p`,{children:e.message}),e.links?.map(e=>(0,K.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:[e.label,(0,K.jsx)(O,{"aria-hidden":`true`})]},e.url))]},e.id)),(0,K.jsx)(`button`,{type:`button`,className:`models-link models-login-cancel`,disabled:l||s?.status===`cancelling`,onClick:()=>{s&&B(()=>new rf().cancelProviderLogin(e,s.id))},children:o(`accountLoginCancel`)})]}),s?.status===`succeeded`&&s.refreshRequired&&(0,K.jsxs)(`p`,{className:`models-hint`,role:`status`,children:[o(`accountLoginRefreshRequired`),` `,(0,K.jsx)(`button`,{type:`button`,className:`models-link`,onClick:a,children:o(`refreshStatus`)})]}),w&&(0,K.jsxs)(`p`,{className:`models-hint`,role:`status`,children:[o(`accountLogoutRefreshRequired`),` `,(0,K.jsx)(`button`,{type:`button`,className:`models-link`,onClick:a,children:o(`refreshStatus`)})]}),s&&[`failed`,`expired`,`cancelled`].includes(s.status)&&(0,K.jsx)(`p`,{className:s.status===`failed`?`models-error`:`models-hint`,role:`status`,children:o(`accountLogin_${s.status}`)}),d&&(0,K.jsxs)(`p`,{className:`models-error`,role:`alert`,children:[o(`accountLoginRequestFailed`),(0,K.jsx)(`button`,{type:`button`,className:`models-link`,onClick:()=>void te(),children:o(`refreshStatus`)})]}),p&&(0,K.jsxs)(`p`,{className:`models-error`,role:`alert`,children:[o(`accountLoginStatusUnknown`),(0,K.jsx)(`button`,{type:`button`,className:`models-link`,onClick:()=>g(e=>e+1),children:o(`refreshStatus`)})]}),S&&(0,K.jsx)(HP,{isOpen:!0,title:o(`accountLogoutTitle`,{provider:t.name}),description:o(`accountLogoutDetail`),cancelLabel:o(`cancel`),actionLabel:o(`accountLogout`),isActionLoading:l,onOpenChange:e=>{!e&&!l&&C(!1)},onAction:()=>{k.current||n||(k.current=!0,u(!0),f(!1),new rf().logoutProvider(e,N).then(e=>{!E.current||F.current!==L||(C(!1),e.refreshRequired?T(!0):a())}).catch(()=>{E.current&&F.current===L&&(C(!1),f(!0))}).finally(()=>{F.current===L&&(k.current=!1,E.current&&u(!1))}))}})]})}function IF({sessionId:e,template:t,existingIds:n,apiKey:r,onClose:i,onAdd:a}){let{t:o}=cr(),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(new Set),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(!0),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(0),S=(0,_.useRef)({template:t,apiKey:r,existingIds:n}),C=new Set(n),w=Math.max(0,100-C.size),T=s.filter(e=>`${e.id} ${e.name}`.toLowerCase().includes(d.trim().toLowerCase())),E=T.filter(e=>!C.has(e.id)),D=E.length>0&&E.every(e=>l.has(e.id));return(0,_.useEffect)(()=>{let t=new AbortController,{template:n,apiKey:r,existingIds:i}=S.current;return m(!0),y(!1),new rf().discoverProviderModels(e,{provider:n.provider,baseUrl:n.baseUrl,api:n.api,...r.trim()?{apiKey:r.trim()}:{}},t.signal).then(e=>{t.signal.aborted||(c(e.models),g(e.truncated),m(!1),u(new Set(e.models.filter(e=>!i.includes(e.id)).slice(0,Math.max(0,100-i.length)).map(e=>e.id))))},()=>{t.signal.aborted||(y(!0),m(!1))}),()=>t.abort()},[e,b]),(0,K.jsx)($j,{isOpen:!0,width:380,padding:0,className:`models-picker-dialog`,"aria-label":o(`providerPickerTitle`),onOpenChange:e=>!e&&i(),children:(0,K.jsxs)(`div`,{className:`models-picker`,children:[(0,K.jsxs)(`header`,{children:[(0,K.jsx)(`h2`,{children:o(`providerPickerTitle`)}),(0,K.jsx)(`button`,{type:`button`,className:`models-icon`,"aria-label":o(`close`),onClick:i,children:(0,K.jsx)(Lt,{})})]}),(0,K.jsx)(`p`,{children:o(`providerPickerIntro`)}),(0,K.jsxs)(`div`,{className:`models-picker-toolbar`,children:[(0,K.jsx)(`input`,{"data-autofocus":!0,type:`search`,"aria-label":o(`providerPickerSearch`),placeholder:o(`providerPickerSearch`),value:d,onKeyDown:e=>{e.key===`Enter`&&e.preventDefault()},onChange:e=>f(e.target.value)}),(0,K.jsx)(`button`,{type:`button`,className:`models-link`,disabled:p||!E.length,onClick:()=>u(e=>{let t=new Set(e);for(let e of E)D?t.delete(e.id):t.size(0,K.jsxs)(`label`,{className:`models-picker-row`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:C.has(e.id)||l.has(e.id),disabled:C.has(e.id)||!l.has(e.id)&&l.size>=w,onChange:t=>u(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})}),(0,K.jsx)(`span`,{title:e.name,children:e.id}),C.has(e.id)&&(0,K.jsx)(`small`,{children:o(`providerPickerAdded`)})]},e.id)),!p&&!v&&!T.length&&(0,K.jsx)(`p`,{className:`models-picker-empty`,children:o(d?`providerPickerNoMatch`:`providerPickerEmpty`)}),v&&(0,K.jsxs)(`div`,{className:`models-error`,role:`alert`,children:[(0,K.jsx)(`p`,{children:o(`providerPickerError_load`)}),(0,K.jsx)(`button`,{type:`button`,className:`models-button`,onClick:()=>x(e=>e+1),children:o(`retryAdmissionCheck`)})]})]}),h&&(0,K.jsx)(`p`,{className:`models-hint`,children:o(`providerPickerBounded`)}),(0,K.jsxs)(`footer`,{children:[(0,K.jsx)(`span`,{className:`models-hint`,"aria-live":`polite`,children:l.size>0&&o(`providerPickerSelected`,{count:l.size})}),(0,K.jsx)(`button`,{type:`button`,className:`models-button`,onClick:i,children:o(`cancel`)}),(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:!l.size||p||v,onClick:()=>a(s.filter(e=>l.has(e.id))),children:o(`providerPickerSave`)})]})]})})}function LF(e){let t=e.trim();if(!t)return;let n=/^(\d+(?:\.\d+)?)([km])?$/i.exec(t);if(!n)return NaN;let r=n[2]?.toLowerCase()===`m`?1e6:n[2]?.toLowerCase()===`k`?1e3:1,i=Number(n[1])*r,a=Math.round(i),o=Math.abs(i-a)<1e-6?a:i;return Number.isSafeInteger(o)&&o>0&&o<=1e8?o:NaN}function RF(e){if(e===void 0)return``;if(Number.isInteger(e)&&e>0){if(e%1e6==0)return`${e/1e6}M`;if(e%1e3==0)return`${e/1e3}K`}return String(e)}function zF({sessionId:e,providerId:t,configuration:n,auth:r,isNew:i,custom:a,taken:o,currentModel:s,availableModels:c,busy:l,onDirty:u,onSaving:d,onClose:f,onReload:p}){let{t:m}=cr(),[h]=(0,_.useState)(()=>{let e=n.providers?.find(e=>e.provider===t),i=n.models.filter(e=>e.provider===t).map(e=>({...e,rowKey:crypto.randomUUID()}));return{provider:t,name:e?.name||r?.name||t,baseUrl:e?.baseUrl||i[0]?.baseUrl||r?.baseUrl||``,api:e?.api||i[0]?.api||r?.api||`openai-completions`,models:i}}),[g]=(0,_.useState)(n.revision),[v,y]=(0,_.useState)(h),[b,x]=(0,_.useState)(``),S=!i&&!!r?.authMethods.includes(`oauth`),C=a||!!r?.authMethods.includes(`api_key`),[w,T]=(0,_.useState)(S&&(!r?.configured||r?.subscription||!C)?`oauth`:`api_key`),[E,D]=(0,_.useState)(!1),[O,k]=(0,_.useState)(!1),A=(0,_.useRef)(null),j=(0,_.useRef)(!1),[M,N]=(0,_.useState)(new Set),[P,F]=(0,_.useState)({}),[I,L]=(0,_.useState)(!1),[R,z]=(0,_.useState)(null),[B,V]=(0,_.useState)(!1),H=(0,_.useRef)(null),te=(0,_.useRef)({onDirty:u,onSaving:d});te.current={onDirty:u,onSaving:d};let ne=JSON.stringify(v)!==JSON.stringify(h),re=ne||b.length>0;(0,_.useEffect)(()=>{te.current.onDirty(re)},[re]),(0,_.useEffect)(()=>{te.current.onSaving(I||E)},[I,E]),(0,_.useEffect)(()=>{O?j.current=!0:j.current&&(j.current=!1,A.current?.focus({preventScroll:!0}))},[O]),(0,_.useEffect)(()=>()=>{H.current?.abort(),te.current.onSaving(!1),te.current.onDirty(!1)},[]);let ie=n.providers?.find(e=>e.provider===t)?.editable!==!1,ae=l||I||E,U=ae||B||!ie,oe=!/^[a-zA-Z0-9._-]+$/.test(v.provider)||[`__proto__`,`constructor`,`prototype`].includes(v.provider)||i&&a&&o.includes(v.provider),se=v.models.findIndex(e=>!e.id.trim()||[e.contextWindow,e.maxTokens].some(e=>e!==void 0&&!Number.isFinite(e))||v.models.some(t=>t.rowKey!==e.rowKey&&t.id.trim()===e.id.trim())),ce=se!==-1,le=i&&a||ne,ue=!oe&&!/[\r\n\u0000]/u.test(b)&&(B||!le||(!a||v.models.length>0)&&!ce&&!!v.baseUrl)&&(le||b.trim().length>0),de=e=>{y(t=>({...t,...e})),R!==`conflict`&&z(null)},fe=(e,t)=>de({models:v.models.map((n,r)=>r===e?{...n,...t}:n)}),pe={id:``,name:``,reasoning:!1,provider:v.provider,baseUrl:v.baseUrl,api:v.api},me=async()=>{if(ae||O||!ue||R===`conflict`)return;let t=new AbortController;H.current=t,L(!0),z(null);let n=B,r=new rf;try{if(le&&!n){if(await r.changeProviderConfiguration(e,g,{action:`save`,configuration:{...v,name:v.name.trim()||v.provider,models:v.models.map(({rowKey:e,...t})=>({...t,id:t.id.trim(),name:t.name.trim()||t.id.trim(),provider:v.provider,baseUrl:v.baseUrl===h.baseUrl&&t.baseUrl||v.baseUrl,api:v.api===h.api?t.api:v.api}))}},t.signal),t.signal.aborted)return;n=!0,V(!0)}if(b.trim()&&await r.saveProviderKey(e,v.provider,b.trim(),t.signal),t.signal.aborted)return;x(``),te.current.onDirty(!1),f(v.name||v.provider,v.provider)}catch(e){t.signal.aborted||z(e instanceof tf&&e.code===`MODEL_CONFIGURATION_CONFLICT`?`conflict`:e instanceof tf&&e.code===`MODEL_NOT_AVAILABLE`?`current`:n?`key`:`failed`)}finally{t.signal.aborted||L(!1)}},W=e=>(0,K.jsxs)(`label`,{className:`models-field`,children:[m(e===`name`?`providerDisplayName`:`modelConfig_${e}`),(0,K.jsx)(`input`,{type:e===`baseUrl`?`url`:`text`,value:v[e],maxLength:e===`baseUrl`?2048:160,autoComplete:`off`,disabled:U,required:e===`provider`||e===`baseUrl`&&le,"aria-invalid":e===`provider`&&v.provider.length>0&&oe,placeholder:e===`provider`?`my-provider`:e===`name`?v.provider:`https://api.example.com/v1`,onChange:t=>de({[e]:t.target.value})})]}),he=(0,K.jsxs)(`label`,{className:`models-field`,children:[m(`modelConfig_api`),(0,K.jsxs)(`select`,{value:v.api,disabled:U,onChange:e=>{let t=e.target.value;(t===`openai-responses`||t===`openai-completions`||t===`anthropic-messages`)&&de({api:t})},children:[(0,K.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Chat Completions`}),(0,K.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,K.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`})]})]}),ge=(0,K.jsxs)(`div`,{className:`models-catalog`,children:[(0,K.jsxs)(`div`,{className:`models-list-head`,children:[(0,K.jsx)(`span`,{children:m(`modelSettings`)}),(0,K.jsx)(`button`,{type:`button`,ref:A,className:`models-link`,disabled:U||oe||!v.baseUrl,onClick:()=>k(!0),children:m(`providerFetchModels`)})]}),!ie&&(0,K.jsx)(`p`,{className:`models-hint`,children:m(`providerModelsReadOnly`)}),v.models.length===0&&(0,K.jsx)(`p`,{className:`models-empty`,children:m(a?`providerModelsEmpty`:`providerModelsInherited`,{count:c.length})}),(0,K.jsx)(`div`,{className:`models-entry-list`,children:v.models.map((e,t)=>(0,K.jsxs)(`div`,{className:`models-entry`,children:[(0,K.jsxs)(`div`,{className:`models-entry-row`,children:[(0,K.jsx)(`input`,{"aria-label":m(`providerModelId`,{number:t+1}),placeholder:m(`modelConfig_id`),value:e.id,maxLength:256,required:!0,disabled:U||s?.provider===v.provider&&s.id===e.id,onChange:e=>fe(t,{id:e.target.value})}),(0,K.jsx)(`input`,{"aria-label":m(`providerModelName`,{number:t+1}),placeholder:m(`modelConfig_name`),value:e.name,maxLength:256,disabled:U,onChange:e=>fe(t,{name:e.target.value})}),(0,K.jsx)(`button`,{type:`button`,className:`models-icon`,"aria-label":m(`providerModelDetails`,{model:e.name||e.id||t+1}),"aria-expanded":M.has(e.rowKey),title:m(`providerModelOptions`),onClick:()=>N(t=>{let n=new Set(t);return n.delete(e.rowKey)||n.add(e.rowKey),n}),children:(0,K.jsx)(ee,{})}),(0,K.jsx)(`button`,{type:`button`,className:`models-icon danger`,"aria-label":m(`providerRemoveModel`,{model:e.name||e.id||t+1}),disabled:U||s?.provider===v.provider&&s.id===e.id,title:s?.provider===v.provider&&s.id===e.id?m(`providerCurrentRemoval`):m(`providerRemoveModel`,{model:e.name||e.id||t+1}),onClick:()=>{de({models:v.models.filter((e,n)=>n!==t)}),N(t=>new Set([...t].filter(t=>t!==e.rowKey))),F(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.rowKey)))},children:(0,K.jsx)(kt,{})})]}),M.has(e.rowKey)&&(0,K.jsxs)(`div`,{className:`models-entry-details`,children:[[`contextWindow`,`maxTokens`].map(n=>(0,K.jsxs)(`label`,{className:`models-field models-capacity`,children:[m(`modelConfig_${n}`),(0,K.jsx)(`input`,{type:`text`,inputMode:`numeric`,autoComplete:`off`,spellCheck:!1,"aria-label":m(`providerCapacityLabel`,{field:m(`modelConfig_${n}`),number:t+1}),"aria-invalid":e[n]!==void 0&&!Number.isFinite(e[n]),placeholder:n===`contextWindow`?`256K`:`32K`,value:P[e.rowKey]?.[n]??RF(e[n]),disabled:U,onChange:r=>{let i=r.target.value;F(t=>({...t,[e.rowKey]:{...t[e.rowKey],[n]:i}})),fe(t,{[n]:LF(i)})}})]},n)),(0,K.jsxs)(`fieldset`,{className:`models-input-types`,"aria-label":m(`providerCapacityLabel`,{field:m(`providerInputTypes`),number:t+1}),children:[(0,K.jsx)(`legend`,{children:m(`providerInputTypes`)}),(0,K.jsx)(`div`,{children:[`text`,`image`].map(n=>{let r=e.input??[`text`];return(0,K.jsxs)(`label`,{className:`models-checkbox`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:r.includes(n),disabled:U||r.length===1&&r.includes(n),onChange:e=>fe(t,{input:[`text`,`image`].filter(t=>t===n?e.target.checked:r.includes(t))})}),m(n===`text`?`providerInputText`:`providerInputImage`)]},n)})})]}),(0,K.jsx)(`p`,{className:`models-hint models-capability-hint`,children:m(`providerImageHint`)}),(0,K.jsxs)(`label`,{className:`models-checkbox models-reasoning`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:e.reasoning,disabled:U,onChange:e=>fe(t,{reasoning:e.target.checked})}),m(`modelConfig_reasoning`)]}),(0,K.jsx)(`p`,{className:`models-hint models-capability-hint`,children:m(`providerReasoningHint`)})]})]},e.rowKey))}),(0,K.jsxs)(`button`,{type:`button`,className:`models-button models-add-model`,disabled:U||v.models.length>=100,onClick:()=>{de({models:[...v.models,{...pe,rowKey:crypto.randomUUID()}]})},children:[(0,K.jsx)(lt,{"aria-hidden":`true`}),m(`addModel`)]}),ce&&(0,K.jsx)(`p`,{className:`models-error`,role:`alert`,children:m(`providerModelInvalid`,{number:se+1})})]});return(0,K.jsxs)(`form`,{className:`models-editor`,onSubmit:e=>{e.preventDefault(),me()},children:[!i&&a&&(0,K.jsxs)(`div`,{className:`models-editor-heading`,children:[(0,K.jsx)(`span`,{children:v.name||v.provider}),v.name!==v.provider&&(0,K.jsx)(`small`,{children:v.provider})]}),i&&a&&(0,K.jsxs)(K.Fragment,{children:[W(`provider`),v.provider&&oe&&(0,K.jsx)(`p`,{className:`models-error`,children:m(`providerIdInvalid`)}),W(`name`),W(`baseUrl`),he]}),S&&C&&(0,K.jsxs)(`fieldset`,{className:`models-add-modes`,"aria-label":m(`accountLoginMethod`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-pressed":w===`oauth`,disabled:ae,onClick:()=>T(`oauth`),children:m(`accountLoginTab`)}),(0,K.jsx)(`button`,{type:`button`,"aria-pressed":w===`api_key`,disabled:ae,onClick:()=>T(`api_key`),children:m(`accountLoginKeyTab`)})]}),S&&w===`oauth`&&r&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(FF,{sessionId:e,auth:r,busy:l||I||re,onSaving:D,onAuthenticated:()=>f(v.name||v.provider,v.provider),onReload:p}),re&&(0,K.jsx)(`p`,{className:`models-hint`,children:m(`accountLoginUnsaved`)})]}),C&&w===`api_key`?(0,K.jsxs)(`label`,{className:`models-field`,children:[m(`providerApiKey`),(0,K.jsx)(`input`,{type:`password`,autoComplete:`new-password`,spellCheck:!1,maxLength:8192,value:b,placeholder:m(r?.configured?`providerKeyKeep`:`providerKeyOptional`),disabled:ae,onChange:e=>{x(e.target.value),R!==`conflict`&&z(null)}})]}):S?null:(0,K.jsx)(`p`,{className:`models-hint`,children:m(`providerNativeAuth`)}),i&&a?ge:(0,K.jsxs)(`details`,{className:`models-customized`,children:[(0,K.jsx)(`summary`,{children:m(`providerCustomSettings`)}),(0,K.jsxs)(`div`,{children:[a&&W(`name`),W(`baseUrl`),a&&he,ge]})]}),R&&(0,K.jsx)(`p`,{className:`models-error`,role:`alert`,children:m(R===`conflict`?`modelConfigurationConflict`:R===`key`?`providerProfileSavedKeyFailed`:R===`current`?`providerCurrentRemoval`:`providerConfigurationFailed`)}),R===`conflict`&&(0,K.jsx)(`button`,{type:`button`,className:`models-button`,onClick:p,children:m(`providerReload`)}),!E&&(0,K.jsxs)(`div`,{className:`models-editor-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:I,onClick:()=>B?p():f(),children:m(`cancel`)}),(w===`api_key`||ne)&&(0,K.jsx)(`button`,{type:`submit`,className:`models-button primary`,disabled:ae||!ue||R===`conflict`,"aria-busy":I,children:m(I?`savingSettings`:`providerSave`)})]}),O&&(0,K.jsx)(IF,{sessionId:e,template:pe,existingIds:v.models.map(e=>e.id),apiKey:b,onClose:()=>k(!1),onAdd:e=>{de({models:[...v.models,...e.map(e=>({...pe,...e,rowKey:crypto.randomUUID()}))]}),k(!1)}})]})}function BF({sessionId:e,sessionPath:t,provider:n,purpose:r,initialModel:i,busy:a,onSelectModel:o,onDefaultSaved:s,onSaving:c,onClose:l}){let{t:u}=cr(),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(i?`${i.provider}/${i.id}`:``),[v,y]=(0,_.useState)(!0),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(0),[w,T]=(0,_.useState)(0),[E,D]=(0,_.useState)(!1),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(null);(0,_.useEffect)(()=>{let t=new AbortController;y(!0),x(!1);let r=window.setTimeout(()=>{new rf().searchModels(d.trim(),e,t.signal,n).then(e=>{t.signal.aborted||(m(e.models),C(e.truncation.matchesOmitted),y(!1))},()=>{t.signal.aborted||(x(!0),y(!1))})},d?200:0);return()=>{t.abort(),window.clearTimeout(r)}},[e,n,d,w]);let M=p.find(e=>`${e.provider}/${e.id}`===h)??p[0],N=new Map;for(let e of p){let t=N.get(e.provider);t?t.push(e):N.set(e.provider,[e])}let P=async()=>{if(!M||v||O||a||!t)return;k(!0),c(!0),j(null);let n=!1;try{if(r===`use`){if(!await o(`${M.provider}/${M.id}`))throw Error(`selection failed`);n=!0}(r==="default"||E)&&s(await new rf().saveModelDefault(M.provider,M.id,e,t)),l()}catch{j(n?`modelDefaultPartial`:r==="default"?`modelDefaultSaveFailed`:`modelConnectionUseFailed`)}finally{k(!1),c(!1)}};return(0,K.jsxs)(`div`,{className:`models-connection-choice`,children:[(0,K.jsx)(`p`,{className:`models-hint`,children:u(r==="default"?`modelDefaultHint`:`modelConnectionNextHint`)}),(p.length>8||S>0||d)&&(0,K.jsx)(`input`,{type:`search`,"aria-label":u(`modelConnectionSearch`),placeholder:u(`modelConnectionSearch`),maxLength:200,value:d,disabled:O,onChange:e=>f(e.target.value)}),b?(0,K.jsxs)(`p`,{className:`models-error`,role:`alert`,children:[u(`modelConnectionLoadFailed`),` `,(0,K.jsx)(`button`,{type:`button`,className:`models-link`,onClick:()=>T(e=>e+1),children:u(`retryAdmissionCheck`)})]}):v?(0,K.jsx)(`p`,{className:`models-hint`,role:`status`,children:u(`loadingModels`)}):p.length?(0,K.jsx)(NF,{label:u(`selectModel`),className:`models-provider-picker`,placement:`below`,value:M?`${M.provider}/${M.id}`:``,isDisabled:O,options:[...N].map(([e,t])=>({type:`section`,title:e,options:t.map(e=>({value:`${e.provider}/${e.id}`,label:e.name||e.id,description:`${e.provider} · ${e.id}`,icon:(0,K.jsx)(ON,{id:e.provider})}))})),onChange:e=>g(e)}):(0,K.jsx)(`p`,{className:`models-hint`,children:u(d?`modelConnectionNoMatch`:`modelConnectionNoModels`)}),S>0&&!v&&(0,K.jsx)(`p`,{className:`models-hint`,children:u(`modelConnectionMore`,{count:S})}),r===`use`&&(0,K.jsxs)(`label`,{className:`models-checkbox`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:E,disabled:O,onChange:e=>D(e.target.checked)}),u(`modelMakeDefault`)]}),A&&(0,K.jsx)(`p`,{className:`models-error`,role:`alert`,children:u(A)}),(0,K.jsxs)(`div`,{className:`models-editor-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:O,onClick:l,children:u(`cancel`)}),(0,K.jsx)(`button`,{type:`button`,className:`models-button primary`,disabled:O||a||v||b||!M||!t,onClick:()=>void P(),children:u(O?`providerSaving`:r==="default"?`modelDefaultSave`:`modelConnectionUse`)})]})]})}function VF({sessionId:e,sessionPath:t,models:n,currentModel:r,busy:i,focusCredentials:a,onSaved:o,onSelectModel:s,onDraftChange:c,onSavingChange:l}){let{t:u}=cr(),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(0),[h,g]=(0,_.useState)(!0),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)([]),[w,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(`account`),[O,k]=(0,_.useState)(``),[A,j]=(0,_.useState)(``),[M,N]=(0,_.useState)({}),[P,F]=(0,_.useState)(!1),[I,L]=(0,_.useState)({}),[R,ee]=(0,_.useState)(!1),z=P||R||Object.values(I).some(Boolean),[B,V]=(0,_.useState)(null),[H,te]=(0,_.useState)(!1),[ne,re]=(0,_.useState)(null),[ie,ae]=(0,_.useState)(null),[U,oe]=(0,_.useState)(null),[se,ce]=(0,_.useState)(null),le=(0,_.useRef)(null),ue=(0,_.useRef)(a),de=(0,_.useRef)(null),fe=(0,_.useRef)(new Map),pe=(0,_.useRef)(null),me=(0,_.useRef)(null),W=(0,_.useRef)({onDraftChange:c,onSavingChange:l});W.current={onDraftChange:c,onSavingChange:l},(0,_.useEffect)(()=>{c(Object.values(M).some(Boolean))},[M,c]),(0,_.useEffect)(()=>{l(z)},[z,l]),(0,_.useEffect)(()=>{!ne&&!z&&me.current&&(me.current.focus({preventScroll:!0}),me.current=null)},[ne,z]),(0,_.useEffect)(()=>{if(!de.current)return;let e=de.current;de.current=null,(fe.current.get(e)??pe.current)?.focus({preventScroll:!0})}),(0,_.useEffect)(()=>()=>{le.current?.abort(),W.current.onDraftChange(!1),W.current.onSavingChange(!1)},[]),(0,_.useEffect)(()=>{let t=new AbortController;g(!0),y(!1);let n=new rf;return Promise.all([n.modelConfigurations(e,t.signal),n.providerAuth(e,t.signal)]).then(([e,n])=>{if(!t.signal.aborted&&(f({configuration:e,auth:n}),g(!1),ue.current)){ue.current=!1;let e=r?.provider||n.providers.find(e=>e.configured)?.id;e&&(x(e),C([e]))}},()=>{t.signal.aborted||(y(!0),g(!1))}),()=>t.abort()},[e,p,r?.provider]),(0,_.useEffect)(()=>{let t=new AbortController;return te(!1),new rf().modelDefaults(e,t.signal).then(e=>{t.signal.aborted||V(e)},()=>{t.signal.aborted||te(!0)}),()=>t.abort()},[e,p]);let he=d?.configuration,ge=new Set([...he?.providers?.map(e=>e.provider)??[],...he?.models.map(e=>e.provider)??[]]),_e=new Set([...ge,...d?.auth.providers.filter(e=>e.configured).map(e=>e.id)??[],...n.map(e=>e.provider),...S.filter(e=>!e.startsWith(`add:`))]),ve=[..._e].map(e=>{let t=d?.auth.providers.find(t=>t.id===e);return{id:e,name:he?.providers?.find(t=>t.provider===e)?.name||t?.name||e,auth:t}}),ye=d?.auth.providers.filter(e=>e.authMethods.includes(`api_key`)&&!_e.has(e.id))??[],be=d?.auth.providers.filter(e=>e.authMethods.includes(`oauth`)&&!e.subscription)??[],xe=be.find(e=>e.id===O)??be[0],Se=ye.find(e=>e.id===A)??ye[0],Ce=[{id:`account`,label:`accountLoginTab`,hint:`providerAccountHint`,available:be.length>0},{id:`catalog`,label:`providerAddCatalog`,hint:`providerCatalogHint`,available:ye.length>0},{id:`custom`,label:`providerAddCustom`,hint:`providerCustomHint`,available:!0}],we=e=>{D(e);let t=e===`custom`?`add:custom`:e===`account`?xe&&`add:account:${xe.id}`:Se&&`add:${Se.id}`;t&&C(e=>e.includes(t)?e:[...e,t])},Te=e=>{me.current=null,re(null),ae(null),T(!1),x(b===e?null:e),C(t=>t.includes(e)?t:[...t,e])},G=(e,t,n)=>{me.current=null,de.current=e;let r=t=>e.startsWith(`add:`)?t.startsWith(`add:`):t===e;C(e=>e.filter(e=>!r(e))),N(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!r(e)))),e.startsWith(`add:`)?T(!1):x(null),t&&(ae(t),re({purpose:`use`,provider:n??e}),m(e=>e+1),o().catch(()=>!1))},Ee=(t,a,s,c)=>{if(!he)return null;let l=d?.auth.providers.find(e=>e.id===a),f=e=>L(n=>n[t]===e?n:{...n,[t]:e}),p=()=>{G(t),m(e=>e+1),o().catch(()=>!1)};return t.startsWith(`add:account:`)?l&&(0,K.jsxs)(`div`,{className:`models-editor`,children:[(0,K.jsx)(FF,{sessionId:e,auth:l,busy:i,onSaving:f,onAuthenticated:()=>G(t,l.name||l.id,l.id),onReload:p}),!I[t]&&(0,K.jsx)(`div`,{className:`models-editor-actions`,children:(0,K.jsx)(`button`,{type:`button`,className:`models-button`,onClick:()=>G(t),children:u(`cancel`)})})]}):(0,K.jsx)(zF,{sessionId:e,providerId:a,configuration:he,auth:l,isNew:s,custom:c,taken:[...d?.auth.providers.map(e=>e.id)??[],...ge],currentModel:r,availableModels:n.filter(e=>e.provider===a),busy:i,onDirty:e=>N(n=>n[t]===e?n:{...n,[t]:e}),onSaving:f,onClose:(e,n)=>G(t,e,n),onReload:p},t)},De=e=>ve.find(t=>t.id===e)?.name??e,Oe=e=>n.find(t=>t.provider===e.provider&&t.id===e.id)?.name||e.id,ke=(e,t,n)=>{me.current=t,re({purpose:e,provider:n}),x(null),T(!1)},Ae=(n,a)=>(0,K.jsx)(BF,{sessionId:e,sessionPath:t,provider:a,purpose:n,initialModel:n==="default"?B?.model:r,busy:i,onSelectModel:s,onDefaultSaved:e=>{V(e),te(!1),o().catch(()=>!1)},onSaving:ee,onClose:()=>{re(null)}},`${n}:${a??`all`}`);return(0,K.jsxs)(`div`,{className:`models-page`,children:[(0,K.jsxs)(`div`,{className:`models-section`,children:[(0,K.jsx)(`h2`,{children:u(`modelSettings`)}),(0,K.jsx)(`p`,{className:`models-intro`,children:u(`modelsIntro`)}),ie&&(0,K.jsx)(`p`,{className:`models-saved`,role:`status`,children:u(`providerSaved`,{provider:ie})}),v&&(0,K.jsxs)(`div`,{className:`models-error`,role:`alert`,children:[u(`providerLoadFailed`),` `,(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:h,onClick:()=>m(e=>e+1),children:u(`retryAdmissionCheck`)})]}),se&&!U&&(0,K.jsxs)(`div`,{className:`models-error`,role:`alert`,children:[se,` `,(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:h,onClick:()=>{ce(null),m(e=>e+1)},children:u(`refreshStatus`)})]}),!d&&h&&(0,K.jsx)(`p`,{className:`models-hint`,role:`status`,children:u(`providerLoading`)}),(0,K.jsxs)(`div`,{className:`models-default-card`,children:[(0,K.jsxs)(`div`,{className:`models-default-row`,children:[(0,K.jsxs)(`div`,{className:`models-default-copy`,children:[(0,K.jsx)(`span`,{className:`models-default-title`,children:u(`modelDefaultTitle`)}),H?(0,K.jsx)(`span`,{className:`models-hint`,children:u(`modelDefaultReadFailed`)}):B?.model?(0,K.jsxs)(`span`,{className:`models-default-value`,children:[(0,K.jsx)(ON,{id:B.model.provider}),(0,K.jsxs)(`span`,{children:[Oe(B.model),(0,K.jsx)(`small`,{children:De(B.model.provider)})]})]}):(0,K.jsx)(`span`,{className:`models-hint`,children:u(B?`modelDefaultNotSet`:`loadingModels`)})]}),(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:z||i||Object.values(M).some(Boolean)||!t,"aria-expanded":ne?.purpose==="default",onClick:e=>H?m(e=>e+1):ne?.purpose==="default"?re(null):ke(`default`,e.currentTarget),children:u(H?`refreshStatus`:`modelDefaultChoose`)})]}),B?.projectOverride&&(0,K.jsx)(`p`,{className:`models-hint`,children:u(`modelDefaultProjectOverride`,{model:`${De(B.projectOverride.provider)} / ${Oe(B.projectOverride)}`})}),ne?.purpose==="default"&&Ae(`default`)]}),(0,K.jsx)(`ul`,{className:`models-provider-list`,children:ve.map(e=>{let n=!w&&b===e.id,a=e.auth?.custom??ge.has(e.id);return(0,K.jsxs)(`li`,{className:`models-provider-card`,children:[(0,K.jsxs)(`div`,{className:`models-provider-head`,children:[(0,K.jsxs)(`div`,{className:`models-provider-identity`,children:[(0,K.jsx)(`span`,{className:`models-provider-avatar`,"aria-hidden":`true`,children:(0,K.jsx)(ON,{id:e.id})}),(0,K.jsxs)(`div`,{className:`models-provider-label`,children:[(0,K.jsx)(`span`,{className:`models-provider-name`,children:e.name}),a&&(0,K.jsx)(`span`,{className:`models-provider-tag`,children:u(`providerCustomTag`)}),B?.model?.provider===e.id&&(0,K.jsx)(`span`,{className:`models-provider-tag`,children:u(`modelDefaultBadge`)}),r?.provider===e.id&&(0,K.jsx)(`span`,{className:`models-provider-tag`,children:u(`modelCurrentBadge`)}),e.auth&&(0,K.jsxs)(`span`,{className:`models-provider-status`,children:[(0,K.jsx)(`span`,{className:`models-credential-dot ${e.auth.configured?`configured`:`missing`}`,role:`img`,"aria-label":u(e.auth.configured?`credentialConfigured`:`credentialMissing`),title:u(e.auth.configured?`credentialConfigured`:`credentialMissing`)}),u(e.auth.subscription?`accountLoginConfigured`:e.auth.configured?`credentialConfigured`:`credentialMissing`)]})]})]}),(0,K.jsxs)(`div`,{className:`models-provider-actions`,children:[e.auth?.configured&&(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:z||i||Object.values(M).some(Boolean)||!t,"aria-label":u(`modelConnectionChooseProvider`,{provider:e.name}),"aria-expanded":ne?.purpose===`use`&&ne.provider===e.id,onClick:t=>ne?.purpose===`use`&&ne.provider===e.id?re(null):ke(`use`,t.currentTarget,e.id),children:u(`selectModel`)}),(0,K.jsx)(`button`,{type:`button`,className:`models-button`,"aria-label":u(`editProvider`,{provider:e.name}),ref:t=>{t?fe.current.set(e.id,t):fe.current.delete(e.id)},"aria-expanded":n,disabled:z,onClick:()=>Te(e.id),children:u(e.auth?.authMethods.includes(`oauth`)&&!e.auth.configured?`accountLoginStart`:`providerEdit`)}),ge.has(e.id)&&(0,K.jsx)(`button`,{type:`button`,className:`models-button danger`,"aria-label":u(`removeProvider`,{provider:e.name}),disabled:z||i||r?.provider===e.id,title:r?.provider===e.id?u(`providerCurrentRemoval`):void 0,onClick:()=>{oe(e.id),ce(null)},children:u(`providerRemove`)})]})]}),ne?.purpose===`use`&&ne.provider===e.id&&Ae(`use`,e.id),S.includes(e.id)&&(0,K.jsx)(`div`,{hidden:!n,children:Ee(e.id,e.id,!1,a)})]},e.id)})}),he&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{hidden:!w,className:`models-add-card`,children:[(0,K.jsx)(`fieldset`,{className:`models-add-modes`,"aria-label":u(`providerAddMode`),onKeyDown:e=>{if(z||![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=Ce.filter(e=>e.available),n=t.findIndex(e=>e.id===E),r=t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowRight`?1:-1)+t.length)%t.length].id;we(r),e.currentTarget.querySelectorAll(`button`)[Ce.findIndex(e=>e.id===r)]?.focus()},children:Ce.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":E===e.id,disabled:z||!e.available,onClick:()=>we(e.id),children:u(e.label)},e.id))}),(0,K.jsx)(`p`,{className:`models-hint`,children:u(Ce.find(e=>e.id===E)?.hint??`providerCustomHint`)}),(0,K.jsxs)(`div`,{hidden:E!==`account`,children:[xe&&(0,K.jsx)(`div`,{className:`models-provider-select`,children:(0,K.jsx)(NF,{label:u(`provider`),className:`models-provider-picker`,options:be.map(e=>({value:e.id,label:e.name||e.id,icon:(0,K.jsx)(ON,{id:e.id})})),value:xe.id,isDisabled:z,placement:`below`,onChange:e=>{k(e);let t=`add:account:${e}`;C(e=>e.includes(t)?e:[...e,t])}})}),S.filter(e=>e.startsWith(`add:account:`)).map(e=>(0,K.jsx)(`div`,{hidden:e!==`add:account:${xe?.id}`,children:Ee(e,e.slice(12),!0,!1)},e))]}),(0,K.jsxs)(`div`,{hidden:E!==`catalog`,children:[Se&&(0,K.jsx)(`div`,{className:`models-provider-select`,children:(0,K.jsx)(NF,{label:u(`provider`),className:`models-provider-picker`,options:ye.map(e=>({value:e.id,label:e.name||e.id,icon:(0,K.jsx)(ON,{id:e.id})})),value:Se.id,isDisabled:z,placement:`below`,onChange:e=>{j(e);let t=`add:${e}`;C(e=>e.includes(t)?e:[...e,t])}})}),S.filter(e=>e.startsWith(`add:`)&&e!==`add:custom`&&!e.startsWith(`add:account:`)).map(e=>(0,K.jsx)(`div`,{hidden:e!==`add:${Se?.id}`,children:Ee(e,e.slice(4),!0,!1)},e))]}),S.includes(`add:custom`)&&(0,K.jsx)(`div`,{hidden:E!==`custom`,children:Ee(`add:custom`,``,!0,!0)})]}),!w&&(0,K.jsxs)(`button`,{type:`button`,className:`models-add-button`,ref:pe,disabled:z,onClick:()=>{me.current=null,re(null),T(!0),x(null),ae(null),we(Ce.find(e=>e.id===E)?.available?E:Ce.find(e=>e.available).id)},children:[(0,K.jsx)(lt,{"aria-hidden":`true`}),u(`providerAdd`)]})]}),i&&(0,K.jsx)(`p`,{className:`models-hint`,role:`status`,children:u(`modelSelectionBusy`)})]}),U&&(0,K.jsx)(HP,{isOpen:!0,title:u(`removeProvider`,{provider:ve.find(e=>e.id===U)?.name||U}),description:se||u(`providerRemoveDetail`),isActionLoading:z,cancelLabel:u(`cancel`),actionLabel:u(z?`savingSettings`:`providerRemove`),onOpenChange:e=>{!e&&!z&&oe(null)},onAction:()=>{if(z||i||!he)return;let t=new AbortController;le.current=t,F(!0),ce(null),new rf().changeProviderConfiguration(e,he.revision,{action:`remove`,provider:U},t.signal).then(()=>{t.signal.aborted||(G(U),oe(null),m(e=>e+1),o().catch(()=>!1))},e=>{t.signal.aborted||ce(u(e instanceof tf&&e.code===`MODEL_CONFIGURATION_CONFLICT`?`modelConfigurationConflict`:`providerConfigurationFailed`))}).finally(()=>{t.signal.aborted||F(!1)})}})]})}var HF=20,UF={track:{kVAEAm:`x10l6tqk`,kWkggS:`xdsb6cv`,kaIpWk:`xjspbzw`,$$css:!0},trackHorizontal:{kLqNvP:`x1o0tod`,kt4wiu:`xtijo5x`,kZKoxP:`xqu0tyb`,k87sOh:`xwa60dl`,k3aq6I:`x1cb1t30`,$$css:!0},trackVertical:{k87sOh:`x13vifvy`,krVfgx:`x1ey2m1c`,kzqmXN:`x51ohtg`,$$css:!0},filledTrack:{kVAEAm:`x10l6tqk`,kWkggS:`x1ewilqj`,kaIpWk:`xjspbzw`,$$css:!0},filledTrackHorizontal:{kZKoxP:`xqu0tyb`,k87sOh:`xwa60dl`,k3aq6I:`x1cb1t30`,$$css:!0},filledTrackVertical:{kzqmXN:`x51ohtg`,$$css:!0},thumb:{kVAEAm:`x10l6tqk`,kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,kaIpWk:`xjspbzw`,kWkggS:`x1ewilqj`,k3aq6I:`x11lhmoz`,k1ekBW:`x106061f`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kI3sdo:`x1a2a7pz`,kkrTdU:`x1jm3nie x16khyan`,kY2c9j:`x1vjfegm`,$$css:!0},thumbHorizontal:{k87sOh:`xwa60dl`,k3aq6I:`x11lhmoz xoffwj3`,$$css:!0},thumbHover:{kWkggS:`x1ewilqj xvxo0qp`,$$css:!0},thumbDisabled:{kWkggS:`xwmxj5m`,kkrTdU:`xt0e3qv`,$$css:!0}};function WF(e,t,n){return Math.min(Math.max(e,t),n)}function GF(e){if(Math.abs(e)<1){let t=e.toExponential().split(`e-`);if(t.length===2)return(t[0].split(`.`)[1]?.length??0)+parseInt(t[1],10)}let t=String(e).split(`.`)[1];return t?t.length:0}function KF(e,t,n){if(n<=0)return e;let r=t+Math.round((e-t)/n)*n,i=Math.min(Math.max(GF(t),GF(n)),20);return Number(r.toFixed(i))}function qF(e,t,n){return n===t?0:(e-t)/(n-t)*100}var JF=HF/2;function YF(e){return QF(e,JF-e/100*HF)}function XF(e,t){let n=t-e;return QF(n,-(n/100)*HF)}function ZF(e,t){let n=t-HF;return n>0?(e-JF)/n:t>0?e/t:0}function QF(e,t){let n=e=>Number(e.toFixed(3));return`calc(${n(e)}% ${t<0?`-`:`+`} ${Math.abs(n(t))}px)`}function $F({ref:e,...t}){let{label:n,isLabelHidden:r=!1,description:i,isDisabled:a=!1,disabledMessage:o,isOptional:s=!1,isRequired:c=!1,status:l,labelTooltip:u,min:d=0,max:f=100,step:p=1,orientation:m=`horizontal`,formatValue:h,htmlName:g,valueDisplay:v=`tooltip`,marks:y,width:b,xstyle:x,className:S,style:C,"data-testid":w,value:T,onChange:E,onChangeEnd:D}=t,O=Array.isArray(T),k=O&&`minStepsBetweenThumbs`in t?t.minStepsBetweenThumbs??0:0,A=m===`horizontal`,j=(0,_.useId)(),M=(0,_.useId)(),N=(0,_.useId)(),P=(0,_.useId)(),F=(0,_.useId)(),I=(0,_.useRef)(null),L=(0,_.useRef)(null),[R,ee]=(0,_.useState)(null),[z,B]=(0,_.useState)(null);(0,_.useEffect)(()=>{Zi()},[]);let V=(0,_.useCallback)((e,t)=>{B(!a&&Qi()===`keyboard`?e:null)},[a]),H=(0,_.useCallback)(e=>{B(null)},[]),te=a&&!!o,ne=po({placement:`above`,focusTrigger:`always`,isEnabled:te}),re=c&&!s,ie=[];i&&ie.push(N),l?.message&&ie.push(P),re&&ie.push(F),te&&ie.push(ne.describedBy);let ae=ie.length>0?ie.join(` `):void 0,U=(0,_.useMemo)(()=>(Array.isArray(T)?T:[T??d]).map(e=>WF(e,d,f)),[T,d,f]),oe=(0,_.useRef)(U);oe.current=U;let se=(0,_.useCallback)((e,t)=>{let n=I.current;if(!n)return d;let r=n.getBoundingClientRect(),i;return i=A?ZF(cA(n)?r.right-e:e-r.left,r.width):1-ZF(t-r.top,r.height),i=WF(i,0,1),WF(KF(d+i*(f-d),d,p),d,f)},[d,f,p,A]),ce=(0,_.useCallback)(e=>{if(!O)return 0;let[t,n]=U;return Math.abs(e-t)<=Math.abs(e-n)?0:1},[O,U]),le=(0,_.useCallback)((e,t)=>{if(a)return;let n=WF(KF(t,d,p),d,f);if(O){let t=[...U];t[e]=n;let r=k*p;e===0?t[0]=Math.min(t[0],t[1]-r):t[1]=Math.max(t[1],t[0]+r),t[0]=WF(t[0],d,f),t[1]=WF(t[1],d,f),E?.(t)}else E?.(n)},[a,O,U,d,f,p,k,E]),ue=(0,_.useRef)(D);ue.current=D;let de=(0,_.useCallback)(e=>{let t=e??oe.current,n=ue.current;O?n?.(t):n?.(t[0])},[O]),fe=(0,_.useCallback)(e=>{if(a)return;e.preventDefault();let t=e.target.closest(`[data-mark-value]`),n=t?Number(t.dataset.markValue):se(e.clientX,e.clientY),r=ce(n);L.current=r,ee(r),le(r,n);let i=I.current;i&&i.querySelectorAll(`[role="slider"]`)[r]?.focus(),B(null),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId)},[a,se,ce,le]),pe=(0,_.useCallback)(e=>{if(L.current===null||a)return;let t=se(e.clientX,e.clientY);le(L.current,t)},[a,se,le]),me=(0,_.useCallback)(e=>{L.current!==null&&(L.current=null,ee(null),de())},[de]),W=(0,_.useCallback)((e,t)=>{if(a)return;Qi()===`keyboard`&&B(e);let n=U[e],r;switch(t.key){case`ArrowRight`:case`ArrowUp`:r=n+p;break;case`ArrowLeft`:case`ArrowDown`:r=n-p;break;case`PageUp`:r=n+p*10;break;case`PageDown`:r=n-p*10;break;case`Home`:r=d;break;case`End`:r=f;break;default:return}t.preventDefault();let i=WF(KF(r,d,p),d,f);if(le(e,r),O){let t=[...U];t[e]=i;let n=k*p;e===0?t[0]=Math.min(t[0],t[1]-n):t[1]=Math.max(t[1],t[0]+n),t[0]=WF(t[0],d,f),t[1]=WF(t[1],d,f),de(t)}else de([i])},[a,O,U,p,d,f,k,le,de]),he=e=>h?h(e):String(e),ge=e=>{let t=U[e],n=qF(t,d,f),r=A?{insetInlineStart:YF(n)}:{bottom:YF(n),left:`50%`},i=O?e===0?`Minimum value`:`Maximum value`:void 0,o=k*p,s=O&&e===1?WF(U[0]+o,d,f):d,c=O&&e===0?WF(U[1]-o,d,f):f,u=v===`tooltip`&&!te,g=A?`above`:`start`,_=(0,K.jsx)(`div`,{id:O?void 0:j,role:`slider`,tabIndex:a&&!te?-1:0,"aria-valuemin":s,"aria-valuemax":c,"aria-valuenow":t,"aria-valuetext":h?h(t):void 0,"aria-orientation":m,"aria-disabled":a||void 0,"aria-invalid":l?.type===`error`||void 0,"aria-label":i,"aria-labelledby":O?void 0:M,"aria-describedby":ae,onKeyDown:t=>W(e,t),onFocus:t=>V(e,t),onBlur:H,...oa(ba(`slider-thumb`,{orientation:m,disabled:a?`disabled`:null}),Sr(UF.thumb,A?UF.thumbHorizontal:Ra.centerInline(`50%`),!a&&UF.thumbHover,!a&&z===e&&Ha.focusVisible,a&&UF.thumbDisabled),void 0,r)},e);return u?(0,K.jsx)(Cd,{content:he(t),placement:g,delay:0,focusTrigger:`always`,isOpen:R===e||void 0,children:_},e):_},_e=(()=>{if(O){let[e,t]=U,n=qF(e,d,f),r=qF(t,d,f);return A?{insetInlineStart:YF(n),width:XF(n,r)}:{bottom:YF(n),height:XF(n,r)}}let e=qF(U[0],d,f);return A?{insetInlineStart:`0%`,width:YF(e)}:{bottom:`0%`,height:YF(e)}})(),ve=v===`text`?(0,K.jsx)(`span`,{className:`x9ynric xcr08ib x1tgivj0 xuxw1ft x2lah0s`,children:O?`${he(U[0])} – ${he(U[1])}`:he(U[0])}):null;return(0,K.jsxs)(MM,{"data-testid":w,label:n,isLabelHidden:r,description:i,inputID:j,labelID:M,isGroupLabel:!0,descriptionID:i?N:void 0,isOptional:s,isRequired:c,isDisabled:a,status:l?{type:l.type,message:l.message,messageID:l.message?P:void 0}:void 0,labelTooltip:u,statusVariant:`detached`,width:b,xstyle:x,className:S,style:C,children:[(0,K.jsxs)(`div`,{...oa(ba(`slider`,{orientation:m,disabled:a?`disabled`:null}),{className:`x78zum5 x6s0dn4 x1txdalj`}),children:[g!=null&&U.map((e,t)=>(0,K.jsx)(`input`,{type:`hidden`,name:g,value:String(e),disabled:a},t===0?`start`:`end`)),(0,K.jsxs)(`div`,{ref:Ao(e,I,ne.ref),...O?{role:`group`,"aria-labelledby":M}:void 0,onPointerDown:fe,onPointerMove:pe,onPointerUp:me,onPointerCancel:me,...{0:{className:`x1n2onr6 x78zum5 x6s0dn4 x1iyjqo2 x5ve5x3 x87ps6o xc8icb0 xw4jnvo x1ymw6g xkagaj0 xdt5ytf xl56j7k x1ypdohk x16khyan`},2:{className:`x1n2onr6 x78zum5 x6s0dn4 x1iyjqo2 x5ve5x3 x87ps6o xc8icb0 x1qx5ct2 x80b3aj xh8yej3 x1ypdohk x16khyan`},1:{className:`x1n2onr6 x78zum5 x6s0dn4 x1iyjqo2 x5ve5x3 x87ps6o xc8icb0 xw4jnvo x1ymw6g xkagaj0 xdt5ytf xl56j7k xbyyjgo xt0e3qv`},3:{className:`x1n2onr6 x78zum5 x6s0dn4 x1iyjqo2 x5ve5x3 x87ps6o xc8icb0 x1qx5ct2 x80b3aj xh8yej3 xbyyjgo xt0e3qv`}}[!!A<<1|!!a<<0],children:[(0,K.jsx)(`div`,{"aria-hidden":`true`,...oa(ba(`slider-track`,{orientation:m}),Sr(UF.track,A?UF.trackHorizontal:[UF.trackVertical,Ra.centerInline(`0px`)]))}),(0,K.jsx)(`div`,{"aria-hidden":`true`,...oa(Sr(UF.filledTrack,A?UF.filledTrackHorizontal:[UF.filledTrackVertical,Ra.centerInline(`0px`)]),{style:_e})}),y&&(0,K.jsx)(`div`,{"aria-hidden":`true`,...{0:{className:`x10l6tqk x13vifvy x1ey2m1c xbudbmw`},1:{className:`x10l6tqk x1o0tod xtijo5x xwa60dl`}}[!!A<<0],children:y.map(e=>{let t=qF(e.value,d,f),n=A?{insetInlineStart:YF(t)}:{bottom:YF(t)};return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{"data-testid":`slider-mark`,"data-mark-value":e.value,...oa({0:{className:`x10l6tqk x7njt3n xjspbzw x36qwtl x1xc55vz x1m9mm8y`},1:{className:`x10l6tqk x7njt3n xjspbzw xfo62xy xdk7pt x11lhmoz xoffwj3`}}[!!A<<0],{style:n})}),e.label&&(0,K.jsx)(`span`,{"data-testid":`slider-mark-label`,"data-mark-value":e.value,...oa({0:{className:`x10l6tqk x9ynric x141an7d xv1l7n4 xuxw1ft x131p8rn x9p6ekw`},1:{className:`x10l6tqk x9ynric x141an7d xv1l7n4 xuxw1ft xuuh30 x1nyx83j xuivejd`}}[!!A<<0],{style:n}),children:e.label})]},e.value)})}),U.map((e,t)=>ge(t))]}),ve]}),re&&(0,K.jsx)(es,{id:F,children:`Required`}),te&&ne.renderTooltip(o)]})}$F.displayName=`Slider`;var eI=[`explorer`,`implementer`,`reviewer`,`advisor`];function tI({catalog:e,error:t,onRefresh:n}){let{t:r}=cr();return!t&&!e?(0,K.jsxs)(`div`,{className:`settings-load-state`,role:`status`,children:[(0,K.jsx)(dt,{className:`settings-spin`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:r(`settingsCatalogLoading`)})]}):t?(0,K.jsxs)(`div`,{className:`settings-load-state error`,role:`alert`,children:[(0,K.jsx)(`strong`,{children:r(`settingsCatalogFailed`)}),(0,K.jsx)(`span`,{children:t}),(0,K.jsx)(`button`,{type:`button`,onClick:n,children:r(`retryAdmissionCheck`)})]}):null}function nI({isPending:e,isBlocked:t=!1,onConfigure:n,request:r,label:i}){return(0,K.jsx)(qc,{label:i,variant:`secondary`,size:`sm`,icon:(0,K.jsx)(It,{"aria-hidden":`true`}),isDisabled:e||t,isLoading:e,onClick:()=>void n(r)})}function rI({pending:e,onConfigure:t,placeholder:n}){let{t:r}=cr(),[i,a]=(0,_.useState)(``);return(0,K.jsxs)(`form`,{className:`settings-edit-form`,onSubmit:n=>{n.preventDefault(),!e&&i.trim()&&t(i.trim())},children:[(0,K.jsxs)(`label`,{className:`settings-form-field`,children:[r(`setupConfigurationRequest`),(0,K.jsx)(`textarea`,{required:!0,maxLength:2e3,value:i,disabled:e,placeholder:n,onChange:e=>a(e.target.value)})]}),(0,K.jsx)(`button`,{type:`submit`,disabled:e||!i.trim(),children:r(`configureViaSetup`)}),(0,K.jsx)(`small`,{children:r(`setupFormDetail`)})]})}function iI({catalog:e,error:t,currentModel:n,thinkingLevel:r,cwd:i,setupPending:a,setupBlocked:o=!1,preferencePending:s,setupBusy:c,setupBlockedReason:l,onConfigure:u,onUpdatePreferences:d,onOpenRuntimeStatus:f,onRefresh:p}){let{t:m}=cr(),h=e?.setup,g=h?.workflows.concurrency??0,v=h?.workflows.maxAgentCalls??0,[y,b]=(0,_.useState)(g),[x,S]=(0,_.useState)(v);return(0,_.useEffect)(()=>b(g),[g]),(0,_.useEffect)(()=>S(v),[v]),(0,K.jsxs)(`section`,{className:`settings-general-panel`,children:[(0,K.jsxs)(`div`,{className:`settings-page-heading`,children:[(0,K.jsx)(`div`,{children:(0,K.jsx)(`h1`,{children:m(`generalSettings`)})}),(0,K.jsx)(nI,{isPending:a,isBlocked:o,onConfigure:u,request:m(`setupRequestReviewAll`),label:m(`configureOpenPi`)})]}),c&&(0,K.jsx)(`p`,{className:`settings-pending-hint`,role:`status`,children:l||m(`settingsSetupBusyHint`)}),(0,K.jsx)(tI,{catalog:e,error:t,onRefresh:p}),h&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{className:`settings-section-block`,children:[(0,K.jsx)(`h2`,{children:m(`agentBehavior`)}),(0,K.jsxs)(`div`,{className:`settings-chat-controls`,children:[(0,K.jsxs)(`label`,{className:`settings-inline-control`,children:[(0,K.jsx)(St,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:m(`capabilityDiscovery`)}),(0,K.jsx)(`select`,{value:h.capabilities.discovery,disabled:a||o,onChange:e=>void u(m(`setupRequestDiscovery`,{mode:e.target.value})),children:[`explicit`,`adaptive`].map(e=>(0,K.jsx)(`option`,{value:e,children:m(`capabilityDiscovery_${e}`)},e))})]}),(0,K.jsxs)(`form`,{className:`settings-limits-control`,onSubmit:e=>{e.preventDefault(),!a&&!o&&u(m(`setupRequestLimits`,{concurrency:y,calls:x}))},children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(ke,{"aria-hidden":`true`}),m(`workflowLimits`)]}),(0,K.jsx)(`small`,{children:m(`workflowLimitsValue`,{concurrency:h.workflows.concurrency,calls:h.workflows.maxAgentCalls})}),(0,K.jsxs)(`label`,{children:[m(`workflowConcurrency`),(0,K.jsx)(`input`,{type:`number`,min:1,value:y,disabled:a||o,onChange:e=>b(Number(e.target.value)),required:!0})]}),(0,K.jsxs)(`label`,{children:[m(`workflowCalls`),(0,K.jsx)(`input`,{type:`number`,min:1,value:x,disabled:a||o,onChange:e=>S(Number(e.target.value)),required:!0})]}),(0,K.jsx)(`button`,{type:`submit`,disabled:a||o||y===h.workflows.concurrency&&x===h.workflows.maxAgentCalls,children:m(`configureViaSetup`)})]}),(0,K.jsx)(QP,{label:m(`nextActionSuggestions`),value:h.suggestions.enabled,size:`sm`,width:`100%`,labelPosition:`start`,labelSpacing:`spread`,isDisabled:a||o,isLoading:a,onChange:e=>void u(m(e?`setupRequestEnableSuggestions`:`setupRequestDisableSuggestions`))}),h.suggestions.model&&(0,K.jsx)(`small`,{children:`${h.suggestions.model.provider}/${h.suggestions.model.model} · ${h.suggestions.model.reasoning}`}),(0,K.jsxs)(`div`,{className:`settings-inline-control`,children:[(0,K.jsx)(ce,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[m(`postEditCommand`),` ·`,` `,m(h.postEditConfigured?`configured`:`disabled`)]}),(0,K.jsx)(nI,{isPending:a,isBlocked:o,onConfigure:u,request:m(`setupRequestPostEdit`),label:m(`configurePostEdit`)})]}),(0,K.jsx)(`small`,{children:m(`agentSettingsSetupHint`)})]})]}),(0,K.jsxs)(`section`,{className:`settings-section-block`,children:[(0,K.jsx)(`h2`,{children:m(`resultDisplay`)}),(0,K.jsxs)(`div`,{className:`settings-chat-controls`,children:[[[`subagentResultDisplay`,`subagentResults`],[`bashToolDisplay`,`bashOperations`],[`fileMutationDisplay`,`fileMutations`]].map(([e,t])=>(0,K.jsxs)(`label`,{className:`settings-inline-control`,children:[(0,K.jsx)(`span`,{children:m(t)}),(0,K.jsxs)(`select`,{value:h.ui[e],disabled:s,onChange:t=>{let n=t.target.value;(n===`full`||n===`compact`)&&d({[e]:n})},children:[(0,K.jsx)(`option`,{value:`compact`,children:m(`detailDisplay_compact`)}),(0,K.jsx)(`option`,{value:`full`,children:m(`detailDisplay_full`)})]})]},e)),(0,K.jsx)(QP,{label:m(`terminalFooter`),value:h.ui.customFooter,size:`sm`,width:`100%`,labelPosition:`start`,labelSpacing:`spread`,isDisabled:s,isLoading:s,onChange:e=>void d({customFooter:e})}),(0,K.jsxs)(`label`,{className:`settings-inline-control`,children:[(0,K.jsx)(`span`,{children:m(`terminalFooterStyle`)}),(0,K.jsxs)(`select`,{value:h.ui.footerStyle,disabled:s||!h.ui.customFooter,onChange:e=>{let t=e.target.value;(t===`plain`||t===`powerline`||t===`powerline-mono`)&&d({footerStyle:t})},children:[(0,K.jsx)(`option`,{value:`plain`,children:`Plain`}),(0,K.jsx)(`option`,{value:`powerline`,children:`Powerline`}),(0,K.jsx)(`option`,{value:`powerline-mono`,children:`Powerline Mono`})]})]}),(0,K.jsx)(`small`,{children:m(`terminalFooterHint`)})]})]})]}),(0,K.jsxs)(`section`,{className:`settings-section-block`,children:[(0,K.jsx)(`h2`,{children:m(`sessionSettings`)}),(0,K.jsxs)(`dl`,{className:`settings-summary-list`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:m(`selectedModel`)}),(0,K.jsx)(`dd`,{children:n?.label??m(`noModels`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:m(`thinkingLevel`)}),(0,K.jsx)(`dd`,{children:r})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:m(`currentWorkspace`)}),(0,K.jsx)(`dd`,{title:i,children:i})]})]}),(0,K.jsx)(qc,{label:m(`openRuntimeDetails`),variant:`secondary`,size:`sm`,icon:(0,K.jsx)(we,{"aria-hidden":`true`}),className:`settings-runtime-action`,onClick:f})]})]})}function aI(e){return e.split(/[\\/]/u).filter(Boolean).at(-1)||e}function oI({kind:e,query:t,scope:n,onQuery:r,onScope:i,onAdd:a}){let{t:o}=cr();return(0,K.jsxs)(`div`,{className:`settings-resource-toolbar`,children:[(0,K.jsxs)(`div`,{className:`settings-resource-toolbar-heading`,children:[(0,K.jsx)(`strong`,{children:o(e===`skills`?`skillsSettings`:`pluginsSettings`)}),(0,K.jsx)(qc,{label:o(e===`skills`?`addSkill`:`addPlugin`),variant:`secondary`,size:`sm`,icon:(0,K.jsx)(lt,{"aria-hidden":`true`}),onClick:a})]}),(0,K.jsxs)(`label`,{className:`settings-resource-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`input`,{type:`search`,"aria-label":o(`searchResources`),placeholder:o(`searchResources`),value:t,onChange:e=>r(e.target.value)})]}),(0,K.jsxs)(`select`,{"aria-label":o(`filterResourceScope`),value:n,onChange:e=>i(e.target.value),children:[(0,K.jsx)(`option`,{value:`all`,children:o(`allResourceScopes`)}),[`project`,`user`,`temporary`].map(e=>(0,K.jsx)(`option`,{value:e,children:o(`resourceScope_${e}`)},e))]})]})}function sI({kind:e,pending:t,onConfigure:n,onCancel:r}){let{t:i}=cr(),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(`user`);return(0,K.jsxs)(`section`,{className:`settings-resource-install`,children:[(0,K.jsx)(`header`,{className:`settings-detail-heading`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{children:i(`resourceManagement`)}),(0,K.jsx)(`h1`,{children:i(e===`skills`?`addSkill`:`addPlugin`)}),(0,K.jsx)(`p`,{children:i(`resourceInstallIntro`)})]})}),(0,K.jsxs)(`form`,{className:`settings-edit-form`,onSubmit:r=>{r.preventDefault(),!t&&a.trim()&&n(i(`setupResourceInstallRequest`,{kind:i(e===`skills`?`skillsSettings`:`pluginsSettings`),source:JSON.stringify(a.trim()),scope:s}))},children:[(0,K.jsxs)(`label`,{className:`settings-form-field`,children:[i(`resourcePackageSource`),(0,K.jsx)(`input`,{required:!0,maxLength:1e3,value:a,placeholder:i(`resourcePackageSourcePlaceholder`),disabled:t,onChange:e=>{o(e.target.value)}})]}),(0,K.jsxs)(`label`,{className:`settings-form-field`,children:[i(`scope`),(0,K.jsxs)(`select`,{value:s,disabled:t,onChange:e=>{c(e.target.value)},children:[(0,K.jsx)(`option`,{value:`user`,children:i(`resourceScope_user`)}),(0,K.jsx)(`option`,{value:`project`,children:i(`resourceScope_project`)})]})]}),(0,K.jsxs)(`div`,{className:`settings-resource-actions`,children:[(0,K.jsx)(qc,{type:`submit`,label:i(`configureViaSetup`),variant:`secondary`,size:`sm`,isDisabled:t||!a.trim()}),(0,K.jsx)(qc,{label:i(`cancel`),variant:`ghost`,size:`sm`,onClick:r})]}),(0,K.jsx)(`small`,{children:i(`resourceInstallReview`)})]}),e===`skills`&&(0,K.jsxs)(`a`,{className:`settings-resource-link`,href:`https://skills.sh`,target:`_blank`,rel:`noreferrer`,children:[i(`browseSkills`),(0,K.jsx)(he,{"aria-hidden":`true`})]})]})}function cI({catalog:e,pending:t,onReload:n,kind:r,onConfigure:i,children:a}){let{t:o}=cr(),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null);return(0,K.jsxs)(`section`,{className:`settings-resource-management`,children:[a&&(0,K.jsx)(`div`,{className:`settings-resource-actions`,children:a}),(0,K.jsxs)(`div`,{className:`settings-resource-reload`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:o(`resourceSessionState`)}),(0,K.jsx)(`p`,{children:o(`resourcesReloadNote`)})]}),(0,K.jsx)(qc,{label:o(`reloadResources`),variant:`secondary`,size:`sm`,icon:(0,K.jsx)(dt,{"aria-hidden":`true`}),isDisabled:t||l||!e?.sessionPath||!n,isLoading:l,onClick:()=>c(!0)})]}),d&&(0,K.jsx)(`p`,{className:`settings-resource-notice`,role:`status`,children:d}),(0,K.jsxs)(`details`,{className:`settings-resource-advanced`,children:[(0,K.jsx)(`summary`,{children:o(`advancedResourceConfiguration`)}),(0,K.jsx)(rI,{pending:t,onConfigure:i,placeholder:o(r===`skills`?`setupSkillsPlaceholder`:`setupPluginsPlaceholder`)})]}),s&&(0,K.jsx)(HP,{isOpen:!0,onOpenChange:c,title:o(`reloadResources`),description:o(`resourceReloadReview`),cancelLabel:o(`cancel`),actionLabel:o(`reloadResources`),onAction:()=>{c(!1),u(!0),f(null),n?.().then(()=>f(o(`resourceReloaded`)),e=>f(e instanceof Error?e.message:o(`resourceReloadFailed`))).finally(()=>u(!1))}})]})}function lI({catalog:e}){let{t}=cr();if(!e)return null;let{diagnostics:n,truncation:r}=e.resources;return!n.settingsErrors&&!n.extensionErrors&&!n.skillErrors&&!r.truncated?null:(0,K.jsxs)(`p`,{className:`settings-resource-notice`,role:`status`,children:[t(`resourceDiagnostics`,n),n.settingsErrors?` ${t(`resourceConfigurationDiagnostics`,{count:n.settingsErrors})}`:``,r.truncated&&` ${t(`resourceCatalogTruncated`)}`]})}function uI({catalog:e,error:t,onRefresh:n,setupPending:r,onConfigure:i,onReload:a}){let{t:o}=cr(),s=e?.resources.skills??[],[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(`all`),[f,p]=(0,_.useState)(!1),m=(0,_.useMemo)(()=>s.filter(e=>(u===`all`||e.scope===u)&&`${e.name} ${e.description} ${e.source}`.toLocaleLowerCase().includes(c.trim().toLocaleLowerCase())),[s,c,u]),h=(0,_.useMemo)(()=>[`project`,`user`,`temporary`].map(e=>({scope:e,skills:m.filter(t=>t.scope===e)})).filter(e=>e.skills.length>0),[m]),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)(null),x=m.find(e=>e.id===g)??m[0],S=m.filter(e=>e.canManage!==!1),C=JSON.stringify(S.map(e=>e.filePath)),w=new TextEncoder().encode(C).length>12e3;(0,_.useEffect)(()=>{s.length&&!s.some(e=>e.id===g)&&v(s[0].id)},[g,s]);let T=e=>{b(null),wd(`/skill:${e.name} `).then(e=>b(e?`copied`:`failed`))};return(0,K.jsxs)(`section`,{className:`settings-split-panel settings-managed-panel`,children:[(0,K.jsxs)(`aside`,{className:`settings-resource-sidebar`,children:[(0,K.jsx)(oI,{kind:`skills`,query:c,scope:u,onQuery:l,onScope:d,onAdd:()=>p(!0)}),(0,K.jsxs)(`div`,{className:`settings-resource-list`,children:[h.map(e=>(0,K.jsxs)(`section`,{className:`settings-resource-group`,children:[(0,K.jsx)(`span`,{className:`settings-sidebar-label`,children:o(`resourceScope_${e.scope}`)}),e.skills.map(e=>(0,K.jsxs)(`button`,{type:`button`,className:`settings-resource-item`,"aria-current":e.id===x?.id?`page`:void 0,onClick:()=>{v(e.id),b(null),p(!1)},children:[(0,K.jsx)(St,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:e.name}),(0,K.jsx)(`small`,{children:o(e.disableModelInvocation?`explicitOnly`:`availableToModel`)})]})]},e.id))]},e.scope)),!e&&!t&&(0,K.jsx)(tI,{catalog:e,error:t,onRefresh:n}),e&&!m.length&&(0,K.jsx)(`p`,{className:`settings-resource-empty`,children:o(s.length?`noMatchingResources`:`noSkillsFound`)})]}),(0,K.jsxs)(`div`,{className:`settings-sidebar-footer`,children:[(0,K.jsx)(`span`,{children:o(`skillCount`,{count:s.length})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o(`refreshStatus`),onClick:n,children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{className:`settings-resource-detail`,children:[(0,K.jsx)(lI,{catalog:e}),f?(0,K.jsx)(sI,{kind:`skills`,pending:r,onConfigure:i,onCancel:()=>p(!1)}):t?(0,K.jsx)(tI,{catalog:e,error:t,onRefresh:n}):x?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`header`,{className:`settings-detail-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`span`,{children:[o(`resourceScope_${x.scope}`),` · `,o(`skill`)]}),(0,K.jsx)(`h1`,{children:x.name}),(0,K.jsx)(`p`,{children:x.description})]}),(0,K.jsx)(qc,{label:o(y===`copied`?`copiedMessage`:`copySkillInvocation`),variant:`secondary`,size:`sm`,icon:y===`copied`?(0,K.jsx)(I,{}):(0,K.jsx)(oe,{}),onClick:()=>T(x)})]}),(0,K.jsxs)(`dl`,{className:`settings-detail-metadata`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`source`)}),(0,K.jsx)(`dd`,{children:x.source===`auto`?o(`resourceSourceAuto`):x.source===`local`?o(`resourceSourceLocal`):x.source===`builtin`?o(`builtIn`):x.source})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`scope`)}),(0,K.jsx)(`dd`,{children:o(`resourceScope_${x.scope}`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`invocation`)}),(0,K.jsx)(`dd`,{children:(0,K.jsx)(`code`,{children:`/skill:${x.name}`})})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`modelInvocation`)}),(0,K.jsx)(`dd`,{children:o(x.disableModelInvocation?`explicitOnly`:`availableToModel`)})]})]}),(0,K.jsxs)(`section`,{className:`settings-path-block`,children:[(0,K.jsx)(Se,{"aria-hidden":`true`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:o(`skillFile`)}),(0,K.jsx)(`code`,{children:x.filePath})]})]}),(0,K.jsxs)(`div`,{className:`settings-resource-actions`,children:[(0,K.jsx)(nI,{isPending:r,isBlocked:x.canManage===!1,onConfigure:i,label:o(x.disableModelInvocation?`enableSkillInvocation`:`disableSkillInvocation`),request:o(`setupSkillInvocationRequest`,{path:x.filePath,disabled:!x.disableModelInvocation})}),(0,K.jsx)(nI,{isPending:r,isBlocked:x.canManage===!1,onConfigure:i,label:o(`updateResource`),request:o(`setupSkillManageRequest`,{action:`update`,path:JSON.stringify(x.filePath),source:JSON.stringify(x.source),scope:x.scope})}),(0,K.jsx)(nI,{isPending:r,isBlocked:x.canManage===!1,onConfigure:i,label:o(`removeResource`),request:o(`setupSkillManageRequest`,{action:`remove`,path:JSON.stringify(x.filePath),source:JSON.stringify(x.source),scope:x.scope})})]}),x.canManage===!1&&(0,K.jsx)(`p`,{className:`settings-resource-notice`,children:o(`resourceTargetTruncated`)}),y===`failed`&&(0,K.jsx)(`p`,{className:`inspection-warning`,children:o(`copyFailed`)})]}):(0,K.jsxs)(`div`,{className:`settings-empty-detail`,children:[(0,K.jsx)(St,{"aria-hidden":`true`}),(0,K.jsx)(`h1`,{children:o(s.length?`noMatchingResources`:`skillsEmptyTitle`)}),(0,K.jsx)(`p`,{children:o(`skillsEmptyIntro`)}),(0,K.jsx)(qc,{label:o(`addSkill`),variant:`secondary`,size:`sm`,icon:(0,K.jsx)(lt,{"aria-hidden":`true`}),onClick:()=>p(!0)})]}),!f&&(0,K.jsxs)(cI,{catalog:e,pending:r,onReload:a,kind:`skills`,onConfigure:i,children:[S.length>1&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(nI,{isPending:r,isBlocked:w,onConfigure:i,label:o(`enableVisibleSkills`,{count:S.length}),request:o(`setupSkillsBulkRequest`,{paths:C,disabled:!1})}),(0,K.jsx)(nI,{isPending:r,isBlocked:w,onConfigure:i,label:o(`disableVisibleSkills`,{count:S.length}),request:o(`setupSkillsBulkRequest`,{paths:C,disabled:!0})})]}),w&&(0,K.jsx)(`p`,{className:`settings-resource-caption`,children:o(`resourceBulkTooLarge`)})]})]})]})}function dI({catalog:e,error:t,currentModel:n,models:r,activity:i,setupPending:a,setupBlocked:o=!1,onConfigure:s,onRefresh:c}){let{t:l}=cr(),[u,d]=(0,_.useState)(`explorer`),f=e?.setup.subagents.roleModels[u],[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(1);(0,_.useEffect)(()=>{let t=e?.setup.subagents.roleModels[u];m(t?`${t.provider}/${t.model}`:``),g(e?.setup.workflows.concurrency??1)},[u,e]);let v=i?.items.filter(e=>e.status===`running`).length??0,y=i?.items.filter(e=>e.status!==`running`).length??0;return(0,K.jsxs)(`section`,{className:`settings-subagents-panel`,children:[(0,K.jsxs)(`header`,{className:`settings-subagent-summary`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:l(`subagentConfiguration`)}),(0,K.jsx)(`span`,{children:l(`subagentConfigurationIntro`)})]}),e&&(0,K.jsxs)(`div`,{className:`settings-subagent-metrics`,children:[(0,K.jsx)(`span`,{children:l(`subagentActiveCount`,{count:v})}),(0,K.jsx)(`span`,{children:l(`subagentCompletedCount`,{count:y})}),(0,K.jsx)(`span`,{children:l(`subagentConcurrency`,{count:e.setup.workflows.concurrency})})]})]}),(0,K.jsxs)(`div`,{className:`settings-split-panel settings-subagent-split`,children:[(0,K.jsxs)(`aside`,{className:`settings-resource-sidebar`,children:[(0,K.jsxs)(`div`,{className:`settings-resource-list`,children:[(0,K.jsx)(`span`,{className:`settings-sidebar-label`,children:l(`builtInRoles`)}),eI.map(e=>(0,K.jsxs)(`button`,{type:`button`,className:`settings-resource-item`,"aria-current":e===u?`page`:void 0,onClick:()=>d(e),children:[(0,K.jsx)(M,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:l(`subagentRole_${e}`)}),(0,K.jsx)(`small`,{children:l(`subagentRoleShort_${e}`)})]})]},e))]}),(0,K.jsx)(`div`,{className:`settings-sidebar-footer settings-sidebar-footer-action`,children:(0,K.jsx)(nI,{isPending:a,isBlocked:o,onConfigure:s,request:l(`setupRequestSubagents`),label:l(`configureRoles`)})})]}),(0,K.jsxs)(`div`,{className:`settings-resource-detail`,children:[(0,K.jsx)(tI,{catalog:e,error:t,onRefresh:c}),e&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`header`,{className:`settings-detail-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{children:l(`builtInRole`)}),(0,K.jsx)(`h1`,{children:l(`subagentRole_${u}`)}),(0,K.jsx)(`p`,{children:l(`subagentRoleDescription_${u}`)})]}),(0,K.jsx)(`span`,{className:`settings-status-badge`,children:l(`builtIn`)})]}),(0,K.jsxs)(`dl`,{className:`settings-detail-metadata settings-detail-metadata-wide`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:l(`modelAssignment`)}),(0,K.jsx)(`dd`,{children:f?`${f.provider}/${f.model}`:l(`inheritParentModel`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:l(`effectiveModel`)}),(0,K.jsx)(`dd`,{children:f?`${f.provider}/${f.model}`:n?.label??l(`unknownState`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:l(`workflowConcurrencyLabel`)}),(0,K.jsx)(`dd`,{children:e.setup.workflows.concurrency})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:l(`workflowCallLimit`)}),(0,K.jsx)(`dd`,{children:e.setup.workflows.maxAgentCalls})]})]}),(0,K.jsxs)(`section`,{className:`settings-role-principles`,children:[(0,K.jsxs)(`form`,{className:`settings-edit-form`,onSubmit:e=>{e.preventDefault(),!a&&s(l(`setupRoleFormRequest`,{role:u,model:p||l(`inheritParentModel`),concurrency:h}))},children:[(0,K.jsxs)(`label`,{className:`settings-form-field`,children:[l(`modelAssignment`),(0,K.jsxs)(`select`,{value:p,disabled:a,onChange:e=>m(e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:l(`inheritParentModel`)}),p&&!r.some(e=>`${e.provider}/${e.id}`===p)&&(0,K.jsx)(`option`,{value:p,children:p}),r.map(e=>(0,K.jsx)(`option`,{value:`${e.provider}/${e.id}`,children:e.label},`${e.provider}/${e.id}`))]})]}),(0,K.jsxs)(`label`,{className:`settings-form-field`,children:[l(`workflowConcurrencyLabel`),(0,K.jsx)(`input`,{type:`number`,min:1,max:64,required:!0,value:h,disabled:a,onChange:e=>g(Number(e.target.value))})]}),(0,K.jsx)(`button`,{type:`submit`,disabled:a,children:l(`configureViaSetup`)}),(0,K.jsx)(`small`,{children:l(`setupFormDetail`)})]}),(0,K.jsx)(`h2`,{children:l(`runtimeBoundaries`)}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(Fe,{"aria-hidden":`true`}),(0,K.jsx)(`p`,{children:l(`subagentAuthorityNote`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(fe,{"aria-hidden":`true`}),(0,K.jsx)(`p`,{children:l(`subagentModelNote`)})]})]})]})]})]})]})}function fI(e){return e.extensions.length+e.skills.length+e.prompts.length+e.themes.length}function pI(e){return e.enabled===!1?`disabled`:e.configured&&!e.installed?`missing`:e.diagnostics?.length?`error`:fI(e)?`loaded`:e.installed?`installed`:`notLoaded`}function mI({catalog:e,error:t,onRefresh:n,setupPending:r,onConfigure:i,onReload:a}){let{t:o}=cr(),s=e?.resources.plugins??[],[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(`all`),[f,p]=(0,_.useState)(!1),m=(0,_.useMemo)(()=>s.filter(e=>(u===`all`||e.scope===u)&&`${e.name??``} ${e.source}`.toLocaleLowerCase().includes(c.trim().toLocaleLowerCase())),[s,c,u]),[h,g]=(0,_.useState)(``),v=m.find(e=>e.id===h)??m[0],y=m.filter(e=>e.configured&&e.canManage!==!1),b=e=>e.name??(e.source===`auto`?o(`resourceSourceAuto`):e.source===`builtin`?o(`builtIn`):aI(e.source)),x=JSON.stringify(y.map(({source:e,scope:t,baseDir:n})=>({source:e,scope:t,path:n}))),S=new TextEncoder().encode(x).length>12e3;return(0,_.useEffect)(()=>{s.length&&!s.some(e=>e.id===h)&&g(s[0].id)},[s,h]),(0,K.jsxs)(`section`,{className:`settings-split-panel settings-managed-panel`,children:[(0,K.jsxs)(`aside`,{className:`settings-resource-sidebar`,children:[(0,K.jsx)(oI,{kind:`plugins`,query:c,scope:u,onQuery:l,onScope:d,onAdd:()=>p(!0)}),(0,K.jsxs)(`div`,{className:`settings-resource-list`,children:[m.map(e=>(0,K.jsxs)(`button`,{type:`button`,className:`settings-resource-item`,"aria-current":e.id===v?.id?`page`:void 0,onClick:()=>{g(e.id),p(!1)},children:[(0,K.jsx)(ct,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:b(e)}),(0,K.jsxs)(`small`,{children:[o(`resourceScope_${e.scope}`),` ·`,` `,o(`pluginState_${pI(e)}`)]})]})]},e.id)),!e&&!t&&(0,K.jsx)(tI,{catalog:e,error:t,onRefresh:n}),e&&!m.length&&(0,K.jsx)(`p`,{className:`settings-resource-empty`,children:o(s.length?`noMatchingResources`:`noPluginsFound`)})]}),(0,K.jsxs)(`div`,{className:`settings-sidebar-footer`,children:[(0,K.jsx)(`span`,{children:e?o(`pluginCount`,{count:s.length}):o(`settingsCatalogLoading`)}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o(`refreshStatus`),onClick:n,children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{className:`settings-resource-detail`,children:[(0,K.jsx)(lI,{catalog:e}),f?(0,K.jsx)(sI,{kind:`plugins`,pending:r,onConfigure:i,onCancel:()=>p(!1)}):t?(0,K.jsx)(tI,{catalog:e,error:t,onRefresh:n}):v?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`header`,{className:`settings-detail-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{children:o(`resourceScope_${v.scope}`)}),(0,K.jsx)(`h1`,{children:b(v)}),(0,K.jsx)(`code`,{children:v.source})]}),(0,K.jsx)(`span`,{className:`settings-status-badge ${pI(v)===`loaded`?`healthy`:``}`,children:o(`pluginState_${pI(v)}`)})]}),(0,K.jsxs)(`dl`,{className:`settings-detail-metadata settings-detail-metadata-wide`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`scope`)}),(0,K.jsx)(`dd`,{children:o(`resourceScope_${v.scope}`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`resourceOrigin`)}),(0,K.jsx)(`dd`,{children:o(`resourceOrigin_${v.origin}`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`installedVersion`)}),(0,K.jsx)(`dd`,{children:v.installedVersion??o(`notReported`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`configuredVersion`)}),(0,K.jsx)(`dd`,{children:v.configuredVersion??o(`resourceVersionUnpinned`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`resources`)}),(0,K.jsx)(`dd`,{children:o(`pluginResourceSummary`,{extensions:v.extensions.length,skills:v.skills.length,prompts:v.prompts.length,themes:v.themes.length})})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`baseDirectory`)}),(0,K.jsx)(`dd`,{title:v.baseDir,children:v.baseDir??o(`notReported`)})]})]}),[...new Set(v.diagnostics)].map(e=>(0,K.jsx)(`p`,{className:`settings-resource-notice`,role:`status`,children:e},e)),v.canManage===!1&&(0,K.jsx)(`p`,{className:`settings-resource-notice`,children:o(`resourceTargetTruncated`)}),v.configured&&v.canManage!==!1&&(0,K.jsx)(`div`,{className:`settings-resource-actions settings-resource-primary-actions`,children:[v.enabled===!1?`enable`:`disable`,`update`,`remove`].map(e=>(0,K.jsx)(nI,{isPending:r,onConfigure:i,label:o(`pluginAction_${e}`),request:o(`setupPluginOperationRequest`,{action:e,source:JSON.stringify(v.source),path:JSON.stringify(v.baseDir??null),scope:v.scope})},e))}),(0,K.jsx)(`p`,{className:`settings-resource-caption`,children:o(`pluginLoadedResources`,{count:fI(v)})}),(0,K.jsxs)(`section`,{className:`settings-resource-groups`,children:[v.extensions.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:o(`extensions`)}),(0,K.jsx)(`ul`,{children:v.extensions.map(e=>(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:e.name}),(0,K.jsx)(`code`,{children:e.path})]}),(0,K.jsx)(`span`,{children:o(`extensionSurfaceCount`,{tools:e.toolCount,commands:e.commandCount})})]},e.path))})]}),v.skills.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:o(`skillsSettings`)}),(0,K.jsx)(`p`,{children:v.skills.join(` · `)})]}),v.prompts.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:o(`prompts`)}),(0,K.jsx)(`p`,{children:v.prompts.join(` · `)})]}),v.themes.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:o(`themes`)}),(0,K.jsx)(`p`,{children:v.themes.join(` · `)})]})]})]}):(0,K.jsxs)(`div`,{className:`settings-empty-detail`,children:[(0,K.jsx)(ct,{"aria-hidden":`true`}),(0,K.jsx)(`h1`,{children:o(s.length?`noMatchingResources`:`pluginsEmptyTitle`)}),(0,K.jsx)(`p`,{children:o(`pluginsEmptyIntro`)}),(0,K.jsx)(qc,{label:o(`addPlugin`),variant:`secondary`,size:`sm`,icon:(0,K.jsx)(lt,{"aria-hidden":`true`}),onClick:()=>p(!0)})]}),!f&&(0,K.jsxs)(cI,{catalog:e,pending:r,onReload:a,kind:`plugins`,onConfigure:i,children:[y.length>1&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(nI,{isPending:r,isBlocked:S,onConfigure:i,label:o(`enableVisiblePlugins`,{count:y.length}),request:o(`setupPluginsBulkRequest`,{packages:x,disabled:!1})}),(0,K.jsx)(nI,{isPending:r,isBlocked:S,onConfigure:i,label:o(`disableVisiblePlugins`,{count:y.length}),request:o(`setupPluginsBulkRequest`,{packages:x,disabled:!0})})]}),S&&(0,K.jsx)(`p`,{className:`settings-resource-caption`,children:o(`resourceBulkTooLarge`)})]})]})]})}function hI(e,t=``,n){let r=(0,_.useMemo)(()=>new rf,[]),[i,a]=(0,_.useState)(0),o=JSON.stringify([e,t]),s=(0,_.useRef)(o);s.current=o;let c=(0,_.useRef)(0),[l,u]=(0,_.useState)(null),d=(0,_.useCallback)(()=>a(e=>e+1),[]);return(0,_.useEffect)(()=>{let t=new AbortController,n=++c.current;return u(e=>({owner:o,catalog:e?.owner===o?e.catalog:null,error:null})),r.settingsCatalog(e,t.signal).then(e=>{!t.signal.aborted&&c.current===n&&u({owner:o,catalog:e,error:null})},e=>{!t.signal.aborted&&c.current===n&&u(t=>({owner:o,catalog:t?.owner===o?t.catalog:null,error:e instanceof Error?e.message:String(e)}))}),()=>t.abort()},[r,i,e,o,n]),{catalog:l?.owner===o?l.catalog:null,error:l?.owner===o?l.error:null,refresh:d,updateSetup:e=>{s.current===o&&(c.current++,u(t=>t?.owner===o&&t.catalog?{...t,catalog:{...t.catalog,setup:e}}:t))}}}var gI=[`default`,`mist`,`rose`,`pine`],_I=[`codex`,`sans`,`serif`,`mono`],vI=[`system`,`light`,`dark`],yI={palette:`default`,accent:``,background:``,foreground:``,font:`codex`};function bI(e){return e===`pine`?`dark`:e===`mist`||e===`rose`?`light`:e}function xI(e,t){return e===`mist`||e===`rose`||e===`pine`?e:t.palette}function SI(e,t){switch(e){case`mist`:return t?{background:`#182126`,foreground:`#EDF3F5`}:{background:`#F8FBFC`,foreground:`#253239`};case`rose`:return t?{background:`#251C20`,foreground:`#F5EDF0`}:{background:`#FFFAFB`,foreground:`#392B2F`};case`pine`:return t?{background:`#16201C`,foreground:`#EDF3EF`}:{background:`#F5FAF7`,foreground:`#24382D`};default:return t?{background:`#17191C`,foreground:`#EDF0F2`}:{background:`#FFFFFF`,foreground:`#1A1C1F`}}}function CI(e){if(e.length>2e3)return null;try{let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;if(Object.keys(n).sort().join(`,`)!==`appearance,theme,version`||n.version!==1)return null;let r=vI.find(e=>e===n.theme);if(!r||!n.appearance||typeof n.appearance!=`object`||Array.isArray(n.appearance))return null;let i=n.appearance;if(Object.keys(i).sort().join(`,`)!==`accent,background,font,foreground,palette`)return null;let a=gI.find(e=>e===i.palette),o=i.font===`system`?`codex`:_I.find(e=>e===i.font),{accent:s,background:c,foreground:l}=i;return!a||!o||typeof s!=`string`||typeof c!=`string`||typeof l!=`string`||![s,c,l].every(e=>e===``||/^#[0-9a-f]{6}$/iu.test(e))?null:{theme:r,appearance:{palette:a,font:o,accent:s,background:c,foreground:l}}}catch{return null}}var wI=[``,`#2563EB`,`#7C3AED`,`#DB2777`,`#D97706`,`#16A34A`];function TI({label:e,value:t,options:n,disabled:r,onSelect:i}){let a=n.find(e=>e.id===t);return(0,K.jsx)(jA,{button:{label:a?.label??t,"aria-label":e,variant:`secondary`,size:`sm`,className:`appearance-menu-trigger`,isDisabled:r,...a?.color?{icon:(0,K.jsx)(`span`,{className:`appearance-color-dot`,style:{background:a.color}})}:{}},menuWidth:200,alignment:`end`,items:n.map(e=>({id:e.id||`default`,label:e.label,isDisabled:r,...e.color?{icon:(0,K.jsx)(`span`,{className:`appearance-color-dot`,style:{background:e.color}})}:{},endContent:t===e.id?(0,K.jsx)(I,{"aria-hidden":`true`}):void 0,onClick:()=>i(e.id)}))})}function EI({label:e,value:t,fallback:n,disabled:r,onSave:i}){let a=(t||n).toUpperCase(),[o,s]=(0,_.useState)(a);(0,_.useEffect)(()=>s(a),[a]);let c=e=>{s(e),e!==a&&/^#[0-9a-f]{6}$/iu.test(e)&&i(e).then(e=>{e||s(a)})};return(0,K.jsxs)(`div`,{className:`appearance-color-input`,children:[(0,K.jsxs)(`label`,{className:`appearance-color-picker`,children:[(0,K.jsx)(`span`,{className:`appearance-color-dot`,style:{background:a}}),(0,K.jsx)(`input`,{"aria-label":`${e} — ${a}`,type:`color`,value:a,disabled:r,onChange:e=>c(e.target.value.toUpperCase())})]}),(0,K.jsx)(`input`,{className:`appearance-color-hex`,type:`text`,"aria-label":e,value:o,maxLength:7,spellCheck:!1,disabled:r,onChange:e=>c(e.target.value.toUpperCase()),onBlur:()=>s(a)})]})}function DI({catalog:e,theme:t,pending:n,error:r,onRefresh:i,onUpdatePreferences:a}){let{t:o}=cr(),{mode:s}=lu(),c=e?.setup,l=c?.ui.webTheme??t,u=c?.ui.webAppearance??yI,d=xI(l,u),f=bI(l),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(null),[w,T]=(0,_.useState)(c?.ui.webChatWidth??820),[E,D]=(0,_.useState)(c?.ui.webChatFontSize??14);(0,_.useEffect)(()=>{c&&(T(c.ui.webChatWidth),D(c.ui.webChatFontSize))},[c]);let O=e?.setupWritable===!1||!!e?.resources.diagnostics.settingsErrors,k=n||!c||!!r||O,A=CI(v),j=e=>a({appearance:e}),M=()=>{n||(g(!1),y(``),x(!1))},N=SI(d,f===`dark`||f===`system`&&s===`dark`);return(0,K.jsxs)(`section`,{className:`settings-content-page settings-appearance-panel`,children:[(0,K.jsx)(`h1`,{children:o(`appearance`)}),(!c||r||O)&&(0,K.jsxs)(`div`,{className:`settings-load-state`,role:r||O?`alert`:`status`,children:[(0,K.jsx)(dt,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:o(O?`configurationReadFailure`:r?`settingsCatalogFailed`:`settingsCatalogLoading`)}),(r||O)&&(0,K.jsx)(`button`,{type:`button`,onClick:i,children:o(`retryAdmissionCheck`)})]}),(0,K.jsxs)(`section`,{className:`appearance-section`,"aria-labelledby":`appearance-visual-title`,children:[(0,K.jsx)(`h2`,{id:`appearance-visual-title`,children:o(`appearanceVisualStyle`)}),(0,K.jsxs)(`div`,{className:`appearance-card appearance-mode-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceMode`)}),(0,K.jsx)(`div`,{role:`radiogroup`,"aria-label":o(`appearanceMode`),className:`appearance-mode-options`,children:vI.map(e=>(0,K.jsx)(Cd,{content:o(e===`system`?`themeSystem`:e===`light`?`themeLight`:`themeDark`),children:(0,K.jsxs)(`label`,{className:`appearance-mode-option`,children:[(0,K.jsx)(`input`,{type:`radio`,name:`openpi-appearance-mode`,"aria-label":o(e===`system`?`themeSystem`:e===`light`?`themeLight`:`themeDark`),checked:f===e,disabled:k,onChange:()=>void a({theme:e})}),(0,K.jsxs)(`span`,{"aria-hidden":`true`,className:`appearance-mode-preview`,"data-mode":e,"data-selected":f===e,children:[(0,K.jsxs)(`span`,{className:`appearance-mini-window`,children:[(0,K.jsx)(`span`,{className:`appearance-mini-sidebar`}),(0,K.jsxs)(`span`,{className:`appearance-mini-chat`,children:[(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`b`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`b`,{}),(0,K.jsx)(`em`,{})]})]}),e===`system`&&(0,K.jsxs)(`span`,{className:`appearance-mini-window appearance-mini-dark`,children:[(0,K.jsx)(`span`,{className:`appearance-mini-sidebar`}),(0,K.jsxs)(`span`,{className:`appearance-mini-chat`,children:[(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`b`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`b`,{}),(0,K.jsx)(`em`,{})]})]})]})]})},e))})]}),(0,K.jsxs)(`div`,{className:`appearance-card`,children:[(0,K.jsxs)(`div`,{className:`appearance-row appearance-theme-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceTheme`)}),(0,K.jsxs)(`div`,{className:`appearance-theme-actions`,children:[(0,K.jsx)(Cd,{content:o(`appearanceImport`),children:(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":o(`appearanceImport`),disabled:k,onClick:()=>{x(!1),g(!0)},children:(0,K.jsx)(pe,{"aria-hidden":`true`})})}),(0,K.jsx)(Cd,{content:o(`appearanceCopy`),children:(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":o(`appearanceCopy`),disabled:k,onClick:()=>{wd(JSON.stringify({version:1,theme:f,appearance:{...u,palette:d}})).then(e=>C(e?`saved`:`failed`))},children:(0,K.jsx)(ue,{"aria-hidden":`true`})})}),(0,K.jsx)(TI,{label:o(`appearanceTheme`),value:d,options:gI.map(e=>({id:e,label:e==="default"?`OpenPI`:o(`theme${e[0].toUpperCase()}${e.slice(1)}`)})),disabled:k,onSelect:e=>{let t=gI.find(t=>t===e);t&&j({palette:t})}})]})]}),(0,K.jsxs)(`div`,{className:`appearance-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceAccent`)}),(0,K.jsxs)(`div`,{className:`appearance-accent-controls`,children:[(0,K.jsx)(TI,{label:o(`appearanceAccent`),value:u.accent,options:wI.map((e,t)=>({id:e,label:o(`appearanceAccent${t}`),color:e||`var(--text)`})),disabled:k,onSelect:e=>void j({accent:e})}),(0,K.jsx)(EI,{label:o(`appearanceCustomAccent`),value:u.accent,fallback:`#2563EB`,disabled:k,onSave:e=>j({accent:e})})]})]}),(0,K.jsxs)(`div`,{className:`appearance-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceBackground`)}),(0,K.jsx)(EI,{label:o(`appearanceBackground`),value:u.background,fallback:N.background,disabled:k,onSave:e=>j({background:e})})]}),(0,K.jsxs)(`div`,{className:`appearance-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceForeground`)}),(0,K.jsx)(EI,{label:o(`appearanceForeground`),value:u.foreground,fallback:N.foreground,disabled:k,onSave:e=>j({foreground:e})})]}),(0,K.jsxs)(`div`,{className:`appearance-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceFont`)}),(0,K.jsx)(TI,{label:o(`appearanceFont`),value:u.font===`system`?`codex`:u.font,options:_I.map(e=>({id:e,label:o(`appearanceFont_${e}`)})),disabled:k,onSelect:e=>{let t=_I.find(t=>t===e);t&&j({font:t})}})]})]}),S&&(0,K.jsx)(`p`,{role:S===`failed`?`alert`:`status`,className:`appearance-share-status`,children:o(S===`saved`?`appearanceCopied`:`appearanceCopyFailed`)})]}),(0,K.jsxs)(`section`,{className:`appearance-section`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`appearance-advanced-toggle`,"aria-expanded":p,"aria-controls":`appearance-advanced`,onClick:()=>m(!p),children:[o(`appearanceAdvanced`),p?(0,K.jsx)(L,{"aria-hidden":`true`}):(0,K.jsx)(ee,{"aria-hidden":`true`})]}),p&&c&&(0,K.jsxs)(`div`,{id:`appearance-advanced`,className:`appearance-card appearance-advanced-content`,children:[(0,K.jsxs)(`div`,{className:`appearance-row`,children:[(0,K.jsx)(`span`,{children:o(`expandThinkingByDefault`)}),(0,K.jsx)(QP,{label:o(`expandThinkingByDefault`),isLabelHidden:!0,value:c.ui.webExpandThinking,size:`sm`,isDisabled:k,onChange:e=>void a({expandThinking:e})})]}),(0,K.jsxs)(`div`,{className:`appearance-slider-row`,children:[(0,K.jsxs)(`div`,{className:`settings-slider-heading`,children:[(0,K.jsx)(`span`,{children:o(`chatContentWidth`)}),(0,K.jsxs)(`output`,{children:[w,`px`]}),(0,K.jsx)(`button`,{type:`button`,className:`settings-reset-button`,"aria-label":o(`resetChatContentWidth`),disabled:k||w===820,onClick:()=>{T(820),a({chatWidth:820}).then(e=>{e||T(c.ui.webChatWidth)})},children:(0,K.jsx)(ft,{"aria-hidden":`true`})})]}),(0,K.jsx)($F,{label:o(`chatContentWidth`),isLabelHidden:!0,value:w,min:820,max:2e3,step:10,width:`100%`,valueDisplay:`none`,isDisabled:k,onChange:e=>T(e),onChangeEnd:e=>{e!==c.ui.webChatWidth&&a({chatWidth:e}).then(e=>{e||T(c.ui.webChatWidth)})}})]}),(0,K.jsxs)(`div`,{className:`appearance-slider-row`,children:[(0,K.jsxs)(`div`,{className:`settings-slider-heading`,children:[(0,K.jsx)(`span`,{children:o(`chatFontSize`)}),(0,K.jsxs)(`output`,{children:[E,`px`]}),(0,K.jsx)(`button`,{type:`button`,className:`settings-reset-button`,"aria-label":o(`resetChatFontSize`),disabled:k||E===14,onClick:()=>{D(14),a({chatFontSize:14}).then(e=>{e||D(c.ui.webChatFontSize)})},children:(0,K.jsx)(ft,{"aria-hidden":`true`})})]}),(0,K.jsx)($F,{label:o(`chatFontSize`),isLabelHidden:!0,value:E,min:12,max:24,step:1,width:`100%`,valueDisplay:`none`,isDisabled:k,onChange:e=>D(e),onChangeEnd:e=>{e!==c.ui.webChatFontSize&&a({chatFontSize:e}).then(e=>{e||D(c.ui.webChatFontSize)})}})]}),(0,K.jsxs)(`div`,{className:`appearance-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceReset`)}),(0,K.jsxs)(`button`,{type:`button`,className:`appearance-reset`,disabled:k,onClick:()=>void a({theme:`system`,appearance:yI,chatWidth:820,chatFontSize:14,expandThinking:!1}),children:[(0,K.jsx)(ft,{"aria-hidden":`true`}),o(`appearanceResetAction`)]})]})]})]}),(0,K.jsxs)($j,{isOpen:h,onOpenChange:e=>{e||M()},"aria-label":o(`appearanceImport`),width:480,className:`appearance-import-dialog`,children:[(0,K.jsx)(`h2`,{className:`appearance-import-title`,children:o(`appearanceImport`)}),(0,K.jsxs)(`form`,{className:`appearance-import-form`,onSubmit:e=>{e.preventDefault(),!(!A||k)&&(x(!1),a(A).then(e=>{e?(g(!1),y(``)):x(!0)}))},children:[(0,K.jsxs)(`label`,{children:[o(`appearanceThemeValue`),(0,K.jsx)(`textarea`,{maxLength:2e3,value:v,disabled:n,placeholder:o(`appearanceImportPlaceholder`),onChange:e=>{x(!1),y(e.target.value)}})]}),v&&!A&&(0,K.jsx)(`p`,{role:`alert`,children:o(`appearanceImportInvalid`)}),b&&(0,K.jsx)(`p`,{role:`alert`,children:o(`settingsPreferencesSaveFailed`)}),(0,K.jsxs)(`div`,{className:`appearance-import-actions`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:n,onClick:M,children:o(`cancel`)}),(0,K.jsx)(`button`,{type:`submit`,disabled:k||!A,children:o(n?`savingSettings`:`appearanceImportAction`)})]})]})]})]})}function OI({workspaces:e,onRestore:t}){let{t:n,i18n:r}=cr(),i=(0,_.useMemo)(()=>new rf,[]),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(`updated`),[d,f]=(0,_.useState)(new Set),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(null),[b,x]=(0,_.useState)(null),[w,T]=(0,_.useState)(new Set),E=(0,_.useRef)(new Set),D=(0,_.useRef)(null),O=(0,_.useRef)(!1),k=JSON.stringify([a.trim(),s,l]),A=(0,_.useRef)({key:k});A.current.key!==k&&(A.current={key:k});let j=p?.scope===k?p:null,M=v?.scope===k?v:null,N=(0,_.useCallback)(async(e,t=0)=>{D.current?.abort();let n=new AbortController;D.current=n,g(!0),y(null);let r={query:a.trim(),sort:l,...s?{cwd:s}:{},limit:25};try{let a=await i.listArchivedSessions({...r,...e?{cursor:e}:{}},n.signal);if(n.signal.aborted||D.current!==n)return;let o=[...a.sessions];for(;!e&&o.length!o.some(t=>t.path===e.path));if(o.push(...e),!e.length)break}m(t=>({...a,scope:k,sessions:e&&t?.scope===k?[...t.sessions,...o.filter(e=>!t.sessions.some(t=>t.path===e.path))]:o}))}catch(t){!n.signal.aborted&&D.current===n&&y({scope:k,stale:t instanceof tf&&t.code===`ARCHIVED_SESSION_CURSOR_STALE`,...e?{cursor:e}:{}})}finally{D.current===n&&(D.current=null,g(!1))}},[i,s,a,k,l]);(0,_.useEffect)(()=>(O.current=!0,()=>{O.current=!1}),[]),(0,_.useEffect)(()=>(x(null),N(),()=>{D.current?.abort(),D.current=null}),[N]);let P=async e=>{if(E.current.has(e))return;E.current.add(e),T(new Set(E.current)),x(null);let n=A.current;try{let r=await t(e);if(!O.current||A.current!==n)return;if(!r){x(e);return}let i=j?.sessions.length??0;m(t=>t?{...t,sessions:t.sessions.filter(t=>t.path!==e)}:null),await N(void 0,i)}catch{O.current&&A.current===n&&x(e)}finally{E.current.delete(e),O.current&&T(new Set(E.current))}},F=new Map;for(let e of j?.sessions??[]){let t=e.workspacePath??e.cwd,n=F.get(t)??[];n.push(e),F.set(t,n)}let I=t=>e.find(e=>e.path===t)?.name??t.split(/[\\/]/u).filter(Boolean).at(-1)??t,R=[...new Set([...e.map(e=>e.path),...F.keys(),...s?[s]:[]])];return(0,K.jsxs)(`section`,{className:`settings-content-page settings-archive-panel`,children:[(0,K.jsx)(`h1`,{children:n(`settingsArchivedChats`)}),(0,K.jsxs)(`div`,{className:`settings-archive-toolbar`,children:[(0,K.jsxs)(`label`,{className:`settings-archive-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`input`,{type:`search`,"aria-label":n(`searchArchivedChats`),placeholder:n(`searchArchivedChats`),maxLength:160,value:a,onChange:e=>o(e.target.value)}),a&&(0,K.jsx)(`button`,{type:`button`,"aria-label":n(`settingsClearSearch`),onClick:()=>o(``),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]}),(0,K.jsxs)(`select`,{"aria-label":n(`archiveProjectFilter`),value:s,onChange:e=>c(e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:n(`archiveAllProjects`)}),R.map(e=>(0,K.jsx)(`option`,{value:e,children:I(e)},e))]}),(0,K.jsxs)(`select`,{"aria-label":n(`archiveSort`),value:l,onChange:e=>u(e.target.value===`created`?`created`:`updated`),children:[(0,K.jsx)(`option`,{value:`updated`,children:n(`archiveSortUpdated`)}),(0,K.jsx)(`option`,{value:`created`,children:n(`archiveSortCreated`)})]}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":n(`refreshArchives`),disabled:h,onClick:()=>void N(void 0,j?.sessions.length),children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]}),M&&(0,K.jsxs)(`div`,{className:`settings-archive-error`,role:`alert`,children:[(0,K.jsx)(`span`,{children:n(M.stale?`archiveCursorStale`:`archiveLoadFailed`)}),(0,K.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void N(M.stale?void 0:M.cursor),children:n(`retryAdmissionCheck`)})]}),b&&(0,K.jsx)(`div`,{className:`settings-archive-error`,role:`alert`,children:n(`restoreFailed`)}),h&&(0,K.jsx)(`p`,{role:`status`,className:`settings-archive-status`,children:n(`loadingArchives`)}),!h&&!M&&j?.sessions.length===0&&(0,K.jsxs)(`div`,{className:`settings-archive-empty`,children:[(0,K.jsx)(C,{"aria-hidden":`true`}),(0,K.jsx)(`p`,{children:n(a.trim()||s?`noMatchingScannedArchives`:j.truncation.truncated?`noScannedArchives`:`noArchivedSessions`)})]}),(0,K.jsx)(`div`,{className:`settings-archive-groups`,children:[...F].map(([e,t])=>(0,K.jsxs)(`section`,{className:`settings-archive-group`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`settings-archive-group-heading`,"aria-label":n(`archiveProjectGroup`,{project:I(e),count:t.length}),"aria-expanded":!d.has(e),"aria-controls":`archive-group-${encodeURIComponent(e)}`,onClick:()=>f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),children:[d.has(e)?(0,K.jsx)(ee,{"aria-hidden":`true`}):(0,K.jsx)(L,{"aria-hidden":`true`}),(0,K.jsx)(De,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{title:e,children:I(e)}),(0,K.jsx)(`small`,{children:t.length})]}),!d.has(e)&&(0,K.jsx)(`ul`,{id:`archive-group-${encodeURIComponent(e)}`,className:`settings-archive-list`,children:t.map(e=>{let t=e.name||e.firstMessage||n(`untitledSession`),i=new Date(l===`created`?e.created:e.modified);return(0,K.jsxs)(`li`,{className:`settings-archive-row`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`settings-archive-chat-title`,title:t,children:t}),(0,K.jsx)(`time`,{dateTime:Number.isNaN(i.getTime())?void 0:i.toISOString(),children:Number.isNaN(i.getTime())?n(`unknownState`):new Intl.DateTimeFormat(r.language,{dateStyle:`medium`}).format(i)})]}),(0,K.jsxs)(`button`,{type:`button`,"aria-label":n(`restoreArchivedChat`,{title:t}),disabled:w.has(e.path),onClick:()=>void P(e.path),children:[(0,K.jsx)(S,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:n(w.has(e.path)?`restoringConversation`:`restoreConversation`)})]})]},e.path)})})]},e))}),!!j?.truncation.recordsUnscanned&&(0,K.jsx)(`p`,{className:`settings-archive-status`,children:n(`archiveScanBounded`,{count:j.truncation.recordsUnscanned})}),j?.nextCursor&&(0,K.jsx)(`button`,{type:`button`,className:`settings-archive-more`,disabled:h,onClick:()=>void N(j.nextCursor),children:n(`moreArchives`)})]})}var kI=[{id:`general`,group:`settingsPersonal`,label:`generalSettings`,Icon:xt,terms:[`agentBehavior`,`resultDisplay`,`workflowLimits`]},{id:`appearance`,group:`settingsPersonal`,label:`appearance`,Icon:Dt,terms:[`appearanceTheme`,`appearanceAccent`,`appearanceFont`,`chatContentWidth`,`chatFontSize`]},{id:`archived-chats`,group:`settingsPersonal`,label:`settingsArchivedChats`,Icon:C,terms:[`restoreConversation`]},{id:`configuration`,group:`settingsPersonal`,label:`configurationSettings`,Icon:bt,terms:[`configurationApproval`,`configurationSandbox`,`configurationVerbosity`,`configurationSummary`,`configurationReasoningLevels`,`configurationDependencies`]},{id:`models`,group:`settingsAgent`,label:`modelSettings`,Icon:fe,terms:[`modelDefaultTitle`]},{id:`subagents`,group:`settingsAgent`,label:`subagentsSettings`,Icon:M,terms:[]},{id:`web-search`,group:`settingsAgent`,label:`webSearchSettings`,Icon:ht,terms:[]},{id:`skills`,group:`settingsIntegrations`,label:`skillsSettings`,Icon:Ie,terms:[]},{id:`plugins`,group:`settingsIntegrations`,label:`pluginsSettings`,Icon:ct,terms:[]},{id:`browser`,group:`settingsIntegrations`,label:`browserSettings`,Icon:me,terms:[]}];function AI(e){return kI.find(({id:t})=>t===e)?.id}function jI({sessionId:e,sessionPath:t,cwd:n,entry:r=`general`,models:i,currentModel:a,thinkingLevel:o,theme:s,preferences:c,workspaces:l=[],onRestoreSession:u,capabilities:d,setupBusy:f,setupBlockedReason:p,plan:m,planSelectionPending:h=!1,onExitPlan:g,setupOutcome:v,onConfigureOpenPi:y,interaction:b,onPreferencesChanged:x,onSelectModel:S,onOpenRuntimeStatus:C,onClose:w}){let{t:T}=cr(),E=f||!!p,D=(0,_.useRef)(null),O=(0,_.useRef)(null),[k,A]=(0,_.useState)(``),[j,M]=(0,_.useState)(r===`credentials`?`models`:r),[N,P]=(0,_.useState)(r===`credentials`||r===`models`),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(!1),[ee,z]=(0,_.useState)(`general`),B=(0,_.useRef)(!1),V=(0,_.useRef)(!1),H=(0,_.useRef)(0),[te,ne]=(0,_.useState)(!1),re=(0,_.useRef)(!1),[ie,ae]=(0,_.useState)(!1),[U,oe]=(0,_.useState)(null),[se,ce]=(0,_.useState)(!1),[le,ue]=(0,_.useState)(!1),[de,fe]=(0,_.useState)(null),pe=le,me=(0,_.useRef)(void 0),W=m!==void 0&&m!==`inactive`,he=F||E||W||h,ge=L&&ee!==j||!L&&(j===`skills`||j===`plugins`||j===`web-search`)?void 0:!L||v?.requestId!==me.current?v:void 0,{catalog:_e,error:ve,refresh:ye,updateSetup:be}=hI(e,a?`${a.provider}/${a.id}`:``,JSON.stringify(c)),xe=ge!==void 0&&[`failed`,`cancelled`,`unconfirmed`].includes(ge.status);(0,_.useEffect)(()=>{D.current?.focus()},[]),(0,_.useEffect)(()=>{if(L){if(ge&&ge.status!==`pending`&&B.current){B.current=!1,V.current=!1,window.clearTimeout(H.current),ye(),x();return}if(E){V.current=!0;return}!V.current||!B.current||(B.current=!1,V.current=!1,window.clearTimeout(H.current),ye(),x())}},[x,ye,E,L,ge]),(0,_.useEffect)(()=>()=>window.clearTimeout(H.current),[]);let Se=async e=>{if(ae(!1),he)return!1;me.current=v?.requestId,z(j),I(!0),R(!1),B.current=!1,V.current=!1,window.clearTimeout(H.current),oe(null);try{let t=await y(e);return t?(R(!0),B.current=!0,H.current=window.setTimeout(()=>{!B.current||V.current||(B.current=!1,V.current=!1,ye(),x())},2e3)):oe(T(`setupRequestFailed`)),t}catch(e){return I(!1),oe(e instanceof Error?e.message:T(`setupRequestFailed`)),!1}finally{I(!1)}},Ce=async()=>{if(he||!_e?.sessionPath)throw Error(T(`resourceReloadFailed`));I(!0);try{await new rf().reloadSettingsResources(e,_e.sessionPath),ye(),x()}finally{I(!1)}},we=async e=>{if(re.current||!_e)return!1;re.current=!0,ne(!0),ae(!1),oe(null);try{let t=await new rf().savePreferences(e);return be(t.setup),ae(!0),x(),!0}catch{return oe(T(`settingsPreferencesSaveFailed`)),!1}finally{re.current=!1,ne(!1)}},Te=e=>{pe||(M(e),A(``),e===`models`&&P(!0),oe(null))};(0,_.useEffect)(()=>{let e=new URL(window.location.href);e.searchParams.set(`settings`,j),window.history.replaceState(window.history.state,``,e)},[j]);let G=kI.filter(({label:e,terms:t})=>[e,...t].some(e=>T(e).normalize(`NFKC`).toLocaleLowerCase().includes(k.trim().normalize(`NFKC`).toLocaleLowerCase()))),Ee=(e,t=!1)=>{if(!pe){if(se&&!t){fe(e);return}fe(null),e.kind===`runtime`?C():w()}};return(0,K.jsxs)($j,{isOpen:!0,purpose:`info`,padding:0,width:`calc(100vw - 32px)`,maxHeight:`calc(100dvh - 16px)`,className:`provider-settings-dialog`,"aria-label":T(`settings`),onOpenChange:e=>{!e&&!de&&Ee({kind:`close`})},children:[(0,K.jsxs)(`section`,{className:`provider-settings-surface`,children:[(0,K.jsxs)(`aside`,{className:`provider-settings-sidebar`,children:[(0,K.jsxs)(`header`,{className:`provider-settings-header`,children:[(0,K.jsx)(`strong`,{className:`provider-settings-title`,children:T(`settings`)}),(0,K.jsx)(`select`,{className:`provider-settings-mobile-picker`,"aria-label":T(`settingsNavigation`),disabled:pe,value:j,onChange:e=>{let t=kI.find(({id:t})=>t===e.target.value);t&&Te(t.id)},children:kI.map(({id:e,label:t})=>(0,K.jsx)(`option`,{value:e,children:T(t)},e))})]}),(0,K.jsxs)(`label`,{className:`provider-settings-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`input`,{type:`search`,"aria-label":T(`settingsSearch`),placeholder:T(`settingsSearch`),value:k,onChange:e=>A(e.target.value),disabled:pe}),k&&(0,K.jsx)(`button`,{type:`button`,"aria-label":T(`settingsClearSearch`),onClick:()=>A(``),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]}),(0,K.jsxs)(`div`,{className:`provider-settings-navigation`,ref:O,"aria-label":T(`settingsNavigation`),role:`tablist`,"aria-orientation":`vertical`,children:[[`settingsPersonal`,`settingsAgent`,`settingsIntegrations`].map(e=>(0,K.jsxs)(`div`,{className:`provider-settings-nav-group`,children:[G.some(t=>t.group===e)&&(0,K.jsx)(`p`,{children:T(e)}),G.filter(t=>t.group===e).map(({id:e,label:t,Icon:n})=>(0,K.jsxs)(`button`,{type:`button`,role:`tab`,disabled:pe,id:`settings-tab-${e}`,tabIndex:j===e||!G.some(e=>e.id===j)&&G[0]?.id===e?0:-1,"aria-selected":j===e,"aria-controls":`settings-panel-${e}`,className:`provider-settings-tab`,title:T(t),onClick:()=>Te(e),onKeyDown:t=>{if(t.altKey||t.ctrlKey||t.metaKey||t.nativeEvent.isComposing)return;let n=G.findIndex(t=>t.id===e),r=t.key===`Home`?0:t.key===`End`?G.length-1:t.key===`ArrowDown`||t.key===`ArrowRight`?(n+1)%G.length:t.key===`ArrowUp`||t.key===`ArrowLeft`?(n+G.length-1)%G.length:void 0;if(r===void 0)return;t.preventDefault();let i=G[r].id;Te(i),O.current?.querySelector(`#settings-tab-${i}`)?.focus()},children:[(0,K.jsx)(n,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:T(t)})]},e))]},e)),G.length===0&&(0,K.jsx)(`p`,{className:`provider-settings-no-results`,role:`status`,children:T(`settingsNoResults`)})]}),(0,K.jsx)(`button`,{ref:D,type:`button`,className:`icon-button provider-settings-close`,"aria-label":T(`close`),disabled:pe,title:T(pe?`savingSettings`:`close`),onClick:()=>Ee({kind:`close`}),children:(0,K.jsx)(Lt,{})})]}),(0,K.jsxs)(`div`,{className:`provider-settings-body`,children:[W&&j!==`browser`&&(0,K.jsxs)(`div`,{className:`settings-plan-notice`,role:`status`,children:[(0,K.jsx)(`span`,{children:T(E?`setupPlanBusy`:`setupPlanBlocked`)}),(0,K.jsx)(qc,{label:T(`planModeExit`),variant:`secondary`,size:`sm`,isDisabled:E||h||!g,onClick:()=>void g?.()})]}),(0,K.jsxs)(`div`,{className:`provider-settings-main`,children:[(0,K.jsx)(`div`,{id:`settings-panel-configuration`,"aria-labelledby":`settings-tab-configuration`,"aria-label":T(`configurationSettings`),role:`tabpanel`,hidden:j!==`configuration`,children:j===`configuration`&&(0,K.jsx)(sF,{catalog:_e,error:ve,pending:he||L&&ee===`configuration`&&(!ge||ge.status===`pending`),preferencePending:te,onConfigure:Se,onUpdatePreferences:we,onRefresh:ye,onOpenRuntimeStatus:()=>Ee({kind:`runtime`})})}),(0,K.jsx)(`div`,{id:`settings-panel-appearance`,"aria-labelledby":`settings-tab-appearance`,"aria-label":T(`appearance`),role:`tabpanel`,hidden:j!==`appearance`,children:(0,K.jsx)(DI,{catalog:_e,theme:s,pending:te,error:ve,onRefresh:ye,onUpdatePreferences:we})}),(0,K.jsx)(`div`,{id:`settings-panel-archived-chats`,"aria-labelledby":`settings-tab-archived-chats`,"aria-label":T(`settingsArchivedChats`),role:`tabpanel`,hidden:j!==`archived-chats`,children:j===`archived-chats`&&(0,K.jsx)(OI,{workspaces:l,onRestore:u??(async()=>!1)})}),(0,K.jsx)(`div`,{id:`settings-panel-web-search`,"aria-labelledby":`settings-tab-web-search`,"aria-label":T(`webSearchSettings`),role:`tabpanel`,hidden:j!==`web-search`,children:j===`web-search`&&(0,K.jsx)(cF,{catalog:_e,error:ve,pending:he,onConfigure:Se,onRefresh:ye})}),(0,K.jsx)(`div`,{id:`settings-panel-browser`,"aria-labelledby":`settings-tab-browser`,"aria-label":T(`browserSettings`),role:`tabpanel`,hidden:j!==`browser`,children:j===`browser`&&(0,K.jsx)(aF,{onConfigure:Se,setupPending:he})}),(0,K.jsx)(`div`,{id:`settings-panel-general`,"aria-labelledby":`settings-tab-general`,"aria-label":T(`generalSettings`),role:`tabpanel`,hidden:j!==`general`,children:(0,K.jsx)(iI,{catalog:_e,error:ve,currentModel:a,thinkingLevel:o,cwd:n,setupPending:F||E,preferencePending:te||!_e,setupBusy:E,setupBlockedReason:p,setupBlocked:W||h,onConfigure:Se,onUpdatePreferences:we,onOpenRuntimeStatus:()=>Ee({kind:`runtime`}),onRefresh:ye})}),(0,K.jsx)(`section`,{id:`settings-panel-models`,"aria-labelledby":`settings-tab-models`,"aria-label":T(`modelSettings`),className:`settings-models`,role:`tabpanel`,hidden:j!==`models`,children:N&&(0,K.jsx)(VF,{sessionId:e,sessionPath:t,models:i,currentModel:a,busy:E,focusCredentials:r===`credentials`,onSaved:async()=>(ye(),x()),onSelectModel:S,onDraftChange:ce,onSavingChange:ue},e)}),(0,K.jsx)(`div`,{id:`settings-panel-skills`,"aria-labelledby":`settings-tab-skills`,"aria-label":T(`skillsSettings`),role:`tabpanel`,hidden:j!==`skills`,children:(0,K.jsx)(uI,{catalog:_e,error:ve,onRefresh:ye,setupPending:he,onConfigure:Se,onReload:Ce},e)}),(0,K.jsx)(`div`,{id:`settings-panel-subagents`,"aria-labelledby":`settings-tab-subagents`,"aria-label":T(`subagentsSettings`),role:`tabpanel`,hidden:j!==`subagents`,children:(0,K.jsx)(dI,{catalog:_e,error:ve,currentModel:a,models:i,activity:d?.subagents,setupPending:F||E,setupBlocked:W||h,onConfigure:Se,onRefresh:ye})}),(0,K.jsx)(`div`,{id:`settings-panel-plugins`,"aria-labelledby":`settings-tab-plugins`,"aria-label":T(`pluginsSettings`),role:`tabpanel`,hidden:j!==`plugins`,children:(0,K.jsx)(mI,{catalog:_e,error:ve,onRefresh:ye,setupPending:he,onConfigure:Se,onReload:Ce},e)})]}),b,U&&(0,K.jsx)(`div`,{className:`settings-global-error`,role:`alert`,children:U}),(te||ie)&&!U&&!xe&&(0,K.jsx)(`div`,{className:`settings-global-status`,role:`status`,children:T(te?`savingSettings`:`settingsPreferencesSaved`)}),!te&&(!ie||xe)&&(L&&ee===j||ge)&&!U&&(0,K.jsxs)(`div`,{className:ge?.status===`failed`?`settings-global-error`:`settings-global-status`,role:ge?.status===`failed`?`alert`:`status`,children:[T(ge?(j===`skills`||j===`plugins`||j===`web-search`)&&[`unconfirmed`,`saved`,`unchanged`].includes(ge.status)?`resourceRequestFinished`:`setupOutcome_${ge.status}`:E?`setupRequestRunning`:j===`skills`||j===`plugins`||j===`web-search`?`resourceRequestSubmitted`:`setupRequestAccepted`),ge?.error&&(0,K.jsx)(`p`,{children:ge.error})]})]})]}),de&&(0,K.jsx)(HP,{isOpen:!0,onOpenChange:e=>{e||fe(null)},title:T(`unsavedSettingsTitle`),description:T(`unsavedSettingsDetail`),cancelLabel:T(`keepEditing`),actionLabel:T(`discardAndContinue`),onAction:()=>Ee(de,!0)})]})}function MI({identity:e}){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)>>>0;let n=t%6;return(0,K.jsx)(`span`,{className:`subagent-avatar tone-${n}`,"aria-hidden":`true`,children:(0,K.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,children:[(0,K.jsxs)(`g`,{children:[(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,K.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`}),(0,K.jsx)(`path`,{d:`M3 12h18M5 6.5c4 3 10 3 14 0M5 17.5c4-3 10-3 14 0`})]},`sphere`),(0,K.jsx)(`g`,{children:(0,K.jsx)(`path`,{d:`M4 20V4a16 16 0 0 1 16 16H4ZM4 4l16 16M4 9l11 11M4 14l6 6M10 5l-6 15M16 10L4 20`})},`fan`),(0,K.jsxs)(`g`,{children:[(0,K.jsx)(`path`,{d:`m12 2 3 6 7-1-4 5 4 5-7-1-3 6-3-6-7 1 4-5-4-5 7 1Z`}),(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`})]},`rosette`),(0,K.jsxs)(`g`,{children:[(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,K.jsx)(`path`,{d:`M3 12h18M12 3a9 9 0 0 0 0 18M12 6a6 6 0 0 0 0 12M12 9a3 3 0 0 0 0 6M12 3v18`})]},`arcs`),(0,K.jsx)(`g`,{children:(0,K.jsx)(`path`,{d:`m12 2 9 5v10l-9 5-9-5V7Zm0 0v20M3 7l18 10M21 7 3 17M3 7l9 5 9-5M3 17l9-5 9 5`})},`prism`),(0,K.jsxs)(`g`,{children:[(0,K.jsx)(`path`,{d:`M12 12V2c6 0 10 4 10 10H12Zm0 0v10C6 22 2 18 2 12h10ZM12 12H2C2 6 6 2 12 2v10Zm0 0h10c0 6-4 10-10 10V12Z`}),(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`2`,fill:`currentColor`})]},`windmill`)][n]})})}function NI(e,t,n,r){let i=(0,_.useMemo)(()=>new rf,[]),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(0),p=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!n)return;let r=new AbortController;return p.current=r,c(!0),u(!1),i.sessionSources(e,t,r.signal).then(n=>{!r.signal.aborted&&n.sessionId===e&&n.path===t&&o(n)}).catch(()=>{r.signal.aborted||u(!0)}).finally(()=>{r.signal.aborted||(c(!1),p.current=null)}),()=>{r.abort(),p.current?.abort(),p.current=null}},[i,e,t,n,r,d]),{page:a?.sessionId===e&&a.path===t?a:null,loading:s,error:l,loadMore:async()=>{if(p.current||!a||a.nextOffset===void 0)return;let n=new AbortController;p.current=n,c(!0),u(!1);try{let r=await i.sessionSources(e,t,n.signal,a.nextOffset,a.revision);!n.signal.aborted&&r.sessionId===e&&r.path===t&&r.revision===a.revision&&o({...r,sources:[...a.sources,...r.sources]})}catch{n.signal.aborted||u(!0)}finally{n.signal.aborted||(c(!1),p.current=null)}},refresh:()=>f(e=>e+1)}}function PI({sessionId:e,path:t,source:n,thumbnail:r=!1,active:i=!0}){let{t:a}=cr(),o=(0,_.useRef)(null),[s,c]=(0,_.useState)(!1),l=JSON.stringify([e,t,n.entryId,n.partIndex]),[u,d]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(!r||!o.current||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(([e])=>c(!!e?.isIntersecting));return e.observe(o.current),()=>e.disconnect()},[r]),(0,_.useEffect)(()=>{if(!i||r&&!s){d(null);return}let a=new AbortController,o;return d({identity:l}),new rf().sourceImage(e,t,n.entryId,n.partIndex,a.signal).then(e=>{if(a.signal.aborted)return;if(![`image/png`,`image/jpeg`,`image/gif`,`image/webp`].includes(e.mimeType)||e.data.length>Ud)throw Error(`Invalid image`);let t=atob(e.data);if(t.length>10485760||btoa(t)!==e.data)throw Error(`Invalid image`);let n=Uint8Array.from(t,e=>e.charCodeAt(0));o=URL.createObjectURL(new Blob([n],{type:e.mimeType})),d({identity:l,url:o})}).catch(()=>{a.signal.aborted||d({identity:l,failed:!0})}),()=>{a.abort(),o&&URL.revokeObjectURL(o)}},[e,t,n.entryId,n.partIndex,l,i,r,s]);let f=i&&(!r||s)&&u?.identity===l?u:null;return(0,K.jsx)(`span`,{ref:o,className:`session-source-image`,"data-thumbnail":r||void 0,children:f?.url&&!f.failed?(0,K.jsx)(`img`,{src:f.url,alt:r?``:n.name||a(`attachedImage`),onError:()=>d({identity:l,failed:!0})}):r?(0,K.jsx)(Ne,{"aria-hidden":`true`}):(0,K.jsx)(`p`,{role:f?.failed?`alert`:`status`,children:a(f?.failed?`imagePreviewFailed`:`readingFile`)})})}function FI({source:e,sessionId:t,path:n,onOpen:r,thumbnail:i=!0}){let{t:a}=cr();return(0,K.jsxs)(`button`,{type:`button`,className:`session-overview-row session-source-row`,title:e.reference||e.name||a(`attachedImage`),onClick:r,children:[(0,K.jsx)(`span`,{className:`session-source-icon`,children:e.kind===`image`?i?(0,K.jsx)(PI,{sessionId:t,path:n,source:e,thumbnail:!0}):(0,K.jsx)(Ne,{"aria-hidden":`true`}):(0,K.jsx)(Se,{"aria-hidden":`true`})}),(0,K.jsx)(`span`,{children:e.name||a(`attachedImage`)})]})}function II({sessionId:e,path:t,open:n,source:r,data:i,onSelect:a,onClose:o}){let{t:s}=cr(),[c,l]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{r?.id,l(!1)},[e,t,r?.id]),(0,K.jsx)($j,{isOpen:n,onOpenChange:e=>!e&&o(),purpose:`info`,width:800,maxHeight:`calc(100dvh - 32px)`,padding:0,"aria-label":s(`sessionSources`),children:(0,K.jsxs)(`div`,{className:`session-sources-dialog draft-image-preview`,children:[(0,K.jsxs)(`header`,{children:[r&&i&&(0,K.jsx)(`button`,{type:`button`,"aria-label":s(`sourcesBack`),onClick:()=>a(null),children:(0,K.jsx)(T,{})}),(0,K.jsx)(`strong`,{title:r?.name,children:r?r.name||s(`attachedImage`):s(`sessionSources`)}),r&&(0,K.jsx)(`button`,{type:`button`,"aria-pressed":c,onClick:()=>l(e=>!e),children:s(c?`fitImage`:`originalImageSize`)}),(0,K.jsx)(`button`,{type:`button`,"data-autofocus":!0,"aria-label":s(`close`),onClick:o,children:(0,K.jsx)(Lt,{})})]}),r?(0,K.jsx)(`section`,{className:`draft-image-preview-body`,"data-mode":c?`original`:`fit`,"aria-label":s(`imageViewMode`),tabIndex:c?0:void 0,children:(0,K.jsx)(PI,{sessionId:e,path:t,source:r,active:n},JSON.stringify([e,t,r.id]))}):(0,K.jsxs)(`div`,{className:`session-sources-list`,children:[!i?.loading&&!i?.error&&!i?.page?.sources.length&&(0,K.jsx)(`p`,{children:s(`sourcesEmpty`)}),i?.page?.sources.map(n=>(0,K.jsx)(FI,{source:n,sessionId:e,path:t,onOpen:()=>a(n),thumbnail:!1},n.id)),i?.error&&(0,K.jsxs)(`p`,{role:`alert`,children:[s(`sourcesFailed`),` `,(0,K.jsx)(`button`,{type:`button`,onClick:i.refresh,children:s(`gitReviewRetry`)})]}),i?.loading&&(0,K.jsx)(`p`,{role:`status`,children:s(`readingFile`)}),i?.page?.nextOffset!==void 0&&(0,K.jsx)(`button`,{className:`sources-load-more`,type:`button`,disabled:i.loading,onClick:()=>void i.loadMore(),children:s(`sourcesLoadMore`)}),i?.page?.truncated&&(0,K.jsx)(`p`,{children:s(`sourcesPartial`)})]})]})})}function LI({sessionId:e,workspace:t,agents:n,omitted:r,review:i,onSubagents:a,onReview:o,sessionPath:s,revision:c,onAddSources:l,reviewLoading:u=!1,reviewError:d}){let{t:f}=cr(),[p,m]=(0,_.useState)(!1),h=(0,_.useRef)(null),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(null),x=NI(e,s??``,!!(s&&(p||g)),c),S=(0,_.useContext)(fk),C=i?.ok?i.snapshot.totals:void 0,w=e=>{e?.kind===`file`&&e.reference?(v(!1),A(()=>S?.open(e.reference,void 0,h.current??void 0))):A(()=>{b(e),v(!0)})},T=n.filter(e=>e.state===`running`),E=n.filter(e=>e.state===`done`),D=n.length-T.length-E.length,O=[...T,...n.filter(e=>e.state!==`running`)].slice(0,4),k=[T.length?f(`subagentSummaryRunning`,{count:T.length}):``,E.length?f(`subagentSummaryDone`,{count:E.length}):``,D?f(`subagentSummaryOther`,{count:D}):``].filter(Boolean).join(` · `)||f(`subagentNoneYet`),A=e=>{m(!1),h.current?.focus(),e()};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gd,{isOpen:p,onOpenChange:m,placement:`below`,alignment:`end`,width:`min(340px, calc(100vw - 24px))`,label:f(`sessionOverview`),closeButtonLabel:f(`close`),isModal:!1,content:(0,K.jsxs)(`div`,{className:`session-overview`,children:[(0,K.jsx)(`p`,{className:`session-overview-title`,children:t}),(0,K.jsxs)(`button`,{type:`button`,className:`session-overview-row`,title:f(`sessionOverviewChanges`),onClick:()=>A(o),children:[(0,K.jsx)(ye,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:f(`overviewChanges`)}),C&&!d?(0,K.jsxs)(`span`,{className:`session-overview-diff`,title:f(C.complete?`overviewLineTotals`:`overviewPartialTotals`),children:[(0,K.jsxs)(`span`,{className:`review-additions`,children:[`+`,C.additions.toLocaleString()]}),(0,K.jsxs)(`span`,{className:`review-deletions`,children:[`−`,C.deletions.toLocaleString()]}),!C.complete&&(0,K.jsx)(`span`,{className:`session-overview-note`,children:f(`gitReviewPartialLabel`)})]}):(0,K.jsx)(`span`,{className:`session-overview-note`,children:f(u?`overviewCounting`:i?.ok?`overviewCountsUnknown`:`overviewReviewUnavailable`)})]}),(0,K.jsxs)(`div`,{className:`session-overview-section`,children:[(0,K.jsx)(`p`,{children:f(`subagentDetails`)}),(0,K.jsxs)(`button`,{type:`button`,className:`session-overview-row session-overview-agents`,onClick:()=>A(a),"aria-label":`${f(`subagentDetails`)}: ${k}`,children:[O.length>0&&(0,K.jsx)(`span`,{className:`subagent-avatar-stack`,children:O.map(t=>(0,K.jsx)(MI,{identity:`${e}:${t.id}`},t.id))}),(0,K.jsx)(`span`,{className:`session-overview-agent-counts`,children:k.split(` · `).map(e=>(0,K.jsx)(`span`,{children:e},e))}),(0,K.jsx)(ee,{"aria-hidden":`true`})]}),r>0&&(0,K.jsx)(`small`,{children:f(`subagentListTruncated`,{count:r})})]}),s&&(0,K.jsxs)(`div`,{className:`session-overview-section`,children:[(0,K.jsxs)(`div`,{className:`session-overview-section-heading`,children:[(0,K.jsx)(`span`,{children:f(`sessionSources`)}),l&&(0,K.jsx)(`button`,{type:`button`,"aria-label":f(`sourcesAdd`),title:f(`sourcesAdd`),onClick:()=>A(l),children:(0,K.jsx)(lt,{})})]}),x.page?.sources.slice(0,3).map(t=>(0,K.jsx)(FI,{source:t,sessionId:e,path:s,onOpen:()=>w(t)},t.id)),x.error?(0,K.jsxs)(`p`,{role:`alert`,children:[f(`sourcesFailed`),` `,(0,K.jsx)(`button`,{type:`button`,onClick:x.refresh,children:f(`gitReviewRetry`)})]}):!x.page?.sources.length&&(0,K.jsx)(`p`,{children:f(x.loading?`readingFile`:`sourcesEmpty`)}),!!(x.page&&(x.page.sources.length>3||x.page.nextOffset!==void 0))&&(0,K.jsxs)(`button`,{type:`button`,className:`session-overview-row sources-view-all`,onClick:()=>w(null),children:[(0,K.jsx)(Re,{}),(0,K.jsx)(`span`,{children:f(`sourcesViewAll`)}),(0,K.jsx)(ee,{})]})]})]}),children:e=>(0,K.jsx)(`button`,{...e,ref:t=>{e.ref(t),h.current=t},type:`button`,className:`task-tools-trigger`,title:f(`sessionOverview`),"aria-label":f(`sessionOverview`),children:(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,K.jsx)(`circle`,{cx:`5.5`,cy:`7`,r:`2.8`}),(0,K.jsx)(`circle`,{cx:`5.5`,cy:`17`,r:`2.8`}),(0,K.jsx)(`path`,{d:`M12 7h8M12 17h8`})]})})}),s&&(0,K.jsx)(II,{sessionId:e,path:s,open:g,source:y,data:x,onSelect:w,onClose:()=>{v(!1),b(null)}})]})}var RI=(0,_.createContext)(null);RI.displayName=`ListContext`;var zI={list:{kogj98:`x1ghz6dp`,kZCmMZ:`x1c1uobl`,kH6xsr:`x3ct3a4`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,$$css:!0},withDividers:{kOIVth:`xxhr3t`,$$css:!0},withCounter:{kt6KFK:`xif0320`,$$css:!0}},BI={kt6KFK:`x1khind5`,$$css:!0},VI={counterStart:e=>[BI,{"--x-counterReset":`astryx-list ${e}`==null?void 0:`astryx-list ${e}`}]};function HI({children:e,density:t=`balanced`,hasDividers:n=!1,header:r,listStyle:i=`none`,start:a,xstyle:o,className:s,style:c,"data-testid":l,ref:u,...d}){let f=(0,_.useId)(),p=i===`decimal`,m=p?`ol`:`ul`,h=(0,_.useMemo)(()=>({density:t,hasDividers:n,listStyle:i}),[t,n,i]),g=(0,K.jsx)(m,{ref:u,...d,"data-testid":l,...r==null?null:{"aria-labelledby":f},...p&&a!=null&&a!==1?{start:a}:{},role:`list`,...oa(ba(`list`,{density:t,listStyle:i}),Sr(zI.list,n&&zI.withDividers,i!==`none`&&(a!=null&&a!==1?VI.counterStart(a-1):zI.withCounter),o),s,c),children:e});return r==null?(0,K.jsx)(RI,{value:h,children:g}):(0,K.jsx)(RI,{value:h,children:(0,K.jsxs)(`div`,{className:`x78zum5 xdt5ytf`,children:[(0,K.jsx)(`div`,{id:f,className:`x1p37lm5`,children:r}),g]})})}HI.displayName=`List`;var UI={withCounter:{kAmcRD:`xfrknyr`,$$css:!0},withDivider:{kt9PQ7:`x92x3c3`,kfdmCh:`x1q0q8m5`,kL6WhQ:`xw8gpjh`,$$css:!0}},WI={noRadius:{kaIpWk:`x2u8bby`,$$css:!0}};function GI({label:e,description:t,startContent:n,endContent:r,onClick:i,interactiveRef:a,href:o,target:s,rel:c,isDisabled:l=!1,isSelected:u=!1,xstyle:d,className:f,style:p,ref:m,...h}){let g=(0,_.use)(RI),v=g?.density??`balanced`,y=g?.hasDividers??!1,b=g?.listStyle??`none`;return(0,K.jsx)(qk,{as:`li`,ref:m,marker:b===`disc`?(0,K.jsx)(`span`,{className:`xoi2r2e x9f619 x78zum5 x6s0dn4 xl56j7k x2lah0s x12xnipv x1233pnv`,children:(0,K.jsx)(`span`,{className:`x1v4s8kt xols6we x16rqkct x19aspcf`})}):b===`circle`?(0,K.jsx)(`span`,{className:`xoi2r2e x9f619 x78zum5 x6s0dn4 xl56j7k x2lah0s x12xnipv x1233pnv`,children:(0,K.jsx)(`span`,{className:`x1v4s8kt xols6we x16rqkct xmkeg23 x1y0btm7 xqcx1ss xjbqb8w`})}):b===`decimal`?(0,K.jsx)(`span`,{className:`xoi2r2e x2lah0s x1tgivj0 xjm74w1 xw6l6zx x12xnipv xc2ndz5`}):null,startContent:n,label:e,description:t,endContent:r,onClick:i,interactiveRef:a,href:o,target:s,rel:c,isDisabled:l,isSelected:u,density:v,xstyle:[b!==`none`&&UI.withCounter,y&&UI.withDivider,y&&WI.noRadius,d],...oa(ba(`list-item`),{className:f,style:p}),...h})}GI.displayName=`ListItem`;function KI(e){let t=new Map;return e.map(e=>{let n=JSON.stringify(e),r=t.get(n)??0;return t.set(n,r+1),{item:e,key:`${n}:${r}`}})}function qI({name:e,args:t,output:n,state:r}){let{t:i}=cr();return(0,K.jsxs)(`details`,{className:`subagent-tool ${r}`,"data-status":r,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(`code`,{children:e}),(0,K.jsx)(`span`,{className:`subagent-state ${r}`,children:i(`subagentTool_${r}`)})]}),t&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`strong`,{className:`subagent-tool-label`,children:i(`trajectoryArguments`)}),(0,K.jsx)(`pre`,{children:t})]}),n&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`strong`,{className:`subagent-tool-label`,children:i(`trajectoryOutput`)}),(0,K.jsx)(`pre`,{children:n})]})]})}function JI({sessionId:e,id:t,kind:n=`subagents`,activity:r,client:i,saved:a,liveAvailable:o,fullView:s,readOnlyNote:c=!0,active:l=!0,refreshRevision:u=0,onDetail:d}){let{t:f}=cr(),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!0),[b,x]=(0,_.useState)(0),[S,C]=(0,_.useState)(null),w=(0,_.useRef)(null),T=(0,_.useRef)(!0),E=(0,_.useRef)(d);E.current=d,(0,_.useEffect)(()=>{if(!l)return;if(!o){y(!1),g(f(`subagentUnavailable`));return}let a=new AbortController,s,c=!1,u=async()=>{if(c||a.signal.aborted||document.visibilityState===`hidden`)return;c=!0;let o=r?.status===`running`;try{let r=await(n===`workflows`?i.workflowAgentDetail(e,t,a.signal):i.subagentDetail(e,t,a.signal));if(a.signal.aborted)return;if(r.sessionId!==e||r.detail.kind!==n||r.detail.id!==t)throw m(null),o=!1,Error(f(`inspectionChanged`));o=r.detail.status===`running`,m(r.detail),r.detail.kind===`subagents`&&E.current?.(r.detail),g(null),C(new Date().toLocaleTimeString())}catch(e){if(a.signal.aborted)return;g(e instanceof tf&&[404,501].includes(e.status)?f(`subagentUnavailable`):e instanceof Error?e.message:f(`inspectionUnavailable`))}finally{c=!1,a.signal.aborted||(y(!1),o&&(s=setTimeout(()=>void u(),1e3)))}},d=()=>{document.visibilityState===`visible`&&(clearTimeout(s),u())};return document.addEventListener(`visibilitychange`,d),u(),()=>{a.abort(),clearTimeout(s),document.removeEventListener(`visibilitychange`,d)}},[l,i,e,t,n,r?.status,b,u,o,f]),(0,_.useLayoutEffect)(()=>{let e=w.current;e&&T.current&&(e.scrollTop=e.scrollHeight)},[p]);let D=new Map(p?.transcript.flatMap(e=>e.kind===`toolResult`?[[e.toolId,e]]:[])),O=new Set(p?.transcript.flatMap(e=>e.kind===`assistant`?e.parts.flatMap(e=>e.type===`toolCall`?[e.toolId]:[]):[])),k=p?.outcome===`interrupted`?`interrupted`:p?.status,A=p?.transcript.some(e=>e.kind===`assistant`&&e.parts.flatMap(e=>e.type===`text`?[e.text]:[]).join(` -`).trim()===p.finalText.trim()),j=s?`h2`:`h3`;return(0,K.jsxs)(`section`,{className:`subagent-detail`,"aria-label":f(`subagentDetails`),hidden:!l,children:[(0,K.jsxs)(`header`,{className:`subagent-detail-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`subagent-state ${k??`unknown`}`,children:k?f(`subagentState_${k}`):a?.state?`${f(`subagentRecordedState`)}: ${f(`subagentState_${a.state}`)}`:f(`unknownState`)}),p&&(0,K.jsx)(`span`,{className:`subagent-duration`,children:nj(p.createdAt,p.settledAt)})]}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":f(`refreshStatus`),disabled:v||!o,onClick:()=>{y(!0),x(e=>e+1)},children:(0,K.jsx)(dt,{})})]}),v&&!p&&(0,K.jsx)(`p`,{role:`status`,children:f(`inspectionLoading`)}),h&&(0,K.jsxs)(`div`,{className:`inspection-warning`,role:`alert`,children:[(0,K.jsx)(`p`,{children:f(p?`subagentStale`:`subagentUnavailable`)}),h!==f(`subagentUnavailable`)&&(0,K.jsx)(`small`,{children:h})]}),p&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`subagent-metadata`,children:[(0,K.jsx)(`code`,{children:p.id}),p.model&&(0,K.jsx)(`span`,{children:p.model}),(0,K.jsx)(`span`,{title:p.cwd,children:p.cwd})]}),(0,K.jsxs)(`details`,{className:`subagent-task`,children:[(0,K.jsx)(`summary`,{children:f(`subagentTask`)}),(0,K.jsx)(`pre`,{children:p.prompt})]}),p.errorText&&(0,K.jsx)(`p`,{className:`inspection-warning`,role:`alert`,children:p.errorText}),p.truncated&&(0,K.jsx)(`p`,{className:`inspection-note`,children:f(`subagentTruncated`,{count:p.omittedEntries})}),p.kind===`workflows`&&p.transcriptUnavailable&&(0,K.jsx)(`p`,{className:`inspection-note`,children:f(`subagentTranscriptUnavailable`)}),(0,K.jsxs)(`div`,{className:`subagent-transcript`,ref:w,role:`log`,"aria-label":f(`subagentTranscript`),onScroll:e=>{let t=e.currentTarget;T.current=t.scrollHeight-t.clientHeight-t.scrollTop<48},children:[KI(p.transcript).map(({item:e,key:t})=>(0,K.jsx)(`div`,{className:`subagent-message ${e.kind}`,"data-role":e.kind,children:e.kind===`user`?(0,K.jsx)(`p`,{className:`subagent-user-message`,children:e.text}):e.kind===`toolResult`?O.has(e.toolId)?null:(0,K.jsx)(qI,{name:e.name,output:e.outputPreview,state:e.isError?`error`:`done`}):KI(e.parts).map(({item:e,key:t})=>e.type===`text`?(0,K.jsx)(Sk,{children:e.text},t):e.type===`thinking`?(0,K.jsxs)(`details`,{className:`subagent-thinking done`,"data-status":`done`,children:[(0,K.jsx)(`summary`,{children:f(`thinkingDone`)}),(0,K.jsx)(`pre`,{children:e.redacted?f(`subagentThinkingRedacted`):e.text})]},t):(0,K.jsx)(qI,{name:e.name,args:e.argsPreview,output:D.get(e.toolId)?.outputPreview??p.liveTools.find(t=>t.toolId===e.toolId)?.outputPreview,state:D.has(e.toolId)?D.get(e.toolId).isError?`error`:`done`:p.liveTools.some(t=>t.toolId===e.toolId&&!t.done)?`running`:`unknown`},e.toolId))},t)),p.liveAssistant?.thinking&&(0,K.jsxs)(`details`,{className:`subagent-thinking running`,"data-status":`running`,children:[(0,K.jsx)(`summary`,{children:f(`thinkingActive`)}),(0,K.jsx)(`pre`,{children:p.liveAssistant.thinking})]}),p.liveAssistant?.text&&(0,K.jsx)(`div`,{className:`subagent-message assistant live`,"data-role":`assistant`,children:(0,K.jsx)(Sk,{children:p.liveAssistant.text})}),p.liveTools.filter(e=>!O.has(e.toolId)).map(e=>(0,K.jsx)(qI,{name:e.name,args:e.argsPreview,output:e.outputPreview,state:e.done?e.isError?`error`:`done`:`running`},e.toolId)),p.finalText&&!A&&(0,K.jsxs)(`section`,{className:`subagent-final`,children:[(0,K.jsx)(j,{children:f(`subagentResult`)}),(0,K.jsx)(Sk,{children:p.finalText})]}),p.status===`running`&&(0,K.jsx)(`p`,{className:`subagent-live`,role:`status`,children:f(`subagentLive`)}),!p.transcript.length&&!p.liveAssistant?.text&&!(p.kind===`workflows`&&p.transcriptUnavailable)&&!p.finalText&&(0,K.jsx)(`p`,{children:f(`subagentNoMessages`)})]}),(c||S)&&(0,K.jsxs)(`p`,{className:`subagent-footnote`,children:[c&&f(`subagentReadOnly`),c&&S&&` · `,S]})]}),!p&&!v&&a&&(0,K.jsxs)(`section`,{className:`subagent-transcript`,"aria-label":f(`subagentSaved`),children:[(0,K.jsx)(j,{children:f(`subagentSaved`)}),(0,K.jsx)(`p`,{className:`inspection-note`,children:f(`subagentSavedHint`)}),a.state&&(0,K.jsxs)(`p`,{children:[f(`subagentRecordedState`),`: `,f(`subagentState_${a.state}`)]}),a.result&&(0,K.jsx)(Sk,{children:a.result}),a.receipt&&(0,K.jsxs)(`details`,{className:`subagent-task`,children:[(0,K.jsx)(`summary`,{children:f(`subagentSpawnReceipt`)}),(0,K.jsx)(`pre`,{children:a.receipt})]})]})]})}function YI({sessionId:e,initialId:t,initialKind:n=`subagents`,activity:r,workflows:i,observed:a=!0,records:o=[],liveAvailable:s=!0,onClose:c}){let{t:l,i18n:u}=cr(),[d,f]=(0,_.useState)([]),p=(0,_.useRef)(null),m=(0,_.useRef)(0),[h,g]=(0,_.useState)(t?{id:t,kind:n}:null),[v,y]=(0,_.useState)(h),b=h?.id;(0,_.useLayoutEffect)(()=>{!b&&p.current&&(p.current.scrollTop=m.current)},[b]);let x=(e,t=`subagents`)=>{let n=e?{id:e,kind:t}:null;n&&y(n),g(n)},[S,C]=(0,_.useState)(()=>window.matchMedia?.(`(max-width: 1100px)`).matches??!1);(0,_.useEffect)(()=>{let e=window.matchMedia?.(`(max-width: 1100px)`);if(!e)return;let t=()=>C(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let w=(0,_.useMemo)(()=>new rf,[]),E=s?r?.items??[]:[],D=s?i?.items??[]:[],O=oj(E,o,D,a),k=(r?.omitted??0)+D.reduce((e,t)=>e+(t.children?.omitted??0),0),A=O.find(e=>e.id===b&&e.kind===h?.kind),j=h?.kind===`subagents`?o.find(e=>e.id===b):void 0,N=(0,_.useRef)(null),P=(0,_.useRef)(document.activeElement);(0,_.useEffect)(()=>{N.current?.focus()},[h]),(0,_.useEffect)(()=>()=>{queueMicrotask(()=>{!document.querySelector(`.subagent-panel`)&&P.current instanceof HTMLElement&&P.current.isConnected&&P.current.focus()})},[]);let F=[{key:`active`,label:`subagentActiveGroup`,items:O.filter(e=>e.state===`running`),empty:`subagentNoneRunning`},{key:`done`,label:`subagentFinishedGroup`,items:O.filter(e=>e.state===`done`),empty:`subagentNoneFinished`},{key:`attention`,label:`subagentOtherGroup`,items:O.filter(e=>e.state===`error`||e.state===`interrupted`)},{key:`saved`,label:`subagentUnconfirmedGroup`,items:O.filter(e=>!e.state)}],I=e=>{let t=Math.max(0,Date.now()-e),n=t<36e5?`minute`:t<864e5?`hour`:`day`,r=n===`minute`?6e4:n===`hour`?36e5:864e5;return new Intl.RelativeTimeFormat(u.language,{numeric:`auto`}).format(-Math.floor(t/r),n)},L=S?`main`:`aside`,R=S?`h1`:`h2`,ee=S?`h2`:`h3`;return(0,K.jsxs)(L,{className:`subagent-panel`,"aria-label":l(`subagentDetails`),onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing&&!e.defaultPrevented&&(e.preventDefault(),b?x(null):c())},children:[(0,K.jsxs)(`header`,{className:`subagent-panel-heading`,children:[(0,K.jsxs)(`div`,{className:`subagent-breadcrumb`,children:[b&&(0,K.jsx)(`button`,{ref:N,type:`button`,className:`icon-button`,"aria-label":l(`backToSubagents`),onClick:()=>x(null),children:(0,K.jsx)(T,{})}),b?(0,K.jsx)(MI,{identity:`${e}:${b}`}):(0,K.jsx)(M,{"aria-hidden":`true`}),(0,K.jsx)(R,{children:b?A?.title||j?.title||b:l(`subagentDetails`)})]}),(0,K.jsx)(`button`,{ref:b?void 0:N,type:`button`,className:`icon-button`,"aria-label":l(`close`),onClick:c,children:(0,K.jsx)(Lt,{})})]}),v&&(0,K.jsx)(JI,{sessionId:e,id:v.id,kind:v.kind,activity:v.kind===`subagents`?E.find(e=>e.id===v.id):D.flatMap(e=>e.children?.items??[]).find(e=>e.id===v.id),client:w,saved:v.kind===`subagents`?o.find(e=>e.id===v.id):void 0,liveAvailable:s,fullView:S,active:!!b},`${e}:${v.kind}:${v.id}`),!b&&(0,K.jsxs)(`nav`,{className:`subagent-list`,"aria-label":l(`subagentTasks`),ref:p,onScroll:e=>{m.current=e.currentTarget.scrollTop},children:[F.map(t=>{if(!t.items.length&&!t.empty)return null;let n=d.includes(t.key)?t.items:t.items.slice(0,t.key===`active`?4:10);return(0,K.jsxs)(`section`,{className:`subagent-list-group`,children:[(0,K.jsxs)(ee,{children:[l(t.label),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,K.jsx)(`span`,{children:t.items.length})]}),!t.items.length&&t.empty&&(0,K.jsx)(`p`,{children:l(t.empty)}),(0,K.jsx)(HI,{density:`compact`,children:n.map(t=>(0,K.jsx)(GI,{className:`subagent-task-row`,onClick:()=>x(t.id,t.kind),label:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`subagent-task-title`,title:t.title||t.id,children:t.title||t.id}),(0,K.jsx)(`span`,{className:`sr-only`,children:` · ${l(`subagentState_${t.state??`unknown`}`)}`})]}),description:t.saved?l(`subagentSaved`):t.state===`error`||t.state===`interrupted`?l(`subagentState_${t.state}`):void 0,startContent:(0,K.jsx)(MI,{identity:`${e}:${t.id}`}),endContent:(0,K.jsx)(`span`,{className:`subagent-task-end`,children:t.state===`running`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(He,{className:`subagent-running-icon`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`sr-only`,children:l(`subagentState_running`)})]}):t.timestamp?(0,K.jsx)(`time`,{dateTime:new Date(t.timestamp).toISOString(),title:new Date(t.timestamp).toLocaleString(u.language),children:I(t.timestamp)}):null})},`${t.kind}:${t.id}`))}),n.lengthf(e=>[...e,t.key]),children:l(`subagentShowMore`,{count:t.items.length-n.length})})]},t.key)}),k>0&&(0,K.jsx)(`p`,{children:l(`subagentListTruncated`,{count:k})}),!!i?.omitted&&(0,K.jsx)(`p`,{children:l(`subagentWorkflowsTruncated`,{count:i?.omitted})})]})]})}var XI=`openpi:subagent-panel:v1`;function ZI(){try{let e=JSON.parse(sessionStorage.getItem(XI)??`null`);if(!e||typeof e!=`object`)return null;let{sessionId:t,sessionPath:n}=e;return typeof t!=`string`||!t||t.length>160||typeof n!=`string`||!n||n.length>4096?null:{sessionId:t,sessionPath:n,navigation:0}}catch{return null}}function QI(e){try{e?sessionStorage.setItem(XI,JSON.stringify({sessionId:e.sessionId,sessionPath:e.sessionPath})):sessionStorage.removeItem(XI)}catch{}}function $I(e){switch(e.toLowerCase()){case`read`:return{action:`read`,Icon:j};case`write`:return{action:`write`,Icon:at};case`edit`:return{action:`edit`,Icon:at};case`bash`:return{action:`command`,Icon:Tt};case`grep`:case`rg`:case`find`:case`fd`:case`glob`:case`tool_search`:return{action:`search`,Icon:ht};case`ls`:return{action:`list`,Icon:De};case`webfetch`:case`websearch`:case`web_fetch`:case`web_search`:return{action:`web`,Icon:je};case`plan_ready`:return{action:`plan`,Icon:U};case`tasks_add`:case`tasks_update`:case`tasks_list`:return{action:`task`,Icon:ze};case`get_goal`:case`create_goal`:case`update_goal`:return{action:`goal`,Icon:Ot};case`git_show`:case`git_diff`:case`git_log`:return{action:`git`,Icon:Ae};default:return e.startsWith(`bg_`)?{action:`command`,Icon:Tt}:e.startsWith(`subagent`)?{action:`agent`,Icon:M}:e.startsWith(`workflow`)?{action:`workflow`,Icon:Ft}:{action:`call`,Icon:It}}}function eL(e,t,n){let{action:r}=$I(t);return n===`returned`?e(`toolActionDone_${r}`):e(`toolActivity_${[`running`,`failed`,`cancelled`,`timed_out`].includes(n)?n:`unknown`}`,{action:e(`toolAction_${r}`)})}function tL(e){let{action:t}=$I(e);return t===`command`?`run`:t===`workflow`?`flow`:t===`call`?e:t}function nL(e,t){let{action:n}=$I(e),r=n===`search`?t.pattern??t.query??t.path:n===`web`?t.url??t.query:t.path??t.command??t.url??t.query??t.id??t.runId;return typeof r==`string`?r:``}function rL(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&(n.kind!==`event`||n.message||n.input!==void 0||n.result))return n}return e.at(-1)}function iL(e){let t=[];for(let n of e){(n.kind===`user`||!t.length)&&t.push({key:n.key,...n.kind===`user`?{prompt:n}:{},runs:[]});let e=t.at(-1),r=e.runs.at(-1);n.kind===`event`&&r?.[0]?.kind===`event`?r.push(n):e.runs.push([n])}return t}function aL(e){let t=new Map(e.map((e,t)=>[e.id,t])),n=new Map,r=new Map,i=new Map;for(let a of e){let e=`message`in a?a.message:void 0;for(let t of e?.parts??[])t.type===`toolCall`&&t.id&&r.set(t.id,(r.get(t.id)??0)+1);if(e?.role===`toolResult`&&e.toolCallId){let r=i.get(e.toolCallId)??[];r.push(e),n.set(e,t.get(a.id)??-1),i.set(e.toolCallId,r)}}let a=new Set,o=[];for(let s of e){let e=`message`in s?s.message:void 0;if(!e){o.push({key:s.id,kind:`event`,title:s.type,timestamp:s.timestamp});continue}if(e.role!==`toolResult`){(e.role!==`assistant`||e.content||!e.parts?.length||e.parts?.some(e=>e.type!==`toolCall`))&&o.push({key:s.id,kind:e.role===`user`?`user`:e.role===`assistant`?`assistant`:`event`,title:e.customType||e.role||s.type,timestamp:s.timestamp,message:e});for(let[c,l]of(e.parts??[]).entries()){if(l.type!==`toolCall`)continue;let u=l.id?i.get(l.id):void 0,d=l.id&&r.get(l.id)===1&&u?.length===1&&u[0]?.toolName===l.name&&!l.id.includes(`[truncated]`)&&(n.get(u[0])??-1)>(t.get(s.id)??-1)?u[0]:void 0;d&&a.add(d),o.push({key:`${s.id}:call:${c}`,kind:`call`,title:l.name,timestamp:s.timestamp,callId:l.id,input:l.arguments,message:e,result:d,outcome:d?.isError===!0?`error`:d?.isError===!1?`returned`:`unknown`})}}}let s=new Map(o.map(e=>[e.key,t.get(e.key)??-1]));for(let n of e){let e=`message`in n?n.message:void 0;e?.role===`toolResult`&&!a.has(e)&&(o.push({key:n.id,kind:`result`,title:e.toolName||`toolResult`,timestamp:n.timestamp,callId:e.toolCallId,result:e,outcome:e.isError===!0?`error`:e.isError===!1?`returned`:`unknown`}),s.set(n.id,t.get(n.id)??0));for(let[r,i]of(e?.parts??[]).entries())i.type===`toolCall`&&s.set(`${n.id}:call:${r}`,t.get(n.id)??0)}return o.sort((e,t)=>(s.get(e.key)??0)-(s.get(t.key)??0)),o}var oL=[];function sL(e){return e.kind===`call`||e.kind===`result`?``:(e.message?.parts??[]).filter(e=>e.type===`thinking`).map(e=>e.text).join(` +`:``}${t(`fileAttachmentPromptLabel`)}\n${r}`,m.length>12e3){ie(t(`fileAttachmentPromptTooLong`));return}l.content=m}if(u=h?await n(m,s.images,i,a,h):a?await n(m,s.images,i,a):i?await n(m,s.images.length>0||r?s.images:void 0,i):r||s.images.length>0?await n(m,s.images):await n(m),u){a?.streamingBehavior===`steer`&&pe(null),i===W.current&&(W.current=null);let e=o.clear(l.owner.key,l.revision);e&&c.current.key===l.owner.key&&(f.current=e,d(e),ie(null))}}catch(e){c.current.key===l.owner.key&&ie(e instanceof Error?e.message:t(`fileAttachmentReadFailed`))}finally{p&&c.current.key===l.owner.key&&!ge.current&&ne(!1),l.pending=!1;let e=o.read(l.owner.key);(u||!e.prompt&&e.images.length===0&&!e.files?.length)&&x.current.get(l.owner.key)===l&&x.current.delete(l.owner.key)}},Je=async n=>{if(n?.preventDefault(),!G||e.sessionSwitching||e.modelSelectionPending||e.planSelectionPending||e.thinkingPendingLevel!==null||e.promptAdmissionPending||e.promptAdmissionRecovery||e.promptAdmissionResolution||y||!p.trim()&&m.length===0&&h.length===0||ge.current)return;if(Ne&&(!je||Ae?.commandId!==Ne.expectedTurnCommandId||W.current)){U(t(`steerStaleTurn`));return}let r=/^\/([^\s/]+)/u.exec(p.trim())?.[1],i=Fe.commands.find(e=>e.name===r);if(i?.availability===`unsupported`){U(`/${i.name}: ${t(`commandUnavailable_${i.unavailableReason??`not_integrated`}`)}`);return}if(i?.action){if(p.trim()!==`/${i.name}`||m.length>0||h.length>0){U(t(`commandPanelArguments`));return}if(e.onCommandAction?.(i.action)!==!0){U(t(`commandPanelUnavailable`));return}xe({prompt:``,caret:0}),U(null);return}U(null),await qe(e.actions.sendPrompt,!1,W.current??void 0,Ne?{streamingBehavior:`steer`,expectedTurnCommandId:Ne.expectedTurnCommandId}:void 0)},Ye=()=>{if(!(!Ce||e.sessionSwitching||e.modelSelectionPending||e.thinkingPendingLevel!==null||y))return qe(e.actions.sendPromptAsNew,!0)},Xe=e=>{if(e.availability!==`available`)return;let t=`/${e.name} `;xe({prompt:t,caret:t.length})&&(U(null),O(!0),queueMicrotask(()=>{c.current.key===b&&(me.current?.focus(),me.current?.setSelectionRange(t.length,t.length))}))},Ze=e=>{if(!Ve.length)return;let t=A;for(let n=0;n{let n=ve.current,r=f.current;if(!n||n.ownerKey!==b||n.ownerKey!==c.current.key||n.revision!==r.revision)return t(`fileReferenceDraftChanged`);let i=r.prompt.slice(0,n.start),a=r.prompt.slice(n.end),o=eN(e),s=i&&!/\s$/u.test(i)?` `:``,l=`${i}${s}${o}${a&&!/^\s/u.test(a)?` `:``}${a}`,u=i.length+s.length+o.length;if(!xe({prompt:l,caret:u}))return t(`draftLimit`);_e.current=!0},et=()=>{let e=f.current,t=me.current,n=Math.min(Math.max(t?.selectionStart??e.caret,0),e.prompt.length);ve.current={ownerKey:b,revision:e.revision,start:n,end:Math.min(Math.max(t?.selectionEnd??n,n),e.prompt.length)},N(!0)},tt=[...(e.snapshot?.workspaces??[]).map(t=>({id:t.path,label:t.name,icon:(0,K.jsx)(De,{}),endContent:t.path===e.selectedWorkspace?(0,K.jsx)(I,{}):void 0,onClick:()=>e.actions.setWorkspace(t.path)})),{type:`divider`},{id:`add`,label:t(`addWorkspaceMenu`),icon:(0,K.jsx)(lt,{}),onClick:()=>void e.actions.chooseWorkspace()}],nt=e.draftModel??e.snapshot?.models.find(e=>e.current),rt=e.snapshot?.workspaces.find(t=>t.path===e.selectedWorkspace)?.name??(e.selectedWorkspace?rj(e.selectedWorkspace):t(`selectWorkspace`)),it=e.snapshot?.sessions.find(e=>e.path===i),at=Ce?nj(it??{},n?.id??t(`untitledSession`)):we?t(`newSession`):n?nj(it??{},n.id):t(`newSession`),ot=e.sessionSwitching?t(`switchingSession`):e.selectedWorkspace?Ce&&e.snapshot?.runtime.planHasPrompt&&[`planning`,`ready`].includes(e.snapshot.runtime.plan??``)?t(`promptPlanMessage`):e.landing?t(`promptTask`):t(Te?`promptMessage`:`promptReadonly`):t(`promptStart`),st=e.snapshot?.thinking,ct=st?.level??null,ut=e.thinkingPendingLevel??null,dt=st?.supported??!1,ft=!!e.selectedWorkspace&&!Ce&&(we||!n),pt=st?!st.available.includes(ct??``):!1,mt=st?!dt&&!ft?`thinkingUnsupportedHint`:!Ce&&!ft?`thinkingInactiveHint`:Oe?`thinkingLockedRunning`:e.modelSelectionPending?`thinkingModelPendingHint`:null:null,ht=e.snapshot?.selectedExecution,gt=n&&ht&&ht.sessionId===n.id&&ht.sessionPath===n.path?ht.pendingFollowUps:void 0,_t=gt??(Ce?e.pendingFollowUpsReceipt:null),vt=n&&ht?.sessionId===n.id&&ht.sessionPath===n.path?ht.pendingSteering:void 0,yt=vt??(Ce?e.pendingSteeringReceipt:null),bt=vt===void 0?[]:ht?.steeringMessages??[],xt=!e.workspaceDraft&&!e.sessionSwitching&&bt.length>0,St=gt===void 0?[]:ht?.queuedMessages??[],Ct=new Map,wt=St.map(e=>{let t=Ct.get(e)??0;return Ct.set(e,t+1),{message:e,key:`${e}:${t}`}}),Tt=!e.workspaceDraft&&!e.sessionSwitching&>!==void 0&&St.length>0,Dt=Ee?t(`compactionDraftHelp`):e.promptAdmissionPending&&!ke?t(`promptPending`):e.modelSelectionPending?t(`thinkingModelPendingHint`):e.thinkingPendingLevel===null?e.workspaceDraft?t(`enterHint`):e.turnCancellationPending?t(`stoppingTurn`):e.turnTerminalStatus===`cancelled`?t(`stoppedTurn`):!xt&&(yt??0)>0?t(`pendingSteeringHint`,{count:yt}):!Tt&&(Ce&&e.pendingFollowUpsReceipt!==null||(_t??0)>0)?(_t??0)>0?t(`pendingFollowUpsHint`,{count:_t??0}):t(`acceptedHint`):t(G?Oe?Ne?`steeringHint`:`queuedHint`:`enterHint`:`activeOnlyHint`):t(`thinkingPendingHint`),kt=G&&(Ee||e.promptAdmissionPending&&!ke||e.modelSelectionPending||e.thinkingPendingLevel!==null||e.turnCancellationPending||e.turnTerminalStatus===`cancelled`||!Tt&&Ce&&e.pendingFollowUpsReceipt!==null||!Tt&&(_t??0)>0||!xt&&(yt??0)>0||Oe&&!!(p.trim()||m.length||h.length)),At=L===b,jt=(e=!1)=>{F(null),e&&V.current?.focus()},Mt=e=>()=>{F(null),e()},Nt=async r=>{if(!(!Ce||!n||At||e.sessionSwitching)){R(b);try{r===`compact`?await B.compactSession(n.id,n.path):await B.updatePromptQueue(n.id,n.path,r),await e.actions.refreshSnapshot()}catch(e){c.current.key===b&&U(e instanceof Error?e.message:t(`commandPanelUnavailable`))}finally{R(e=>e===b?null:e)}}},Pt=P===`files`?[{id:`back`,section:t(`composerAdd`),label:t(`composerBack`),icon:(0,K.jsx)(de,{}),onClick:()=>F(`main`)},{id:`file-upload`,section:t(`composerAdd`),label:t(`addFiles`),description:t(`fileAttachmentDescription`),icon:(0,K.jsx)(Se,{}),disabled:te||m.length+h.length>=8,onClick:Mt(()=>{he.current&&(he.current.accept=``,he.current.click())})},{id:`image`,section:t(`composerAdd`),label:t(`addImages`),description:t(`imageAttachmentDescription`),icon:(0,K.jsx)(Me,{}),disabled:te||m.length>=8,onClick:Mt(()=>{he.current&&(he.current.accept=`image/png,image/jpeg,image/gif,image/webp`,he.current.click())})},{id:`workspace-file`,section:t(`composerAdd`),label:t(`fileReference`),icon:(0,K.jsx)(Se,{}),onClick:Mt(et)}]:[{id:`file`,section:t(`composerAdd`),label:t(`composerFile`),alias:`file`,icon:(0,K.jsx)(Se,{}),onClick:()=>F(`files`)},{id:`goal`,section:t(`composerAdd`),label:t(`composerGoal`),alias:`goal`,description:t(`composerGoalDescription`),icon:(0,K.jsx)(Ot,{}),disabled:!Ue,onClick:Mt(()=>{xe({prompt:`/goal `,caret:6})&&(O(!0),queueMicrotask(()=>me.current?.focus()))})},{id:`plan`,section:t(`composerAdd`),label:t(`composerPlan`),alias:`plan`,description:t(`composerPlanDescription`),icon:(0,K.jsx)(ze,{}),disabled:!Ce||Oe||e.planSelectionPending||e.promptAdmissionPending,onClick:Mt(()=>void e.actions.selectPlanMode(e.snapshot?.runtime.plan===`inactive`))},{id:`compact`,section:t(`composerCommands`),label:t(`composerCompact`),alias:`compact`,description:t(`composerCompactDescription`),icon:(0,K.jsx)(Qe,{}),disabled:!Ce||Oe||At||e.promptAdmissionPending||(_t??0)>0,onClick:Mt(()=>void Nt(`compact`))},{id:`model`,section:t(`composerCommands`),label:t(`composerModel`),alias:`model`,description:t(`composerModelDescription`),icon:(0,K.jsx)(fe,{}),disabled:!Ce&&!we||Oe||e.modelSelectionPending,onClick:Mt(()=>z(e=>e+1))}];return(0,K.jsxs)(`div`,{className:`composer-dock`,children:[Ce&&e.snapshot?.runtime.plan===`ready`&&!e.sessionSwitching&&(0,K.jsx)(`div`,{className:`plan-mode-bar`,children:(0,K.jsx)(`button`,{type:`button`,disabled:Oe||te||!!ge.current||e.planSelectionPending||e.promptAdmissionPending||!!e.promptAdmissionRecovery,onClick:()=>{if((p.trim()||m.length>0||h.length>0)&&!window.confirm(t(`planImplementationReplaceDraft`)))return;let n=f.current.revision,r=c.current.key;e.actions.preparePlanImplementation().then(e=>{!e||f.current.revision!==n||c.current.key!==r||xe({prompt:e.prompt,images:[],caret:e.prompt.length},r)&&(W.current={sessionId:e.sessionId,sessionPath:e.sessionPath,planRevision:e.planRevision},ie(null),me.current?.focus())})},children:t(`planModeImplement`)})}),!Ce&&!e.workspaceDraft&&!e.sessionSwitching&&n&&r===n.path&&(0,K.jsxs)(`div`,{className:`composer-session-notice`,children:[(0,K.jsx)(`span`,{children:t(`activateViewedSessionHint`)}),(0,K.jsx)(`button`,{type:`button`,className:`secondary`,onClick:()=>void e.actions.selectSession(n.path),children:t(`activateViewedSession`)})]}),Ce&&(0,K.jsx)(mj,{snapshot:e.snapshot,observed:e.activityObserved,onInspectTerminal:e.onInspect,onInspectSubagent:e.onInspectSubagent}),e.accessory,e.landing&&(0,K.jsx)(`div`,{className:`workspace-picker-row`,children:(0,K.jsx)(IA,{className:`workspace-picker-menu`,button:{label:e.selectedWorkspace?rj(e.selectedWorkspace):t(`selectWorkspace`),icon:(0,K.jsx)(De,{}),size:`md`,variant:`ghost`,className:`workspace-picker`},items:tt,menuWidth:240,placement:`above`,alignment:`start`,hasChevron:!0})}),e.promptAdmissionRecovery&&(0,K.jsxs)(`section`,{className:`prompt-recovery`,role:`alert`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:t(`promptAdmissionUnknown`)}),(0,K.jsx)(`span`,{children:e.promptAdmissionRecovery.phase===`checking`?t(`promptAdmissionCheckingDetail`):e.promptAdmissionRecovery.phase===`verification-failed`?t(`promptAdmissionVerificationFailedDetail`):t(`promptAdmissionUnknownDetail`)})]}),(0,K.jsxs)(`div`,{className:`prompt-recovery-actions`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:e.promptAdmissionRecovery.phase===`submitting`,onClick:e.actions.abandonPromptAdmission,children:t(`abandonAdmission`)}),e.promptAdmissionRecovery.phase===`verification-failed`&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>void e.actions.checkPromptAdmissionRecovery(),children:t(`retryAdmissionCheck`)}),e.promptAdmissionRecovery.retryable&&(0,K.jsx)(`button`,{type:`button`,disabled:!Ce||e.sessionSwitching||e.modelSelectionPending||e.thinkingPendingLevel!==null||e.promptAdmissionRecovery.phase!==`ready`,onClick:()=>void e.actions.retryPromptAdmission(),children:t(`retryOriginalAdmission`)}),(0,K.jsx)(`button`,{type:`button`,className:`primary`,disabled:te||!Ce||e.sessionSwitching||e.modelSelectionPending||e.thinkingPendingLevel!==null||y||e.promptAdmissionRecovery.phase!==`ready`||!p.trim()&&m.length===0&&h.length===0,onClick:()=>void Ye(),children:e.promptAdmissionRecovery.phase===`submitting`?t(`sendingAsNew`):t(`sendAsNew`)})]})]}),Tt&&(0,K.jsxs)(`section`,{className:`composer-queue`,"aria-label":t(`pendingFollowUpsHint`,{count:gt}),children:[(0,K.jsxs)(`div`,{className:`composer-queue-status`,role:`status`,children:[(0,K.jsx)(`span`,{children:t(ht?.promptQueueBlocked?`compactionQueueBlocked`:Ee?`compactionQueueWaiting`:`queuedHint`)}),Ce&&(0,K.jsxs)(`span`,{children:[ht?.promptQueueBlocked&&(0,K.jsx)(`button`,{type:`button`,disabled:At||Ee,onClick:()=>void Nt(`retry`),children:t(`retryPrompt`)}),(0,K.jsx)(`button`,{type:`button`,disabled:At,onClick:()=>void Nt(`clear`),children:t(`clearPromptQueue`)})]})]}),(0,K.jsx)(`ul`,{children:wt.map(({message:e,key:r})=>{let i=`${n?.id}\0${n?.path}\0${r}`,a=ce===i,o=e||t(`queuedImage`),s=t(a?`queuedMessageCollapse`:`queuedMessageExpand`);return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,className:`composer-queue-row ${a?`expanded`:``}`,"aria-expanded":a,"aria-label":`${s}: ${a?o:aj(o,80)}`,title:s,onClick:()=>le(a?null:i),children:[(0,K.jsx)(de,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:o})]})},r)})}),gt>St.length&&(0,K.jsx)(`small`,{children:t(`queuedMore`,{count:gt-St.length})})]}),xt&&(0,K.jsxs)(`section`,{className:`composer-queue`,"aria-label":t(`steeringMessagesTitle`),children:[(0,K.jsxs)(`div`,{className:`composer-queue-status`,role:`status`,children:[(0,K.jsx)(`span`,{children:t(`pendingSteeringHint`,{count:yt})}),Ce&&(0,K.jsx)(`button`,{type:`button`,disabled:At,onClick:()=>void Nt(`clear`),children:t(`clearPromptQueue`)})]}),(0,K.jsx)(`ul`,{children:bt.map((e,r)=>{let i=`${n?.id}\0${n?.path}\0steer:${r}:${e}`,a=ce===i,o=e||t(`queuedImage`),s=t(a?`queuedMessageCollapse`:`queuedMessageExpand`);return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,className:`composer-queue-row ${a?`expanded`:``}`,"aria-expanded":a,"aria-label":`${s}: ${a?o:aj(o,80)}`,title:s,onClick:()=>le(a?null:i),children:[(0,K.jsx)(de,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:o})]})},i)})}),(yt??0)>bt.length&&(0,K.jsx)(`small`,{children:t(`queuedMore`,{count:(yt??0)-bt.length})})]}),(0,K.jsxs)(`form`,{className:`composer composer-m02 ${e.selectedWorkspace?``:`dormant`} ${oe?`is-dragging`:``}`,onSubmit:e=>void Je(e),onDragEnter:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),We&&se(!0))},onDragOver:e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),We&&(e.dataTransfer.dropEffect=`copy`,se(!0)))},onDragLeave:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||se(!1)},onDrop:e=>{se(!1),e.dataTransfer.files.length!==0&&(e.preventDefault(),We&&Ke(e.dataTransfer.files))},children:[P&&(0,K.jsx)(nN,{items:Pt,onClose:jt},P),!e.selectedWorkspace&&(0,K.jsxs)(`div`,{className:`composer-dormant-cta`,"aria-hidden":`true`,children:[(0,K.jsx)(De,{}),(0,K.jsx)(`span`,{children:ot})]}),!e.selectedWorkspace&&(0,K.jsx)(`button`,{className:`dormant-overlay`,type:`button`,"aria-label":t(`selectWorkspace`),onClick:()=>void e.actions.chooseWorkspace()}),(0,K.jsx)(`input`,{ref:he,className:`sr-only`,type:`file`,multiple:!0,tabIndex:-1,"aria-hidden":`true`,onChange:e=>{e.currentTarget.files&&Ke(e.currentTarget.files)}}),(0,K.jsx)(lM,{ownerKey:b,images:m,onRemove:e=>{xe({images:f.current.images.filter(t=>t.id!==e)})&&ie(null)}}),(0,K.jsx)(uM,{ownerKey:b,files:h,onRemove:e=>{xe({files:(f.current.files??[]).filter(t=>t.id!==e)})&&ie(null)}}),re&&(0,K.jsx)(`p`,{className:`composer-attachment-error`,role:`alert`,children:re}),s.status===`failed`&&(0,K.jsxs)(`p`,{className:`composer-attachment-error`,role:`status`,children:[t(`draftStorageUnavailable`),` `,(0,K.jsx)(`button`,{type:`button`,onClick:()=>{o.retryStorage().then(()=>{let e=o.read(c.current.key);f.current=e,C.current=!0,d(e)})},children:t(`draftStorageRetry`)})]}),s.invalid&&(0,K.jsx)(`p`,{className:`composer-attachment-error`,role:`status`,children:t(`draftStorageInvalid`)}),te&&(0,K.jsx)(`p`,{role:`status`,children:t(`imageAttachmentsLoading`)}),ae&&(0,K.jsx)(`p`,{className:`composer-attachment-error`,role:`alert`,children:ae}),y&&(0,K.jsx)(`p`,{id:`composer-prompt-length-error`,className:`composer-attachment-error`,role:`alert`,children:t(`promptTooLong`,{count:v,limit:12e3})}),oe&&(0,K.jsxs)(`div`,{className:`composer-drop-overlay`,"aria-hidden":`true`,children:[(0,K.jsx)(Me,{}),(0,K.jsx)(`span`,{children:t(`dropImagesHere`)})]}),(0,K.jsx)(`textarea`,{ref:me,value:p,rows:1,disabled:Pe,readOnly:!e.selectedWorkspace,"aria-label":t(`describeTask`),"aria-invalid":y||void 0,"aria-describedby":y?`composer-prompt-length-error`:void 0,"aria-autocomplete":`list`,"aria-controls":He?IN:void 0,"aria-activedescendant":He&&Ve[A]?LN(A):void 0,placeholder:ot,onChange:e=>{xe({prompt:e.target.value,caret:e.target.selectionStart})&&(U(null),O(!1))},onClick:e=>xe({caret:e.currentTarget.selectionStart}),onSelect:e=>xe({caret:e.currentTarget.selectionStart}),onFocus:()=>{E(!0),O(!1)},onBlur:()=>E(!1),onPaste:e=>{if(!We)return;let t=Array.from(e.clipboardData.files);if(t.length===0)for(let n of Array.from(e.clipboardData.items??[])){let e=n.kind===`file`?n.getAsFile():null;e&&t.push(e)}t.length!==0&&(e.clipboardData.getData(`text/plain`)||e.preventDefault(),Ke(t))},onKeyDown:e=>{if(!e.nativeEvent.isComposing){if(Le){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),Ze(e.key===`ArrowDown`?1:-1);return}if(e.key===`Escape`){e.preventDefault(),O(!0);return}if(e.key===`Tab`){let t=Ve[A];!e.shiftKey&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&t?.availability===`available`&&(e.preventDefault(),Xe(t));return}if(e.key===`Enter`&&!e.shiftKey){let t=Ve[A];if(t){e.preventDefault(),Xe(t);return}if(Ve.length>0){e.preventDefault();return}}}e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),Je())}}}),Le&&(0,K.jsx)(BN,{activeIndex:A,commandDiscovery:Fe,commands:Ve,draft:!!e.workspaceDraft,preferBelow:e.landing,onComplete:Xe,onSelect:j}),(0,K.jsxs)(`div`,{className:`composer-toolbar`,children:[(0,K.jsxs)(`div`,{className:`composer-toolbar-context`,children:[We&&(0,K.jsx)(`button`,{ref:V,type:`button`,className:`composer-context-trigger icon-button`,"aria-label":t(`addContext`),"aria-haspopup":`menu`,"aria-expanded":P!==null,"aria-controls":P?`composer-action-menu`:void 0,onClick:()=>{O(!0),F(P?null:`main`)},children:(0,K.jsx)(lt,{})}),!e.landing&&(0,K.jsxs)(`span`,{className:`composer-workspace-label`,title:`${rt} / ${at}`,children:[(0,K.jsx)(De,{}),rt]}),Ce&&e.snapshot?.runtime.plan&&e.snapshot.runtime.plan!==`inactive`&&(0,K.jsx)(`span`,{className:`composer-plan-chip`,children:t(`planMode_${e.snapshot.runtime.plan}`)})]}),(0,K.jsxs)(`div`,{className:`composer-toolbar-controls`,children:[(je||Ne)&&(0,K.jsx)(IA,{button:{label:t(Ne?`steerCurrentTurn`:`sendNextTurn`),variant:`ghost`,size:`sm`,isDisabled:e.promptAdmissionPending||!!e.promptAdmissionRecovery},items:[{id:`followUp`,label:t(`sendNextTurn`),onClick:()=>{pe(null),U(null)}},{id:`steer`,label:t(`steerCurrentTurn`),isDisabled:!je,onClick:()=>{!je||!Ae||(pe({ownerKey:b,expectedTurnCommandId:Ae.commandId}),U(null))}}],placement:`above`,alignment:`end`,hasChevron:!0}),(0,K.jsx)(`div`,{className:`model-picker-wrap`,hidden:!!(n&&!Ce&&!e.workspaceDraft),title:mt?t(mt):void 0,"data-level":ct??`none`,"data-pending":ut!==null,"data-warning":pt,children:(0,K.jsx)(FN,{snapshot:e.snapshot,openRequest:ee,currentModel:nt,draftModel:e.draftModel,modelSearch:w,modelSelectionPending:!!e.modelSelectionPending,promptAdmissionPending:e.promptAdmissionPending,sessionSwitching:e.sessionSwitching,liveRunning:Oe,workspaceDraft:!!e.workspaceDraft,thinkingPendingLevel:ut,thinkingNeedsSession:ft,thinkingDisabledReason:mt,onOpenProviders:e.onOpenProviders,actions:e.actions})}),ke&&(0,K.jsx)(Cd,{content:t(`stopTurn`),placement:`above`,children:(0,K.jsx)(`button`,{className:`send-button`,type:`button`,"aria-label":t(`stopTurn`),disabled:e.turnCancellationPending||e.sessionSwitching,onClick:()=>void e.actions.cancelActiveTurn(),children:(0,K.jsx)(Et,{})})}),(!ke||!!(p.trim()||m.length||h.length))&&(0,K.jsx)(Cd,{content:t(Ee?`compactionDraftHelp`:`send`),placement:`above`,children:(0,K.jsx)(`button`,{className:`send-button`,type:`submit`,"aria-label":t(`send`),disabled:te||e.sessionSwitching||e.modelSelectionPending||e.thinkingPendingLevel!==null||!G||!e.selectedWorkspace||e.promptAdmissionPending||y||e.planSelectionPending||!!e.promptAdmissionRecovery||!!e.promptAdmissionResolution||!p.trim()&&m.length===0&&h.length===0,children:(0,K.jsx)(k,{})})})]})]}),(0,K.jsx)(`div`,{className:`composer-hint`,"data-visible":kt,"aria-live":`polite`,children:G?Dt:null})]}),(0,K.jsx)($M,{open:M,sessionId:Ce?n?.id:void 0,onClose:()=>N(!1),onInsert:$e})]})}function WN({target:e,onClose:t,onOpenProviders:n}){let{t:r}=cr(),i=(0,_.useMemo)(()=>new lf,[]),[a,o]=(0,_.useState)(0),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(null),p=e=>{f(null),wd(e).then(e=>f(e?`copied`:`failed`))};(0,_.useEffect)(()=>{let t=new AbortController;return c(null),u(null),f(null),(async()=>{let n={errors:[]};if(e.terminalId)try{let a=await i.terminalDetail(e.sessionId,e.terminalId,t.signal);if(a.sessionId!==e.sessionId||a.detail.id!==e.terminalId)throw Error(r(`inspectionChanged`));n.terminal=a.detail}catch(e){n.errors.push(e instanceof Error?e.message:r(`inspectionUnavailable`))}else{let[a,o]=await Promise.allSettled([i.thinking(e.sessionId,t.signal),i.trust(e.sessionId,t.signal)]);a.status===`fulfilled`&&a.value.sessionId===e.sessionId?n.thinking=a.value:n.errors.push(r(`thinkingUnavailable`)),o.status===`fulfilled`&&(o.value.workspace===void 0||o.value.workspace===e.cwd)?n.trust=o.value:n.errors.push(r(`trustUnavailable`))}t.signal.aborted||(c(n),u(new Date().toLocaleTimeString()))})(),()=>t.abort()},[i,e,a,r]);let m=e.terminalId?r(`terminalDetails`):r(`runtimeStatus`),h=s?.terminal;return(0,K.jsx)(iM,{isOpen:!0,onOpenChange:e=>!e&&t(),width:640,"aria-label":m,children:(0,K.jsxs)(`section`,{className:`inspection-panel`,children:[(0,K.jsxs)(`header`,{className:`inspection-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:m}),(0,K.jsx)(`p`,{className:`inspection-subtitle`,children:e.cwd})]}),(0,K.jsxs)(`div`,{className:`inspection-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":r(`refreshStatus`),disabled:!s,onClick:()=>o(e=>e+1),children:(0,K.jsx)(dt,{})}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":r(`close`),onClick:t,children:(0,K.jsx)(Lt,{})})]})]}),d&&(0,K.jsx)(`p`,{role:`status`,children:r(d===`copied`?`copiedMessage`:`copyFailed`)}),s?(0,K.jsxs)(K.Fragment,{children:[s.errors.map(e=>(0,K.jsx)(`p`,{className:`inspection-warning`,role:`alert`,children:e},e)),h?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`inspection-section`,children:[(0,K.jsx)(`h3`,{children:h.title||h.id}),(0,K.jsxs)(`dl`,{children:[(0,K.jsx)(`dt`,{children:r(`executionState`)}),(0,K.jsx)(`dd`,{children:r(`execution_${h.status}`,{defaultValue:h.status})}),(0,K.jsx)(`dt`,{children:r(`terminalCommand`)}),(0,K.jsxs)(`dd`,{children:[(0,K.jsx)(`code`,{children:h.command}),(0,K.jsx)(`button`,{type:`button`,className:`inspection-copy`,"aria-label":r(`copyTerminalCommand`),title:r(`copyTerminalCommand`),onClick:()=>p(h.command),children:(0,K.jsx)(oe,{"aria-hidden":`true`})})]}),(0,K.jsx)(`dt`,{children:r(`terminalDirectory`)}),(0,K.jsx)(`dd`,{children:h.cwd}),(0,K.jsx)(`dt`,{children:r(`startedAt`)}),(0,K.jsx)(`dd`,{children:new Date(h.createdAt).toLocaleString()}),h.status!==`running`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{children:r(`exitCode`)}),(0,K.jsx)(`dd`,{children:h.exitCode??r(`unknownState`)})]})]}),h.errorText&&(0,K.jsx)(`p`,{className:`inspection-warning`,children:h.errorText}),h.truncated&&(0,K.jsx)(`p`,{className:`inspection-note`,children:r(`detailTruncated`)})]}),[`stdout`,`stderr`].map(e=>(0,K.jsxs)(`section`,{className:`inspection-section`,children:[(0,K.jsxs)(`div`,{className:`inspection-stream-heading`,children:[(0,K.jsx)(`h3`,{children:r(e===`stdout`?`standardOutput`:`standardError`)}),(0,K.jsx)(`button`,{type:`button`,className:`inspection-copy`,disabled:!h[e].text,"aria-label":r(`copyVisibleOutput`,{stream:r(e===`stdout`?`standardOutput`:`standardError`)}),title:r(`copyVisibleOutput`,{stream:r(e===`stdout`?`standardOutput`:`standardError`)}),onClick:()=>p(h[e].text),children:(0,K.jsx)(oe,{"aria-hidden":`true`})})]}),(0,K.jsx)(`section`,{className:`terminal-evidence`,tabIndex:0,"aria-label":r(e===`stdout`?`standardOutput`:`standardError`),children:(0,K.jsx)(`pre`,{children:h[e].text||r(`noOutput`)})}),h[e].truncated&&(0,K.jsx)(`p`,{className:`inspection-note`,children:r(`outputTruncated`,{count:h[e].omittedBytes})}),h[e].recoveryAvailable&&(0,K.jsx)(`p`,{className:`inspection-note`,children:r(`outputRecovery`)})]},e))]}):!e.terminalId&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{className:`inspection-section`,children:[(0,K.jsx)(`h3`,{children:r(`modelAndThinking`)}),(0,K.jsxs)(`dl`,{children:[(0,K.jsx)(`dt`,{children:r(`selectedModel`)}),(0,K.jsx)(`dd`,{children:e.model||r(`noModels`)}),(0,K.jsx)(`dt`,{children:r(`thinkingLevel`)}),(0,K.jsx)(`dd`,{children:s.thinking?.supported===!1?r(`thinkingUnsupported`):s.thinking?.level??r(`unknownState`)}),!!s.thinking?.available.length&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{children:r(`availableThinking`)}),(0,K.jsx)(`dd`,{children:s.thinking?.available.join(` · `)})]})]}),s.thinking?.supported===!1&&(0,K.jsx)(`p`,{className:`inspection-note`,children:r(`thinkingUnsupportedHint`)}),s.thinking&&s.thinking.supported!==!1&&!s.thinking.available.includes(s.thinking.level)&&(0,K.jsx)(`p`,{className:`inspection-warning`,role:`status`,children:r(`thinkingLevelMismatch`)})]}),(0,K.jsxs)(`section`,{className:`inspection-section`,children:[(0,K.jsx)(`h3`,{children:r(`projectTrust`)}),(0,K.jsx)(`p`,{children:r(`trust_${s.trust?.state??`unknown`}`)}),(0,K.jsxs)(`dl`,{children:[(0,K.jsx)(`dt`,{children:r(`savedTrustDecision`)}),(0,K.jsx)(`dd`,{children:r(`trustDecision_${s.trust?.decision??`unknown`}`)}),(0,K.jsx)(`dt`,{children:r(`activeSessionTrust`)}),(0,K.jsx)(`dd`,{children:s.trust?.sessionTrusted===!0?r(`trustActiveYes`):s.trust?.sessionTrusted===!1?r(`trustActiveNo`):r(`unknownState`)})]}),s.trust?.refreshRequired===!0&&(0,K.jsx)(`p`,{className:`inspection-warning`,children:r(`trustRefreshNeeded`)})]}),n&&(0,K.jsxs)(`button`,{type:`button`,className:`inspection-provider-link`,"aria-label":r(`openProviderSettings`),onClick:n,children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:r(`providerAvailability`)}),(0,K.jsx)(`small`,{children:r(`authNotVerified`)})]}),r(`openProviderSettings`)]}),(0,K.jsxs)(`div`,{className:`inspection-setup`,children:[(0,K.jsx)(`p`,{className:`inspection-note`,children:r(`configurationViaPi`)}),(0,K.jsx)(`code`,{children:`/openpi-setup`}),(0,K.jsx)(`button`,{type:`button`,className:`inspection-copy`,"aria-label":r(`copySetupCommand`),title:r(`copySetupCommand`),onClick:()=>p(`/openpi-setup`),children:(0,K.jsx)(oe,{"aria-hidden":`true`})})]})]}),(0,K.jsx)(`p`,{className:`inspection-updated`,children:r(`statusCaptured`,{time:l})})]}):(0,K.jsx)(`p`,{role:`status`,children:r(`inspectionLoading`)})]})})}var GN=32,KN=1048576;function qN(e){return e.drafts.reduce((e,t)=>e+jd(t.custom)+Object.values(t.notes).reduce((e,t)=>e+jd(t),0),0)}function JN(e,t,n){if(!(n.submission||n.drafts.some(e=>e.choice!==null||e.custom||Object.values(e.notes).some(Boolean))))return e.delete(t),!0;let r=e.get(t);if(!r&&e.size>=GN)return!1;let i=r?qN(r):0,a=qN(n),o=Array.from(e.values()).reduce((e,t)=>e+qN(t),0);return a>i&&o-i+a>KN?!1:(e.set(t,n),!0)}function YN(e,t,n,r){for(let[i,a]of e)a.sessionId===t&&a.sessionPath===n&&a.requestId!==r&&e.delete(i)}function XN({request:e,answer:t,onSettled:n,connected:r=!0,sessionPath:i=``,workingCache:a}){let{t:o}=cr(),s=(0,_.useId)(),c=(0,_.useMemo)(()=>new Map,[]),l=a??c,u=JSON.stringify([e.sessionId,i,e.requestId]),[d,f]=(0,_.useState)(()=>l.get(u)??{sessionId:e.sessionId,sessionPath:i,requestId:e.requestId,drafts:e.questions.map(()=>({choice:null,custom:``,notes:{}})),index:0,review:!1,submission:null}),p=(0,_.useRef)(d),{drafts:m,index:h,review:g,submission:v}=d,[y,b]=(0,_.useState)(!!d.submission),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(!1),D=(0,_.useRef)(!1),O=!!v,k=(0,_.useRef)(null),A=(0,_.useRef)(null),j=e.questions[h],M=m[h],N=C||O||!r,P=m.some(e=>e.choice===`custom`?!Md(e.custom):typeof e.choice==`number`&&!Md(e.notes[e.choice]??``)),F=m.every(e=>e.choice!==null)&&!P,L=(t,n)=>e.handoff?o(n===0?`handoffDone`:`handoffUnable`):t;(0,_.useEffect)(()=>()=>k.current?.abort(),[]);let R=e=>JN(l,u,e)?(p.current=e,f(e),S(!1),!0):(S(!0),!1),ee=(e,t=!1)=>{R({...p.current,index:e,review:t}),requestAnimationFrame(()=>A.current?.focus())},z=e=>{let t=p.current;R({...t,drafts:t.drafts.map((n,r)=>r===t.index?{...n,...e}:n)})},B=()=>e.questions.map((e,t)=>{let n=m[t];if(n.choice===`custom`)return n.custom.trim()?{id:e.id,custom:n.custom}:{id:e.id,rephrase:!0};let r=typeof n.choice==`number`?e.options[n.choice]?.label:void 0;return{id:e.id,selected:r,...typeof n.choice==`number`&&n.notes[n.choice]?.trim()?{note:n.notes[n.choice]}:{}}}),V=async(i=!1)=>{if(D.current||!r||!i&&!O&&!F)return;let a=p.current.submission??{answers:i?null:B()};if(!R({...p.current,submission:a}))return;D.current=!0,w(!0),b(!1);let o=new AbortController;k.current=o;try{let r=await t(e,a.answers,o.signal);o.signal.aborted||(l.delete(u),n(r))}catch{o.signal.aborted||b(!0)}finally{o.signal.aborted||(D.current=!1,w(!1))}};return(0,K.jsxs)(`section`,{className:`question-card`,"aria-labelledby":`${s}-title`,"aria-busy":C,children:[(0,K.jsxs)(`header`,{className:`question-card-header`,children:[(0,K.jsxs)(`span`,{className:`question-eyebrow`,children:[(0,K.jsx)(Je,{"aria-hidden":`true`}),o(e.handoff?`handoffWaiting`:`questionWaiting`)]}),(0,K.jsx)(`span`,{className:`question-count`,children:g?o(e.handoff?`handoffReview`:`questionReview`):o(`questionProgress`,{current:h+1,total:e.questions.length})}),(0,K.jsx)(`button`,{type:`button`,className:`question-icon`,"aria-label":o(`questionDismiss`),title:o(`questionDismiss`),disabled:N,onClick:()=>void V(!0),children:(0,K.jsx)(Lt,{})})]}),(0,K.jsxs)(`div`,{className:`question-card-body`,children:[(0,K.jsx)(`h2`,{id:`${s}-title`,ref:A,tabIndex:-1,children:g?o(`questionReviewTitle`):j.question}),e.handoff&&(0,K.jsxs)(`div`,{className:`handoff-instructions`,children:[(0,K.jsx)(`p`,{children:e.handoff.instructions}),(0,K.jsxs)(`p`,{className:`question-help`,children:[o(`handoffSignal`),` `,e.handoff.completionSignal]}),(0,K.jsx)(`p`,{className:`question-help`,children:o(`handoffVerify`)})]}),g?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`question-help`,children:o(`questionReviewHelp`)}),(0,K.jsx)(`ol`,{className:`question-review-list`,children:e.questions.map((e,t)=>{let n=m[t];return(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`question-review-label`,children:e.header}),(0,K.jsx)(`p`,{children:typeof n.choice==`number`?L(e.options[n.choice]?.label,n.choice):n.custom.trim()||o(`questionRephrase`)}),typeof n.choice==`number`&&n.notes[n.choice]?.trim()&&(0,K.jsx)(`p`,{className:`question-help`,children:n.notes[n.choice]})]}),(0,K.jsx)(`button`,{type:`button`,className:`question-icon`,"aria-label":o(`questionEdit`,{question:e.header}),disabled:N,onClick:()=>ee(t),children:(0,K.jsx)(at,{})})]},e.id)})})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`fieldset`,{disabled:N,className:`question-choices`,children:[(0,K.jsx)(`legend`,{className:`sr-only`,children:j.header}),j.options.map((t,n)=>(0,K.jsxs)(`label`,{className:`question-choice ${M.choice===n?`is-selected`:``}`,children:[(0,K.jsx)(`input`,{className:`question-radio`,type:`radio`,name:`${s}-${j.id}`,checked:M.choice===n,onChange:()=>z({choice:n})}),(0,K.jsx)(`span`,{className:`question-choice-number`,"aria-hidden":`true`,children:n+1}),(0,K.jsxs)(`span`,{className:`question-choice-copy`,children:[(0,K.jsx)(`strong`,{children:L(t.label,n)}),(0,K.jsx)(`span`,{children:e.handoff?o(n===0?`handoffDoneHelp`:`handoffUnableHelp`):t.description})]})]},t.label))]}),typeof M.choice==`number`&&(0,K.jsxs)(`div`,{className:`question-extras`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`question-note-toggle`,disabled:N,"aria-expanded":!!M.notesExpanded,"aria-controls":M.notesExpanded?`${s}-notes`:void 0,onClick:()=>z({notesExpanded:!M.notesExpanded}),children:[(0,K.jsx)(at,{"aria-hidden":`true`}),o(`questionNotes`)]}),typeof M.choice==`number`&&j.options[M.choice]?.preview&&(0,K.jsxs)(`details`,{className:`question-preview-disclosure`,children:[(0,K.jsx)(`summary`,{children:o(`questionPreview`)}),(0,K.jsx)(`pre`,{className:`question-preview`,children:j.options[M.choice].preview})]},`${j.id}-${M.choice}`)]}),(M.choice===`custom`||typeof M.choice==`number`&&M.notesExpanded)&&(0,K.jsxs)(`label`,{className:`question-notes`,id:`${s}-notes`,children:[(0,K.jsx)(`span`,{className:`sr-only`,id:`${s}-answer-label`,children:M.choice===`custom`?o(`questionYourAnswer`):o(`questionNotes`)}),(0,K.jsx)(`textarea`,{rows:1,disabled:N,value:M.choice===`custom`?M.custom:M.notes[M.choice]??``,onChange:e=>M.choice===`custom`?z({custom:e.target.value}):typeof M.choice==`number`&&z({notes:{...M.notes,[M.choice]:e.target.value}}),"aria-invalid":P,"aria-labelledby":`${s}-answer-label`,"aria-describedby":[P?`${s}-limit`:``,M.choice===`custom`?`${s}-custom-help`:``].filter(Boolean).join(` `)||void 0,placeholder:M.choice===`custom`?o(`questionCustomPlaceholder`):o(`questionNotesPlaceholder`)}),M.choice===`custom`&&(0,K.jsx)(`span`,{className:`question-help`,id:`${s}-custom-help`,children:o(`questionCustomHelp`)})]})]}),P&&(0,K.jsx)(`p`,{className:`question-error`,id:`${s}-limit`,role:`alert`,children:o(`questionLimit`,{count:8e3})}),x&&(0,K.jsx)(`p`,{className:`question-error`,role:`alert`,children:o(`questionDraftLimit`)}),!r&&(0,K.jsx)(`p`,{className:`question-help`,role:`status`,children:o(`questionDisconnected`)}),y&&(0,K.jsx)(`p`,{className:`question-error`,role:`alert`,children:o(`questionUncertain`)})]}),(0,K.jsxs)(`footer`,{className:`question-card-footer`,children:[!g&&!e.handoff&&(0,K.jsxs)(`label`,{className:`question-custom ${M.choice===`custom`?`is-selected`:``} ${N?`is-disabled`:``}`,children:[(0,K.jsx)(`input`,{className:`question-radio`,type:`radio`,name:`${s}-${j.id}`,checked:M.choice===`custom`,disabled:N,onChange:()=>z({choice:`custom`})}),(0,K.jsx)(`span`,{className:`question-choice-number`,"aria-hidden":`true`,children:(0,K.jsx)(at,{})}),(0,K.jsx)(`span`,{children:o(`questionCustom`)})]}),(0,K.jsxs)(`div`,{className:`question-actions`,children:[(g||h>0)&&(0,K.jsxs)(`button`,{type:`button`,className:`question-secondary`,disabled:N||!g&&h===0,onClick:()=>ee(g?e.questions.length-1:h-1),children:[(0,K.jsx)(T,{}),o(`questionBack`)]}),!O&&(0,K.jsx)(`button`,{type:`button`,className:`question-secondary question-skip`,disabled:N,title:o(`questionDismiss`),onClick:()=>void V(!0),children:o(`questionSkip`)}),O?(0,K.jsxs)(`button`,{type:`button`,className:`question-primary`,disabled:C||!r,onClick:()=>void V(),children:[(0,K.jsx)(ft,{}),o(C?`questionSubmitting`:`questionRetry`)]}):g?(0,K.jsxs)(`button`,{type:`button`,className:`question-primary`,disabled:N||!F,onClick:()=>void V(),children:[(0,K.jsx)(I,{}),o(e.handoff?`handoffSubmit`:`questionSubmit`)]}):(0,K.jsxs)(`button`,{type:`button`,className:`question-primary`,disabled:N||M.choice===null||P,onClick:()=>ee(hnew lf,[]),s=(0,_.useMemo)(()=>new Map,[]),c=i??s,[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(0),v=(0,_.useRef)(null),y=(0,_.useRef)(null);return(0,_.useEffect)(()=>{let t=new AbortController;return o.pendingQuestions(e,t.signal).then(({pending:n})=>{if(t.signal.aborted)return;let i=n?.requestId===v.current?null:n;y.current=i?.requestId??null,m(!1),YN(c,e,r,n?.requestId),u(i),n&&n.requestId!==v.current&&f(null)},()=>{t.signal.aborted||m(!0)}),()=>t.abort()},[o,e,r,c,t,h]),!l&&!d&&!p?null:(0,K.jsx)(`div`,{className:`question-panel`,children:l?(0,K.jsx)(XN,{request:l,connected:n,sessionPath:r,workingCache:c,answer:(e,t,n)=>o.answerQuestions(e,t,n),onSettled:e=>{y.current===l.requestId&&(y.current=null,v.current=l.requestId,u(null),f(e.state===`answered`?null:e),g(e=>e+1))}},l.requestId):d?(0,K.jsxs)(`div`,{className:`question-receipt`,role:`status`,children:[(0,K.jsx)(I,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:a(`questionState_${d.state}`)}),(0,K.jsx)(`button`,{type:`button`,className:`question-icon`,"aria-label":a(`questionCloseReceipt`),onClick:()=>f(null),children:(0,K.jsx)(Lt,{})})]}):(0,K.jsxs)(`div`,{className:`question-receipt`,role:`alert`,children:[(0,K.jsx)(`span`,{children:a(`questionLoadFailed`)}),(0,K.jsx)(`button`,{type:`button`,className:`question-secondary`,onClick:()=>g(e=>e+1),children:a(`questionRetryLoad`)})]})})}function QN(e,t,{active:n=!0,running:r=!1,initialSource:i=`unstaged`,initialBaseRef:a}={}){let{t:o}=cr(),s=(0,_.useMemo)(()=>new lf,[]),c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(!1),d=(0,_.useRef)({active:n,running:r});d.current={active:n,running:r};let[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(null),y=e?.id,b=e?.path,[x,S]=(0,_.useState)({sessionId:y,sessionPath:b,source:i,baseRef:a}),C=x.sessionId===y&&x.sessionPath===b?x.source:i,w=x.sessionId===y&&x.sessionPath===b?x.baseRef:a,T=(0,_.useCallback)(e=>{S({sessionId:y,sessionPath:b,source:e,baseRef:w})},[y,b,w]),E=(0,_.useCallback)(e=>{S({sessionId:y,sessionPath:b,source:`branch`,baseRef:e})},[y,b]);(0,_.useLayoutEffect)(()=>{p(null),v(null),h(!!y)},[y,b,C,w]);let D=(0,_.useCallback)(async()=>{if(!y||!b||document.visibilityState===`hidden`)return;if(c.current){u.current=!0;return}let e=new AbortController;c.current=e,h(!0),v(null);try{let t=await s.gitReview(y,b,e.signal,{source:C,offset:`0`,...C===`branch`&&w?{baseRef:w}:{}});e.signal.aborted||(t.ok||v(o(t.reason===`not_git_repository`?`gitReviewNotRepository`:t.reason===`baseline_unavailable`?`gitReviewBaselineUnavailable`:t.reason===`base_branch_unavailable`?`gitReviewBaseUnavailable`:t.reason===`invalid_base_branch`?`gitReviewBaseInvalid`:`gitReviewFailed`)),p(e=>!t.ok&&e?.ok?t.branches?{...e,branches:t.branches}:e:t.ok&&e?.ok&&t.snapshot.revision===e.snapshot.revision?JSON.stringify(t.branches)===JSON.stringify(e.branches)?e:{...e,branches:t.branches}:t))}catch(t){e.signal.aborted||v(t instanceof Error?t.message:`Git review unavailable`)}finally{if(!e.signal.aborted&&(c.current=null,h(!1),u.current)){u.current=!1;let e=d.current;(e.active||!e.running)&&l.current===null&&(l.current=window.setTimeout(()=>{l.current=null,D()},e.active?200:2e3))}}},[s,y,b,C,w,o]),O=(0,_.useCallback)(async()=>{if(!y||!b||!f?.ok||f.snapshot.nextOffset===void 0||c.current)return;let e=f.snapshot,t=new AbortController;c.current=t,h(!0),v(null);try{let n=await s.gitReview(y,b,t.signal,{source:C,offset:String(e.nextOffset),revision:e.revision,...C===`branch`&&w?{baseRef:w}:{}});if(t.signal.aborted)return;if(!n.ok||n.snapshot.revision!==e.revision)throw Error(o(!n.ok&&n.reason===`revision_changed`?`gitReviewChanged`:`gitReviewFailed`));p({...n,snapshot:{...n.snapshot,files:[...e.files,...n.snapshot.files],additions:e.additions+n.snapshot.additions,deletions:e.deletions+n.snapshot.deletions}})}catch(e){t.signal.aborted||v(e instanceof Error?e.message:o(`gitReviewFailed`))}finally{t.signal.aborted||(c.current=null,h(!1))}},[s,y,b,C,w,f,o]),k=(0,_.useCallback)(async(e,t,n)=>{if(!y||!b)return;let r=await s.gitReview(y,b,t,{source:C,file:e,revision:n,...C===`branch`&&w?{baseRef:w}:{}});if(!r.ok||r.summaryRevision!==n)throw(r.ok||r.reason===`revision_changed`)&&!t.aborted&&D(),Error(o(!r.ok&&r.reason!==`revision_changed`?`gitReviewFailed`:`gitReviewChanged`));return r.snapshot.files.find(t=>t.path===e)},[s,y,b,C,w,D,o]);return(0,_.useEffect)(()=>{if(y)return l.current=window.setTimeout(()=>{l.current=null,D()},200),()=>{l.current!==null&&window.clearTimeout(l.current),l.current=null,u.current=!1,c.current?.abort(),c.current=null}},[D,y]),(0,_.useEffect)(()=>{n&&l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[n]),(0,_.useEffect)(()=>{if(!n&&r){l.current!==null&&window.clearTimeout(l.current),l.current=null,u.current=!1;return}!y||l.current!==null||(l.current=window.setTimeout(()=>{l.current=null,D()},n?200:2e3))},[D,t,n,r,y]),(0,_.useEffect)(()=>{if(!y)return;let e=()=>{let e=d.current;(e.active||!e.running)&&D()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}},[D,y]),(0,_.useMemo)(()=>({result:f,loading:m,error:g,refresh:D,source:C,setSource:T,baseRef:w,setBaseRef:E,readFile:k,loadMore:O}),[f,m,g,D,C,T,w,E,k,O])}function $N({notice:e,actions:t}){let{t:n}=cr(),r=(0,_.useRef)(!1),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=()=>t.dismissArchiveNotice(e.key),l=async n=>{if(!r.current){r.current=!0,a(n),s(!1);try{(n===`undo`?await t.unarchiveSession(e.path):await t.selectSession(e.path,e.sessionId))===!1?s(!0):c()}catch{s(!0)}finally{r.current=!1,a(null)}}};return(0,K.jsx)(`div`,{className:`archive-notification`,"data-session-path":e.path,children:(0,K.jsx)(Zu,{type:`info`,body:n(`archiveNoticeTitle`),isAutoHide:!i&&!o,autoHideDuration:8e3,onDismiss:c,renderContent:()=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(C,{className:`archive-notification-icon`,"aria-hidden":`true`}),(0,K.jsxs)(`div`,{className:`archive-notification-copy`,children:[(0,K.jsx)(`strong`,{children:n(`archiveNoticeTitle`)}),(0,K.jsx)(`span`,{title:e.title,children:e.title}),o&&(0,K.jsx)(`span`,{className:`archive-notification-error`,role:`alert`,children:n(`archiveNoticeFailed`)})]}),(0,K.jsx)(`button`,{type:`button`,disabled:i!==null,onClick:()=>void l(`view`),children:n(`archiveNoticeView`)}),(0,K.jsxs)(`button`,{type:`button`,className:`archive-notification-undo`,disabled:i!==null,onClick:()=>void l(`undo`),children:[i===`undo`&&(0,K.jsx)(He,{className:`archive-notification-spinner`,"aria-hidden":`true`}),n(`archiveNoticeUndo`)]}),(0,K.jsx)(`button`,{type:`button`,className:`archive-notification-close`,"aria-label":n(`close`),onClick:c,children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]})})})}function eP({notices:e,actions:t}){return e.length?(0,K.jsx)(`div`,{className:`archive-notifications`,children:e.map(e=>(0,K.jsx)($N,{notice:e,actions:t},e.key))}):null}function tP(e){let t=e?.closest(`.session-row, .workspace-group`),n=e?.closest(`.session-sidebar`),r=t?.dataset.sessionKey,i=Array.from(n?.querySelectorAll(`.session, .workspace-label, .workspace-heading-label`)??[]),a=i.findIndex(e=>t?.contains(e)),o=a<0?i:[...i.slice(a+1),...i.slice(0,a).reverse()];return()=>requestAnimationFrame(()=>{!n?.isConnected||document.querySelector(`dialog[open]`)||[e,r==null?null:Array.from(n.querySelectorAll(`.session-row`)).find(e=>e.dataset.sessionKey===r)?.querySelector(`.menu-action-button`),...o,n.querySelector(`.new-session-button`)].find(e=>e?.isConnected&&!e.closest(`[hidden], [inert]`)&&e.checkVisibility?.()!==!1)?.focus({preventScroll:!0})})}function nP({session:e,archived:t,connected:n,pinSaving:r,restoring:i,movementItems:a,client:o,actions:s,onRename:c,onPin:l,onRead:u,onArchive:d,onNotice:f}){let{t:p}=cr(),m=(0,_.useRef)(null),h=(0,_.useRef)(!0),g=(0,_.useRef)(0),v=(0,_.useRef)(!1),[y,b]=(0,_.useState)(!1),[x,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(!1),[D,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(null),[M,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(null),[I,L]=(0,_.useState)(!1),[R,ee]=(0,_.useState)(!1),z=e.execution?.status===`running`||e.execution?.waitingForInput,B=(e.execution?.pendingFollowUps??0)+(e.execution?.pendingSteering??0)>0,V=n?z||B?p(`sidebarActionRunning`):void 0:p(`sidebarActionDisconnected`),H=t?p(`sidebarForkArchived`):n?A?.local===!1?p(`sidebarForkUnavailable`):void 0:p(`sidebarActionDisconnected`),te=P!==null&&(P.path!==e.path||P.id!==e.id),ne=e.pinOrder!==void 0,re=()=>tP(m.current?.querySelector(`button`)??null),ie=()=>{let t=new URL(`/`,window.location.origin);return t.searchParams.set(`sessionPath`,e.path),t.searchParams.set(`sessionId`,e.id),t.href};(0,_.useEffect)(()=>(h.current=!0,()=>{h.current=!1,g.current++}),[]);let ae=(0,_.useRef)({id:e.id,path:e.path});(0,_.useEffect)(()=>{(ae.current.id!==e.id||ae.current.path!==e.path)&&(ae.current={id:e.id,path:e.path},b(!1),w(null),j(null))},[e.id,e.path]),(0,_.useEffect)(()=>{if(!y||!e.cwd||!n)return;let t=++g.current;return w(null),E(!1),o.sessionOpenTargets(e.path,e.id).then(e=>{h.current&&g.current===t&&w(e.targets)}).catch(()=>{h.current&&g.current===t&&E(!0)}),()=>{g.current++}},[o,n,y,e.cwd,e.id,e.path]),(0,_.useEffect)(()=>{if(!y||t||!n)return;let r=!1;return j(null),N(!1),Promise.resolve().then(()=>o.sessionForkOptions(e.path,e.id)).then(e=>{r||j(e)}).catch(()=>{r||N(!0)}),()=>{r=!0}},[t,o,n,y,e.id,e.path]);let U=()=>{b(!1),queueMicrotask(c)},oe=()=>{let e=re();l().then(e,e)},se=()=>{let e=re();d().then(e,e)},ce=async t=>{try{let n=await wd(t===`link`?ie():t===`cwd`?e.cwd:(await o.sessionMarkdown(e.path,e.id)).markdown);f(p(n?`sidebarCopied`:`sidebarCopyFailed`),!n)}catch{f(p(`sidebarCopyFailed`),!0)}},le=async(t=`local`)=>{if(!(D||H)&&!(t===`worktree`&&!A?.worktree)){k(!0);try{t===`worktree`?await s.forkConversation(e.path,e.id,t):await s.forkConversation(e.path,e.id)}catch{f(p(`sidebarForkFailed`),!0)}finally{h.current&&k(!1)}}},de=()=>{if(v.current)return;let e=P?.restoreFocus;F(null),e?.()},fe=async()=>{if(!(!P||v.current||V||te)){v.current=!0,L(!0),ee(!1);try{await s.deleteSession(P.path,P.id,P.commandId)?(h.current&&F(null),P.restoreFocus()):h.current&&ee(!0)}catch{h.current&&ee(!0)}finally{v.current=!1,h.current&&L(!1)}}},pe=[{id:`rename`,label:p(`sidebarRename`),icon:(0,K.jsx)(at,{}),isDisabled:!n,onClick:U},...t?[]:[{id:`pin`,label:p(ne?`sidebarUnpin`:`sidebarPin`),icon:ne?(0,K.jsx)(ot,{}):(0,K.jsx)(st,{}),isDisabled:r||!n,onClick:oe},{id:`read`,label:p(e.unread?`markConversationRead`:`markConversationUnread`),icon:(0,K.jsx)(_e,{}),isDisabled:!e.readRevision||!n,onClick:()=>void u()}],...a.length?[{type:`divider`},...a]:[],...t?[]:[{type:`divider`},{id:`fork`,label:H?(0,K.jsxs)(`span`,{className:`sidebar-menu-unavailable`,children:[(0,K.jsx)(`span`,{children:p(`sidebarFork`)}),(0,K.jsx)(`small`,{children:H})]}):p(`sidebarFork`),icon:(0,K.jsx)(Ae,{}),isDisabled:!!H||D,items:[{id:`fork-local`,label:p(D?`forkSessionPending`:e.worktree?`sidebarForkSameWorktree`:`sidebarForkLocal`),icon:(0,K.jsx)(et,{}),onClick:()=>void le()},...A?.worktree?[{id:`fork-worktree`,label:p(`sidebarForkWorktree`),icon:(0,K.jsx)(jt,{className:`sidebar-worktree-icon`}),onClick:()=>void le(`worktree`)}]:A===null?[{id:`fork-worktree-loading`,label:p(M?`sidebarForkOptionsFailed`:`sidebarForkOptionsLoading`),isDisabled:!0}]:[]]}],{type:`divider`},{id:`copy`,label:p(`sidebarCopy`),icon:(0,K.jsx)(ue,{}),items:[{id:`copy-link`,label:p(`sidebarCopyLink`),onClick:()=>void ce(`link`)},{id:`copy-markdown`,label:p(`sidebarCopyMarkdown`),isDisabled:!n,onClick:()=>void ce(`markdown`)},{id:`copy-cwd`,label:p(`sidebarCopyCwd`),isDisabled:!e.cwd,onClick:()=>void ce(`cwd`)}]},{type:`divider`},{id:`new-window`,label:p(`sidebarNewWindow`),icon:(0,K.jsx)(Ct,{}),onClick:()=>{window.open(ie(),`_blank`,`noopener,noreferrer`)}},...e.cwd&&n&&(x==null||x.length>0)?[{id:`open-in`,label:p(`sidebarOpenIn`),icon:(0,K.jsx)(O,{}),items:x?.map(t=>({id:t.id,label:t.label,onClick:()=>{o.openSessionIn(e.path,e.id,t.id).catch(()=>f(p(`sidebarOpenFailed`),!0))}}))??[{id:`open-in-loading`,label:p(T?`sidebarAppsFailed`:`sidebarAppsLoading`),isDisabled:!0}]}]:[],{type:`divider`},{id:t?`restore`:`archive`,label:p(i?`restoringConversation`:t?`sidebarRestore`:`sidebarArchive`),icon:t?(0,K.jsx)(S,{}):(0,K.jsx)(C,{}),isDisabled:i||!!V,description:V,onClick:se},{id:`delete`,label:p(`sidebarDelete`),icon:(0,K.jsx)(kt,{}),isDisabled:!!V,description:V,onClick:()=>{let t=re();queueMicrotask(()=>{h.current&&(ee(!1),F({commandId:crypto.randomUUID(),path:e.path,id:e.id,name:nj(e,p(`untitledSession`)),restoreFocus:t}))})}}];return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`astryx-menu-trigger`,ref:m,children:(0,K.jsx)(IA,{className:`sidebar-action-menu sidebar-conversation-menu`,button:{label:p(`conversationOptions`),icon:(0,K.jsx)(W,{}),isIconOnly:!0,size:`sm`,variant:`ghost`,className:`menu-action-button`},items:y?pe:[],menuWidth:248,placement:`below`,alignment:`start`,hasChevron:!1,isMenuOpen:y,onOpenChange:b})}),P&&(0,K.jsx)(iM,{isOpen:P!==null,onOpenChange:e=>{e||de()},purpose:`form`,width:420,"aria-label":p(`sidebarDeleteTitle`),children:(0,K.jsxs)(`form`,{className:`openpi-dialog sidebar-delete-dialog`,onSubmit:e=>{e.preventDefault(),fe()},children:[(0,K.jsx)(`strong`,{children:p(`sidebarDeleteTitle`)}),(0,K.jsx)(`p`,{children:p(`sidebarDeleteDescription`,{name:P?.name})}),(R||te)&&(0,K.jsx)(`p`,{className:`sidebar-dialog-error`,role:`alert`,children:p(te?`sessionLinkUnavailable`:`sidebarDeleteFailed`)}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,"data-autofocus":!0,disabled:I,onClick:de,children:p(`cancel`)}),(0,K.jsx)(`button`,{type:`submit`,className:`danger`,disabled:I||!!V||te,children:p(I?`sidebarDeleting`:`sidebarDeleteConfirm`)})]})]})})]})}var rP=e=>JSON.stringify([`session`,e.id,e.path]),iP=e=>JSON.stringify([`message`,e.sessionId,e.sessionPath,e.messageId,e.source,e.lineOffset]);function aP({open:e,initialQuery:t,initialIncludeArchived:n,sessions:r,workspaces:i,onClose:a,onCreateSession:o,onOpenSession:s,onOpenMessage:c}){let{t:l}=cr(),u=(0,_.useMemo)(()=>new lf,[]),[d,f]=(0,_.useState)(t),p=n,[m,h]=(0,_.useState)(null),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(0),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(null),[D,O]=(0,_.useState)(null),k=(0,_.useRef)(null),A=(0,_.useId)(),j=(0,_.useRef)(null);(0,_.useEffect)(()=>(e&&(f(t),h(null),S(!1),w(null),E(null)),()=>{j.current?.abort(),j.current=null}),[e,t]);let M=d.trim(),N=(0,_.useMemo)(()=>new Map(i?.map(e=>[e.path,e.name])),[i]),P=(0,_.useMemo)(()=>{if(!e||!s)return[];let t=M.toLocaleLowerCase();return(r??[]).filter(e=>e.archived&&!p?!1:!t||`${nj(e,l(`untitledSession`))} ${e.cwd} ${N.get(e.cwd)??``}`.toLocaleLowerCase().includes(t)).sort((e,t)=>t.modified.localeCompare(e.modified)||e.path.localeCompare(t.path))},[e,r,N,M,p,s,l]),F=M?[{name:`transcriptSearchSessions`,sessions:P.slice(0,9)}]:[{name:`pinnedConversations`,sessions:P.filter(e=>e.pinOrder!==void 0).sort((e,t)=>(e.pinOrder??0)-(t.pinOrder??0))},{name:`transcriptSearchRecent`,sessions:P.filter(e=>e.pinOrder===void 0).slice(0,10)}];(0,_.useLayoutEffect)(()=>{j.current?.abort(),j.current=null,E(null),w(null),O(null)},[e,M,p,y]),(0,_.useEffect)(()=>{if(!e||!M){v(!1),S(!1);return}let t=new AbortController;v(!0),S(!1);let n=window.setTimeout(()=>{u.searchTranscripts(M,{includeArchived:p,signal:t.signal}).then(e=>{t.signal.aborted||h({query:M,revision:y,includeArchived:p,response:e})}).catch(()=>{t.signal.aborted||S(!0)}).finally(()=>{t.signal.aborted||v(!1)})},250);return()=>{window.clearTimeout(n),t.abort()}},[u,e,M,p,y]);let I=m?.query===M&&m.revision===y&&m.includeArchived===p?m.response:null,L=[...F.flatMap(e=>e.sessions.map(rP)),...M?I?.matches.map(iP)??[]:[]],R=D!==null&&L.includes(D)?D:L[0],ee=e=>`${A}-${encodeURIComponent(e)}`,z=R?ee(R):void 0;(0,_.useLayoutEffect)(()=>{e&&z&&document.getElementById(z)?.scrollIntoView?.({block:`nearest`})},[e,z]);let B=async(e,t,n)=>{if(j.current)return;O(e),k.current?.focus({preventScroll:!0});let r=new AbortController;j.current=r,E(e),w(null);try{let e=await t(r.signal);if(r.signal.aborted)return;e===!1?w(n):a()}catch{r.signal.aborted||w(n)}finally{j.current===r&&(j.current=null,E(null))}};return(0,K.jsx)(iM,{isOpen:e,onOpenChange:e=>!e&&a(),purpose:`info`,width:`min(520px, 92vw)`,maxHeight:`calc(var(--transcript-search-list-height) + 64px)`,padding:0,className:`transcript-search-modal`,"aria-label":l(`transcriptSearch`),children:e&&(0,K.jsxs)(`div`,{className:`transcript-search-dialog`,children:[(0,K.jsx)(`h2`,{className:`transcript-search-sr-only`,children:l(`transcriptSearch`)}),(0,K.jsx)(`input`,{ref:k,className:`transcript-search-input`,"data-autofocus":!0,type:`search`,maxLength:200,value:d,"aria-label":l(`transcriptSearch`),"aria-autocomplete":`list`,"aria-controls":A,"aria-activedescendant":z,placeholder:l(`transcriptSearchPlaceholder`),autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>f(e.target.value),onKeyDown:e=>{if(e.nativeEvent.isComposing||e.nativeEvent.keyCode===229||![`ArrowDown`,`ArrowUp`,`Home`,`End`,`Enter`].includes(e.key)||T!==null)return;if(!R||!z){e.key===`Enter`&&!M&&o&&(e.preventDefault(),a(),o());return}e.preventDefault();let t=L.indexOf(R);if(e.key===`Enter`){document.getElementById(z)?.click();return}let n=e.key===`Home`?0:e.key===`End`?L.length-1:e.key===`ArrowDown`?Math.min(t+1,L.length-1):Math.max(t-1,0);O(L[n]??null)}}),(0,K.jsx)(`span`,{className:`transcript-search-sr-only`,role:`status`,children:g?l(`transcriptSearching`):null}),(0,K.jsxs)(`div`,{className:`transcript-search-groups`,children:[(0,K.jsx)(`div`,{id:A,role:`listbox`,"aria-label":l(`transcriptSearch`),children:F.filter(e=>e.sessions.length>0||M&&I?.matches.length).map(e=>(0,K.jsxs)(`fieldset`,{"aria-label":l(e.name),children:[(0,K.jsxs)(`h3`,{children:[l(e.name),g&&(0,K.jsx)(He,{className:`is-spinning`,"aria-hidden":`true`})]}),(0,K.jsxs)(`ul`,{className:`transcript-search-results`,role:`presentation`,children:[s&&e.sessions.map(e=>{let t=nj(e,l(`untitledSession`)),n=rP(e),r=e.ungrouped?l(`ungrouped`):N.get(e.cwd)||rj(e.cwd);return(0,K.jsx)(`li`,{role:`presentation`,children:(0,K.jsxs)(`button`,{id:ee(n),role:`option`,"aria-selected":n===R,tabIndex:-1,type:`button`,disabled:T!==null,"aria-label":l(`transcriptSearchSessionResult`,{session:t}),onPointerMove:()=>O(n),onMouseDown:e=>e.preventDefault(),onClick:()=>void B(n,t=>s(e.path,t),`transcriptSearchSessionOpenFailed`),children:[(0,K.jsx)(`span`,{className:`transcript-search-accessory`,"aria-hidden":`true`,children:T===n?(0,K.jsx)(He,{className:`is-spinning`}):e.unread?(0,K.jsx)(ae,{className:`transcript-search-unread`}):null}),(0,K.jsx)(`span`,{className:`transcript-search-result-body`,children:(0,K.jsxs)(`span`,{className:`transcript-search-result-line`,children:[(0,K.jsx)(`span`,{className:`transcript-search-title`,title:t,children:t}),(0,K.jsx)(`span`,{className:`transcript-search-project`,title:e.cwd,children:r})]})})]})},n)}),M&&I?.matches.map(e=>{let t=e.sessionName||l(`untitledSession`),n=l(`transcriptSearchSource_${e.source}`),r=iP(e);return(0,K.jsx)(`li`,{role:`presentation`,children:(0,K.jsxs)(`button`,{id:ee(r),role:`option`,"aria-selected":r===R,tabIndex:-1,type:`button`,disabled:T!==null,"aria-label":l(`transcriptSearchResult`,{session:t,source:n}),onPointerMove:()=>O(r),onMouseDown:e=>e.preventDefault(),onClick:()=>void B(r,t=>c({sessionId:e.sessionId,sessionPath:e.sessionPath,entryId:e.messageId},t),`transcriptSearchOpenFailed`),children:[(0,K.jsx)(`span`,{className:`transcript-search-accessory`,"aria-hidden":`true`,children:T===r&&(0,K.jsx)(He,{className:`is-spinning`})}),(0,K.jsxs)(`span`,{className:`transcript-search-result-body`,children:[(0,K.jsxs)(`span`,{className:`transcript-search-result-line`,children:[(0,K.jsx)(`span`,{className:`transcript-search-title`,title:t,children:t}),(0,K.jsx)(`span`,{className:`transcript-search-project`,title:e.workspace??n,children:e.workspace?N.get(e.workspace)||rj(e.workspace):n})]}),(0,K.jsx)(`span`,{className:`transcript-search-snippet`,children:e.snippet})]})]})},r)})]})]},e.name))}),!M&&!P.length&&(0,K.jsxs)(`div`,{className:`transcript-search-empty-history`,children:[(0,K.jsx)(`p`,{children:l(`noConversations`)}),o&&(0,K.jsx)(`button`,{className:`transcript-search-create`,type:`button`,onClick:()=>{a(),o()},children:l(`newSession`)})]}),M&&!P.length&&!I?.matches.length&&(g?(0,K.jsx)(`div`,{className:`transcript-search-feedback`,"aria-hidden":`true`,children:(0,K.jsx)(He,{className:`is-spinning`})}):I&&!x?(0,K.jsx)(`div`,{className:`transcript-search-feedback`,role:`status`,children:l(`transcriptSearchEmpty`)}):null),x&&(0,K.jsxs)(`p`,{className:`transcript-search-error`,role:`alert`,children:[l(`transcriptSearchFailed`),(0,K.jsx)(`button`,{type:`button`,onClick:()=>b(e=>e+1),children:l(`transcriptSearchRetry`)})]}),C&&(0,K.jsx)(`p`,{className:`transcript-search-error`,role:`alert`,children:l(C)}),I?.partial&&(0,K.jsx)(`p`,{className:`transcript-search-partial`,children:l(`transcriptSearchPartial`)})]})]})})}function oP({workspace:e,client:t,actions:n,connected:r,onClose:i}){let{t:a}=cr(),[o,s]=(0,_.useState)([]),[c,l]=(0,_.useState)(),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(0),[g,v]=(0,_.useState)(null),[y,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(!1),T=(0,_.useRef)(0),E=(0,_.useRef)(null),D=(0,_.useRef)(!1),O=(0,_.useRef)(!0),k=(0,_.useCallback)(async n=>{let r=++T.current;d(!0),p(null);try{let i=await t.workspaceWorktrees(e,n);if(!O.current||r!==T.current)return;if(i.truncated&&!i.nextCursor)throw Error(`Missing worktree continuation`);s(e=>{let t=n?[...e]:[];for(let e of i.worktrees)t.some(t=>t.worktreePath===e.worktreePath&&t.sessionId===e.sessionId&&t.sessionPath===e.sessionPath)||t.push(e);return t}),l(i.nextCursor),h(e=>(n?e:0)+i.unavailable)}catch(e){O.current&&r===T.current&&p(e instanceof sf&&e.code===`WORKTREE_LIST_CHANGED`?`changed`:`failed`)}finally{O.current&&r===T.current&&d(!1)}},[t,e]);(0,_.useEffect)(()=>(O.current=!0,k(),()=>{O.current=!1,T.current++}),[k]);let A=async()=>{if(!(!g||D.current||!r)){D.current=!0,w(!0);try{let e=await n.releaseSessionWorktree(g);if(!O.current)return;b(e),S(!1),e.state===`removed`&&s(e=>e.filter(e=>e.worktreePath!==g.worktreePath||e.sessionId!==g.sessionId||e.sessionPath!==g.sessionPath))}catch{O.current&&(S(!0),b(null))}finally{D.current=!1,O.current&&w(!1)}}};(0,_.useEffect)(()=>{g&&!C&&E.current?.focus()},[g,C]);let j=()=>{D.current||i()};return(0,K.jsx)(iM,{isOpen:!0,onOpenChange:e=>{e||j()},purpose:`form`,width:560,"aria-label":a(`managedWorktrees`),children:(0,K.jsxs)(`div`,{className:`openpi-dialog`,children:[(0,K.jsx)(`strong`,{children:a(`managedWorktrees`)}),(0,K.jsx)(`p`,{className:`sidebar-dialog-path`,children:e}),(0,K.jsx)(`p`,{children:a(`managedWorktreesDescription`)}),g?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`sidebar-dialog-path`,children:g.worktreePath}),(0,K.jsx)(`p`,{children:a(`managedWorktreeConfirm`)}),(y||x)&&(0,K.jsxs)(`p`,{role:`status`,className:y?.state===`removed`?void 0:`sidebar-dialog-error`,children:[a(y?.state===`removed`?`managedWorktreeRemoved`:y?.state===`preserved`?`managedWorktreePreserved`:y?.state===`uncertain`?`managedWorktreeUncertainTerminal`:`managedWorktreeUncertain`),y?.reason&&(0,K.jsxs)(K.Fragment,{children:[` `,y.reason]})]}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,"data-autofocus":!0,ref:E,disabled:C,onClick:()=>{v(null),b(null),S(!1)},children:a(`managedWorktreesBack`)}),y?.state!==`removed`&&y?.state!==`uncertain`&&(0,K.jsx)(`button`,{type:`button`,className:`danger`,disabled:C||!r,onClick:()=>void A(),children:a(C?`managedWorktreeRemoving`:y||x?`managedWorktreesRetry`:`managedWorktreeRemove`)})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`managed-worktrees-list`,children:o.map(e=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`sidebar-dialog-path`,children:e.worktreePath}),(0,K.jsx)(`button`,{type:`button`,disabled:!r||u||!!f,onClick:()=>{v(e),b(null),S(!1)},children:a(`managedWorktreeReview`)})]},JSON.stringify([e.worktreePath,e.sessionId,e.sessionPath])))}),!u&&!f&&!o.length&&(0,K.jsx)(`p`,{children:a(`managedWorktreesEmpty`)}),m>0&&(0,K.jsx)(`p`,{children:a(`managedWorktreesUnavailable`,{count:m})}),f&&(0,K.jsx)(`p`,{role:`alert`,children:a(f===`changed`?`managedWorktreesChanged`:`managedWorktreesLoadFailed`)}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,"data-autofocus":!0,onClick:j,children:a(`close`)}),f&&(0,K.jsx)(`button`,{type:`button`,disabled:u||!r,onClick:()=>void k(f===`changed`?void 0:c),children:a(f===`changed`?`managedWorktreesRefresh`:`managedWorktreesRetry`)}),c&&!f&&(0,K.jsx)(`button`,{type:`button`,disabled:u||!r,onClick:()=>void k(c),children:a(`managedWorktreesMore`)}),u&&(0,K.jsx)(`span`,{role:`status`,children:a(`loading`)})]})]})]})})}function sP(e){return e.workspacePath??e.cwd}function cP(e,t,n){return e[t+(n?2:-1)]??null}function lP(e,t,n){return e[t+ +!!n]??null}function uP(e,t){return e>t.top+t.height/2}function dP(e){let t=e.execution?.lastTurn;return JSON.stringify(t?[e.path,e.id,t.commandId,t.finishedAt]:[e.path,e.id])}function fP(e){return e.firstUnread?.type===`turn`?e.firstUnread.finishedAt:e.execution?.lastTurn?.finishedAt??Date.parse(e.modified)}function pP(e){return JSON.stringify([e.path,e.id])}function mP(e,t=!0){return t&&e.execution?.waitingForInput?0:e.unread?1:t&&e.execution?.status===`running`?2:3}function hP({items:e,label:t,alignment:n=`start`}){return(0,K.jsx)(`span`,{className:`astryx-menu-trigger`,children:(0,K.jsx)(IA,{className:`sidebar-action-menu`,button:{label:t,icon:(0,K.jsx)(W,{}),isIconOnly:!0,size:`sm`,variant:`ghost`,className:`menu-action-button`},items:e,menuWidth:240,placement:`below`,alignment:n,hasChevron:!1})})}function gP(e){let{t}=cr(),n=(0,_.useRef)(null),[r,i]=(0,_.useState)(null),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(10),[p,m]=(0,_.useState)(!0),[h,g]=(0,_.useState)(new Set),v=(0,_.useRef)(null),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(!1),[E,D]=(0,_.useState)(!1),[O,j]=(0,_.useState)(new Set),[M,P]=(0,_.useState)(10),[F,R]=(0,_.useState)(!1),[ee,z]=(0,_.useState)(null),[B,H]=(0,_.useState)(!1),te=(0,_.useRef)(new Set),ne=(0,_.useRef)(null),[re,ie]=(0,_.useState)(null),[U,oe]=(0,_.useState)(``),[se,ce]=(0,_.useState)(!1),le=(0,_.useRef)(null),ue=(0,_.useRef)(null),de=(0,_.useRef)(null),fe=(0,_.useRef)(null),pe=(0,_.useRef)(null),me=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!ee)return;let e=window.setTimeout(()=>z(null),5e3);return()=>window.clearTimeout(e)},[ee]);let W=e.snapshot,he=W?.selectedSession?.path===e.selectedPath?e.selectedPath:null,ge=W?.sessions.find(e=>e.path===W.selectedSession?.path&&e.id===W.selectedSession?.id),_e=dP(ge??{id:``,path:``});(0,_.useEffect)(()=>{e.selectedPath,ne.current=null},[_e,e.selectedPath]),(0,_.useEffect)(()=>{if(!e.sessionViewVisible||!ge||e.selectedPath!==ge.path||ne.current===_e||e.connected===!1)return;let t=!0,n=()=>{document.visibilityState!==`visible`||!document.hasFocus()||document.querySelector(`dialog[open]`)||ne.current!==_e&&(ne.current=_e,!(!ge.unread||!ge.readRevision)&&e.actions.setSessionRead(ge.path,ge.id,!0,ge.readRevision).catch(()=>{t&&R(!0)}))};return n(),document.addEventListener(`visibilitychange`,n),window.addEventListener(`focus`,n),document.addEventListener(`close`,n,!0),()=>{t=!1,document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`focus`,n),document.removeEventListener(`close`,n,!0)}},[_e,ge,e.sessionViewVisible,e.selectedPath,e.connected,e.actions]);let ve=(0,_.useMemo)(()=>new lf,[]),[ye,be]=(0,_.useState)(!1),[xe,Se]=(0,_.useState)(!1),[Ce,we]=(0,_.useState)(!1),Te=(0,_.useRef)(!1),Ee=(0,_.useRef)(null),Oe=(0,_.useRef)(!1),[ke,Ae]=(0,_.useState)(!1),je=(0,_.useRef)(null),[Me,Ne]=(0,_.useState)(null),[Pe,Fe]=(0,_.useState)(null),[Ie,Le]=(0,_.useState)(!1),[Re,ze]=(0,_.useState)(!1),Ve=W?.preferences.pinnedSort??`manual`,We=W?.preferences.sidebarGrouping??`project`,Ge=W?.preferences.chatsSort??`updated`,Ke=(W?.sessions??[]).filter(e=>e.pinOrder!==void 0&&!e.archived).sort((e,t)=>(Ve===`updated`?t.modified.localeCompare(e.modified):0)||e.pinOrder-t.pinOrder).filter(n=>{let r=W?.workspaces.find(e=>e.path===sP(n));return`${nj(n,t(`untitledSession`))} ${n.cwd} ${r?.name??``}`.toLowerCase().includes(e.query.trim().toLowerCase())}),qe=async e=>{if(!Te.current){Te.current=!0,we(!0),ze(!1);try{await e()}catch{ze(!0)}finally{Te.current=!1,we(!1)}}},Je=(t,n,r)=>qe(()=>e.actions.setSessionPin(t.path,t.id,n,r)),Ye=(t,n,r)=>qe(()=>e.actions.setSidebarPin(t,n,r)),Xe=t=>qe(async()=>{await ve.savePreferences(t),await e.actions.refreshSnapshot()}),Ze=async(t,n)=>{if(!t.readRevision)return;let r=dP(t);if(!te.current.has(r)){t.path===e.selectedPath&&(ne.current=r),te.current.add(r),R(!1);try{await e.actions.setSessionRead(t.path,t.id,n,t.readRevision)}catch{R(!0)}finally{te.current.delete(r)}}},Qe=e.query.trim(),$e=JSON.stringify([ye,Qe]),et=(0,_.useRef)({key:$e});et.current.key!==$e&&(et.current={key:$e});let nt=(0,_.useRef)(!1),[rt,it]=(0,_.useState)(null),[at,ot]=(0,_.useState)(!1),[ct,ut]=(0,_.useState)(null),ft=(0,_.useRef)(null),pt=rt?.query===Qe?rt:null,mt=ct?.query===Qe?ct:null,gt=(0,_.useCallback)(async(e,t)=>{if(!ye)return;ft.current?.abort();let n=new AbortController;ft.current=n,ot(!0),ut(null);try{let r=await ve.listArchivedSessions({query:Qe,...e?{cursor:e}:{},limit:25},n.signal);if(n.signal.aborted||ft.current!==n)return;let i=[...r.sessions];for(;!e&&t!==void 0&&i.length!i.some(t=>t.path===e.path));if(i.push(...e),!e.length)break}it(t=>({...r,query:Qe,sessions:e&&t?.query===Qe?[...t.sessions,...i.filter(e=>!t.sessions.some(t=>t.path===e.path))]:i}))}catch(r){!n.signal.aborted&&ft.current===n&&ut({query:Qe,kind:r instanceof sf&&r.code===`ARCHIVED_SESSION_CURSOR_STALE`?`stale`:`failed`,...e?{cursor:e}:{},...t===void 0?{}:{retainedCount:t}})}finally{ft.current===n&&(ft.current=null,ot(!1))}},[Qe,ye,ve]),[_t,yt]=(0,_.useState)(new Set),[bt,xt]=(0,_.useState)(new Set),St=(0,_.useRef)(new Set),[Ct,Tt]=(0,_.useState)(!1),[Et,Dt]=(0,_.useState)(!1),Ot=(0,_.useRef)(!1),[At,jt]=(0,_.useState)(!1),Mt=(0,_.useRef)(!1),[Nt,Pt]=(0,_.useState)(!1),[Ft,It]=(0,_.useState)(!1),Rt=(0,_.useRef)(!1),zt=async t=>{if(St.current.has(t))return;St.current.add(t),xt(new Set(St.current)),Tt(!1);let n=et.current;try{let r=await e.actions.unarchiveSession(t);if(!nt.current||et.current!==n)return;r?(it(e=>e?{...e,sessions:e.sessions.filter(e=>e.path!==t)}:null),await gt()):Tt(!0)}finally{St.current.delete(t),nt.current&&xt(new Set(St.current))}};(0,_.useEffect)(()=>(nt.current=!0,()=>{nt.current=!1}),[]),(0,_.useEffect)(()=>(Tt(!1),ut(null),ye&&(it(e=>e?.query===Qe?e:null),gt()),()=>{ft.current?.abort(),ft.current=null}),[Qe,ye,gt]),(0,_.useEffect)(()=>{if(e.searchOpen)return le.current?.focus(),()=>ue.current?.focus()},[e.searchOpen]),(0,_.useEffect)(()=>{if(e.mobileOpen)return pe.current?.focus(),()=>{let t=e.returnFocusRef?.current;t?.checkVisibility()&&t.focus()}},[e.mobileOpen,e.returnFocusRef]),(0,_.useEffect)(()=>{e.mobileOpen&&document.activeElement===document.body&&!document.querySelector(`dialog:modal`)&&pe.current?.focus()}),(0,_.useEffect)(()=>{a&&(de.current?.focus(),de.current?.select())},[a]);let Bt=(0,_.useMemo)(()=>{let n=e.query.trim().toLowerCase(),r=ye?pt?.sessions??[]:W?.sessions??[],i=(e,i)=>r.filter(r=>!!r.archived===ye&&(ye||r.pinOrder===void 0)&&(e===`__ungrouped__`?r.ungrouped:sP(r)===e&&!r.ungrouped)&&(!n||ye||i||`${nj(r,t(`untitledSession`))} ${r.cwd}`.toLowerCase().includes(n))),a=[...W?.workspaces??[]];for(let e of r)!e.ungrouped&&!a.some(t=>t.path===sP(e))&&a.push({path:sP(e),name:sP(e),current:!1});return[...a.map(e=>{let t=!!n&&`${e.name} ${e.path}`.toLowerCase().includes(n);return{...e,showPath:a.some(t=>t.path!==e.path&&t.name===e.name),sessions:i(e.path,t),ungrouped:!1,matches:t}}),{path:`__ungrouped__`,name:t(`ungrouped`),current:!1,sessions:i(`__ungrouped__`,!1),ungrouped:!0,pinOrder:void 0,showPath:!1,matches:!1}].filter(e=>e.sessions.length>0||!ye&&!e.ungrouped&&(!n||e.matches))},[ye,e.query,pt,W,t]),Vt=e=>[...e].sort((e,t)=>(Ge===`manual`?(e.order??2**53-1)-(t.order??2**53-1):0)||t.modified.localeCompare(e.modified)||e.path.localeCompare(t.path)),Ht=(e,t)=>{if(e.length<=t+1)return e;let n=e.slice(0,t),r=e.find(e=>e.path===he&&e.id===W?.selectedSession?.id);return r&&!n.includes(r)&&n.push(r),n},Ut=Bt.filter(e=>!e.ungrouped),Wt=Ut.filter(e=>e.pinOrder!==void 0),Gt=[...Ke.map(e=>({kind:`session`,session:e,pinOrder:e.pinOrder})),...Wt.map(e=>({kind:`workspace`,project:e,pinOrder:e.pinOrder}))].sort((e,t)=>{let n=e=>e.kind===`session`?e.session.modified:e.project.sessions.reduce((e,t)=>t.modified>e?t.modified:e,``);return(Ve===`updated`?n(t).localeCompare(n(e)):0)||e.pinOrder-t.pinOrder}),Kt=e=>e.kind===`session`?{kind:`session`,path:e.session.path,id:e.session.id}:{kind:`workspace`,path:e.project.path},qt=Ut.filter(e=>e.pinOrder===void 0),Jt=y||e.query.trim()||ye||qt.length<=6?qt:qt.slice(0,5),Yt=qt.find(e=>ge?.path===he&&e.path===(ge?sP(ge):void 0));Yt&&!Jt.includes(Yt)&&Jt.push(Yt);let Xt=Vt((W?.sessions??[]).filter(n=>!n.archived&&n.pinOrder===void 0&&!W?.workspaces.some(e=>e.pinOrder!==void 0&&e.path===sP(n))&&(We===`list`||W?.preferences.projectsInRecents!==!1||n.ungrouped||!Ut.some(e=>e.path===sP(n)))&&(!e.query.trim()||`${nj(n,t(`untitledSession`))} ${n.cwd} ${W?.workspaces.find(e=>e.path===sP(n))?.name??``}`.toLowerCase().includes(e.query.trim().toLowerCase())))),Zt=e.query.trim()?Xt:Ht(Xt,M),Qt=t=>mP(t,e.connected)<3,$t=new Date;$t.setHours(0,0,0,0),$t.setDate($t.getDate()-6);let en=(W?.sessions??[]).filter(e=>!e.archived&&(Qt(e)||h.has(pP(e))||[`completed`,`failed`].includes(e.execution?.lastTurn?.outcome??``)&&(e.execution?.lastTurn?.finishedAt??0)>=$t.getTime())),tn=new Map([...h].map((e,t)=>[e,t])),nn=en.filter(e=>Qt(e)||h.has(pP(e))).sort((t,n)=>(tn.get(pP(t))??1/0)-(tn.get(pP(n))??1/0)||mP(t,e.connected)-mP(n,e.connected)||n.modified.localeCompare(t.modified)),rn=new Set(nn.map(e=>e.path)),an=en.filter(e=>!p||!rn.has(e.path)).sort((e,t)=>fP(t)-fP(e)),on=p?nn.slice(0,d):[],sn=an.slice(0,Math.max(0,d-on.length)),cn=en.length>on.length+sn.length;(0,_.useEffect)(()=>{let e=me.current;if(!l||!cn||!e||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(([e])=>{e?.isIntersecting&&(t.disconnect(),f(d+10))},{root:e.closest(`.sidebar-navigation`)});return t.observe(e),()=>t.disconnect()},[l,cn,d]),(0,_.useEffect)(()=>{if(!l){v.current=null,g(e=>e.size?new Set:e),f(10);return}let t=v.current??{openedAt:Date.now(),sessions:new Set((W?.sessions??[]).map(pP))},n=(W?.sessions??[]).filter(t=>!t.archived&&mP(t,e.connected)<3).sort((t,n)=>mP(t,e.connected)-mP(n,e.connected)||n.modified.localeCompare(t.modified)),r=n.filter(e=>!t.sessions.has(pP(e))&&Date.parse(e.created)>=t.openedAt);for(let e of W?.sessions??[])t.sessions.add(pP(e));v.current=t,g(e=>{let t=new Set([...r.map(pP),...e,...n.map(pP)]);return t.size===e.size?e:t})},[l,W?.sessions,e.connected]);let ln=(W?.sessions??[]).filter(e=>!e.archived&&e.unread),un=ln.filter(e=>e.readRevision),dn=p?nn.filter(e=>e.unread&&e.readRevision):[],fn=async e=>{if(!B){H(!0);try{await Promise.all(e.map(e=>Ze(e,!0)))}finally{H(!1)}}},pn=he?ge?sP(ge):W?.selectedSession?.cwd:null,mn=!!(W?.truncation.sessionsOmitted||W?.truncation.workspacesOmitted),hn=e=>{Ot.current||(oe(e.name),ce(!1),o(e))},gn=async()=>{let t=U.trim();if(!a||!t||t===a.name||Ot.current)return;let n=a,r=et.current,i=pt?.sessions.length??25;Ot.current=!0,Dt(!0),ce(!1);try{if(n.kind===`workspace`?await e.actions.renameWorkspace(n.path,t):await e.actions.renameSession(n.path,t),!nt.current)return;o(null),n.kind===`session`&&ye&&et.current===r&>(void 0,i)}catch{nt.current&&ce(!0)}finally{Ot.current=!1,nt.current&&Dt(!1)}},_n=async()=>{if(!re||Mt.current)return;let t=re;Mt.current=!0,jt(!0),Pt(!1);try{let n=await e.actions.removeWorkspace(t.path);if(!nt.current)return;n?ie(null):Pt(!0)}catch{nt.current&&Pt(!0)}finally{Mt.current=!1,nt.current&&jt(!1)}},vn=async t=>{if(Rt.current)return;let n=et.current;Rt.current=!0,It(!0);try{if(!t){await e.actions.chooseWorkspace();return}let r=await e.actions.createSession(t);if(!nt.current||et.current!==n||!r?.sessionId||!r.sessionPath||r.workspacePath!==t)return;be(!1),u(!1),e.actions.setQuery(``)}catch{}finally{Rt.current=!1,nt.current&&It(!1)}},yn=(0,_.useCallback)(()=>{(Ee.current||je.current)&&(Oe.current=!0),Ee.current=null,je.current=null,Ae(!1),Fe(null),Ne(null)},[]);(0,_.useEffect)(()=>{let e=e=>{e.key!==`Escape`||!Ee.current&&!je.current||(e.preventDefault(),yn())},t=()=>{(Ee.current||je.current)&&yn()};return window.addEventListener(`keydown`,e,!0),window.addEventListener(`blur`,t),()=>{window.removeEventListener(`keydown`,e,!0),window.removeEventListener(`blur`,t)}},[yn]);let bn=(e,t)=>{let n=Gt[e];if(!n)return;let r=cP(Gt,e,t);Ye(Kt(n),!0,r?Kt(r):null)},xn=e=>Ve===`manual`?[{id:`move-up`,label:t(`movePinUp`),icon:(0,K.jsx)(k,{}),isDisabled:Ce||e<=0,onClick:()=>bn(e,!1)},{id:`move-down`,label:t(`movePinDown`),icon:(0,K.jsx)(w,{}),isDisabled:Ce||e===Gt.length-1,onClick:()=>bn(e,!0)}]:[],Sn=[{id:`updated`,label:t(`pinnedRecentlyUpdated`),endContent:Ge===`updated`?(0,K.jsx)(I,{size:16}):void 0,isDisabled:Ce,onClick:()=>void Xe({chatsSort:`updated`})},{id:`manual`,label:t(`pinnedManualOrder`),endContent:Ge===`manual`?(0,K.jsx)(I,{size:16}):void 0,isDisabled:Ce,onClick:()=>void Xe({chatsSort:`manual`})}],Cn=[{id:`updated`,label:t(`pinnedRecentlyUpdated`),endContent:Ve===`updated`?(0,K.jsx)(I,{size:16}):void 0,isDisabled:Ce,onClick:()=>void Xe({pinnedSort:`updated`})},{id:`manual`,label:t(`pinnedManualOrder`),endContent:Ve===`manual`?(0,K.jsx)(I,{size:16}):void 0,isDisabled:Ce,onClick:()=>void Xe({pinnedSort:`manual`})}],wn=[{label:t(`sidebarGroupBy`),items:[{label:t(`sidebarByProject`),endContent:We===`project`?(0,K.jsx)(I,{size:16}):void 0,isDisabled:Ce,onClick:()=>void Xe({sidebarGrouping:`project`})},{label:t(`sidebarFlatList`),endContent:We===`list`?(0,K.jsx)(I,{size:16}):void 0,isDisabled:Ce,onClick:()=>void Xe({sidebarGrouping:`list`})}]},{label:t(`sidebarChatSort`),items:Sn}],Tn=[...wn,...We===`project`?[{label:t(`sidebarShow`),items:[{label:t(`sidebarProjectsInRecents`),endContent:W?.preferences.projectsInRecents===!1?void 0:(0,K.jsx)(I,{size:16}),isDisabled:Ce,onClick:()=>void Xe({projectsInRecents:W?.preferences.projectsInRecents===!1})}]}]:[]],En=(0,K.jsxs)(`div`,{className:`sidebar-section-actions is-always-visible`,children:[(0,K.jsx)(hP,{label:t(`sidebarActivityOptions`),items:[{type:`section`,title:t(`sidebarShow`),items:[{label:t(`sidebarPriority`),endContent:p?(0,K.jsx)(I,{size:16}):void 0,onClick:()=>m(e=>!e)}]},{type:`divider`},{label:t(`sidebarMarkAllRead`),icon:(0,K.jsx)(Ue,{}),isDisabled:B||!dn.length,onClick:()=>void fn(dn)}]}),p&&nn.some(e=>!Qt(e))&&(0,K.jsx)(Cd,{content:t(`sidebarClearRead`),children:(0,K.jsx)(`button`,{className:`icon-button`,type:`button`,"aria-label":t(`sidebarClearRead`),onClick:()=>g(new Set(nn.filter(Qt).map(pP))),children:(0,K.jsx)(N,{"aria-hidden":`true`})})})]}),Dn=(n,r=!1,i)=>{let a=Gt.findIndex(e=>e.kind===`session`&&e.session.path===n.path&&e.session.id===n.id),o={kind:`session`,path:n.path,id:n.id},s=n.pinOrder!==void 0,c=e.connected!==!1&&n.execution?.status===`running`,u=e.connected!==!1&&n.execution?.waitingForInput,d=n.firstUnread?.type===`turn`?n.firstUnread.outcome:n.execution?.lastTurn?.outcome,f=u?`attention`:c?`running`:n.unread?d===`failed`?`attention`:d===`completed`?`completed`:`unread`:void 0,p=f===`running`?He:f===`attention`?V:ae,m=e.connected===!1?0:n.execution?.pendingFollowUps??0,h=n.path===he&&n.id===W?.selectedSession?.id,g=f===`attention`?u?`waiting`:`failed`:f===`running`&&n.execution?.compacting?`compacting`:f,_=[...g?[t(`sidebarState_`+g)]:[],...m>0?[t(`pendingFollowUpsHint`,{count:m})]:[]].join(` · `),v=i?.sessions.findIndex(e=>e.path===n.path&&e.id===n.id)??-1,y=!ye&&!r&&Ge===`manual`&&!!i,b=t=>qe(()=>e.actions.setSessionOrder(n.path,n.id,t?{path:t.path,id:t.id}:null)),x=r?xn(a):y&&i?[{id:`move-up`,label:t(`movePinUp`),icon:(0,K.jsx)(k,{}),isDisabled:Ce||v<=0,onClick:()=>void b(cP(i.sessions,v,!1))},{id:`move-down`,label:t(`movePinDown`),icon:(0,K.jsx)(w,{}),isDisabled:Ce||v===i.sessions.length-1,onClick:()=>void b(cP(i.sessions,v,!0))}]:[];return(0,K.jsxs)(`li`,{className:`session-row `+(n.unread?`is-unread `:``)+(Pe===n.path?Ie?`is-pin-drop-after`:`is-pin-drop-target`:``),"aria-label":nj(n,t(`untitledSession`)),"data-session-key":JSON.stringify([n.path,n.id]),draggable:!Ce&&!e.query.trim()&&(r?Ve===`manual`:y),onDragStart:e=>{if(e.stopPropagation(),r&&Ve===`manual`)Ee.current=o;else if(y&&i)je.current={path:n.path,id:n.id,scope:i.key};else{e.preventDefault();return}Ae(!0),Oe.current=!0,e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,n.id)},onDragOver:e=>{if(!(r&&Ve===`manual`&&Ee.current)&&!(y&&je.current?.scope===i?.key))return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,Fe(n.path),Ne(null);let t=e.currentTarget.getBoundingClientRect();Le(uP(e.clientY,t))},onDragEnd:yn,onDrop:t=>{let n=t.currentTarget.getBoundingClientRect(),s=uP(t.clientY,n);if(r&&Ve===`manual`&&Ee.current){t.preventDefault(),t.stopPropagation();let e=Gt[a+1];Ye(Ee.current,!0,s?e?Kt(e):null:o)}else if(y&&i&&je.current?.scope===i.key){t.preventDefault(),t.stopPropagation();let n=je.current,r=lP(i.sessions,v,s);qe(()=>e.actions.setSessionOrder(n.path,n.id,r?{path:r.path,id:r.id}:null))}else return;yn()},children:[(0,K.jsxs)(`button`,{className:`session `+(h?`active`:``),type:`button`,"aria-current":h?`page`:void 0,"aria-label":[nj(n,t(`untitledSession`)),n.path,_].filter(Boolean).join(` · `),onClick:()=>{h&&n.unread&&e.sessionViewVisible&&e.connected!==!1&&Ze(n,!0),e.actions.selectSession(n.path)},onDoubleClick:r=>{h&&e.connected!==!1&&r.target instanceof Element&&r.target.closest(`.session-title`)&&hn({kind:`session`,path:n.path,name:nj(n,t(`untitledSession`))})},children:[(0,K.jsxs)(`span`,{className:`session-copy`,children:[(0,K.jsx)(`span`,{className:`session-title`,title:nj(n,t(`untitledSession`)),children:nj(n,t(`untitledSession`))}),l&&(0,K.jsxs)(`span`,{className:`session-project`,children:[(0,K.jsx)(De,{"aria-hidden":`true`}),W?.workspaces.find(e=>e.path===sP(n))?.name??ij(sP(n))]})]}),_&&(0,K.jsx)(Cd,{content:_,children:(0,K.jsxs)(`span`,{className:`session-status`,"aria-hidden":`true`,children:[f&&(0,K.jsx)(p,{className:`session-state session-state-`+f}),m>0&&(0,K.jsxs)(`span`,{className:`session-queue`,children:[(0,K.jsx)(Be,{}),(0,K.jsx)(`span`,{children:m>99?`99+`:m})]})]})})]}),!ye&&(0,K.jsx)(Cd,{content:t(s?`unpinConversation`:`pinConversation`),children:(0,K.jsx)(`button`,{type:`button`,className:`session-pin-button`,"aria-label":t(s?`unpinConversation`:`pinConversation`),disabled:Ce,onClick:e=>{let t=tP(e.currentTarget);Je(n,!s).finally(t)},children:(0,K.jsx)(st,{"aria-hidden":`true`,fill:s?`currentColor`:`none`})})}),(0,K.jsx)(nP,{session:n,archived:ye,connected:e.connected!==!1,pinSaving:Ce,restoring:bt.has(n.path),movementItems:x,client:ve,actions:e.actions,onRename:()=>hn({kind:`session`,path:n.path,name:nj(n,t(`untitledSession`))}),onPin:()=>Je(n,!s),onRead:()=>Ze(n,!!n.unread),onArchive:()=>ye?zt(n.path):e.actions.archiveSession(n.path),onNotice:(e,t=!1)=>z({message:e,error:t})})]},n.path)},On=(r,a=!1)=>{let o=(ye?_t:e.collapsed).has(r.path)&&!e.query.trim(),s=!r.ungrouped&&pn===r.path,c=Gt.findIndex(e=>e.kind===`workspace`&&e.project.path===r.path),l=qt.findIndex(e=>e.path===r.path),u=!ye&&!r.ungrouped&&!Ce&&!e.query.trim(),d=t=>qe(()=>e.actions.setWorkspaceOrder(r.path,cP(qt,l,t)?.path??null)),f={kind:`workspace`,path:r.path},p=Vt(r.sessions),m=un.filter(e=>!e.ungrouped&&sP(e)===r.path),h=ye||!!e.query.trim()||O.has(r.path)||p.length<=6,g=[...ye?[]:[{id:`pin`,label:t(a?`unpinWorkspace`:`pinWorkspace`),icon:(0,K.jsx)(st,{}),isDisabled:Ce,onClick:()=>void Ye(f,!a)},{id:`mark-read`,label:t(`sidebarMarkAllRead`),icon:(0,K.jsx)(Ue,{}),isDisabled:B||!m.length,onClick:()=>void fn(m)}],...a?xn(c):ye?[]:[{id:`move-up`,label:t(`movePinUp`),icon:(0,K.jsx)(k,{}),isDisabled:!u||l<=0,onClick:()=>void d(!1)},{id:`move-down`,label:t(`movePinDown`),icon:(0,K.jsx)(w,{}),isDisabled:!u||l===qt.length-1,onClick:()=>void d(!0)}],...r.ungrouped?[]:[{id:`managed-worktrees`,label:t(`managedWorktrees`),icon:(0,K.jsx)(De,{}),isDisabled:e.connected===!1,onClick:()=>{let e=Array.from(fe.current?.querySelectorAll(`.workspace-group`)??[]).find(e=>e.dataset.workspaceKey===r.path);n.current=tP(e?.querySelector(`.workspace-row-actions .menu-action-button`)??null),queueMicrotask(()=>i(r.path))}}],{id:`rename`,label:t(`renameWorkspace`),icon:(0,K.jsx)(wt,{}),onClick:()=>hn({kind:`workspace`,path:r.path,name:r.name})},{id:`remove`,label:t(`removeWorkspace`),icon:(0,K.jsx)(kt,{}),variant:`destructive`,onClick:()=>{Pt(!1),ie({path:r.path,name:r.name})}}];return(0,K.jsxs)(`section`,{className:`workspace-group `+(o?`collapsed `:``)+(s?`is-active-workspace `:``)+(Me===r.path?Ie?`is-pin-drop-after`:`is-pin-drop-target`:``),"data-workspace-key":r.path,"aria-label":r.name,onDragOver:e=>{if(!u||!Ee.current||(a?Ve!==`manual`:Ee.current.kind!==`workspace`))return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect=`move`,Ne(r.path),Fe(null);let t=e.currentTarget.getBoundingClientRect();Le(uP(e.clientY,t))},onDragEnd:yn,onDragLeave:e=>{(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&Ne(null)},onDrop:t=>{if(!u||!Ee.current||(a?Ve!==`manual`:Ee.current.kind!==`workspace`))return;t.preventDefault(),t.stopPropagation();let n=t.currentTarget.getBoundingClientRect(),i=uP(t.clientY,n),o=Ee.current;if(o.kind!==`workspace`||o.path!==r.path)if(a){let e=Gt[c+1];Ye(o,!0,i?e?Kt(e):null:f)}else qe(()=>e.actions.setWorkspaceOrder(o.path,i?qt[l+1]?.path??null:r.path));yn()},children:[(0,K.jsxs)(`div`,{className:`workspace-button`,draggable:u&&(!a||Ve===`manual`),onDragStart:e=>{if(!u||a&&Ve!==`manual`||e.target instanceof Element&&e.target.closest(`.workspace-row-actions`)){e.preventDefault();return}Ee.current=f,requestAnimationFrame(()=>{nt.current&&Ee.current===f&&Ae(!0)}),Oe.current=!0,e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,r.path)},children:[(0,K.jsxs)(`button`,{className:`workspace-label`,type:`button`,"aria-expanded":!o,"aria-current":s?`location`:void 0,disabled:!!e.query.trim(),title:r.ungrouped?void 0:r.path,onClick:()=>{ye?yt(e=>{let t=new Set(e);return t.has(r.path)?t.delete(r.path):t.add(r.path),t}):e.actions.toggleWorkspace(r.path)},children:[(0,K.jsx)(`span`,{className:`workspace-toggle`,"aria-hidden":`true`,children:o?(0,K.jsx)(De,{className:`workspace-folder`}):(0,K.jsx)(G,{className:`workspace-folder`})}),(0,K.jsxs)(`span`,{className:`workspace-identity`,children:[(0,K.jsx)(`strong`,{children:r.name}),r.showPath&&(0,K.jsx)(`small`,{children:ij(r.path)})]})]}),!r.ungrouped&&(0,K.jsxs)(`span`,{className:`workspace-row-actions`,children:[(0,K.jsx)(hP,{label:t(`workspaceOptions`),items:g}),(0,K.jsx)(Cd,{content:t(`newSession`),children:(0,K.jsx)(`button`,{className:`workspace-action`,type:`button`,"aria-label":t(`newSession`)+` `+r.name,disabled:Ft,"aria-busy":Ft||void 0,onClick:()=>void vn(r.path),children:(0,K.jsx)(wt,{})})})]})]}),!o&&!p.length&&!ye&&!e.query.trim()&&!mn&&(0,K.jsx)(`p`,{className:`workspace-empty`,children:t(`noConversations`)}),!o&&p.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`ul`,{className:`workspace-sessions`,children:(h?p:Ht(p,5)).map(e=>Dn(e,!1,{key:r.path,sessions:p}))}),!ye&&!e.query.trim()&&p.length>6&&(0,K.jsx)(`button`,{className:`sidebar-show-more is-indented`,type:`button`,"aria-expanded":O.has(r.path),onClick:()=>j(e=>{let t=new Set(e);return t.has(r.path)?t.delete(r.path):t.add(r.path),t}),children:t(O.has(r.path)?`sidebarShowLess`:`sidebarShowMore`)})]})]},r.path)},kn=new Map,An=new Date,jn=new Date(An);jn.setDate(An.getDate()-1);for(let e of sn){let n=new Date(fP(e)),r=n.toDateString()===An.toDateString()?t(`sidebarToday`):n.toDateString()===jn.toDateString()?t(`sidebarYesterday`):Number.isFinite(n.getTime())?n.toLocaleDateString(void 0,{weekday:`long`}):t(`sidebarEarlier`);kn.set(r,[...kn.get(r)??[],e])}return(0,K.jsxs)(`div`,{ref:fe,id:`session-sidebar`,className:`session-sidebar`,role:e.mobileOpen?`dialog`:`complementary`,"aria-modal":e.mobileOpen||void 0,"aria-label":`Session navigation`,tabIndex:e.mobileOpen?-1:void 0,onPointerDownCapture:()=>{!Ee.current&&!je.current&&(Oe.current=!1)},onClickCapture:e=>{e.detail!==0&&Oe.current&&(e.preventDefault(),e.stopPropagation(),Oe.current=!1)},onKeyDown:t=>{if(!e.mobileOpen||t.defaultPrevented||t.target instanceof Element&&(t.target.closest(`dialog`)||t.key!==`Tab`&&t.target.closest(`[role="menu"]`))||t.key===`Escape`&&fe.current?.querySelector(`[aria-haspopup="menu"][aria-expanded="true"]`)||(t.key===`Escape`&&!t.nativeEvent.isComposing&&(t.preventDefault(),e.actions.closeMobileSidebar()),t.key!==`Tab`))return;let n=Array.from(fe.current?.querySelectorAll(`button, input, select, textarea, a[href], [tabindex]`)??[]).filter(e=>e.tabIndex>=0&&!e.matches(`:disabled`)&&e.checkVisibility({visibilityProperty:!0})),r=t.shiftKey?n.at(-1):n[0],i=t.shiftKey?n[0]:n.at(-1);(document.activeElement===fe.current||document.activeElement===i)&&(t.preventDefault(),r?.focus())},children:[(0,K.jsxs)(`div`,{className:`sidebar-brand`,children:[(0,K.jsx)(`span`,{className:`sidebar-brand-title`,children:`OpenPI`}),(0,K.jsxs)(`div`,{className:`sidebar-header-actions`,children:[(0,K.jsx)(Cd,{content:t(l?`sidebarViewChats`:`sidebarViewActivity`),children:(0,K.jsxs)(`button`,{className:`icon-button sidebar-activity-toggle`,type:`button`,"aria-label":t(l?`sidebarViewChats`:`sidebarViewActivity`),"aria-pressed":l,onClick:()=>{be(!1),u(e=>!e)},children:[(0,K.jsx)(A,{"aria-hidden":`true`}),ln.length>0&&(0,K.jsx)(`span`,{className:`sidebar-unread-dot`})]})}),(0,K.jsx)(Cd,{content:t(`searchConversations`),children:(0,K.jsx)(`button`,{ref:ue,className:`icon-button`,type:`button`,"aria-label":t(`searchConversations`),onClick:()=>c(!0),children:(0,K.jsx)(ht,{"aria-hidden":`true`})})}),(0,K.jsx)(Cd,{content:t(`collapseSidebar`),placement:`end`,children:(0,K.jsx)(`button`,{ref:pe,className:`collapse-button sidebar-mobile-close`,type:`button`,"aria-label":t(`collapseSidebar`),onClick:()=>e.mobileOpen?e.actions.closeMobileSidebar():e.actions.toggleSidebar(!1),children:(0,K.jsx)(tt,{})})})]})]}),(0,K.jsxs)(`button`,{className:`new-session-button`,type:`button`,"aria-label":t(`newSession`),title:t(`newSession`),disabled:Ft,"aria-busy":Ft||void 0,onClick:()=>void vn(e.selectedWorkspace),children:[(0,K.jsx)(wt,{}),(0,K.jsx)(`span`,{children:t(`newSession`)})]}),(0,K.jsx)(aP,{open:s,initialQuery:e.query,initialIncludeArchived:ye,sessions:W?.sessions??[],workspaces:W?.workspaces??[],onClose:()=>c(!1),onOpenMessage:e.actions.navigateToMessage,onOpenSession:t=>e.actions.selectSession(t),onCreateSession:()=>void vn(e.selectedWorkspace)}),(0,K.jsxs)(`div`,{className:`sidebar-navigation`,children:[ee&&(0,K.jsx)(`p`,{className:`sidebar-scope-note sidebar-action-feedback`,role:ee.error?`alert`:`status`,children:ee.message}),Re&&(0,K.jsx)(`p`,{className:`sidebar-scope-note`,role:`alert`,children:t(`sidebarSaveFailed`)}),F&&(0,K.jsx)(`p`,{className:`sidebar-scope-note`,role:`alert`,children:t(`sidebarReadFailed`)}),l?(0,K.jsxs)(`section`,{className:`sidebar-activity`,"aria-label":t(`sidebarActivity`),children:[p&&(0,K.jsxs)(`section`,{"aria-label":t(`sidebarPriority`),children:[(0,K.jsxs)(`div`,{className:`sidebar-section-heading`,children:[(0,K.jsx)(`h2`,{className:`sidebar-section-label`,children:t(`sidebarPriority`)}),En]}),(0,K.jsx)(`ul`,{className:`sidebar-activity-sessions`,children:on.map(e=>Dn(e))}),!on.length&&(0,K.jsx)(`p`,{className:`sidebar-activity-empty`,children:t(`sidebarActivityEmpty`)})]}),[...kn].map(([e,t],n)=>(0,K.jsxs)(`section`,{"aria-label":e,children:[(0,K.jsxs)(`div`,{className:`sidebar-section-heading`,children:[(0,K.jsx)(`h2`,{className:`sidebar-section-label`,children:e}),!p&&n===0&&En]}),(0,K.jsx)(`ul`,{className:`sidebar-activity-sessions`,children:t.map(e=>Dn(e))})]},e)),!p&&!kn.size&&(0,K.jsxs)(`section`,{"aria-label":t(`sidebarToday`),children:[(0,K.jsxs)(`div`,{className:`sidebar-section-heading`,children:[(0,K.jsx)(`h2`,{className:`sidebar-section-label`,children:t(`sidebarToday`)}),En]}),(0,K.jsx)(`p`,{className:`sidebar-activity-empty`,children:t(`sidebarActivityEmpty`)})]}),cn&&(0,K.jsx)(`div`,{ref:me,className:`sidebar-activity-tail`,role:`status`,"aria-label":t(`loading`),children:(0,K.jsx)(He,{"aria-hidden":`true`})})]}):(0,K.jsxs)(K.Fragment,{children:[!ye&&(Gt.length>0||ke&&Ee.current&&Ve===`manual`)&&(0,K.jsxs)(`section`,{className:`pinned-section `+(Me===`pinned-tail`?`is-pin-drop-after`:``),"aria-label":t(`pinnedConversations`),onDragOver:t=>{Ce||Ve!==`manual`||!Ee.current||e.query.trim()||(t.preventDefault(),t.dataTransfer.dropEffect=`move`,Ne(`pinned-tail`),Fe(null))},onDragLeave:e=>{(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&Ne(null)},onDrop:t=>{Ce||Ve!==`manual`||!Ee.current||e.query.trim()||(t.preventDefault(),t.stopPropagation(),Ye(Ee.current,!0,null),yn())},children:[(0,K.jsxs)(`div`,{className:`sidebar-section-heading`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`workspace-heading-label`,"aria-expanded":!xe||!!e.query.trim(),onClick:()=>Se(e=>!e),children:[t(`pinnedConversations`),(0,K.jsx)(L,{className:xe&&!e.query.trim()?`is-collapsed`:``,"aria-hidden":`true`})]}),(0,K.jsx)(`div`,{className:`sidebar-section-actions`,children:(0,K.jsx)(hP,{label:t(`pinnedOptions`),items:Cn,alignment:`end`})})]}),ke&&Ve===`manual`&&(Gt.length===0||xe)&&(0,K.jsx)(`p`,{className:`sidebar-drop-hint`,children:t(`sidebarDropPin`)}),(!xe||!!e.query.trim())&&(0,K.jsx)(`ul`,{className:`pinned-sessions`,children:Gt.map(e=>e.kind===`session`?Dn(e.session,!0):(0,K.jsx)(`li`,{className:`pinned-workspace`,children:On(e.project,!0)},e.project.path))})]}),(ye||We===`project`||e.searchOpen)&&(0,K.jsxs)(`div`,{className:`workspace-heading sidebar-section-heading `+(e.searchOpen?`is-searching`:``),children:[(0,K.jsxs)(`button`,{type:`button`,className:`workspace-heading-label`,"aria-label":t(ye?`currentConversations`:`sidebarProjects`),"aria-expanded":ye?void 0:!x||!!e.query.trim(),onClick:()=>ye?be(!1):S(e=>!e),children:[ye&&(0,K.jsx)(T,{"aria-hidden":`true`}),t(ye?`archivedConversations`:`sidebarProjects`),!ye&&(0,K.jsx)(L,{className:x&&!e.query.trim()?`is-collapsed`:``,"aria-hidden":`true`})]}),(0,K.jsxs)(`div`,{className:`session-search`,children:[(0,K.jsx)(ht,{}),(0,K.jsx)(`input`,{ref:le,type:`search`,value:e.query,placeholder:t(`searchPlaceholder`),maxLength:ye?160:void 0,"aria-label":t(`searchConversations`),onChange:t=>e.actions.setQuery(t.target.value)}),(0,K.jsx)(`button`,{type:`button`,"aria-label":t(`closeSearch`),onClick:()=>e.actions.setSearchOpen(!1),children:(0,K.jsx)(Lt,{})})]}),(0,K.jsxs)(`div`,{className:`workspace-actions sidebar-section-actions`,children:[!ye&&(0,K.jsx)(hP,{label:t(`sidebarProjectOptions`),items:wn}),ye&&(0,K.jsx)(Cd,{content:t(`sidebarFilterList`),children:(0,K.jsx)(`button`,{className:`icon-button`,type:`button`,"aria-label":t(`sidebarFilterList`),onClick:()=>e.actions.setSearchOpen(!0),children:(0,K.jsx)(ht,{})})}),!ye&&(0,K.jsx)(Cd,{content:t(`addWorkspace`),children:(0,K.jsx)(`button`,{className:`icon-button`,type:`button`,"aria-label":t(`addWorkspace`),onClick:()=>void e.actions.chooseWorkspace(),children:(0,K.jsx)(lt,{})})})]})]}),e.searchOpen&&(0,K.jsxs)(`button`,{type:`button`,className:`sidebar-content-search`,onClick:()=>c(!0),children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),t(`transcriptSearch`)]}),ye&&(0,K.jsxs)(`div`,{className:`sidebar-archive-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":t(`refreshArchives`),title:t(`refreshArchives`),disabled:at,onClick:()=>void gt(),children:(0,K.jsx)(dt,{"aria-hidden":`true`})}),at&&(0,K.jsx)(`span`,{role:`status`,children:t(`loadingArchives`)})]}),ye&&mt&&(0,K.jsxs)(`div`,{className:`sidebar-scope-note`,role:`alert`,children:[(0,K.jsx)(`p`,{children:t(mt.kind===`stale`?`archiveCursorStale`:`archiveLoadFailed`)}),(0,K.jsx)(`button`,{type:`button`,disabled:at,onClick:()=>void gt(mt.kind===`stale`?void 0:mt.cursor,mt.retainedCount),children:t(mt.kind===`stale`?`refreshArchives`:`retryArchives`)})]}),ye&&!!pt?.truncation.recordsUnscanned&&(0,K.jsx)(`p`,{className:`sidebar-scope-note`,children:t(`archiveScanBounded`,{count:pt?.truncation.recordsUnscanned})}),!ye&&mn&&(0,K.jsx)(`p`,{className:`sidebar-scope-note`,children:t(`loadedHistoryBounded`,{sessions:W?.truncation.sessionsOmitted,workspaces:W?.truncation.workspacesOmitted})}),ye&&Ct&&(0,K.jsx)(`p`,{className:`sidebar-scope-note`,role:`alert`,children:t(`restoreFailed`)}),(0,K.jsxs)(`div`,{className:`workspace-tree`,children:[(ye?Bt:We===`project`&&(!x||e.query.trim())?Jt:[]).map(e=>On(e)),!ye&&We===`project`&&ke&&Ee.current?.kind===`workspace`&&!e.query.trim()&&(0,K.jsx)(`section`,{className:`sidebar-project-tail `+(Me===`project-tail`?`is-pin-drop-target`:``),"aria-label":t(`sidebarDropProjectLast`),onDragOver:e=>{Ce||Ee.current?.kind!==`workspace`||(e.preventDefault(),e.dataTransfer.dropEffect=`move`,Ne(`project-tail`),Fe(null))},onDragLeave:e=>{(!(e.relatedTarget instanceof Node)||!e.currentTarget.contains(e.relatedTarget))&&Ne(null)},onDrop:t=>{if(Ce||Ee.current?.kind!==`workspace`)return;t.preventDefault();let n=Ee.current;qe(()=>e.actions.setWorkspaceOrder(n.path,null)),yn()},children:t(`sidebarDropProjectLast`)}),!ye&&We===`project`&&!x&&!e.query.trim()&&qt.length>6&&(0,K.jsx)(`button`,{className:`sidebar-show-more`,type:`button`,"aria-expanded":y,onClick:()=>b(e=>!e),children:t(y?`sidebarShowLess`:`sidebarShowMore`)}),!ye&&(0,K.jsxs)(`section`,{className:`sidebar-recents`,"aria-label":t(`sidebarRecent`),children:[(0,K.jsxs)(`div`,{className:`sidebar-section-heading`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`workspace-heading-label`,"aria-expanded":!E||!!e.query.trim(),onClick:()=>D(e=>!e),children:[t(`sidebarRecent`),(0,K.jsx)(L,{className:E&&!e.query.trim()?`is-collapsed`:``,"aria-hidden":`true`})]}),(0,K.jsx)(`div`,{className:`sidebar-section-actions`,children:(0,K.jsx)(hP,{label:t(`sidebarRecentOptions`),items:Tn})})]}),(!E||!!e.query.trim())&&(0,K.jsx)(`ul`,{className:`recent-sessions`,children:Zt.map(e=>Dn(e,!1,{key:`recent`,sessions:Xt}))}),!E&&Zt.lengthP(e=>e+10),children:t(`sidebarShowMore`)})]}),(ye?!Bt.length:!Gt.length&&!Xt.length&&(We===`list`||!qt.length))&&(0,K.jsx)(`div`,{className:`empty`,hidden:ye&&(at||!!mt),children:e.query.trim()?t(ye&&pt?.truncation.recordsUnscanned?`noMatchingScannedArchives`:!ye&&mn?`noMatchingLoaded`:`noMatching`):t(ye?pt?.truncation.recordsUnscanned?`noScannedArchives`:`noArchivedSessions`:`noSessions`)}),ye&&pt?.nextCursor&&mt?.kind!==`stale`&&(0,K.jsx)(`button`,{type:`button`,className:`sidebar-archive-more`,disabled:at,onClick:()=>void gt(pt.nextCursor),children:t(`moreArchives`)})]})]})]}),(0,K.jsxs)(`div`,{className:`sidebar-footer`,children:[(0,K.jsxs)(`button`,{className:`sidebar-settings-button sidebar-archive-toggle`,type:`button`,"aria-label":t(`archivedConversations`),"aria-pressed":ye,title:t(`archivedConversations`),onClick:()=>{u(!1),be(e=>!e)},children:[(0,K.jsx)(C,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:t(`archivedConversations`)})]}),(0,K.jsxs)(`button`,{className:`sidebar-settings-button`,type:`button`,"aria-label":t(`settings`),title:t(`settings`),"data-provider-settings-trigger":!0,disabled:e.settingsDisabled,onClick:e.onOpenSettings,children:[(0,K.jsx)(vt,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:t(`settings`)})]})]}),(0,K.jsx)(iM,{isOpen:!!a,onOpenChange:e=>!e&&!Ot.current&&o(null),purpose:`form`,width:400,"aria-label":a?.kind===`workspace`?t(`renameWorkspace`):t(`renameConversation`),children:(0,K.jsxs)(`form`,{className:`openpi-dialog`,onSubmit:e=>{e.preventDefault(),gn()},children:[(0,K.jsx)(`strong`,{children:a?.kind===`workspace`?t(`renameWorkspace`):t(`renameConversation`)}),(0,K.jsx)(`input`,{ref:de,value:U,maxLength:80,disabled:Et,"aria-label":a?.kind===`workspace`?t(`workspaceName`):t(`conversationName`),onChange:e=>oe(e.target.value)}),se&&(0,K.jsx)(`p`,{className:`sidebar-dialog-error`,role:`alert`,children:t(`renameFailed`)}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:Et,onClick:()=>{Ot.current||o(null)},children:t(`cancel`)}),(0,K.jsx)(`button`,{type:`submit`,className:`primary`,disabled:Et||!U.trim()||U.trim()===a?.name,children:t(Et?`savingName`:`save`)})]})]})}),r&&(0,K.jsx)(oP,{workspace:r,client:ve,actions:e.actions,connected:e.connected!==!1,onClose:()=>{i(null),n.current?.()}},r),(0,K.jsx)(iM,{isOpen:!!re,onOpenChange:e=>!e&&!Mt.current&&ie(null),purpose:`form`,width:440,"aria-label":t(`removeWorkspace`),children:(0,K.jsxs)(`div`,{className:`openpi-dialog`,children:[(0,K.jsx)(`strong`,{children:t(`removeWorkspace`)}),(0,K.jsx)(`p`,{className:`sidebar-dialog-path`,children:re?.path}),(0,K.jsxs)(`p`,{children:[re?.name,`:`,t(`workspaceDeleteConfirm`)]}),Nt&&(0,K.jsx)(`p`,{className:`sidebar-dialog-error`,role:`alert`,children:t(`workspaceRemoveFailed`)}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:At,onClick:()=>{Mt.current||ie(null)},children:t(`cancel`)}),(0,K.jsx)(`button`,{type:`button`,className:`danger`,disabled:At,onClick:()=>void _n(),children:t(At?`removingWorkspace`:`removeWorkspace`)})]})]})})]})}var _P=(0,_.createContext)(null);_P.displayName=`LayoutAreaContext`;var vP=(0,_.createContext)({hasHeader:!1,hasFooter:!1,hasStart:!1,hasEnd:!1});vP.displayName=`LayoutSlotsContext`;var yP={center:{kGNEyG:`x6s0dn4`,$$css:!0},end:{kGNEyG:`xuk3077`,$$css:!0},start:{kGNEyG:`x1cy8zhl`,$$css:!0},stretch:{kGNEyG:`x1qjc9v5`,$$css:!0}},bP={start:{kjj79g:`x1nhvcw1`,$$css:!0},center:{kjj79g:`xl56j7k`,$$css:!0},end:{kjj79g:`x13a6bvl`,$$css:!0},between:{kjj79g:`x1qughib`,$$css:!0},around:{kjj79g:`x1l1ennw`,$$css:!0},evenly:{kjj79g:`xaw8158`,$$css:!0}},xP={horizontal:{kXwgrk:`x1q0g3np`,$$css:!0},vertical:{kXwgrk:`xdt5ytf`,$$css:!0}},SP={nowrap:{kwnvtZ:`xozqiw3`,$$css:!0},wrap:{kwnvtZ:`x1a02dak`,$$css:!0},"wrap-reverse":{kwnvtZ:`x8hhl5t`,$$css:!0}},CP={stack:{k1xSpc:`x78zum5`,$$css:!0}},wP={0:{k1C7PZ:`x1o57wo1`,khm7nJ:`x6yxi7o`,$$css:!0},1:{k1C7PZ:`x1lfs0n9`,khm7nJ:`x1ngg2t4`,$$css:!0},2:{k1C7PZ:`xak3so`,khm7nJ:`x1x7z4sm`,$$css:!0},3:{k1C7PZ:`xewh9hi`,khm7nJ:`x4olc9o`,$$css:!0},4:{k1C7PZ:`xty4p9g`,khm7nJ:`xtx9w7w`,$$css:!0},5:{k1C7PZ:`x1eqhezk`,khm7nJ:`x1iu6piu`,$$css:!0},6:{k1C7PZ:`x3qlgwd`,khm7nJ:`xczp1bk`,$$css:!0},8:{k1C7PZ:`xicv188`,khm7nJ:`xgx0vcf`,$$css:!0},10:{k1C7PZ:`x1p37tyl`,khm7nJ:`x1xpicb7`,$$css:!0},"0.5":{k1C7PZ:`x1kihgfc`,khm7nJ:`x1tw44j4`,$$css:!0},"1.5":{k1C7PZ:`x1thn6ci`,khm7nJ:`xhq53yo`,$$css:!0}};function TP({crossAlign:e,direction:t,gap:n,mainAlign:r,wrap:i}){return[CP.stack,xP[t],n!=null&&wP[n],e!=null&&yP[e],r!=null&&bP[r],i!=null&&SP[i]]}var EP={reset:{kAzted:`x2lwn1j`,k7Eaqz:`xeuugli`,$$css:!0}},DP={center:{kSGwAc:`xamitd3`,$$css:!0},end:{kSGwAc:`xpvyfi4`,$$css:!0},start:{kSGwAc:`xqcrz7y`,$$css:!0},stretch:{kSGwAc:`xkh2ocl`,$$css:!0}},OP={fill:{kzQI83:`x1iyjqo2`,$$css:!0},static:{kzQI83:`x1c4vz4f`,kmuXW:`x2lah0s`,$$css:!0}};function kP({crossAlignSelf:e,size:t}={}){return[EP.reset,OP[t??`static`],e!=null&&DP[e]]}var AP={layoutOuter:{keTefX:`xojxgvx`,k71WvV:`x1fcf3bl`,keoZOQ:`x1sa9bsh`,k1K539:`x6h7pi7`,$$css:!0},layoutInner:{"--container-padding-inline-start":`xrhngw9`,"--container-padding-inline-end":`xjsfl84`,"--container-padding-block-start":`x1047aw6`,"--container-padding-block-end":`xax9j7h`,$$css:!0},fill:{kZKoxP:`x12qplqi`,kskxy:`xenllk4`,$$css:!0},auto:{kAzted:`x1us19tq`,$$css:!0},middle:{kUk6DE:`x98rzlu`,kAzted:`x2lwn1j`,$$css:!0},fullBleed:{"--layout-padding-outer-x":`x1wbjvqu`,"--layout-padding-outer-y":`xzxxx64`,$$css:!0}},jP={kzqmXN:`xh8yej3`,kUOVxO:`xvueqy4`,$$css:!0},MP={contentWidthVar:e=>[{"--layout-content-width":(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`x4906uf`,$$css:!0},{"--x---layout-content-width":(typeof e==`number`?`${e}px`:e)==null?void 0:typeof e==`number`?`${e}px`:e}],contentWidth:e=>[jP,{ks0D6T:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`xf68679`,$$css:!0},{"--x-maxWidth":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e)}]};function NP({area:e,children:t}){return t==null?null:(0,K.jsx)(_P,{value:e,children:t})}var PP={"x-default-marker":`x-default-marker`,$$css:!0};function FP({children:e,content:t,contentWidth:n,defaultHasDividers:r,end:i,footer:a,header:o,height:s=`fill`,padding:c,ref:l,start:u,xstyle:d,className:f,style:p}){let m=s===`fill`,h=t??e,g=(0,_.useMemo)(()=>r==null?null:{defaultHasDividers:r},[r]),v=o!=null,y=a!=null,b=u!=null,x=i!=null,S=(0,_.useMemo)(()=>({hasHeader:v,hasFooter:y,hasStart:b,hasEnd:x}),[v,y,b,x]),C=(0,K.jsx)(vP,{value:S,children:(0,K.jsx)(`div`,{ref:l,...oa(ba(`layout`,{height:s}),Sr(AP.layoutOuter,m?AP.fill:AP.auto,d),f,p),children:(0,K.jsxs)(`div`,{...Sr(PP,AP.layoutInner,...TP({direction:`vertical`}),m?AP.fill:AP.auto,c===0&&AP.fullBleed,c!=null&&oi[c],c!=null&&si[c],n!=null&&MP.contentWidthVar(n)),children:[(0,K.jsx)(NP,{area:`header`,children:o}),(0,K.jsxs)(`div`,{...Sr(...TP({direction:`horizontal`}),AP.middle,n!=null&&MP.contentWidth(n)),children:[(0,K.jsx)(NP,{area:`start`,children:u}),(0,K.jsx)(`div`,{...Sr(...kP({size:`fill`})),children:(0,K.jsx)(NP,{area:`content`,children:h})}),(0,K.jsx)(NP,{area:`end`,children:i})]}),(0,K.jsx)(NP,{area:`footer`,children:a})]})})});return g==null?C:(0,K.jsx)(aM,{value:g,children:C})}FP.displayName=`Layout`;var IP={content:{kB7OPa:`x9f619`,kZKoxP:`x5yr21d`,kUk6DE:`x98rzlu`,kAzted:`x2lwn1j`,kVQacm:`x7giv3`,kZCmMZ:`xwjyata`,kwRFfy:`x1peupej`,kLKAdn:`xqty4a x1ioh5az`,kGO01o:`xg476vw xsg11nj`,"--container-padding-inline-start":`x408pgh`,"--container-padding-inline-end":`xikqloz`,"--container-padding-block-start":`xjmgx01`,"--container-padding-block-end":`xi9ns85`,$$css:!0},noStart:{kZCmMZ:`x139j0dd`,"--container-padding-inline-start":`xdvaxxn`,"--container-padding-inline-end":`xqpvj4r`,$$css:!0},noEnd:{kwRFfy:`xpc6k2p`,$$css:!0},noHeader:{kLKAdn:`x81pis9`,"--container-padding-block-start":`xzz8v79`,$$css:!0},noFooter:{kGO01o:`xon7vh3`,"--container-padding-block-end":`x1xjq73n`,$$css:!0},scrollable:{kVQacm:`xysyzu8`,$$css:!0},fullBleed:{kZCmMZ:`x1c1uobl`,kwRFfy:`xyri2b`,kLKAdn:`xexx8yu`,kGO01o:`x18d9i69`,"--container-padding-inline-start":`xrhngw9`,"--container-padding-inline-end":`xjsfl84`,"--container-padding-block-start":`x1047aw6`,"--container-padding-block-end":`xax9j7h`,$$css:!0}};function LP({children:e,isScrollable:t=!0,padding:n,label:r,role:i,xstyle:a,className:o,style:s,ref:c,...l}){let{hasHeader:u,hasFooter:d,hasStart:f,hasEnd:p}=(0,_.use)(vP),m=n===0;return(0,K.jsx)(`div`,{ref:c,role:i,"aria-label":r,...oa(ba(`layout-content`),Sr(IP.content,!f&&!m&&n==null&&IP.noStart,!p&&!m&&n==null&&IP.noEnd,!u&&!m&&n==null&&IP.noHeader,!d&&!m&&n==null&&IP.noFooter,t&&IP.scrollable,m&&IP.fullBleed,n!=null&&ni[n],n!=null&&ri[n],n!=null&&ii[n],n!=null&&ai[n],a),o,s),...l,children:e})}LP.displayName=`LayoutContent`;var RP={footer:{kmuXW:`x2lah0s`,$$css:!0},inner:{kB7OPa:`x9f619`,ks0D6T:`xjl2t3p`,kUOVxO:`xvueqy4`,kZCmMZ:`x139j0dd`,kwRFfy:`xpc6k2p`,kLKAdn:`xqty4a`,kGO01o:`xon7vh3`,"--container-padding-inline-start":`xdvaxxn`,"--container-padding-inline-end":`xqpvj4r`,"--container-padding-block-start":`xjmgx01`,"--container-padding-block-end":`x1xjq73n`,$$css:!0},fullBleed:{kZCmMZ:`x1c1uobl`,kwRFfy:`xyri2b`,kLKAdn:`xexx8yu`,kGO01o:`x18d9i69`,"--container-padding-inline-start":`xrhngw9`,"--container-padding-inline-end":`xjsfl84`,"--container-padding-block-start":`x1047aw6`,"--container-padding-block-end":`xax9j7h`,$$css:!0},divider:{kEafiO:`x178xt8z`,kPef9Z:`x13fuv20`,kLZC3w:`x1pc3f07`,$$css:!0}},zP={sizing:e=>[{kZKoxP:e==null?e:`x16ye13r`,$$css:!0},{"--x-height":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]};function BP({children:e,hasDivider:t,height:n,label:r,padding:i,role:a,xstyle:o,className:s,style:c,ref:l,...u}){let d=(0,_.use)(aM),f=t??d?.defaultHasDividers??!1,p=i===0;return(0,K.jsx)(`div`,{ref:l,role:a,"aria-label":r,"data-divider":f||void 0,...oa(ba(`layout-footer`),Sr(RP.footer,zP.sizing(n??null),f&&RP.divider,o),s,c),...u,children:(0,K.jsx)(`div`,{...Sr(RP.inner,p&&RP.fullBleed,i!=null&&ni[i],i!=null&&ri[i],i!=null&&ii[i],i!=null&&ai[i]),children:e})})}BP.displayName=`LayoutFooter`;var VP={scrollable:{kVQacm:`xysyzu8`,$$css:!0}};function HP({direction:e=`vertical`,hAlign:t,vAlign:n,justify:r,align:i,gap:a,padding:o,paddingInline:s,paddingInlineStart:c,paddingInlineEnd:l,paddingBlock:u,paddingBlockStart:d,paddingBlockEnd:f,isScrollable:p,width:m,height:h,maxWidth:g,minHeight:v,wrap:y,as:b=`div`,xstyle:x,className:S,style:C,children:w,ref:T,...E}){let D=t??(e===`horizontal`?r:i),O=n??(e===`horizontal`?i:r),k=e===`horizontal`?D:O,A=e===`horizontal`?O:D,j=c??s??o,M=l??s??o,N=d??u??o,P=f??u??o,F=Sr(...TP({direction:e,crossAlign:A,mainAlign:k,gap:a,wrap:y}),j!=null&&ci[j],M!=null&&li[M],N!=null&&ui[N],P!=null&&di[P],p&&VP.scrollable,x),I={...m!=null&&{width:typeof m==`number`?`${m}px`:m},...h!=null&&{height:typeof h==`number`?`${h}px`:h},...g!=null&&{maxWidth:typeof g==`number`?`${g}px`:g},...v!=null&&{minHeight:typeof v==`number`?`${v}px`:v}};return(0,_.createElement)(b,{ref:T,...oa(ba(`stack`,{direction:e,gap:a,wrap:y}),F,S,{...C,...I}),...E},w)}HP.displayName=`Stack`;function UP({ref:e,justify:t,align:n,hAlign:r,vAlign:i,...a}){return(0,K.jsx)(HP,{...a,direction:`horizontal`,hAlign:r??t,vAlign:i??n,ref:e})}UP.displayName=`HStack`;function WP({ref:e,justify:t,align:n,hAlign:r,vAlign:i,...a}){return(0,K.jsx)(HP,{...a,direction:`vertical`,hAlign:r??n,vAlign:i??t,ref:e})}WP.displayName=`VStack`;var GP=`(max-width: 640px)`,KP={action:{ks0D6T:`x193iq5w`,k7Eaqz:`xeuugli`,$$css:!0},stackedAction:{kzqmXN:`xh8yej3`,$$css:!0}};function qP({ref:e,isOpen:t,isInline:n,onOpenChange:r,title:i,description:a,cancelLabel:o,actionLabel:s,actionVariant:c=`destructive`,isActionLoading:l,onAction:u,width:d=400,xstyle:f,className:p,style:m,"data-testid":h,...g}){let v=Rc(),y=o??v(`@astryx.alertDialog.cancel`),b=(0,_.useId)(),x=(0,_.useId)(),S=Wl(GP),C=(0,_.useCallback)(()=>{r(!1)},[r]),w=[KP.action,S&&KP.stackedAction],T=(0,K.jsx)(qc,{variant:`ghost`,label:y,onClick:C,xstyle:w,"data-autofocus":!0},`cancel`),E=(0,K.jsx)(qc,{variant:c,label:s,onClick:u,isLoading:l,xstyle:w},`action`);return(0,K.jsx)(iM,{...g,ref:e,isOpen:t,isInline:n,onOpenChange:r,width:d,purpose:`form`,role:n?`group`:`alertdialog`,"aria-labelledby":b,"aria-describedby":x,...oa(ba(`alert-dialog`),{className:p,style:m}),xstyle:f,"data-testid":h,children:(0,K.jsx)(FP,{content:(0,K.jsxs)(LP,{children:[(0,K.jsx)(cM,{level:2,id:b,children:i}),(0,K.jsx)(zo,{type:`body`,color:`secondary`,id:x,children:a})]}),footer:(0,K.jsx)(BP,{children:(0,K.jsx)(HP,{direction:S?`vertical`:`horizontal`,gap:2,hAlign:S?`stretch`:`end`,wrap:S?`nowrap`:`wrap`,children:S?[E,T]:[T,E]})})})})}qP.displayName=`AlertDialog`;var JP={x1iwu4tg:`x1iwu4tg`,$$css:!0},YP={sm:{kzqmXN:`x1td3qas`,kZKoxP:`x1qx5ct2`,$$css:!0},md:{kzqmXN:`x100vrsf`,kZKoxP:`xxk0z11`,$$css:!0}},XP={sm:{kzqmXN:`x1td3qas`,kZKoxP:`x1qx5ct2`,$$css:!0},md:{kzqmXN:`x100vrsf`,kZKoxP:`xxk0z11`,$$css:!0}},ZP={sm:{kzqmXN:`x1td3qas`,kZKoxP:`x1qx5ct2`,kmVPX3:`x1i3ajwb`,$$css:!0},md:{kzqmXN:`x100vrsf`,kZKoxP:`xxk0z11`,kmVPX3:`xfawy5m`,$$css:!0}},QP={sm:{kzqmXN:`x6jxa94`,kZKoxP:`x1v9usgg`,k3aq6I:`xbryuvx`,$$css:!0},md:{kzqmXN:`x1kky2od`,kZKoxP:`xlup9mm`,k3aq6I:`xbryuvx`,$$css:!0}},$P={sm:{kzqmXN:`x1kky2od`,kZKoxP:`xlup9mm`,k3aq6I:`xv5t66b xi9aj42`,$$css:!0},md:{kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,k3aq6I:`x15481yp x12xz5k6`,$$css:!0}},eF={sm:{kAzted:`xisnujt`,$$css:!0},md:{kAzted:`xjwf9q1`,$$css:!0}},tF={container:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x1txdalj`,$$css:!0},containerLabelHidden:{kOIVth:`xxhr3t`,$$css:!0},containerSpread:{kjj79g:`x1qughib`,kzqmXN:`xh8yej3`,$$css:!0},statusGap:{keoZOQ:`xtbrsbv`,$$css:!0},switchWrapper:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kmuXW:`x2lah0s`,kHBbk8:`xc8icb0`,$$css:!0},input:{kVAEAm:`x10l6tqk`,kogj98:`x1ghz6dp`,kmVPX3:`x1717udv`,kSiTet:`xg01cxk`,kkrTdU:`x1ypdohk x16khyan`,kY2c9j:`x1vjfegm`,k7Eaqz:`xkagaj0`,kAzted:`x80b3aj`,k87sOh:`xijlfn0`,kLqNvP:`x1hsn8va`,k3aq6I:`x8i4i9p`,$$css:!0},inputDisabled:{kkrTdU:`xt0e3qv`,$$css:!0},inputBusy:{kfzvcC:`x47corl`,$$css:!0},track:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kaIpWk:`xjspbzw`,k1ekBW:`x15406qy`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kB7OPa:`x9f619`,kMzoRj:`xc342km x13rsnn2`,ksu8eU:`xng3xce xx61lck`,kVAM5u:`x1w1tqly`,$$css:!0},trackFocus:{kI3sdo:`x1a2a7pz xafswnp`,kInvED:`xwz5zln`,$$css:!0},trackOff:{kWkggS:`xspzpui x1a8ae7b x9yvj25`,$$css:!0},trackOn:{kWkggS:`x1ewilqj xcgwt1n x1jzqe4`,$$css:!0},trackDisabled:{kSiTet:`xbyyjgo`,kVAM5u:`xmnqt3w`,$$css:!0},trackDisabledOff:{kWkggS:`xspzpui`,$$css:!0},thumb:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kaIpWk:`xjspbzw`,k1ekBW:`xh3q6i0`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},thumbOff:{kWkggS:`x10xzikg xwvh9j7`,$$css:!0},thumbOn:{kWkggS:`x10xzikg x1sir5s4`,$$css:!0},labelWrapper:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,kjj79g:`xl56j7k`,$$css:!0}},nF={width:e=>[{kzqmXN:e==null?e:`x5lhr3w`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(e)}]};function rF({label:e,isLabelHidden:t=!1,description:n,onChange:r,changeAction:i,isLoading:a=!1,value:o,isDisabled:s=!1,htmlName:c,disabledMessage:l,isOptional:u=!1,isRequired:d=!1,onFocus:f,onBlur:p,labelIcon:m,labelTooltip:h,labelPosition:g=`end`,labelSpacing:v=`hug`,status:y,size:b=`md`,width:x,xstyle:S,className:C,style:w,ref:T,...E}){let D=(0,_.useId)(),O=(0,_.useId)(),k=(0,_.useId)(),A=qM({isRequired:d,isOptional:u}),[,j]=(0,_.useTransition)(),[M,N]=(0,_.useOptimistic)(o),P=a||M!==o,F=M===!0,I=s&&!!l,L=po({placement:`above`,focusTrigger:`always`,isEnabled:I}),R=[];n&&R.push(O),y?.message&&R.push(k),I&&R.push(L.describedBy);let ee=R.length>0?R.join(` `):void 0,z=(0,K.jsxs)(`div`,{...Sr(tF.switchWrapper,YP[b]),children:[(0,K.jsx)(`input`,{ref:Ao(T,L.positionRef),id:D,type:`checkbox`,role:`switch`,name:s?void 0:c,checked:F,disabled:s&&!I,"aria-disabled":I?`true`:void 0,form:I?``:void 0,required:d,"aria-required":A?`true`:void 0,onChange:e=>{if(s||P)return;let t=e.target.checked;r?.(t,e),i&&!e.defaultPrevented&&j(async()=>{N(t),await i(t,e)})},onFocus:f,onBlur:p,"aria-describedby":ee,"aria-invalid":y?.type===`error`||void 0,"aria-busy":P||void 0,...Sr(tF.input,XP[b],s&&tF.inputDisabled,P&&tF.inputBusy)}),(0,K.jsx)(`div`,{"aria-hidden":`true`,...oa(ba(`switch`,{checked:F?`checked`:null,disabled:s?`disabled`:null,size:b}),Sr(tF.track,ZP[b],F?tF.trackOn:tF.trackOff,!s&&tF.trackFocus,s&&tF.trackDisabled,s&&!F&&tF.trackDisabledOff)),children:(0,K.jsx)(`div`,{...oa(ba(`switch-thumb`,{checked:F?`checked`:null,size:b}),Sr(tF.thumb,F?$P[b]:QP[b],F?tF.thumbOn:tF.thumbOff)),children:P&&(0,K.jsx)($o,{size:`sm`})})}),P&&(0,K.jsx)(es,{role:`status`,children:`Loading`})]}),B=(0,K.jsx)(`div`,{...Sr(tF.labelWrapper,eF[b]),children:(0,K.jsx)(AM,{...ba(`switch-label`),label:e,inputID:D,isLabelHidden:t,isDisabled:s,isOptional:u,isRequired:d,labelIcon:m,labelTooltip:h,description:n,descriptionID:O})});return(0,K.jsxs)(`div`,{...oa(ba(`switch-field`,{labelPosition:g===`end`?void 0:g,labelSpacing:v===`hug`?void 0:v}),Sr(x!=null&&nF.width(x),S),C,w),...E,children:[(0,K.jsxs)(`div`,{ref:e=>{L.interactionRef(e)},...Sr(tF.container,t&&tF.containerLabelHidden,v===`spread`&&tF.containerSpread,!s&&JP),children:[` `,g===`start`?(0,K.jsxs)(K.Fragment,{children:[B,z]}):(0,K.jsxs)(K.Fragment,{children:[z,B]})]}),y?.message&&(0,K.jsx)(PM,{type:y.type,message:y.message,id:k,variant:`detached`,xstyle:tF.statusGap}),I&&L.renderTooltip(l)]})}rF.displayName=`Switch`;var iF=[`chrome`,`edge`,`brave`,`chromium`,`safari`,`firefox`],aF=[`embedded`,...iF],oF=e=>iF.some(t=>t===e);function sF(){let[e,t]=(0,_.useState)(),n=(0,_.useRef)(void 0),r=(0,_.useRef)(!1),i=(0,_.useRef)(!0),a=(0,_.useRef)(void 0),o=(0,_.useCallback)(()=>{a.current?.(),a.current=void 0,n.current?.close(),n.current=void 0,i.current&&t(void 0)},[]);return(0,_.useEffect)(()=>(i.current=!0,window.addEventListener(`pagehide`,o),()=>{i.current=!1,window.removeEventListener(`pagehide`,o),o()}),[o]),{container:e,open:async()=>{if(n.current&&!n.current.closed)return n.current.focus(),!0;if(r.current)return!1;r.current=!0;try{let e=window.documentPictureInPicture,r=e?await e.requestWindow({width:460,height:740}):window.open(`about:blank`,`_blank`,`popup,width=460,height=740`);if(!r)return!1;if(!i.current)return r.close(),!1;n.current=r,r.document.title=`OpenPI Browser Bridge`;let o=()=>{r.document.documentElement.lang=document.documentElement.lang,r.document.documentElement.dataset.theme=document.documentElement.dataset.theme,r.document.documentElement.style.cssText=document.documentElement.style.cssText};o(),r.document.documentElement.classList.add(`browser-guide-window`);for(let e of document.styleSheets)try{let t=r.document.createElement(`style`);t.textContent=[...e.cssRules].map(e=>e.cssText).join(` +`),r.document.head.append(t)}catch{if(!e.href)continue;let t=r.document.createElement(`link`);t.rel=`stylesheet`,t.href=e.href,r.document.head.append(t)}let s=r.document.createElement(`main`);s.className=`browser-settings browser-settings-detached`,r.document.body.append(s);let c=new MutationObserver(o);c.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`,`style`,`lang`]});let l=()=>{c.disconnect(),n.current===r&&(n.current=void 0,a.current=void 0,i.current&&t(void 0))};return r.addEventListener(`pagehide`,l,{once:!0}),a.current=()=>{c.disconnect(),r.removeEventListener(`pagehide`,l)},t(s),!0}catch{return o(),!1}finally{r.current=!1}},close:o,isOpen:()=>!!(n.current&&!n.current.closed)}}var cF={chrome:`Chrome`,edge:`Microsoft Edge`,brave:`Brave`,chromium:`Chromium`,safari:`Safari`,firefox:`Firefox`};function lF({browser:e}){return(0,K.jsx)(`span`,{className:`browser-settings-mark ${e}`,"aria-hidden":`true`,children:e===`chrome`||e===`chromium`?(0,K.jsx)(`i`,{}):(0,K.jsx)(me,{})})}function uF({onConfigure:e,setupPending:t=!1}){let{t:n}=cr(),r=sF(),i=(0,_.useRef)(r.isOpen);i.current=r.isOpen;let[a,o]=(0,_.useState)(),[s,c]=(0,_.useState)(),[l,u]=(0,_.useState)(!1),d=l||t,[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(),[g,v]=(0,_.useState)(`chrome`),[y,b]=(0,_.useState)(1),[x,S]=(0,_.useState)(!1),[C,w]=(0,_.useState)(),D=(0,_.useRef)(0),O=(0,_.useRef)(null),k=(0,_.useRef)(null),A=(0,_.useRef)(!0);(0,_.useEffect)(()=>{m&&(O.current?.scrollIntoView?.({block:`nearest`}),k.current?.focus({preventScroll:!0}))},[m,y,r.container]);let j=(0,_.useCallback)(async()=>{let e=++D.current;try{let t=await new lf().request(`/api/settings/browser`);return A.current&&e===D.current&&(o(t),c(void 0)),t}catch(t){A.current&&e===D.current&&c(t instanceof Error?t.message:String(t));return}},[]);(0,_.useEffect)(()=>{A.current=!0,j();let e=setInterval(()=>{(document.visibilityState===`visible`||i.current())&&j()},3e3),t=()=>void j();return window.addEventListener(`focus`,t),()=>{A.current=!1,clearInterval(e),window.removeEventListener(`focus`,t)}},[j]);let M=async t=>{u(!0),c(void 0),w(void 0),++D.current;try{let r=await e(`Configure browser access: ${[t.control===void 0?void 0:`browser_control=${t.control}`,t.embedded===void 0?void 0:`browser_embedded=${t.embedded}`,t.defaultBrowser===void 0?void 0:`browser_default=${JSON.stringify(t.defaultBrowser)}`,t.externalBrowsers===void 0?void 0:`browser_external=${JSON.stringify(t.externalBrowsers)}`].filter(e=>e!==void 0).join(`, `)}. Preserve all other settings.`);if(!A.current)return;if(!r)throw Error(n(`setupRequestFailed`));w(n(`setupRequestAccepted`))}catch(e){await j(),A.current&&c(e instanceof Error?e.message:String(e))}finally{A.current&&u(!1)}},N=async(e,t)=>{u(!0),c(void 0),w(void 0);try{if(await new lf().request(`/api/settings/browser/action`,{method:`POST`,body:JSON.stringify({browser:e,action:t})}),A.current)return t===`folder`&&w(n(`browserFolderOpened`)),!0}catch(e){A.current&&c(e instanceof Error?e.message:String(e))}finally{A.current&&u(!1)}return!1},P=e=>e===`embedded`?n(`browserEmbedded`):cF[e];if(!a)return(0,K.jsxs)(`div`,{className:`browser-settings-load`,role:s?`alert`:`status`,children:[(0,K.jsx)(me,{}),(0,K.jsx)(`p`,{children:s||n(`browserLoading`)}),s&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>void j(),children:n(`browserCheck`)})]});let{config:F}=a,R=a.profiles.find(e=>e.current&&e.connected&&e.version===a.extensionVersion),z=e=>a.profiles.filter(t=>t.connected&&t.version===a.extensionVersion&&(e===`embedded`?t.current&&![`safari`,`firefox`].includes(t.browser):t.browser===e)),B=e=>e===`embedded`?F.embedded:F.externalBrowsers.includes(e),V=(e,t)=>e===`embedded`?{embedded:t}:{externalBrowsers:t?[...new Set([...F.externalBrowsers,e])]:F.externalBrowsers.filter(t=>t!==e)},H=e=>{h(e),b(1),w(void 0),S(!1),v(e===`embedded`?R&&![`safari`,`firefox`].includes(R.browser)?R.browser:`chrome`:e)},ne=e=>{let t=z(e).length>0,r=e===`embedded`||a.browsers.some(t=>t.id===e&&t.installed),i=a.profiles.some(t=>t.connected&&t.version!==a.extensionVersion&&(e===`embedded`?t.current&&![`safari`,`firefox`].includes(t.browser):t.browser===e));return(0,K.jsxs)(`div`,{className:`browser-settings-row`,children:[(0,K.jsx)(lF,{browser:e}),(0,K.jsxs)(`div`,{className:`browser-settings-description`,children:[(0,K.jsx)(`strong`,{children:P(e)}),(0,K.jsx)(`span`,{className:t?`connected`:``,children:t?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`i`,{}),n(`browserConnected`)]}):n(i?`browserUpdateNeeded`:r?`browserNeedsSetup`:`browserNotFound`)})]}),(0,K.jsx)(`button`,{className:`browser-settings-button`,type:`button`,disabled:l,"aria-label":n(t?`browserManageNamed`:`browserSetupNamed`,{browser:P(e)}),onClick:()=>H(e),children:n(t?`browserManage`:`browserSetUp`)}),(0,K.jsx)(rF,{label:n(`browserAllowNamed`,{browser:P(e)}),isLabelHidden:!0,size:`sm`,value:B(e),isDisabled:d,onChange:t=>void M(V(e,t))})]},e)},re=m!==void 0&&z(m).length>0,ie=a.browsers.some(e=>e.id===g&&e.installed),ae=g===`safari`||g===`firefox`,U=ae?a.portableExtensionPath??a.extensionPath:a.extensionPath,oe=g===`firefox`?`${U.replace(/[\\/]+$/,``)}/manifest.json`:U,se=g===`safari`?n(`browserSafariSettings`):g===`firefox`?`about:debugging#/runtime/this-firefox`:`${g===`edge`?`edge`:g===`brave`?`brave`:`chrome`}://extensions/`,ce=n(g===`safari`?`browserSafariDeveloper`:g===`firefox`?`browserFirefoxThis`:`browserDeveloperMode`),le=n(g===`safari`?`browserSafariTemporary`:g===`firefox`?`browserFirefoxTemporary`:`browserLoadUnpacked`),de=[n(`browserStepOpen`),ce,n(`browserStepAdd`),n(`browserStepConnect`)];return(0,K.jsxs)(`div`,{className:`browser-settings`,children:[(0,K.jsxs)(`header`,{className:`browser-settings-heading`,children:[(0,K.jsx)(`h2`,{children:n(`browserSettings`)}),(0,K.jsx)(`p`,{children:n(`browserSettingsIntro`)})]}),(0,K.jsxs)(`div`,{className:`browser-settings-card browser-settings-main-card`,children:[(0,K.jsxs)(`div`,{className:`browser-settings-control`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:n(`browserControl`)}),(0,K.jsx)(`p`,{children:n(`browserControlHint`)})]}),(0,K.jsx)(rF,{label:n(`browserControl`),isLabelHidden:!0,size:`sm`,value:F.control,isDisabled:d,onChange:e=>void M({control:e})})]}),(0,K.jsxs)(`div`,{className:`browser-settings-default`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{htmlFor:`browser-default`,children:n(`browserDefault`)}),(0,K.jsx)(`p`,{children:n(`browserDefaultHint`)})]}),(0,K.jsx)(`select`,{id:`browser-default`,value:F.defaultBrowser,disabled:d,onChange:e=>void M({defaultBrowser:e.target.value}),children:aF.map(e=>(0,K.jsxs)(`option`,{value:e,disabled:!B(e),children:[P(e),B(e)?``:` · ${n(`browserBlocked`)}`]},e))})]})]}),!B(F.defaultBrowser)&&(0,K.jsx)(`p`,{className:`browser-settings-warning`,role:`status`,children:n(`browserDefaultBlocked`)}),(0,K.jsxs)(`div`,{className:`browser-settings-section-heading`,children:[(0,K.jsx)(`h3`,{children:n(`browserAllowedTitle`)}),(0,K.jsx)(`span`,{children:!F.control&&n(`browserOffHint`)})]}),(0,K.jsxs)(`div`,{className:`browser-settings-card`,children:[ne(`embedded`),ne(`chrome`),(0,K.jsxs)(`details`,{className:`browser-settings-more`,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(ee,{}),n(`browserMore`)]}),iF.filter(e=>e!==`chrome`).map(ne)]})]}),(0,K.jsx)(`p`,{className:`browser-settings-example`,children:n(`browserSpeakHint`)}),r.container&&(0,K.jsxs)(`div`,{className:`browser-settings-guide-placeholder`,role:`status`,children:[(0,K.jsx)(`p`,{children:n(`browserGuideDetached`)}),(0,K.jsx)(`button`,{type:`button`,className:`browser-settings-button`,onClick:()=>void r.open(),children:n(`browserShowGuide`)}),(0,K.jsx)(`button`,{type:`button`,className:`browser-settings-text-button`,onClick:r.close,children:n(`browserGuideInline`)})]}),m!==void 0&&(e=>r.container?(0,Rt.createPortal)(e,r.container):e)((0,K.jsxs)(`section`,{ref:O,className:`browser-settings-guide`,"aria-label":n(`browserGuideTitle`,{browser:P(m)}),children:[(0,K.jsxs)(`div`,{className:`browser-settings-guide-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{children:n(re?`browserConnectionTitle`:`browserGuideEyebrow`)}),(0,K.jsx)(`h3`,{children:n(`browserGuideTitle`,{browser:P(m)})})]}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,disabled:l,"aria-label":n(`browserCloseGuide`),onClick:()=>{r.close(),h(void 0)},children:(0,K.jsx)(Lt,{})})]}),!r.container&&!re&&(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-text-button`,onClick:async()=>{await r.open()||w(n(`browserGuideBlocked`))},children:[(0,K.jsx)(he,{}),n(`browserGuidePopout`)]}),re?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`p`,{className:`browser-settings-ready`,children:[(0,K.jsx)(te,{}),n(`browserConnectionReady`)]}),(0,K.jsx)(`p`,{children:m===`embedded`?n(`browserEmbeddedDetail`):n(`browserExternalDetail`,{browser:P(m)})}),(0,K.jsxs)(`div`,{className:`browser-settings-guide-actions`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-button`,disabled:l,onClick:()=>void N(m===`embedded`?R.browser:m,`manage`),children:[n(`browserManageExtension`),(0,K.jsx)(he,{})]}),(!B(m)||!F.control)&&(0,K.jsx)(`button`,{type:`button`,className:`browser-settings-primary`,disabled:d,onClick:()=>void M({control:!0,...V(m,!0)}),children:n(`browserAllowUse`)}),B(m)&&F.defaultBrowser!==m&&(0,K.jsx)(`button`,{type:`button`,className:`browser-settings-button`,disabled:d,onClick:()=>void M({defaultBrowser:m}),children:n(`browserMakeDefault`)})]})]}):(0,K.jsxs)(K.Fragment,{children:[m===`embedded`&&(0,K.jsxs)(`label`,{className:`browser-settings-install-browser`,children:[n(`browserInstallIn`),(0,K.jsx)(`select`,{value:g,disabled:l,onChange:e=>{v(e.target.value),b(1),S(!1),w(void 0)},children:iF.filter(e=>![`safari`,`firefox`].includes(e)).map(e=>(0,K.jsx)(`option`,{value:e,children:cF[e]},e))})]}),(0,K.jsx)(`ol`,{className:`browser-settings-progress`,"aria-label":n(`browserSetupSteps`),children:de.map((e,t)=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,"aria-current":y===t+1?`step`:void 0,"aria-label":n(`browserStepLabel`,{step:t+1,label:e}),disabled:l,onClick:()=>{b(t+1),w(void 0)},children:[(0,K.jsx)(`span`,{children:t+1}),e]})},e))}),(0,K.jsxs)(`div`,{className:`browser-settings-wizard`,"aria-live":`polite`,children:[(0,K.jsx)(`span`,{className:`browser-settings-step-count`,children:n(`browserStepCount`,{step:y,total:de.length})}),(0,K.jsx)(`h4`,{ref:k,tabIndex:-1,children:n(y===1?`browserOpenManagerTitle`:y===2?g===`safari`?`browserSafariDeveloperTitle`:g===`firefox`?`browserFirefoxDeveloperTitle`:`browserDeveloperTitle`:y===3?`browserInstallTitle`:`browserConnectTitle`,{browser:cF[g]})}),(0,K.jsx)(`p`,{children:n(y===1?g===`safari`?`browserSafariOpenHint`:`browserOpenManagerHint`:y===2?g===`safari`?`browserSafariDeveloperHint`:g===`firefox`?`browserFirefoxDeveloperHint`:`browserDeveloperHint`:y===3?g===`safari`?`browserSafariLoadHint`:g===`firefox`?`browserFirefoxLoadHint`:`browserLoadHint`:`browserConnectHint`,{browser:cF[g]})}),y===1&&(0,K.jsxs)(`div`,{className:`browser-settings-address`,children:[(0,K.jsx)(lF,{browser:g}),(0,K.jsx)(`code`,{children:se})]}),(y===2||y===3)&&(0,K.jsxs)(`figure`,{className:`browser-settings-illustration ${g}`,children:[(0,K.jsx)(`figcaption`,{children:n(`browserIllustration`,{browser:cF[g]})}),(0,K.jsxs)(`div`,{className:`browser-settings-demo`,"aria-hidden":`true`,children:[(0,K.jsxs)(`div`,{className:`browser-settings-demo-bar`,children:[(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`code`,{children:se})]}),(0,K.jsxs)(`div`,{className:`browser-settings-demo-heading`,children:[(0,K.jsx)(`span`,{children:n(`browserExtensions`)}),(0,K.jsxs)(`span`,{className:`browser-settings-demo-toggle ${y===2?`highlight`:``}`,children:[y===2&&(0,K.jsx)(`b`,{className:`browser-settings-target-number`,children:`2`}),ce,g!==`firefox`&&(0,K.jsx)(`i`,{})]})]}),(0,K.jsxs)(`div`,{className:`browser-settings-demo-toolbar`,children:[(0,K.jsxs)(`span`,{className:y===3?`highlight`:``,children:[y===3&&(0,K.jsx)(`b`,{className:`browser-settings-target-number`,children:`3`}),le]}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{})]})]})]}),y===3&&(0,K.jsxs)(`div`,{className:`browser-settings-folder`,children:[(0,K.jsxs)(`div`,{className:`browser-settings-folder-heading`,children:[(0,K.jsx)(G,{}),(0,K.jsx)(`strong`,{children:ae?`browser-extension-portable`:`browser-extension`}),(0,K.jsx)(`span`,{children:n(`browserFolderBundled`)})]}),(0,K.jsx)(`div`,{className:`browser-settings-path`,children:(0,K.jsx)(`code`,{children:oe})}),(0,K.jsxs)(`div`,{className:`browser-settings-guide-actions`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-button`,onClick:async e=>{let t=await wd(oe,e.currentTarget.ownerDocument);S(t),t||w(n(`browserCopyFailed`))},children:[x?(0,K.jsx)(I,{}):(0,K.jsx)(ue,{}),n(x?`browserPathCopied`:`browserCopyPath`)]}),(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-button`,disabled:l,onClick:()=>void N(g,`folder`),children:[(0,K.jsx)(G,{}),n(`browserOpenFolder`)]})]}),(0,K.jsx)(`p`,{children:n(navigator.userAgent.includes(`Mac`)?`browserChooseFolderMac`:`browserChooseFolderOther`)})]}),y===4&&(0,K.jsxs)(`div`,{className:`browser-settings-waiting`,role:`status`,children:[(0,K.jsx)(dt,{}),(0,K.jsx)(`span`,{children:n(`browserWaiting`)})]}),!ie&&(0,K.jsx)(`p`,{className:`browser-settings-warning`,children:n(`browserInstallBrowserFirst`,{browser:cF[g]})}),(0,K.jsxs)(`div`,{className:`browser-settings-wizard-actions`,children:[y>1&&(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-button`,disabled:l,onClick:()=>{b(y-1),w(void 0)},children:[(0,K.jsx)(T,{}),n(`browserPreviousStep`)]}),y===1&&(0,K.jsx)(`button`,{type:`button`,className:`browser-settings-text-button`,disabled:l,onClick:()=>b(4),children:n(`browserAlreadyInstalled`)}),y<4?(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-primary`,disabled:l||!ie,onClick:async()=>{y===1&&!r.isOpen()&&(await r.open()||w(n(`browserGuideBlocked`))),(y===2||await N(g,y===1?`manage`:`connect`))&&b(y+1)},children:[n(y===1?`browserOpenManager`:y===2?g===`firefox`?`browserFirefoxDone`:`browserDeveloperDone`:`browserInstalledConnect`,{browser:cF[g]}),y===2?(0,K.jsx)(E,{}):(0,K.jsx)(he,{})]}):(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-primary`,disabled:l||f,onClick:async()=>{p(!0);let e=await j();if(A.current){p(!1);let t=e?.profiles.some(t=>t.connected&&t.version===e.extensionVersion&&(m===`embedded`?t.current&&![`safari`,`firefox`].includes(t.browser):t.browser===m));w(n(t?`browserConnectionReady`:`browserNotConnectedYet`))}},children:[(0,K.jsx)(dt,{className:f?`settings-spin`:``}),n(`browserCheck`)]})]}),y===4?(0,K.jsxs)(`div`,{className:`browser-settings-connect-help`,children:[(0,K.jsx)(`p`,{children:n(`browserAllowHint`)}),(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-text-button`,disabled:l||!ie,onClick:()=>void N(g,`connect`),children:[n(`browserOpenIn`,{browser:cF[g]}),(0,K.jsx)(he,{})]})]}):y>1&&(0,K.jsxs)(`button`,{type:`button`,className:`browser-settings-text-button`,disabled:l||!ie,onClick:()=>void N(g,`manage`),children:[n(`browserReopenManager`),(0,K.jsx)(he,{})]})]})]}),(0,K.jsxs)(`details`,{className:`browser-settings-help`,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(L,{}),n(`browserHelp`)]}),(0,K.jsx)(`p`,{children:n(`browserReloadHint`)}),(0,K.jsx)(`p`,{children:n(`browserSupportedHint`)})]}),s&&(0,K.jsx)(`div`,{className:`browser-settings-error`,role:`alert`,children:s}),(0,K.jsx)(`div`,{className:`browser-settings-feedback`,role:`status`,"aria-live":`polite`,children:l?n(`browserSaving`):C})]})),!m&&s&&(0,K.jsxs)(`div`,{className:`browser-settings-error`,role:`alert`,children:[s,(0,K.jsx)(`button`,{type:`button`,onClick:()=>void j(),children:n(`browserCheck`)})]}),(0,K.jsx)(`div`,{className:`browser-settings-feedback`,role:`status`,"aria-live":`polite`,children:!m&&(l?n(`browserSaving`):C)})]})}function dF({label:e,value:t,options:n,disabled:r,onChange:i}){return(0,K.jsx)(IA,{button:{label:n.find(e=>e.value===t)?.label??t,"aria-label":e,variant:`secondary`,size:`sm`,className:`configuration-menu-trigger`,isDisabled:r},className:`configuration-menu`,menuWidth:`min(360px, calc(100vw - 32px))`,alignment:`end`,items:n.map(e=>({id:e.value,label:e.label,isDisabled:r,description:e.description?(0,K.jsx)(`span`,{className:`configuration-option-description`,children:e.description}):void 0,endContent:t===e.value?(0,K.jsx)(I,{"aria-hidden":`true`}):void 0,onClick:()=>{e.value!==t&&i(e.value)}}))})}function fF({catalog:e,error:t,pending:n,preferencePending:r,onConfigure:i,onUpdatePreferences:a,onRefresh:o,onOpenRuntimeStatus:s}){let{t:c}=cr(),l=e?.setupWritable===!1||!!e?.resources.diagnostics.settingsErrors,u=n||r||!!t||!!e?.resources.diagnostics.settingsErrors,d=e?.setup.ui.webHiddenThinkingLevels??[],f=(e?.thinking?.available??[]).filter(e=>[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`].includes(e)),p=e?.setup.response?.verbosity??`default`,m=e?.setup.response?.reasoningSummary??`default`;return(0,K.jsxs)(`section`,{className:`settings-configuration-panel`,children:[(0,K.jsxs)(`header`,{className:`settings-page-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{children:c(`configurationSettings`)}),(0,K.jsx)(`p`,{children:c(`configurationIntro`)})]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":c(`refreshStatus`),onClick:o,children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]}),t&&(0,K.jsx)(`p`,{className:`inspection-warning`,role:`alert`,children:t}),!e&&!t&&(0,K.jsx)(`p`,{role:`status`,children:c(`settingsCatalogLoading`)}),l&&(0,K.jsxs)(`p`,{className:`inspection-warning`,role:`alert`,children:[c(`configurationReadFailure`),e?.setupDiagnostics?.map(e=>(0,K.jsxs)(`span`,{children:[e.path,`: `,e.message]},`${e.path}:${e.message}`))]}),e&&!l&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`configuration-scope`,children:[(0,K.jsxs)(`span`,{className:`configuration-scope-label`,children:[(0,K.jsx)(Nt,{"aria-hidden":`true`}),c(`configurationUserScope`)]}),(0,K.jsx)(`span`,{children:c(`configurationSetupHint`)})]}),(0,K.jsxs)(`div`,{className:`configuration-group`,children:[(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`configurationApproval`)}),(0,K.jsx)(`p`,{children:c(`configurationApprovalDetail`)})]}),(0,K.jsx)(`span`,{className:`configuration-readonly`,children:c(`configurationPiPermissions`)})]}),(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`configurationSandbox`)}),(0,K.jsx)(`p`,{children:c(`configurationSandboxDetail`)})]}),(0,K.jsx)(`span`,{className:`configuration-readonly`,children:c(`configurationSandboxUnavailable`)})]}),(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`webSearchSettings`)}),(0,K.jsx)(`p`,{children:c(`configurationSearchDetail`)}),e.webSearch?.available!==!0&&(0,K.jsx)(`p`,{children:c(`webSearchUnsupported`)})]}),(0,K.jsx)(`div`,{className:`configuration-control`,children:(0,K.jsx)(dF,{label:c(`webSearchSettings`),value:e.setup.webSearch?.enabled===!0?`on`:`off`,options:[{value:`off`,label:c(`disabled`),description:c(`configurationSearchOff`)},{value:`on`,label:c(`enabled`),description:c(`configurationSearchOn`)}],disabled:u,onChange:e=>{i(c(e===`on`?`webSearchNativeRequest`:`webSearchDisableRequest`))}})})]}),(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`configurationVerbosity`)}),(0,K.jsx)(`p`,{children:c(`configurationVerbosityDetail`)}),e.responseSupport?.verbosity!==!0&&(0,K.jsx)(`p`,{children:c(`configurationResponsesUnavailable`)})]}),(0,K.jsx)(`div`,{className:`configuration-control`,children:(0,K.jsx)(dF,{label:c(`configurationVerbosity`),value:p,options:[`default`,`low`,`medium`,`high`].map(e=>({value:e,label:c(`configurationVerbosity_${e}`),description:e==="default"?void 0:c(`configurationVerbosityHelp_${e}`)})),disabled:u||e.responseSupport?.verbosity!==!0,onChange:e=>{i(c(`configurationVerbosityRequest`,{value:e}))}})})]}),(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`configurationSummary`)}),(0,K.jsx)(`p`,{children:c(`configurationSummaryDetail`)}),e.responseSupport?.reasoningSummary!==!0&&(0,K.jsx)(`p`,{children:c(`configurationSummaryUnavailable`)})]}),(0,K.jsx)(`div`,{className:`configuration-control`,children:(0,K.jsx)(dF,{label:c(`configurationSummary`),value:m,options:[`default`,`auto`,`concise`,`detailed`,`none`].map(e=>({value:e,label:c(`configurationSummary_${e}`),description:e==="default"?void 0:c(`configurationSummaryHelp_${e}`)})),disabled:u||e.responseSupport?.reasoningSummary!==!0,onChange:e=>{i(c(`configurationSummaryRequest`,{value:e}))}})})]})]}),(0,K.jsxs)(`section`,{className:`configuration-section`,children:[(0,K.jsx)(`h2`,{children:c(`configurationModelFeatures`)}),(0,K.jsx)(`div`,{className:`configuration-group`,children:(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`configurationReasoningLevels`)}),(0,K.jsx)(`p`,{children:c(`configurationReasoningDetail`)})]}),(0,K.jsx)(`div`,{className:`configuration-control`,children:(0,K.jsx)(IA,{button:{label:c(`configurationReasoningCount`,{count:f.filter(e=>!d.includes(e)).length}),"aria-label":c(`configurationReasoningLevels`),variant:`secondary`,size:`sm`,className:`configuration-menu-trigger`,isDisabled:u||f.length===0},className:`configuration-level-menu`,menuWidth:`min(240px, calc(100vw - 32px))`,alignment:`end`,children:f.map(e=>(0,K.jsx)(tj,{label:e,value:!d.includes(e),isDisabled:u,endContent:(0,K.jsx)(`span`,{className:`configuration-check`,children:!d.includes(e)&&(0,K.jsx)(I,{"aria-hidden":`true`})}),onChange:t=>{a({thinkingLevelVisibility:{level:e,visible:t}})}},e))})})]})})]}),(0,K.jsxs)(`section`,{className:`configuration-section`,children:[(0,K.jsx)(`h2`,{children:c(`configurationDependencies`)}),(0,K.jsx)(`div`,{className:`configuration-group`,children:(0,K.jsxs)(`div`,{className:`configuration-row`,children:[(0,K.jsxs)(`div`,{className:`configuration-copy`,children:[(0,K.jsx)(`strong`,{children:c(`configurationEnvironment`)}),(0,K.jsx)(`p`,{children:c(`configurationEnvironmentDetail`)})]}),(0,K.jsxs)(`button`,{type:`button`,className:`configuration-runtime-button`,onClick:s,children:[c(`configurationRuntimeStatus`),(0,K.jsx)(O,{"aria-hidden":`true`})]})]})})]})]})]})}function pF({catalog:e,error:t,pending:n,onConfigure:r,onRefresh:i}){let{t:a}=cr(),o=e?.setup.webSearch?.enabled===!0,s=e?.webSearch?.available===!0,c=n||!e||!!t||!!e?.resources.diagnostics.settingsErrors;return(0,K.jsxs)(`section`,{className:`settings-general-panel settings-web-search-panel`,children:[(0,K.jsxs)(`header`,{className:`settings-page-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{children:a(`webSearchSettings`)}),(0,K.jsx)(`p`,{children:a(`webSearchIntro`)})]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":a(`refreshStatus`),onClick:i,children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]}),t&&(0,K.jsx)(`p`,{className:`inspection-warning`,role:`alert`,children:t}),!e&&!t&&(0,K.jsx)(`p`,{role:`status`,children:a(`settingsCatalogLoading`)}),(0,K.jsxs)(`section`,{className:`settings-section-block`,children:[(0,K.jsxs)(`div`,{className:`settings-detail-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`h2`,{children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),a(`webSearchCurrentModel`)]}),(0,K.jsx)(`p`,{children:a(`webSearchNativeDetail`)})]}),(0,K.jsx)(`span`,{className:`settings-status-badge`,children:a(o?`enabled`:`disabled`)})]}),(0,K.jsxs)(`dl`,{className:`settings-detail-metadata`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:a(`source`)}),(0,K.jsx)(`dd`,{children:a(`webSearchCurrentModel`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:a(`model`)}),(0,K.jsx)(`dd`,{children:e?.webSearch?.model?`${e.webSearch.provider} / ${e.webSearch.model}`:a(`unavailable`)})]})]}),(0,K.jsx)(`p`,{className:`settings-resource-caption`,children:a(`webSearchDefaultOff`)}),(0,K.jsx)(`p`,{role:`status`,className:`settings-resource-caption`,children:a(s?`webSearchSupported`:`webSearchUnsupported`)})]}),(0,K.jsx)(`section`,{className:`settings-section-block settings-chat-controls`,children:(0,K.jsx)(qc,{label:a(o?`webSearchDisable`:`webSearchEnable`),variant:`secondary`,size:`sm`,isDisabled:c,isLoading:n,onClick:()=>void r(a(o?`webSearchDisableRequest`:`webSearchNativeRequest`))})})]})}var mF={wrapper:{k8WAf4:`xu0wf1k`,kg3NbH:`x7a5moj`,$$css:!0},icon:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kmuXW:`x2lah0s`,$$css:!0}};function hF({ref:e,label:t,clearLabel:n,placeholder:r,value:i,onValueChange:a,onKeyDown:o,onFocus:s,onBlur:c,onContainerKeyDown:l,xstyle:u,className:d,style:f,...p}){let[m,h]=(0,_.useState)(!1);(0,_.useEffect)(()=>{Zi()},[]);let g=(0,_.useCallback)(e=>{h(Qi()===`keyboard`),s?.(e)},[s]),v=(0,_.useCallback)(e=>{h(!1),c?.(e)},[c]),y=(0,_.useCallback)(()=>{a(``),typeof e==`object`&&e?.current&&e.current.focus()},[a,e]);return(0,K.jsx)(`div`,{onKeyDown:l,...oa(Sr(mF.wrapper,u),d,f),children:(0,K.jsxs)(`div`,{"data-keyboard-focus":m?`true`:void 0,...{0:{className:`x9f619 x78zum5 x6s0dn4 x1txdalj xh8yej3 x1vofgu7 xf314gf xh6dtrn xkdsq27 xuedmi6 x12w9bfk xlr8y92`},1:{className:`x9f619 x78zum5 x6s0dn4 x1txdalj xh8yej3 x1vofgu7 xf314gf xh6dtrn xkdsq27 xuedmi6 x12w9bfk xlr8y92 x1gnnqk1 x1btxeh5`}}[!!m<<0],children:[(0,K.jsx)(xu,{icon:`search`,size:`sm`,color:`secondary`,xstyle:mF.icon}),(0,K.jsx)(`input`,{ref:e,type:`text`,"aria-label":t,placeholder:r,value:i,onChange:e=>a(e.target.value),onKeyDown:o,onFocus:g,onBlur:v,className:`x1iyjqo2 xs83m0k xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w x1tgivj0 x9ynric xcr08ib xdk3u5w x1kq96og x1a2a7pz xeyghm5`,...p}),i!==``&&(0,K.jsx)(WM,{label:n,onClick:y})]})})}hF.displayName=`PanelSearchInput`;function gF(e){return typeof e==`string`||!(`type`in e)}function _F(e){return typeof e==`object`&&`type`in e&&e.type===`divider`}function vF(e){return typeof e==`object`&&`type`in e&&e.type===`section`}function yF(e){return typeof e==`string`?{value:e,label:e}:{...e,label:e.label??e.value}}function bF(e){let t=[];for(let n of e)if(gF(n))t.push(yF(n));else if(vF(n))for(let e of n.options)t.push(yF(e));return t}var xF=1;function SF(e){let t=0,n=e;for(;n;)t+=n.offsetTop,n=n.offsetParent;return t}function CF({isOpen:e,selectedItemIndex:t,listboxId:n,listboxRef:r,anchorRef:i}){let[a,o]=(0,_.useState)(0),[s,c]=(0,_.useState)(!1),l=(0,_.useCallback)((e,t)=>{o(e),c(t)},[]);return wu(()=>{if(!e){l(0,!1);return}if(!r.current||!i.current){l(0,!0);return}let a=`${n}-item-${t>=0?t:0}`,o=document.getElementById(a);if(!o){l(0,!0);return}let s=r.current,c=i.current.getBoundingClientRect(),u=s.offsetHeight;if(u<=0){l(0,!0);return}let d=SF(o)-SF(s)-s.scrollTop+o.offsetHeight/2,f=c.top+c.height/2-d-xF,p=window.innerHeight,m=Math.max(0,p-u),h=Math.min(Math.max(f,0),m),g=Math.max(0,c.bottom-h);l(g,!0)},[e,t,n,r,i,l]),{offset:a,isPositioned:s}}function wF({selectableItems:e,value:t,isDisabled:n=!1,isOpen:r,hasSearch:i=!1,onOpen:a,onClose:o,onSelect:s,onClear:c,onSearchSeed:l,wasJustDismissed:u,listboxId:d}){let[f,p]=(0,_.useState)(-1),m=(0,_.useCallback)(e=>`${d}-item-${e}`,[d]),h=(0,_.useCallback)(()=>e.map((e,t)=>e.disabled?-1:t).filter(e=>e>=0),[e]),g=(0,_.useCallback)(()=>e.findIndex(e=>e.value===t),[e,t]),v=(0,_.useCallback)(()=>{p(-1),o()},[o]),y=(0,_.useCallback)(e=>{e.disabled||(s?.(e.value),v())},[s,v]),b=(0,_.useCallback)(()=>{if(!(n||u?.())){if(r)v();else if(a(),!i){let e=g();p(e>=0?e:0)}}},[n,u,r,a,v,g,i]),x=(0,_.useCallback)((e,t)=>{e.disabled||p(t)},[]);return{highlightedIndex:f,setHighlightedIndex:p,getItemId:m,onTriggerClick:b,onKeyDown:(0,_.useCallback)(o=>{if(n)return;let s=h();switch(o.key){case`ArrowDown`:if(o.preventDefault(),!r)a(),p(0);else{let e=s.indexOf(f),t=Math.min(e+1,s.length-1);p(s[t]??f)}break;case`ArrowUp`:if(o.preventDefault(),!r)a(),p(e.length-1);else{let e=s.indexOf(f),t=Math.max(e-1,0);p(s[t]??f)}break;case` `:if(i)break;case`Enter`:if(o.preventDefault(),r&&f>=0){let t=e[f];t&&!t.disabled&&y(t)}else if(!r&&(a(),!i)){let e=g();p(e>=0?e:0)}break;case`Escape`:r&&(o.preventDefault(),v());break;case`Tab`:r&&v();break;case`Home`:o.preventDefault(),r&&s.length>0&&p(s[0]);break;case`End`:o.preventDefault(),r&&s.length>0&&p(s[s.length-1]);break;case`PageUp`:o.preventDefault(),r&&s.length>0&&p(s[0]);break;case`PageDown`:o.preventDefault(),r&&s.length>0&&p(s[s.length-1]);break;case`Delete`:case`Backspace`:!i&&!r&&c!=null&&t!=null&&(o.preventDefault(),c());break;default:i&&l&&o.key.length===1&&!o.ctrlKey&&!o.metaKey&&(r||a(),l(o.key))}},[n,r,a,v,e,f,y,g,h,i,c,l,t]),onItemSelect:y,onItemMouseEnter:x}}var TF=(0,_.createContext)(`stacked`);TF.displayName=`SelectorRowLayoutContext`;function EF(){return(0,_.use)(TF)}var DF={root:{k8WAf4:`xt970qd`,kg3NbH:`xnjsko4`,kaIpWk:`x2u8bby`,$$css:!0}};function OF({icon:e,label:t,description:n,layout:r,endContent:i,xstyle:a,className:o,style:s}){let c=EF();return(0,K.jsx)(Qk,{startContent:e?Cu(e,{size:`sm`,color:`secondary`}):void 0,label:t,description:n,layout:c===`inline`?`inline`:r,endContent:i,xstyle:[DF.root,a],...oa(ba(`selector-option`),{className:o,style:s})})}OF.displayName=`SelectorOption`;var kF={triggerContainer:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,k8WAf4:`xce4md1`,kg3NbH:`xrrkdod`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib xdk3u5w`,kLWn49:`x7acx1w`,kMwMTN:`x1tgivj0`,kkrTdU:`x1ypdohk x16khyan`,$$css:!0},triggerPlaceholder:{kMwMTN:`xv1l7n4`,$$css:!0},triggerInGroup:{kAzted:`x2lwn1j`,k8WAf4:`xt970qd`,$$css:!0},triggerIcon:{kmuXW:`x2lah0s`,$$css:!0},triggerIconRotation:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6`,kAMwcw:`xlr8y92`,k3nNDw:`x1g0ag68`,$$css:!0},triggerIconOpen:{k3aq6I:`x19jd1h0`,$$css:!0},triggerGhost:{kzqmXN:`x14atkfc`,kMzoRj:`xc342km`,kWkggS:`xjbqb8w`,kGVxlE:`x1gnnqk1 x1s17dad x15ysqaf`,k63SB2:`x1e4wzip`,k1ekBW:`xrafxwg`,k3aq6I:`x3oybdh xk4oym4`,$$css:!0},triggerGhostDisabled:{kKwaWg:`x18o3ruo`,k3aq6I:`x1c071of x1pdlv7q`,$$css:!0},statusButton:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kmVPX3:`x1717udv`,kogj98:`x1ghz6dp`,kMzoRj:`xc342km`,ksu8eU:`xng3xce`,kWkggS:`xjbqb8w`,kMwMTN:`x1heor9g`,kkrTdU:`x1ypdohk x16khyan`,kaIpWk:`xh6dtrn`,$$css:!0},searchRowInput:{kg3NbH:`x2hg6jq`,$$css:!0},popover:{k7Eaqz:`xrzjruh`,$$css:!0},divider:{kqGvvJ:`xsq74q5`,$$css:!0},item:{kB7OPa:`x9f619`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kjj79g:`x1qughib`,kOIVth:`x1txdalj`,kzqmXN:`xh8yej3`,kmVPX3:`xlsj2fj`,kaIpWk:`xh6dtrn`,kMv6JI:`x9ynric`,kGuDYH:`xcr08ib`,kMwMTN:`x1tgivj0`,kWkggS:`xjbqb8w`,kkrTdU:`x1ypdohk x16khyan`,k9WMMc:`x1yc453h`,kI3sdo:`x1a2a7pz`,$$css:!0},itemHighlighted:{kWkggS:`x1lmrjuc`,$$css:!0},itemSelected:{k63SB2:`x1e4wzip`,$$css:!0},itemDisabled:{kSiTet:`xbyyjgo`,kkrTdU:`xt0e3qv`,$$css:!0}},AF={sm:{kAzted:`x1gdqauq`,k8WAf4:`x1ecmfrv`,$$css:!0},md:{kAzted:`x1uogy3y`,k8WAf4:`x1ioay2v`,$$css:!0},lg:{kAzted:`x1xf4nls`,k8WAf4:`x1vn5h1t`,$$css:!0}},jF={sm:{k8WAf4:`xu0wf1k`,kg3NbH:`xf314gf`,$$css:!0},md:{k8WAf4:`x1vofgu7`,$$css:!0},lg:{$$css:!0}},MF={warning:`warning`,error:`error`,success:`success`},NF={warning:`warning`,error:`error`,success:`success`},PF={warning:`@astryx.input.statusButton.warning`,error:`@astryx.input.statusButton.error`,success:`@astryx.input.statusButton.success`};function FF({option:e}){return(0,K.jsx)(OF,{icon:e.icon,label:e.label??e.value,description:e.description})}function IF(e,t){return!t||(e.label??e.value).toLowerCase().includes(t.toLowerCase())}function LF(e,t){return t?e.filter(e=>IF(e,t)):e}function RF(e){let t=Rc(),{label:n,isLabelHidden:r=!1,description:i,isOptional:a=!1,isRequired:o=!1,isDisabled:s=!1,disabledMessage:c,options:l,value:u,onChange:d,changeAction:f,isLoading:p=!1,placeholder:m,size:h,variant:g=`input`,status:v,statusVariant:y=`attached`,labelTooltip:b,startIcon:x,htmlName:S,renderOption:C,renderValue:w,indicatorPosition:T=`end`,hasSearch:E=!1,searchPlaceholder:D,emptyText:O,emptySearchText:k,placement:A,isDefaultOpen:j=!1,"data-testid":M,width:N,xstyle:P,className:F,style:I,hasClear:L,id:R,...ee}=e,z=qM({isRequired:o,isOptional:a}),B=m??t(`@astryx.selector.placeholder`),V=D??t(`@astryx.selector.searchPlaceholder`),H=O??t(`@astryx.selector.empty`),te=k??t(`@astryx.selector.emptySearchResults`),ne=L===!0,re=as(h,`md`),ie=g===`ghost`&&y===`attached`?`detached`:y,ae=u===null?void 0:u,U=(0,_.useId)(),oe=R??U,se=(0,_.useId)(),ce=(0,_.useId)(),le=(0,_.useId)(),ue=(0,_.useId)(),de=(0,_.useId)(),fe=(0,_.useRef)(null),pe=(0,_.useRef)(null),me=(0,_.useRef)(null),W=YM(),[he,ge]=(0,_.useState)(``),_e=(0,_.useRef)(``),ve=he.length>0,[,ye]=(0,_.useTransition)(),[be,xe]=(0,_.useOptimistic)(ae),Se=p||be!==ae,Ce=so(),we=typeof H==`string`?H:t(`@astryx.selector.empty`),Te=typeof te==`string`?te:t(`@astryx.selector.emptySearchResults`),G=s&&!!c,Ee=po({placement:`above`,focusTrigger:`always`,isEnabled:G}),De=po({placement:`above`,isEnabled:ie===`tooltip`&&!!v?.message}),{ariaLabelledBy:Oe,ariaDescribedBy:ke}=Oa(ue,[i?ce:null,!W&&ie!==`tooltip`&&v?.message?le:null,ie===`tooltip`&&v?.message?De.describedBy:null,G?Ee.describedBy:null],W),Ae=(0,_.useMemo)(()=>bF(l),[l]),je=(0,_.useMemo)(()=>LF(Ae,he),[Ae,he]),Me=(0,_.useMemo)(()=>Ae.findIndex(e=>e.value===be),[Ae,be]),Ne=(0,_.useMemo)(()=>Me>=0?Ae[Me]:void 0,[Ae,Me]),Pe=(0,_.useRef)(null),Fe=(0,_.useRef)(()=>{}),Ie=dd({onHide:(0,_.useCallback)(()=>{ge(``),_e.current=``,Fe.current(),Ce(``),pe.current?.focus()},[Ce]),hasLightDismiss:!0,hasCloseButton:!1,hasAutoFocus:!1,role:`none`,surfaceTarget:`selector-popup`}),Le=yi(Ie.id,Ie.isOpen);(0,_.useEffect)(()=>{j&&Ie.show()},[]);let Re=(0,_.useCallback)(e=>{if(e.length===0){Ce(``);return}if(p){Ce(``);return}let n=LF(Ae,e).length;Ce(n===0?Te:t(`@astryx.selector.resultCount`,{count:n}))},[Ce,p,Ae,Te,t]),ze=(0,_.useCallback)(e=>{ge(e),_e.current=e,Re(e)},[Re]),Be=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(!(Ie.isOpen&&!p&&he===``&&Ae.length===0)){Be.current=null;return}Be.current!==we&&(Be.current=we,Ce(we))},[Ie.isOpen,p,he,Ae.length,we,Ce]);let Ve=A==null&&!E,{offset:He,isPositioned:Ue}=CF({isOpen:Ie.isOpen&&Ve,selectedItemIndex:Me,listboxId:se,listboxRef:Pe,anchorRef:fe}),We=Ve?He:0,Ge=!Ve||Ue,Ke=A??`below`,qe=We>0?{marginBlockStart:`-${We}px`}:void 0,Je=(0,_.useCallback)(()=>{Fe.current(),d?.(null),f&&ye(async()=>{xe(void 0),await f(null)})},[d,f,ye,xe]),Ye=(0,_.useCallback)(e=>{let t=_e.current+e;_e.current=t,ge(t),Re(t)},[Re]),Xe=(0,_.useCallback)(e=>{d?.(e),f&&ye(async()=>{xe(e),await f(e)})},[d,f,ye,xe]),{highlightedIndex:Ze,setHighlightedIndex:Qe,getItemId:$e,onTriggerClick:et,onKeyDown:tt,onItemSelect:nt,onItemMouseEnter:rt}=wF({selectableItems:je,wasJustDismissed:Ie.wasJustDismissed,value:be,isDisabled:s,isOpen:Ie.isOpen,hasSearch:E,onOpen:(0,_.useCallback)(()=>{Ie.show(),E&&requestAnimationFrame(()=>{let e=me.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))})},[Ie,E]),onClose:Ie.hide,onSelect:Xe,onClear:ne?Je:void 0,onSearchSeed:Ye,listboxId:se}),it=SA({getItemLabels:()=>Ae.map(e=>e.label??e.value),isDisabled:e=>Ae[e]?.disabled===!0,getCurrentIndex:()=>Ie.isOpen?Ze:Me,onMatch:e=>{let t=Ae[e];Ie.isOpen?Qe(e):t.value!==be&&(Xe(t.value),Ce(t.label??t.value))}});Fe.current=it.reset;let at=(0,_.useCallback)(e=>{if(!s&&!E&&it.onKeyDown(e)){e.preventDefault();return}tt(e)},[s,E,it,tt]);(0,_.useEffect)(()=>{!Ie.isOpen||Ze<0||document.getElementById($e(Ze))?.scrollIntoView?.({block:`nearest`})},[Ie.isOpen,Ze,$e]);let ot=(0,_.useCallback)(e=>{e.stopPropagation(),Je()},[Je]),st=(0,_.useCallback)(()=>E?(0,K.jsx)(hF,{ref:me,id:de,label:t(`@astryx.selector.searchOptions`),clearLabel:t(`@astryx.textInput.clearLabel`,{label:t(`@astryx.selector.searchOptions`)}),...ba(`selector-search`),xstyle:g!==`ghost`&&kF.searchRowInput,role:`combobox`,"aria-expanded":Ie.isOpen,"aria-controls":se,"aria-autocomplete":`list`,"aria-activedescendant":Ie.isOpen&&Ze>=0?$e(Ze):void 0,value:he,onValueChange:ze,onContainerKeyDown:e=>{e.target!==me.current&&e.key===`Tab`&&!e.shiftKey&&tt(e)},onKeyDown:e=>{if(!Di(e.nativeEvent)){if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`PageUp`||e.key===`PageDown`||e.key===`Enter`||e.key===`Escape`){tt(e);return}e.key===`Tab`&&(e.shiftKey||!ve)&&tt(e)}},placeholder:V}):null,[E,de,se,he,ve,V,ze,tt,Ie.isOpen,Ze,$e,g,t]),ct=$A(`check`),lt=(0,_.useCallback)((e,t)=>{let n=t===Ze,r=e.value===ae,i=(0,K.jsx)(`span`,{className:`x3nfvp2 x6s0dn4 xl56j7k x2lah0s xgomdpo`,children:(0,K.jsx)(ct,{state:r?`checked`:`unchecked`,size:`sm`,isDisabled:e.disabled??!1,...ba(`selector-check`)})}),a=(0,K.jsx)(`span`,{className:`x78zum5 x6s0dn4 x1txdalj x98rzlu xeuugli`,children:C?C(e):(0,K.jsx)(FF,{option:e})}),o=T===`start`?(0,K.jsxs)(K.Fragment,{children:[i,a]}):(0,K.jsxs)(K.Fragment,{children:[a,i]});return(0,K.jsx)(`div`,{id:$e(t),role:`option`,"aria-selected":r,"aria-disabled":e.disabled,onClick:()=>nt(e),onMouseEnter:()=>rt(e,t),...oa(ba(`selector-option-row`,{size:re,selected:r?`selected`:null,disabled:e.disabled?`disabled`:null}),Sr(kF.item,jF[re],n&&kF.itemHighlighted,r&&kF.itemSelected,e.disabled&&kF.itemDisabled)),children:o},e.value)},[C,T,Ze,re,ae,$e,nt,rt,ct]),ut=(0,_.useCallback)(()=>{let e=E&&!!he;if(je.length===0&&!p)return[(0,K.jsx)(`div`,{role:`presentation`,...oa(ba(`selector-empty-state`),{className:`x1b2ylru x2b8uid xv1l7n4 x9ynric xcr08ib`}),children:e?te:H},`empty`)];let t=0,n=[];for(let r=0;r{fe.current=e,Ie.triggerRef(e),Ee.ref(e)},onClick:et,"data-testid":M,...oa(ba(`selector`,{variant:g,size:re,status:v?.type??null,disabled:s?`disabled`:null}),Sr(RM.base,kF.triggerContainer,AF[re],g===`ghost`&&kF.triggerGhost,g===`ghost`&&ds.backgroundImage,g===`ghost`&&Ha.focusWithin,s&&RM.disabled,g===`ghost`&&s&&kF.triggerGhostDisabled,!Ne&&kF.triggerPlaceholder,g!==`ghost`&&v&&zM[v.type],g!==`ghost`&&v&&!s&&BM[v.type],g!==`ghost`&&W&&KM.inGroup,W&&kF.triggerInGroup,P),F,I),children:[x&&Cu(x,{size:`sm`,color:`secondary`}),W&&(0,K.jsx)(es,{id:ue,children:n}),(0,K.jsx)(`button`,{ref:pe,id:oe,type:`button`,role:E?void 0:`combobox`,...ee,"aria-haspopup":`listbox`,"aria-expanded":Ie.isOpen,"aria-controls":se,"aria-activedescendant":!E&&Ie.isOpen&&Ze>=0?$e(Ze):void 0,"aria-describedby":ke,"aria-labelledby":Oe,"aria-required":z?`true`:void 0,"aria-invalid":v?.type===`error`?`true`:void 0,"aria-busy":Se||void 0,disabled:s&&!G,"aria-disabled":G?`true`:void 0,onKeyDown:at,tabIndex:s&&!G?-1:0,...{0:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz`},1:{className:`x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x16khyan x1a2a7pz xkh2ocl`}}[!!W<<0],children:pt}),S!=null&&(0,K.jsx)(`input`,{type:`hidden`,name:S,value:u??``,disabled:s}),Se&&(0,K.jsx)($o,{size:`sm`}),ne&&u!=null&&!s&&(0,K.jsx)(GM,{...Le,label:t(`@astryx.selector.clearLabel`,{label:n}),onClick:ot,iconClassName:pa(`selector-clear-icon`)}),dt?ft?(0,K.jsx)(`button`,{ref:De.ref,type:`button`,"aria-label":t(PF[v.type]),"aria-describedby":De.describedBy,...Le,onClick:e=>e.stopPropagation(),...Sr(Ha.focusVisible,kF.statusButton),children:(0,K.jsx)(xu,{icon:MF[v.type],size:`sm`,color:NF[v.type],xstyle:kF.triggerIcon})}):(0,K.jsx)(xu,{icon:MF[v.type],size:`sm`,color:NF[v.type],xstyle:kF.triggerIcon}):(0,K.jsx)(xu,{icon:`chevronDown`,size:`sm`,color:`secondary`,xstyle:[kF.triggerIcon,kF.triggerIconRotation,Ie.isOpen&&kF.triggerIconOpen],...ba(`selector-indicator-icon`,{state:Ie.isOpen?`expanded`:`collapsed`})})]}),Ie.render(E?(0,K.jsxs)(`div`,{children:[st(),(0,K.jsx)(lA,{}),(0,K.jsx)(`div`,{ref:Pe,id:se,role:`listbox`,"aria-labelledby":oe,...{0:{className:`x9f619 xuyqlj2 x1odjw0f xu0wf1k x7a5moj x1hc1fzr x1ey1afo`},1:{className:`x9f619 xuyqlj2 x1odjw0f xu0wf1k x1hc1fzr x1ey1afo x2hg6jq`}}[(g!==`ghost`)<<0],children:ut()})]}):(0,K.jsx)(`div`,{ref:Pe,id:se,role:`listbox`,"aria-labelledby":oe,...{0:{className:`x9f619 xuyqlj2 x1odjw0f xu0wf1k x7a5moj x1hc1fzr x1ey1afo`},2:{className:`x9f619 xuyqlj2 x1odjw0f xu0wf1k x1hc1fzr x1ey1afo x2hg6jq`},1:{className:`x9f619 xuyqlj2 x1odjw0f xu0wf1k x7a5moj xg01cxk xq2gx43`},3:{className:`x9f619 xuyqlj2 x1odjw0f xu0wf1k x2hg6jq xg01cxk xq2gx43`}}[(g!==`ghost`)<<1|!Ge<<0],children:ut()}),{placement:Ke,alignment:`start`,offset:Ve?void 0:Br[`--spacing-1`],xstyle:[kF.popover,co[Ke]],style:qe}),ft&&De.renderTooltip(v?.message??``),G&&Ee.renderTooltip(c)]});return W?mt:(0,K.jsx)(LM,{label:n,isLabelHidden:r,description:i,inputID:oe,descriptionID:i?ce:void 0,isOptional:a,isRequired:o,isDisabled:s,status:v?{type:v.type,message:v.message,messageID:v.message?le:void 0}:void 0,statusVariant:ie,labelTooltip:b,width:N,children:mt})}RF.displayName=`Selector`;function zF(e){return e?.status===`running`||e?.status===`cancelling`}function BF({sessionId:e,auth:t,busy:n,onSaving:r,onAuthenticated:i,onReload:a}){let{t:o}=cr(),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(0),[v,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(!1),E=(0,_.useRef)(!1),D=(0,_.useRef)(null),k=(0,_.useRef)(!1),A=(0,_.useRef)(null),j=(0,_.useRef)({onSaving:r,onAuthenticated:i});j.current={onSaving:r,onAuthenticated:i};let M=zF(s),N=t.id,P=`${e}:${N}`,F=(0,_.useRef)({key:P});F.current.key!==P&&(F.current={key:P});let L=F.current,R=(0,_.useCallback)((t,n)=>{if(t&&(t.sessionId!==e||t.provider!==N||n&&t.id!==n))throw Error(`Login ownership changed`);if(n&&!t)throw Error(`Login status unavailable`);if(!E.current||F.current!==L){t&&zF(t)&&new lf().cancelProviderLogin(e,t.id).catch(()=>void 0);return}D.current=t,c(t),m(!1),t?.status===`succeeded`&&!t.refreshRequired&&A.current!==t.id&&(A.current=t.id,j.current.onAuthenticated())},[e,N,L]);(0,_.useEffect)(()=>{E.current=!0,D.current=null,k.current=!1,A.current=null,c(null),u(!1),f(!1),m(!1),x(!1),T(!1);let t=new AbortController;return new lf().providerLogin(e,void 0,t.signal).then(e=>{!t.signal.aborted&&e?.provider===N&&zF(e)&&R(e)}).catch(()=>void 0),()=>{E.current=!1,t.abort();let n=D.current;n&&zF(n)&&new lf().cancelProviderLogin(e,n.id).catch(()=>void 0),j.current.onSaving(!1)}},[e,N,R]),(0,_.useEffect)(()=>{j.current.onSaving(M||l)},[M,l]);let ee=s?.prompt?.id;(0,_.useEffect)(()=>{y(``)},[ee]);let z=s?.id;(0,_.useEffect)(()=>{x(!1)},[z]),(0,_.useEffect)(()=>{if(!M||!z)return;let t=new AbortController,n=0,r=async()=>{try{let i=await new lf().providerLogin(e,z,t.signal);if(t.signal.aborted)return;R(i,z),zF(i)&&(n=window.setTimeout(()=>void r(),900))}catch{t.signal.aborted||m(!0)}};return r(),()=>{t.abort(),clearTimeout(n)}},[e,R,z,M,h]);let B=async e=>{if(!k.current){k.current=!0,u(!0),f(!1);try{R(await e())}catch{E.current&&F.current===L&&f(!0)}finally{F.current===L&&(k.current=!1,E.current&&u(!1))}}},V=()=>{n||M||B(()=>new lf().startProviderLogin(e,N))},H=t=>{let n=s?.prompt;if(!s||!n)return;let r=s.id;B(()=>new lf().respondProviderLogin(e,r,n.id,t))},te=async()=>{try{let t=await new lf().providerLogin(e,s?.id);R(t,s?.id),E.current&&F.current===L&&(f(!1),g(e=>e+1))}catch{E.current&&F.current===L&&f(!0)}},ne=s?.prompt,re=s?.auth||s?.device,ie=ne&&ne.type!==`select`&&(0,K.jsxs)(`div`,{className:`models-login-input`,children:[(0,K.jsxs)(`label`,{className:`models-field`,children:[ne.type===`manual_code`?o(`accountLoginPaste`):ne.message,(0,K.jsx)(`input`,{type:ne.type===`secret`||ne.type===`manual_code`?`password`:`text`,autoComplete:`off`,spellCheck:!1,value:v,maxLength:8192,placeholder:ne.placeholder,disabled:l||s.status!==`running`,onChange:e=>y(e.target.value),onKeyDown:e=>{e.key!==`Enter`||e.nativeEvent.isComposing||(e.preventDefault(),(ne.type===`text`||v.trim())&&H(v))}})]}),(0,K.jsx)(`button`,{type:`button`,className:`models-button primary`,disabled:l||ne.type!==`text`&&!v.trim()||s.status!==`running`,onClick:()=>H(v),children:o(`accountLoginContinue`)})]});return(0,K.jsxs)(`div`,{className:`models-account-login`,children:[!M&&!w&&(!s||[`failed`,`expired`,`cancelled`].includes(s.status))&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{className:`models-login-intro`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:N===`openai`?o(`accountLoginChatGPT`):N===`anthropic`?o(`accountLoginClaude`):t.loginLabel||t.name}),(0,K.jsx)(`p`,{className:`models-hint`,children:o(t.subscription?`accountLoginExisting`:`accountLoginIntro`)})]})}),(0,K.jsxs)(`div`,{className:`models-login-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`models-button primary`,disabled:n||l||d,onClick:V,children:o(t.subscription?`accountLoginAgain`:`accountLoginStart`)}),t.subscription&&(0,K.jsx)(`button`,{type:`button`,className:`models-link`,disabled:n||l,onClick:()=>C(!0),children:o(`accountLogout`)})]})]}),M&&(0,K.jsxs)(`div`,{className:`models-login-flow`,children:[(0,K.jsxs)(`div`,{className:`models-login-status`,role:`status`,children:[(0,K.jsx)(He,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:o(s?.status===`cancelling`?`accountLoginCancelling`:re?`accountLoginWaiting`:ne?`accountLoginChoose`:`accountLoginStarting`)})]}),re&&(0,K.jsx)(`p`,{className:`models-hint`,children:o(s?.device?`accountLoginDeviceHelp`:`accountLoginBrowserHelp`)}),s?.device&&(0,K.jsxs)(`div`,{className:`models-device-code`,children:[(0,K.jsx)(`code`,{children:s.device.code}),(0,K.jsx)(`button`,{type:`button`,className:`models-icon`,"aria-label":o(`accountLoginCopyCode`),onClick:()=>{s.device&&navigator.clipboard.writeText(s.device.code).then(()=>{E.current&&F.current===L&&x(!0)}).catch(()=>{E.current&&F.current===L&&x(!1)})},children:b?(0,K.jsx)(I,{}):(0,K.jsx)(ue,{})})]}),re&&(0,K.jsxs)(`a`,{className:`models-button primary models-login-open`,href:s?.device?.url||s?.auth?.url,target:`_blank`,rel:`noopener noreferrer`,children:[o(`accountLoginOpen`),(0,K.jsx)(O,{"aria-hidden":`true`})]}),ne?.type===`select`&&(0,K.jsx)(`fieldset`,{className:`models-login-options`,"aria-label":ne.message,children:ne.options?.map(e=>{let t=[`openai`,`openai-codex`].includes(N)&&[`browser`,`device_code`].includes(e.id);return(0,K.jsxs)(`button`,{type:`button`,className:`models-login-option`,disabled:l||s?.status!==`running`,onClick:()=>H(e.id),children:[(0,K.jsx)(`strong`,{children:t?o(e.id===`browser`?`accountLoginBrowser`:`accountLoginDevice`):e.label}),(t||e.description)&&(0,K.jsx)(`span`,{children:t?o(e.id===`browser`?`accountLoginBrowserOption`:`accountLoginDeviceOption`):e.description})]},e.id)})}),ne?.type===`manual_code`&&re?(0,K.jsxs)(`details`,{className:`models-login-fallback`,children:[(0,K.jsx)(`summary`,{children:o(`accountLoginFallback`)}),(0,K.jsx)(`p`,{className:`models-hint`,children:o(`accountLoginRemoteHelp`)}),ie]}):ie,s?.messages.map(e=>(0,K.jsxs)(`div`,{className:`models-hint`,children:[(0,K.jsx)(`p`,{children:e.message}),e.links?.map(e=>(0,K.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:[e.label,(0,K.jsx)(O,{"aria-hidden":`true`})]},e.url))]},e.id)),(0,K.jsx)(`button`,{type:`button`,className:`models-link models-login-cancel`,disabled:l||s?.status===`cancelling`,onClick:()=>{s&&B(()=>new lf().cancelProviderLogin(e,s.id))},children:o(`accountLoginCancel`)})]}),s?.status===`succeeded`&&s.refreshRequired&&(0,K.jsxs)(`p`,{className:`models-hint`,role:`status`,children:[o(`accountLoginRefreshRequired`),` `,(0,K.jsx)(`button`,{type:`button`,className:`models-link`,onClick:a,children:o(`refreshStatus`)})]}),w&&(0,K.jsxs)(`p`,{className:`models-hint`,role:`status`,children:[o(`accountLogoutRefreshRequired`),` `,(0,K.jsx)(`button`,{type:`button`,className:`models-link`,onClick:a,children:o(`refreshStatus`)})]}),s&&[`failed`,`expired`,`cancelled`].includes(s.status)&&(0,K.jsx)(`p`,{className:s.status===`failed`?`models-error`:`models-hint`,role:`status`,children:o(`accountLogin_${s.status}`)}),d&&(0,K.jsxs)(`p`,{className:`models-error`,role:`alert`,children:[o(`accountLoginRequestFailed`),(0,K.jsx)(`button`,{type:`button`,className:`models-link`,onClick:()=>void te(),children:o(`refreshStatus`)})]}),p&&(0,K.jsxs)(`p`,{className:`models-error`,role:`alert`,children:[o(`accountLoginStatusUnknown`),(0,K.jsx)(`button`,{type:`button`,className:`models-link`,onClick:()=>g(e=>e+1),children:o(`refreshStatus`)})]}),S&&(0,K.jsx)(qP,{isOpen:!0,title:o(`accountLogoutTitle`,{provider:t.name}),description:o(`accountLogoutDetail`),cancelLabel:o(`cancel`),actionLabel:o(`accountLogout`),isActionLoading:l,onOpenChange:e=>{!e&&!l&&C(!1)},onAction:()=>{k.current||n||(k.current=!0,u(!0),f(!1),new lf().logoutProvider(e,N).then(e=>{!E.current||F.current!==L||(C(!1),e.refreshRequired?T(!0):a())}).catch(()=>{E.current&&F.current===L&&(C(!1),f(!0))}).finally(()=>{F.current===L&&(k.current=!1,E.current&&u(!1))}))}})]})}function VF({sessionId:e,template:t,existingIds:n,apiKey:r,onClose:i,onAdd:a}){let{t:o}=cr(),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(new Set),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)(!0),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(0),S=(0,_.useRef)({template:t,apiKey:r,existingIds:n}),C=new Set(n),w=Math.max(0,100-C.size),T=s.filter(e=>`${e.id} ${e.name}`.toLowerCase().includes(d.trim().toLowerCase())),E=T.filter(e=>!C.has(e.id)),D=E.length>0&&E.every(e=>l.has(e.id));return(0,_.useEffect)(()=>{let t=new AbortController,{template:n,apiKey:r,existingIds:i}=S.current;return m(!0),y(!1),new lf().discoverProviderModels(e,{provider:n.provider,baseUrl:n.baseUrl,api:n.api,...r.trim()?{apiKey:r.trim()}:{}},t.signal).then(e=>{t.signal.aborted||(c(e.models),g(e.truncated),m(!1),u(new Set(e.models.filter(e=>!i.includes(e.id)).slice(0,Math.max(0,100-i.length)).map(e=>e.id))))},()=>{t.signal.aborted||(y(!0),m(!1))}),()=>t.abort()},[e,b]),(0,K.jsx)(iM,{isOpen:!0,width:380,padding:0,className:`models-picker-dialog`,"aria-label":o(`providerPickerTitle`),onOpenChange:e=>!e&&i(),children:(0,K.jsxs)(`div`,{className:`models-picker`,children:[(0,K.jsxs)(`header`,{children:[(0,K.jsx)(`h2`,{children:o(`providerPickerTitle`)}),(0,K.jsx)(`button`,{type:`button`,className:`models-icon`,"aria-label":o(`close`),onClick:i,children:(0,K.jsx)(Lt,{})})]}),(0,K.jsx)(`p`,{children:o(`providerPickerIntro`)}),(0,K.jsxs)(`div`,{className:`models-picker-toolbar`,children:[(0,K.jsx)(`input`,{"data-autofocus":!0,type:`search`,"aria-label":o(`providerPickerSearch`),placeholder:o(`providerPickerSearch`),value:d,onKeyDown:e=>{e.key===`Enter`&&e.preventDefault()},onChange:e=>f(e.target.value)}),(0,K.jsx)(`button`,{type:`button`,className:`models-link`,disabled:p||!E.length,onClick:()=>u(e=>{let t=new Set(e);for(let e of E)D?t.delete(e.id):t.size(0,K.jsxs)(`label`,{className:`models-picker-row`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:C.has(e.id)||l.has(e.id),disabled:C.has(e.id)||!l.has(e.id)&&l.size>=w,onChange:t=>u(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})}),(0,K.jsx)(`span`,{title:e.name,children:e.id}),C.has(e.id)&&(0,K.jsx)(`small`,{children:o(`providerPickerAdded`)})]},e.id)),!p&&!v&&!T.length&&(0,K.jsx)(`p`,{className:`models-picker-empty`,children:o(d?`providerPickerNoMatch`:`providerPickerEmpty`)}),v&&(0,K.jsxs)(`div`,{className:`models-error`,role:`alert`,children:[(0,K.jsx)(`p`,{children:o(`providerPickerError_load`)}),(0,K.jsx)(`button`,{type:`button`,className:`models-button`,onClick:()=>x(e=>e+1),children:o(`retryAdmissionCheck`)})]})]}),h&&(0,K.jsx)(`p`,{className:`models-hint`,children:o(`providerPickerBounded`)}),(0,K.jsxs)(`footer`,{children:[(0,K.jsx)(`span`,{className:`models-hint`,"aria-live":`polite`,children:l.size>0&&o(`providerPickerSelected`,{count:l.size})}),(0,K.jsx)(`button`,{type:`button`,className:`models-button`,onClick:i,children:o(`cancel`)}),(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:!l.size||p||v,onClick:()=>a(s.filter(e=>l.has(e.id))),children:o(`providerPickerSave`)})]})]})})}function HF(e){let t=e.trim();if(!t)return;let n=/^(\d+(?:\.\d+)?)([km])?$/i.exec(t);if(!n)return NaN;let r=n[2]?.toLowerCase()===`m`?1e6:n[2]?.toLowerCase()===`k`?1e3:1,i=Number(n[1])*r,a=Math.round(i),o=Math.abs(i-a)<1e-6?a:i;return Number.isSafeInteger(o)&&o>0&&o<=1e8?o:NaN}function UF(e){if(e===void 0)return``;if(Number.isInteger(e)&&e>0){if(e%1e6==0)return`${e/1e6}M`;if(e%1e3==0)return`${e/1e3}K`}return String(e)}function WF({sessionId:e,providerId:t,configuration:n,auth:r,isNew:i,custom:a,taken:o,currentModel:s,availableModels:c,busy:l,onDirty:u,onSaving:d,onClose:f,onReload:p}){let{t:m}=cr(),[h]=(0,_.useState)(()=>{let e=n.providers?.find(e=>e.provider===t),i=n.models.filter(e=>e.provider===t).map(e=>({...e,rowKey:crypto.randomUUID()}));return{provider:t,name:e?.name||r?.name||t,baseUrl:e?.baseUrl||i[0]?.baseUrl||r?.baseUrl||``,api:e?.api||i[0]?.api||r?.api||`openai-completions`,models:i}}),[g]=(0,_.useState)(n.revision),[v,y]=(0,_.useState)(h),[b,x]=(0,_.useState)(``),S=!i&&!!r?.authMethods.includes(`oauth`),C=a||!!r?.authMethods.includes(`api_key`),[w,T]=(0,_.useState)(S&&(!r?.configured||r?.subscription||!C)?`oauth`:`api_key`),[E,D]=(0,_.useState)(!1),[O,k]=(0,_.useState)(!1),A=(0,_.useRef)(null),j=(0,_.useRef)(!1),[M,N]=(0,_.useState)(new Set),[P,F]=(0,_.useState)({}),[I,L]=(0,_.useState)(!1),[R,z]=(0,_.useState)(null),[B,V]=(0,_.useState)(!1),H=(0,_.useRef)(null),te=(0,_.useRef)({onDirty:u,onSaving:d});te.current={onDirty:u,onSaving:d};let ne=JSON.stringify(v)!==JSON.stringify(h),re=ne||b.length>0;(0,_.useEffect)(()=>{te.current.onDirty(re)},[re]),(0,_.useEffect)(()=>{te.current.onSaving(I||E)},[I,E]),(0,_.useEffect)(()=>{O?j.current=!0:j.current&&(j.current=!1,A.current?.focus({preventScroll:!0}))},[O]),(0,_.useEffect)(()=>()=>{H.current?.abort(),te.current.onSaving(!1),te.current.onDirty(!1)},[]);let ie=n.providers?.find(e=>e.provider===t)?.editable!==!1,ae=l||I||E,U=ae||B||!ie,oe=!/^[a-zA-Z0-9._-]+$/.test(v.provider)||[`__proto__`,`constructor`,`prototype`].includes(v.provider)||i&&a&&o.includes(v.provider),se=v.models.findIndex(e=>!e.id.trim()||[e.contextWindow,e.maxTokens].some(e=>e!==void 0&&!Number.isFinite(e))||v.models.some(t=>t.rowKey!==e.rowKey&&t.id.trim()===e.id.trim())),ce=se!==-1,le=i&&a||ne,ue=!oe&&!/[\r\n\u0000]/u.test(b)&&(B||!le||(!a||v.models.length>0)&&!ce&&!!v.baseUrl)&&(le||b.trim().length>0),de=e=>{y(t=>({...t,...e})),R!==`conflict`&&z(null)},fe=(e,t)=>de({models:v.models.map((n,r)=>r===e?{...n,...t}:n)}),pe={id:``,name:``,reasoning:!1,provider:v.provider,baseUrl:v.baseUrl,api:v.api},me=async()=>{if(ae||O||!ue||R===`conflict`)return;let t=new AbortController;H.current=t,L(!0),z(null);let n=B,r=new lf;try{if(le&&!n){if(await r.changeProviderConfiguration(e,g,{action:`save`,configuration:{...v,name:v.name.trim()||v.provider,models:v.models.map(({rowKey:e,...t})=>({...t,id:t.id.trim(),name:t.name.trim()||t.id.trim(),provider:v.provider,baseUrl:v.baseUrl===h.baseUrl&&t.baseUrl||v.baseUrl,api:v.api===h.api?t.api:v.api}))}},t.signal),t.signal.aborted)return;n=!0,V(!0)}if(b.trim()&&await r.saveProviderKey(e,v.provider,b.trim(),t.signal),t.signal.aborted)return;x(``),te.current.onDirty(!1),f(v.name||v.provider,v.provider)}catch(e){t.signal.aborted||z(e instanceof sf&&e.code===`MODEL_CONFIGURATION_CONFLICT`?`conflict`:e instanceof sf&&e.code===`MODEL_NOT_AVAILABLE`?`current`:n?`key`:`failed`)}finally{t.signal.aborted||L(!1)}},W=e=>(0,K.jsxs)(`label`,{className:`models-field`,children:[m(e===`name`?`providerDisplayName`:`modelConfig_${e}`),(0,K.jsx)(`input`,{type:e===`baseUrl`?`url`:`text`,value:v[e],maxLength:e===`baseUrl`?2048:160,autoComplete:`off`,disabled:U,required:e===`provider`||e===`baseUrl`&&le,"aria-invalid":e===`provider`&&v.provider.length>0&&oe,placeholder:e===`provider`?`my-provider`:e===`name`?v.provider:`https://api.example.com/v1`,onChange:t=>de({[e]:t.target.value})})]}),he=(0,K.jsxs)(`label`,{className:`models-field`,children:[m(`modelConfig_api`),(0,K.jsxs)(`select`,{value:v.api,disabled:U,onChange:e=>{let t=e.target.value;(t===`openai-responses`||t===`openai-completions`||t===`anthropic-messages`)&&de({api:t})},children:[(0,K.jsx)(`option`,{value:`openai-completions`,children:`OpenAI Chat Completions`}),(0,K.jsx)(`option`,{value:`openai-responses`,children:`OpenAI Responses`}),(0,K.jsx)(`option`,{value:`anthropic-messages`,children:`Anthropic Messages`})]})]}),ge=(0,K.jsxs)(`div`,{className:`models-catalog`,children:[(0,K.jsxs)(`div`,{className:`models-list-head`,children:[(0,K.jsx)(`span`,{children:m(`modelSettings`)}),(0,K.jsx)(`button`,{type:`button`,ref:A,className:`models-link`,disabled:U||oe||!v.baseUrl,onClick:()=>k(!0),children:m(`providerFetchModels`)})]}),!ie&&(0,K.jsx)(`p`,{className:`models-hint`,children:m(`providerModelsReadOnly`)}),v.models.length===0&&(0,K.jsx)(`p`,{className:`models-empty`,children:m(a?`providerModelsEmpty`:`providerModelsInherited`,{count:c.length})}),(0,K.jsx)(`div`,{className:`models-entry-list`,children:v.models.map((e,t)=>(0,K.jsxs)(`div`,{className:`models-entry`,children:[(0,K.jsxs)(`div`,{className:`models-entry-row`,children:[(0,K.jsx)(`input`,{"aria-label":m(`providerModelId`,{number:t+1}),placeholder:m(`modelConfig_id`),value:e.id,maxLength:256,required:!0,disabled:U||s?.provider===v.provider&&s.id===e.id,onChange:e=>fe(t,{id:e.target.value})}),(0,K.jsx)(`input`,{"aria-label":m(`providerModelName`,{number:t+1}),placeholder:m(`modelConfig_name`),value:e.name,maxLength:256,disabled:U,onChange:e=>fe(t,{name:e.target.value})}),(0,K.jsx)(`button`,{type:`button`,className:`models-icon`,"aria-label":m(`providerModelDetails`,{model:e.name||e.id||t+1}),"aria-expanded":M.has(e.rowKey),title:m(`providerModelOptions`),onClick:()=>N(t=>{let n=new Set(t);return n.delete(e.rowKey)||n.add(e.rowKey),n}),children:(0,K.jsx)(ee,{})}),(0,K.jsx)(`button`,{type:`button`,className:`models-icon danger`,"aria-label":m(`providerRemoveModel`,{model:e.name||e.id||t+1}),disabled:U||s?.provider===v.provider&&s.id===e.id,title:s?.provider===v.provider&&s.id===e.id?m(`providerCurrentRemoval`):m(`providerRemoveModel`,{model:e.name||e.id||t+1}),onClick:()=>{de({models:v.models.filter((e,n)=>n!==t)}),N(t=>new Set([...t].filter(t=>t!==e.rowKey))),F(t=>Object.fromEntries(Object.entries(t).filter(([t])=>t!==e.rowKey)))},children:(0,K.jsx)(kt,{})})]}),M.has(e.rowKey)&&(0,K.jsxs)(`div`,{className:`models-entry-details`,children:[[`contextWindow`,`maxTokens`].map(n=>(0,K.jsxs)(`label`,{className:`models-field models-capacity`,children:[m(`modelConfig_${n}`),(0,K.jsx)(`input`,{type:`text`,inputMode:`numeric`,autoComplete:`off`,spellCheck:!1,"aria-label":m(`providerCapacityLabel`,{field:m(`modelConfig_${n}`),number:t+1}),"aria-invalid":e[n]!==void 0&&!Number.isFinite(e[n]),placeholder:n===`contextWindow`?`256K`:`32K`,value:P[e.rowKey]?.[n]??UF(e[n]),disabled:U,onChange:r=>{let i=r.target.value;F(t=>({...t,[e.rowKey]:{...t[e.rowKey],[n]:i}})),fe(t,{[n]:HF(i)})}})]},n)),(0,K.jsxs)(`fieldset`,{className:`models-input-types`,"aria-label":m(`providerCapacityLabel`,{field:m(`providerInputTypes`),number:t+1}),children:[(0,K.jsx)(`legend`,{children:m(`providerInputTypes`)}),(0,K.jsx)(`div`,{children:[`text`,`image`].map(n=>{let r=e.input??[`text`];return(0,K.jsxs)(`label`,{className:`models-checkbox`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:r.includes(n),disabled:U||r.length===1&&r.includes(n),onChange:e=>fe(t,{input:[`text`,`image`].filter(t=>t===n?e.target.checked:r.includes(t))})}),m(n===`text`?`providerInputText`:`providerInputImage`)]},n)})})]}),(0,K.jsx)(`p`,{className:`models-hint models-capability-hint`,children:m(`providerImageHint`)}),(0,K.jsxs)(`label`,{className:`models-checkbox models-reasoning`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:e.reasoning,disabled:U,onChange:e=>fe(t,{reasoning:e.target.checked})}),m(`modelConfig_reasoning`)]}),(0,K.jsx)(`p`,{className:`models-hint models-capability-hint`,children:m(`providerReasoningHint`)})]})]},e.rowKey))}),(0,K.jsxs)(`button`,{type:`button`,className:`models-button models-add-model`,disabled:U||v.models.length>=100,onClick:()=>{de({models:[...v.models,{...pe,rowKey:crypto.randomUUID()}]})},children:[(0,K.jsx)(lt,{"aria-hidden":`true`}),m(`addModel`)]}),ce&&(0,K.jsx)(`p`,{className:`models-error`,role:`alert`,children:m(`providerModelInvalid`,{number:se+1})})]});return(0,K.jsxs)(`form`,{className:`models-editor`,onSubmit:e=>{e.preventDefault(),me()},children:[!i&&a&&(0,K.jsxs)(`div`,{className:`models-editor-heading`,children:[(0,K.jsx)(`span`,{children:v.name||v.provider}),v.name!==v.provider&&(0,K.jsx)(`small`,{children:v.provider})]}),i&&a&&(0,K.jsxs)(K.Fragment,{children:[W(`provider`),v.provider&&oe&&(0,K.jsx)(`p`,{className:`models-error`,children:m(`providerIdInvalid`)}),W(`name`),W(`baseUrl`),he]}),S&&C&&(0,K.jsxs)(`fieldset`,{className:`models-add-modes`,"aria-label":m(`accountLoginMethod`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-pressed":w===`oauth`,disabled:ae,onClick:()=>T(`oauth`),children:m(`accountLoginTab`)}),(0,K.jsx)(`button`,{type:`button`,"aria-pressed":w===`api_key`,disabled:ae,onClick:()=>T(`api_key`),children:m(`accountLoginKeyTab`)})]}),S&&w===`oauth`&&r&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(BF,{sessionId:e,auth:r,busy:l||I||re,onSaving:D,onAuthenticated:()=>f(v.name||v.provider,v.provider),onReload:p}),re&&(0,K.jsx)(`p`,{className:`models-hint`,children:m(`accountLoginUnsaved`)})]}),C&&w===`api_key`?(0,K.jsxs)(`label`,{className:`models-field`,children:[m(`providerApiKey`),(0,K.jsx)(`input`,{type:`password`,autoComplete:`new-password`,spellCheck:!1,maxLength:8192,value:b,placeholder:m(r?.configured?`providerKeyKeep`:`providerKeyOptional`),disabled:ae,onChange:e=>{x(e.target.value),R!==`conflict`&&z(null)}})]}):S?null:(0,K.jsx)(`p`,{className:`models-hint`,children:m(`providerNativeAuth`)}),i&&a?ge:(0,K.jsxs)(`details`,{className:`models-customized`,children:[(0,K.jsx)(`summary`,{children:m(`providerCustomSettings`)}),(0,K.jsxs)(`div`,{children:[a&&W(`name`),W(`baseUrl`),a&&he,ge]})]}),R&&(0,K.jsx)(`p`,{className:`models-error`,role:`alert`,children:m(R===`conflict`?`modelConfigurationConflict`:R===`key`?`providerProfileSavedKeyFailed`:R===`current`?`providerCurrentRemoval`:`providerConfigurationFailed`)}),R===`conflict`&&(0,K.jsx)(`button`,{type:`button`,className:`models-button`,onClick:p,children:m(`providerReload`)}),!E&&(0,K.jsxs)(`div`,{className:`models-editor-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:I,onClick:()=>B?p():f(),children:m(`cancel`)}),(w===`api_key`||ne)&&(0,K.jsx)(`button`,{type:`submit`,className:`models-button primary`,disabled:ae||!ue||R===`conflict`,"aria-busy":I,children:m(I?`savingSettings`:`providerSave`)})]}),O&&(0,K.jsx)(VF,{sessionId:e,template:pe,existingIds:v.models.map(e=>e.id),apiKey:b,onClose:()=>k(!1),onAdd:e=>{de({models:[...v.models,...e.map(e=>({...pe,...e,rowKey:crypto.randomUUID()}))]}),k(!1)}})]})}function GF({sessionId:e,sessionPath:t,provider:n,purpose:r,initialModel:i,busy:a,onSelectModel:o,onDefaultSaved:s,onSaving:c,onClose:l}){let{t:u}=cr(),[d,f]=(0,_.useState)(``),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(i?`${i.provider}/${i.id}`:``),[v,y]=(0,_.useState)(!0),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(0),[w,T]=(0,_.useState)(0),[E,D]=(0,_.useState)(!1),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(null);(0,_.useEffect)(()=>{let t=new AbortController;y(!0),x(!1);let r=window.setTimeout(()=>{new lf().searchModels(d.trim(),e,t.signal,n).then(e=>{t.signal.aborted||(m(e.models),C(e.truncation.matchesOmitted),y(!1))},()=>{t.signal.aborted||(x(!0),y(!1))})},d?200:0);return()=>{t.abort(),window.clearTimeout(r)}},[e,n,d,w]);let M=p.find(e=>`${e.provider}/${e.id}`===h)??p[0],N=new Map;for(let e of p){let t=N.get(e.provider);t?t.push(e):N.set(e.provider,[e])}let P=async()=>{if(!M||v||O||a||!t)return;k(!0),c(!0),j(null);let n=!1;try{if(r===`use`){if(!await o(`${M.provider}/${M.id}`))throw Error(`selection failed`);n=!0}(r==="default"||E)&&s(await new lf().saveModelDefault(M.provider,M.id,e,t)),l()}catch{j(n?`modelDefaultPartial`:r==="default"?`modelDefaultSaveFailed`:`modelConnectionUseFailed`)}finally{k(!1),c(!1)}};return(0,K.jsxs)(`div`,{className:`models-connection-choice`,children:[(0,K.jsx)(`p`,{className:`models-hint`,children:u(r==="default"?`modelDefaultHint`:`modelConnectionNextHint`)}),(p.length>8||S>0||d)&&(0,K.jsx)(`input`,{type:`search`,"aria-label":u(`modelConnectionSearch`),placeholder:u(`modelConnectionSearch`),maxLength:200,value:d,disabled:O,onChange:e=>f(e.target.value)}),b?(0,K.jsxs)(`p`,{className:`models-error`,role:`alert`,children:[u(`modelConnectionLoadFailed`),` `,(0,K.jsx)(`button`,{type:`button`,className:`models-link`,onClick:()=>T(e=>e+1),children:u(`retryAdmissionCheck`)})]}):v?(0,K.jsx)(`p`,{className:`models-hint`,role:`status`,children:u(`loadingModels`)}):p.length?(0,K.jsx)(RF,{label:u(`selectModel`),className:`models-provider-picker`,placement:`below`,value:M?`${M.provider}/${M.id}`:``,isDisabled:O,options:[...N].map(([e,t])=>({type:`section`,title:e,options:t.map(e=>({value:`${e.provider}/${e.id}`,label:e.name||e.id,description:`${e.provider} · ${e.id}`,icon:(0,K.jsx)(NN,{id:e.provider})}))})),onChange:e=>g(e)}):(0,K.jsx)(`p`,{className:`models-hint`,children:u(d?`modelConnectionNoMatch`:`modelConnectionNoModels`)}),S>0&&!v&&(0,K.jsx)(`p`,{className:`models-hint`,children:u(`modelConnectionMore`,{count:S})}),r===`use`&&(0,K.jsxs)(`label`,{className:`models-checkbox`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:E,disabled:O,onChange:e=>D(e.target.checked)}),u(`modelMakeDefault`)]}),A&&(0,K.jsx)(`p`,{className:`models-error`,role:`alert`,children:u(A)}),(0,K.jsxs)(`div`,{className:`models-editor-actions`,children:[(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:O,onClick:l,children:u(`cancel`)}),(0,K.jsx)(`button`,{type:`button`,className:`models-button primary`,disabled:O||a||v||b||!M||!t,onClick:()=>void P(),children:u(O?`providerSaving`:r==="default"?`modelDefaultSave`:`modelConnectionUse`)})]})]})}function KF({sessionId:e,sessionPath:t,models:n,currentModel:r,busy:i,focusCredentials:a,onSaved:o,onSelectModel:s,onDraftChange:c,onSavingChange:l}){let{t:u}=cr(),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(0),[h,g]=(0,_.useState)(!0),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)([]),[w,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(`account`),[O,k]=(0,_.useState)(``),[A,j]=(0,_.useState)(``),[M,N]=(0,_.useState)({}),[P,F]=(0,_.useState)(!1),[I,L]=(0,_.useState)({}),[R,ee]=(0,_.useState)(!1),z=P||R||Object.values(I).some(Boolean),[B,V]=(0,_.useState)(null),[H,te]=(0,_.useState)(!1),[ne,re]=(0,_.useState)(null),[ie,ae]=(0,_.useState)(null),[U,oe]=(0,_.useState)(null),[se,ce]=(0,_.useState)(null),le=(0,_.useRef)(null),ue=(0,_.useRef)(a),de=(0,_.useRef)(null),fe=(0,_.useRef)(new Map),pe=(0,_.useRef)(null),me=(0,_.useRef)(null),W=(0,_.useRef)({onDraftChange:c,onSavingChange:l});W.current={onDraftChange:c,onSavingChange:l},(0,_.useEffect)(()=>{c(Object.values(M).some(Boolean))},[M,c]),(0,_.useEffect)(()=>{l(z)},[z,l]),(0,_.useEffect)(()=>{!ne&&!z&&me.current&&(me.current.focus({preventScroll:!0}),me.current=null)},[ne,z]),(0,_.useEffect)(()=>{if(!de.current)return;let e=de.current;de.current=null,(fe.current.get(e)??pe.current)?.focus({preventScroll:!0})}),(0,_.useEffect)(()=>()=>{le.current?.abort(),W.current.onDraftChange(!1),W.current.onSavingChange(!1)},[]),(0,_.useEffect)(()=>{let t=new AbortController;g(!0),y(!1);let n=new lf;return Promise.all([n.modelConfigurations(e,t.signal),n.providerAuth(e,t.signal)]).then(([e,n])=>{if(!t.signal.aborted&&(f({configuration:e,auth:n}),g(!1),ue.current)){ue.current=!1;let e=r?.provider||n.providers.find(e=>e.configured)?.id;e&&(x(e),C([e]))}},()=>{t.signal.aborted||(y(!0),g(!1))}),()=>t.abort()},[e,p,r?.provider]),(0,_.useEffect)(()=>{let t=new AbortController;return te(!1),new lf().modelDefaults(e,t.signal).then(e=>{t.signal.aborted||V(e)},()=>{t.signal.aborted||te(!0)}),()=>t.abort()},[e,p]);let he=d?.configuration,ge=new Set([...he?.providers?.map(e=>e.provider)??[],...he?.models.map(e=>e.provider)??[]]),_e=new Set([...ge,...d?.auth.providers.filter(e=>e.configured).map(e=>e.id)??[],...n.map(e=>e.provider),...S.filter(e=>!e.startsWith(`add:`))]),ve=[..._e].map(e=>{let t=d?.auth.providers.find(t=>t.id===e);return{id:e,name:he?.providers?.find(t=>t.provider===e)?.name||t?.name||e,auth:t}}),ye=d?.auth.providers.filter(e=>e.authMethods.includes(`api_key`)&&!_e.has(e.id))??[],be=d?.auth.providers.filter(e=>e.authMethods.includes(`oauth`)&&!e.subscription)??[],xe=be.find(e=>e.id===O)??be[0],Se=ye.find(e=>e.id===A)??ye[0],Ce=[{id:`account`,label:`accountLoginTab`,hint:`providerAccountHint`,available:be.length>0},{id:`catalog`,label:`providerAddCatalog`,hint:`providerCatalogHint`,available:ye.length>0},{id:`custom`,label:`providerAddCustom`,hint:`providerCustomHint`,available:!0}],we=e=>{D(e);let t=e===`custom`?`add:custom`:e===`account`?xe&&`add:account:${xe.id}`:Se&&`add:${Se.id}`;t&&C(e=>e.includes(t)?e:[...e,t])},Te=e=>{me.current=null,re(null),ae(null),T(!1),x(b===e?null:e),C(t=>t.includes(e)?t:[...t,e])},G=(e,t,n)=>{me.current=null,de.current=e;let r=t=>e.startsWith(`add:`)?t.startsWith(`add:`):t===e;C(e=>e.filter(e=>!r(e))),N(e=>Object.fromEntries(Object.entries(e).filter(([e])=>!r(e)))),e.startsWith(`add:`)?T(!1):x(null),t&&(ae(t),re({purpose:`use`,provider:n??e}),m(e=>e+1),o().catch(()=>!1))},Ee=(t,a,s,c)=>{if(!he)return null;let l=d?.auth.providers.find(e=>e.id===a),f=e=>L(n=>n[t]===e?n:{...n,[t]:e}),p=()=>{G(t),m(e=>e+1),o().catch(()=>!1)};return t.startsWith(`add:account:`)?l&&(0,K.jsxs)(`div`,{className:`models-editor`,children:[(0,K.jsx)(BF,{sessionId:e,auth:l,busy:i,onSaving:f,onAuthenticated:()=>G(t,l.name||l.id,l.id),onReload:p}),!I[t]&&(0,K.jsx)(`div`,{className:`models-editor-actions`,children:(0,K.jsx)(`button`,{type:`button`,className:`models-button`,onClick:()=>G(t),children:u(`cancel`)})})]}):(0,K.jsx)(WF,{sessionId:e,providerId:a,configuration:he,auth:l,isNew:s,custom:c,taken:[...d?.auth.providers.map(e=>e.id)??[],...ge],currentModel:r,availableModels:n.filter(e=>e.provider===a),busy:i,onDirty:e=>N(n=>n[t]===e?n:{...n,[t]:e}),onSaving:f,onClose:(e,n)=>G(t,e,n),onReload:p},t)},De=e=>ve.find(t=>t.id===e)?.name??e,Oe=e=>n.find(t=>t.provider===e.provider&&t.id===e.id)?.name||e.id,ke=(e,t,n)=>{me.current=t,re({purpose:e,provider:n}),x(null),T(!1)},Ae=(n,a)=>(0,K.jsx)(GF,{sessionId:e,sessionPath:t,provider:a,purpose:n,initialModel:n==="default"?B?.model:r,busy:i,onSelectModel:s,onDefaultSaved:e=>{V(e),te(!1),o().catch(()=>!1)},onSaving:ee,onClose:()=>{re(null)}},`${n}:${a??`all`}`);return(0,K.jsxs)(`div`,{className:`models-page`,children:[(0,K.jsxs)(`div`,{className:`models-section`,children:[(0,K.jsx)(`h2`,{children:u(`modelSettings`)}),(0,K.jsx)(`p`,{className:`models-intro`,children:u(`modelsIntro`)}),ie&&(0,K.jsx)(`p`,{className:`models-saved`,role:`status`,children:u(`providerSaved`,{provider:ie})}),v&&(0,K.jsxs)(`div`,{className:`models-error`,role:`alert`,children:[u(`providerLoadFailed`),` `,(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:h,onClick:()=>m(e=>e+1),children:u(`retryAdmissionCheck`)})]}),se&&!U&&(0,K.jsxs)(`div`,{className:`models-error`,role:`alert`,children:[se,` `,(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:h,onClick:()=>{ce(null),m(e=>e+1)},children:u(`refreshStatus`)})]}),!d&&h&&(0,K.jsx)(`p`,{className:`models-hint`,role:`status`,children:u(`providerLoading`)}),(0,K.jsxs)(`div`,{className:`models-default-card`,children:[(0,K.jsxs)(`div`,{className:`models-default-row`,children:[(0,K.jsxs)(`div`,{className:`models-default-copy`,children:[(0,K.jsx)(`span`,{className:`models-default-title`,children:u(`modelDefaultTitle`)}),H?(0,K.jsx)(`span`,{className:`models-hint`,children:u(`modelDefaultReadFailed`)}):B?.model?(0,K.jsxs)(`span`,{className:`models-default-value`,children:[(0,K.jsx)(NN,{id:B.model.provider}),(0,K.jsxs)(`span`,{children:[Oe(B.model),(0,K.jsx)(`small`,{children:De(B.model.provider)})]})]}):(0,K.jsx)(`span`,{className:`models-hint`,children:u(B?`modelDefaultNotSet`:`loadingModels`)})]}),(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:z||i||Object.values(M).some(Boolean)||!t,"aria-expanded":ne?.purpose==="default",onClick:e=>H?m(e=>e+1):ne?.purpose==="default"?re(null):ke(`default`,e.currentTarget),children:u(H?`refreshStatus`:`modelDefaultChoose`)})]}),B?.projectOverride&&(0,K.jsx)(`p`,{className:`models-hint`,children:u(`modelDefaultProjectOverride`,{model:`${De(B.projectOverride.provider)} / ${Oe(B.projectOverride)}`})}),ne?.purpose==="default"&&Ae(`default`)]}),(0,K.jsx)(`ul`,{className:`models-provider-list`,children:ve.map(e=>{let n=!w&&b===e.id,a=e.auth?.custom??ge.has(e.id);return(0,K.jsxs)(`li`,{className:`models-provider-card`,children:[(0,K.jsxs)(`div`,{className:`models-provider-head`,children:[(0,K.jsxs)(`div`,{className:`models-provider-identity`,children:[(0,K.jsx)(`span`,{className:`models-provider-avatar`,"aria-hidden":`true`,children:(0,K.jsx)(NN,{id:e.id})}),(0,K.jsxs)(`div`,{className:`models-provider-label`,children:[(0,K.jsx)(`span`,{className:`models-provider-name`,children:e.name}),a&&(0,K.jsx)(`span`,{className:`models-provider-tag`,children:u(`providerCustomTag`)}),B?.model?.provider===e.id&&(0,K.jsx)(`span`,{className:`models-provider-tag`,children:u(`modelDefaultBadge`)}),r?.provider===e.id&&(0,K.jsx)(`span`,{className:`models-provider-tag`,children:u(`modelCurrentBadge`)}),e.auth&&(0,K.jsxs)(`span`,{className:`models-provider-status`,children:[(0,K.jsx)(`span`,{className:`models-credential-dot ${e.auth.configured?`configured`:`missing`}`,role:`img`,"aria-label":u(e.auth.configured?`credentialConfigured`:`credentialMissing`),title:u(e.auth.configured?`credentialConfigured`:`credentialMissing`)}),u(e.auth.subscription?`accountLoginConfigured`:e.auth.configured?`credentialConfigured`:`credentialMissing`)]})]})]}),(0,K.jsxs)(`div`,{className:`models-provider-actions`,children:[e.auth?.configured&&(0,K.jsx)(`button`,{type:`button`,className:`models-button`,disabled:z||i||Object.values(M).some(Boolean)||!t,"aria-label":u(`modelConnectionChooseProvider`,{provider:e.name}),"aria-expanded":ne?.purpose===`use`&&ne.provider===e.id,onClick:t=>ne?.purpose===`use`&&ne.provider===e.id?re(null):ke(`use`,t.currentTarget,e.id),children:u(`selectModel`)}),(0,K.jsx)(`button`,{type:`button`,className:`models-button`,"aria-label":u(`editProvider`,{provider:e.name}),ref:t=>{t?fe.current.set(e.id,t):fe.current.delete(e.id)},"aria-expanded":n,disabled:z,onClick:()=>Te(e.id),children:u(e.auth?.authMethods.includes(`oauth`)&&!e.auth.configured?`accountLoginStart`:`providerEdit`)}),ge.has(e.id)&&(0,K.jsx)(`button`,{type:`button`,className:`models-button danger`,"aria-label":u(`removeProvider`,{provider:e.name}),disabled:z||i||r?.provider===e.id,title:r?.provider===e.id?u(`providerCurrentRemoval`):void 0,onClick:()=>{oe(e.id),ce(null)},children:u(`providerRemove`)})]})]}),ne?.purpose===`use`&&ne.provider===e.id&&Ae(`use`,e.id),S.includes(e.id)&&(0,K.jsx)(`div`,{hidden:!n,children:Ee(e.id,e.id,!1,a)})]},e.id)})}),he&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{hidden:!w,className:`models-add-card`,children:[(0,K.jsx)(`fieldset`,{className:`models-add-modes`,"aria-label":u(`providerAddMode`),onKeyDown:e=>{if(z||![`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key))return;e.preventDefault();let t=Ce.filter(e=>e.available),n=t.findIndex(e=>e.id===E),r=t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowRight`?1:-1)+t.length)%t.length].id;we(r),e.currentTarget.querySelectorAll(`button`)[Ce.findIndex(e=>e.id===r)]?.focus()},children:Ce.map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":E===e.id,disabled:z||!e.available,onClick:()=>we(e.id),children:u(e.label)},e.id))}),(0,K.jsx)(`p`,{className:`models-hint`,children:u(Ce.find(e=>e.id===E)?.hint??`providerCustomHint`)}),(0,K.jsxs)(`div`,{hidden:E!==`account`,children:[xe&&(0,K.jsx)(`div`,{className:`models-provider-select`,children:(0,K.jsx)(RF,{label:u(`provider`),className:`models-provider-picker`,options:be.map(e=>({value:e.id,label:e.name||e.id,icon:(0,K.jsx)(NN,{id:e.id})})),value:xe.id,isDisabled:z,placement:`below`,onChange:e=>{k(e);let t=`add:account:${e}`;C(e=>e.includes(t)?e:[...e,t])}})}),S.filter(e=>e.startsWith(`add:account:`)).map(e=>(0,K.jsx)(`div`,{hidden:e!==`add:account:${xe?.id}`,children:Ee(e,e.slice(12),!0,!1)},e))]}),(0,K.jsxs)(`div`,{hidden:E!==`catalog`,children:[Se&&(0,K.jsx)(`div`,{className:`models-provider-select`,children:(0,K.jsx)(RF,{label:u(`provider`),className:`models-provider-picker`,options:ye.map(e=>({value:e.id,label:e.name||e.id,icon:(0,K.jsx)(NN,{id:e.id})})),value:Se.id,isDisabled:z,placement:`below`,onChange:e=>{j(e);let t=`add:${e}`;C(e=>e.includes(t)?e:[...e,t])}})}),S.filter(e=>e.startsWith(`add:`)&&e!==`add:custom`&&!e.startsWith(`add:account:`)).map(e=>(0,K.jsx)(`div`,{hidden:e!==`add:${Se?.id}`,children:Ee(e,e.slice(4),!0,!1)},e))]}),S.includes(`add:custom`)&&(0,K.jsx)(`div`,{hidden:E!==`custom`,children:Ee(`add:custom`,``,!0,!0)})]}),!w&&(0,K.jsxs)(`button`,{type:`button`,className:`models-add-button`,ref:pe,disabled:z,onClick:()=>{me.current=null,re(null),T(!0),x(null),ae(null),we(Ce.find(e=>e.id===E)?.available?E:Ce.find(e=>e.available).id)},children:[(0,K.jsx)(lt,{"aria-hidden":`true`}),u(`providerAdd`)]})]}),i&&(0,K.jsx)(`p`,{className:`models-hint`,role:`status`,children:u(`modelSelectionBusy`)})]}),U&&(0,K.jsx)(qP,{isOpen:!0,title:u(`removeProvider`,{provider:ve.find(e=>e.id===U)?.name||U}),description:se||u(`providerRemoveDetail`),isActionLoading:z,cancelLabel:u(`cancel`),actionLabel:u(z?`savingSettings`:`providerRemove`),onOpenChange:e=>{!e&&!z&&oe(null)},onAction:()=>{if(z||i||!he)return;let t=new AbortController;le.current=t,F(!0),ce(null),new lf().changeProviderConfiguration(e,he.revision,{action:`remove`,provider:U},t.signal).then(()=>{t.signal.aborted||(G(U),oe(null),m(e=>e+1),o().catch(()=>!1))},e=>{t.signal.aborted||ce(u(e instanceof sf&&e.code===`MODEL_CONFIGURATION_CONFLICT`?`modelConfigurationConflict`:`providerConfigurationFailed`))}).finally(()=>{t.signal.aborted||F(!1)})}})]})}var qF=20,JF={track:{kVAEAm:`x10l6tqk`,kWkggS:`xdsb6cv`,kaIpWk:`xjspbzw`,$$css:!0},trackHorizontal:{kLqNvP:`x1o0tod`,kt4wiu:`xtijo5x`,kZKoxP:`xqu0tyb`,k87sOh:`xwa60dl`,k3aq6I:`x1cb1t30`,$$css:!0},trackVertical:{k87sOh:`x13vifvy`,krVfgx:`x1ey2m1c`,kzqmXN:`x51ohtg`,$$css:!0},filledTrack:{kVAEAm:`x10l6tqk`,kWkggS:`x1ewilqj`,kaIpWk:`xjspbzw`,$$css:!0},filledTrackHorizontal:{kZKoxP:`xqu0tyb`,k87sOh:`xwa60dl`,k3aq6I:`x1cb1t30`,$$css:!0},filledTrackVertical:{kzqmXN:`x51ohtg`,$$css:!0},thumb:{kVAEAm:`x10l6tqk`,kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,kaIpWk:`xjspbzw`,kWkggS:`x1ewilqj`,k3aq6I:`x11lhmoz`,k1ekBW:`x106061f`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,kI3sdo:`x1a2a7pz`,kkrTdU:`x1jm3nie x16khyan`,kY2c9j:`x1vjfegm`,$$css:!0},thumbHorizontal:{k87sOh:`xwa60dl`,k3aq6I:`x11lhmoz xoffwj3`,$$css:!0},thumbHover:{kWkggS:`x1ewilqj xvxo0qp`,$$css:!0},thumbDisabled:{kWkggS:`xwmxj5m`,kkrTdU:`xt0e3qv`,$$css:!0}};function YF(e,t,n){return Math.min(Math.max(e,t),n)}function XF(e){if(Math.abs(e)<1){let t=e.toExponential().split(`e-`);if(t.length===2)return(t[0].split(`.`)[1]?.length??0)+parseInt(t[1],10)}let t=String(e).split(`.`)[1];return t?t.length:0}function ZF(e,t,n){if(n<=0)return e;let r=t+Math.round((e-t)/n)*n,i=Math.min(Math.max(XF(t),XF(n)),20);return Number(r.toFixed(i))}function QF(e,t,n){return n===t?0:(e-t)/(n-t)*100}var $F=qF/2;function eI(e){return rI(e,$F-e/100*qF)}function tI(e,t){let n=t-e;return rI(n,-(n/100)*qF)}function nI(e,t){let n=t-qF;return n>0?(e-$F)/n:t>0?e/t:0}function rI(e,t){let n=e=>Number(e.toFixed(3));return`calc(${n(e)}% ${t<0?`-`:`+`} ${Math.abs(n(t))}px)`}function iI({ref:e,...t}){let{label:n,isLabelHidden:r=!1,description:i,isDisabled:a=!1,disabledMessage:o,isOptional:s=!1,isRequired:c=!1,status:l,labelTooltip:u,min:d=0,max:f=100,step:p=1,orientation:m=`horizontal`,formatValue:h,htmlName:g,valueDisplay:v=`tooltip`,marks:y,width:b,xstyle:x,className:S,style:C,"data-testid":w,value:T,onChange:E,onChangeEnd:D}=t,O=Array.isArray(T),k=O&&`minStepsBetweenThumbs`in t?t.minStepsBetweenThumbs??0:0,A=m===`horizontal`,j=(0,_.useId)(),M=(0,_.useId)(),N=(0,_.useId)(),P=(0,_.useId)(),F=(0,_.useId)(),I=(0,_.useRef)(null),L=(0,_.useRef)(null),[R,ee]=(0,_.useState)(null),[z,B]=(0,_.useState)(null);(0,_.useEffect)(()=>{Zi()},[]);let V=(0,_.useCallback)((e,t)=>{B(!a&&Qi()===`keyboard`?e:null)},[a]),H=(0,_.useCallback)(e=>{B(null)},[]),te=a&&!!o,ne=po({placement:`above`,focusTrigger:`always`,isEnabled:te}),re=c&&!s,ie=[];i&&ie.push(N),l?.message&&ie.push(P),re&&ie.push(F),te&&ie.push(ne.describedBy);let ae=ie.length>0?ie.join(` `):void 0,U=(0,_.useMemo)(()=>(Array.isArray(T)?T:[T??d]).map(e=>YF(e,d,f)),[T,d,f]),oe=(0,_.useRef)(U);oe.current=U;let se=(0,_.useCallback)((e,t)=>{let n=I.current;if(!n)return d;let r=n.getBoundingClientRect(),i;return i=A?nI(pA(n)?r.right-e:e-r.left,r.width):1-nI(t-r.top,r.height),i=YF(i,0,1),YF(ZF(d+i*(f-d),d,p),d,f)},[d,f,p,A]),ce=(0,_.useCallback)(e=>{if(!O)return 0;let[t,n]=U;return Math.abs(e-t)<=Math.abs(e-n)?0:1},[O,U]),le=(0,_.useCallback)((e,t)=>{if(a)return;let n=YF(ZF(t,d,p),d,f);if(O){let t=[...U];t[e]=n;let r=k*p;e===0?t[0]=Math.min(t[0],t[1]-r):t[1]=Math.max(t[1],t[0]+r),t[0]=YF(t[0],d,f),t[1]=YF(t[1],d,f),E?.(t)}else E?.(n)},[a,O,U,d,f,p,k,E]),ue=(0,_.useRef)(D);ue.current=D;let de=(0,_.useCallback)(e=>{let t=e??oe.current,n=ue.current;O?n?.(t):n?.(t[0])},[O]),fe=(0,_.useCallback)(e=>{if(a)return;e.preventDefault();let t=e.target.closest(`[data-mark-value]`),n=t?Number(t.dataset.markValue):se(e.clientX,e.clientY),r=ce(n);L.current=r,ee(r),le(r,n);let i=I.current;i&&i.querySelectorAll(`[role="slider"]`)[r]?.focus(),B(null),typeof e.currentTarget.setPointerCapture==`function`&&e.currentTarget.setPointerCapture(e.pointerId)},[a,se,ce,le]),pe=(0,_.useCallback)(e=>{if(L.current===null||a)return;let t=se(e.clientX,e.clientY);le(L.current,t)},[a,se,le]),me=(0,_.useCallback)(e=>{L.current!==null&&(L.current=null,ee(null),de())},[de]),W=(0,_.useCallback)((e,t)=>{if(a)return;Qi()===`keyboard`&&B(e);let n=U[e],r;switch(t.key){case`ArrowRight`:case`ArrowUp`:r=n+p;break;case`ArrowLeft`:case`ArrowDown`:r=n-p;break;case`PageUp`:r=n+p*10;break;case`PageDown`:r=n-p*10;break;case`Home`:r=d;break;case`End`:r=f;break;default:return}t.preventDefault();let i=YF(ZF(r,d,p),d,f);if(le(e,r),O){let t=[...U];t[e]=i;let n=k*p;e===0?t[0]=Math.min(t[0],t[1]-n):t[1]=Math.max(t[1],t[0]+n),t[0]=YF(t[0],d,f),t[1]=YF(t[1],d,f),de(t)}else de([i])},[a,O,U,p,d,f,k,le,de]),he=e=>h?h(e):String(e),ge=e=>{let t=U[e],n=QF(t,d,f),r=A?{insetInlineStart:eI(n)}:{bottom:eI(n),left:`50%`},i=O?e===0?`Minimum value`:`Maximum value`:void 0,o=k*p,s=O&&e===1?YF(U[0]+o,d,f):d,c=O&&e===0?YF(U[1]-o,d,f):f,u=v===`tooltip`&&!te,g=A?`above`:`start`,_=(0,K.jsx)(`div`,{id:O?void 0:j,role:`slider`,tabIndex:a&&!te?-1:0,"aria-valuemin":s,"aria-valuemax":c,"aria-valuenow":t,"aria-valuetext":h?h(t):void 0,"aria-orientation":m,"aria-disabled":a||void 0,"aria-invalid":l?.type===`error`||void 0,"aria-label":i,"aria-labelledby":O?void 0:M,"aria-describedby":ae,onKeyDown:t=>W(e,t),onFocus:t=>V(e,t),onBlur:H,...oa(ba(`slider-thumb`,{orientation:m,disabled:a?`disabled`:null}),Sr(JF.thumb,A?JF.thumbHorizontal:Ra.centerInline(`50%`),!a&&JF.thumbHover,!a&&z===e&&Ha.focusVisible,a&&JF.thumbDisabled),void 0,r)},e);return u?(0,K.jsx)(Cd,{content:he(t),placement:g,delay:0,focusTrigger:`always`,isOpen:R===e||void 0,children:_},e):_},_e=(()=>{if(O){let[e,t]=U,n=QF(e,d,f),r=QF(t,d,f);return A?{insetInlineStart:eI(n),width:tI(n,r)}:{bottom:eI(n),height:tI(n,r)}}let e=QF(U[0],d,f);return A?{insetInlineStart:`0%`,width:eI(e)}:{bottom:`0%`,height:eI(e)}})(),ve=v===`text`?(0,K.jsx)(`span`,{className:`x9ynric xcr08ib x1tgivj0 xuxw1ft x2lah0s`,children:O?`${he(U[0])} – ${he(U[1])}`:he(U[0])}):null;return(0,K.jsxs)(LM,{"data-testid":w,label:n,isLabelHidden:r,description:i,inputID:j,labelID:M,isGroupLabel:!0,descriptionID:i?N:void 0,isOptional:s,isRequired:c,isDisabled:a,status:l?{type:l.type,message:l.message,messageID:l.message?P:void 0}:void 0,labelTooltip:u,statusVariant:`detached`,width:b,xstyle:x,className:S,style:C,children:[(0,K.jsxs)(`div`,{...oa(ba(`slider`,{orientation:m,disabled:a?`disabled`:null}),{className:`x78zum5 x6s0dn4 x1txdalj`}),children:[g!=null&&U.map((e,t)=>(0,K.jsx)(`input`,{type:`hidden`,name:g,value:String(e),disabled:a},t===0?`start`:`end`)),(0,K.jsxs)(`div`,{ref:Ao(e,I,ne.ref),...O?{role:`group`,"aria-labelledby":M}:void 0,onPointerDown:fe,onPointerMove:pe,onPointerUp:me,onPointerCancel:me,...{0:{className:`x1n2onr6 x78zum5 x6s0dn4 x1iyjqo2 x5ve5x3 x87ps6o xc8icb0 xw4jnvo x1ymw6g xkagaj0 xdt5ytf xl56j7k x1ypdohk x16khyan`},2:{className:`x1n2onr6 x78zum5 x6s0dn4 x1iyjqo2 x5ve5x3 x87ps6o xc8icb0 x1qx5ct2 x80b3aj xh8yej3 x1ypdohk x16khyan`},1:{className:`x1n2onr6 x78zum5 x6s0dn4 x1iyjqo2 x5ve5x3 x87ps6o xc8icb0 xw4jnvo x1ymw6g xkagaj0 xdt5ytf xl56j7k xbyyjgo xt0e3qv`},3:{className:`x1n2onr6 x78zum5 x6s0dn4 x1iyjqo2 x5ve5x3 x87ps6o xc8icb0 x1qx5ct2 x80b3aj xh8yej3 xbyyjgo xt0e3qv`}}[!!A<<1|!!a<<0],children:[(0,K.jsx)(`div`,{"aria-hidden":`true`,...oa(ba(`slider-track`,{orientation:m}),Sr(JF.track,A?JF.trackHorizontal:[JF.trackVertical,Ra.centerInline(`0px`)]))}),(0,K.jsx)(`div`,{"aria-hidden":`true`,...oa(Sr(JF.filledTrack,A?JF.filledTrackHorizontal:[JF.filledTrackVertical,Ra.centerInline(`0px`)]),{style:_e})}),y&&(0,K.jsx)(`div`,{"aria-hidden":`true`,...{0:{className:`x10l6tqk x13vifvy x1ey2m1c xbudbmw`},1:{className:`x10l6tqk x1o0tod xtijo5x xwa60dl`}}[!!A<<0],children:y.map(e=>{let t=QF(e.value,d,f),n=A?{insetInlineStart:eI(t)}:{bottom:eI(t)};return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{"data-testid":`slider-mark`,"data-mark-value":e.value,...oa({0:{className:`x10l6tqk x7njt3n xjspbzw x36qwtl x1xc55vz x1m9mm8y`},1:{className:`x10l6tqk x7njt3n xjspbzw xfo62xy xdk7pt x11lhmoz xoffwj3`}}[!!A<<0],{style:n})}),e.label&&(0,K.jsx)(`span`,{"data-testid":`slider-mark-label`,"data-mark-value":e.value,...oa({0:{className:`x10l6tqk x9ynric x141an7d xv1l7n4 xuxw1ft x131p8rn x9p6ekw`},1:{className:`x10l6tqk x9ynric x141an7d xv1l7n4 xuxw1ft xuuh30 x1nyx83j xuivejd`}}[!!A<<0],{style:n}),children:e.label})]},e.value)})}),U.map((e,t)=>ge(t))]}),ve]}),re&&(0,K.jsx)(es,{id:F,children:`Required`}),te&&ne.renderTooltip(o)]})}iI.displayName=`Slider`;var aI=[`explorer`,`implementer`,`reviewer`,`advisor`];function oI({catalog:e,error:t,onRefresh:n}){let{t:r}=cr();return!t&&!e?(0,K.jsxs)(`div`,{className:`settings-load-state`,role:`status`,children:[(0,K.jsx)(dt,{className:`settings-spin`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:r(`settingsCatalogLoading`)})]}):t?(0,K.jsxs)(`div`,{className:`settings-load-state error`,role:`alert`,children:[(0,K.jsx)(`strong`,{children:r(`settingsCatalogFailed`)}),(0,K.jsx)(`span`,{children:t}),(0,K.jsx)(`button`,{type:`button`,onClick:n,children:r(`retryAdmissionCheck`)})]}):null}function sI({isPending:e,isBlocked:t=!1,onConfigure:n,request:r,label:i}){return(0,K.jsx)(qc,{label:i,variant:`secondary`,size:`sm`,icon:(0,K.jsx)(It,{"aria-hidden":`true`}),isDisabled:e||t,isLoading:e,onClick:()=>void n(r)})}function cI({pending:e,onConfigure:t,placeholder:n}){let{t:r}=cr(),[i,a]=(0,_.useState)(``);return(0,K.jsxs)(`form`,{className:`settings-edit-form`,onSubmit:n=>{n.preventDefault(),!e&&i.trim()&&t(i.trim())},children:[(0,K.jsxs)(`label`,{className:`settings-form-field`,children:[r(`setupConfigurationRequest`),(0,K.jsx)(`textarea`,{required:!0,maxLength:2e3,value:i,disabled:e,placeholder:n,onChange:e=>a(e.target.value)})]}),(0,K.jsx)(`button`,{type:`submit`,disabled:e||!i.trim(),children:r(`configureViaSetup`)}),(0,K.jsx)(`small`,{children:r(`setupFormDetail`)})]})}function lI({catalog:e,error:t,currentModel:n,thinkingLevel:r,cwd:i,setupPending:a,setupBlocked:o=!1,preferencePending:s,setupBusy:c,setupBlockedReason:l,onConfigure:u,onUpdatePreferences:d,onOpenRuntimeStatus:f,onRefresh:p}){let{t:m}=cr(),h=e?.setup,g=h?.workflows.concurrency??0,v=h?.workflows.maxAgentCalls??0,[y,b]=(0,_.useState)(g),[x,S]=(0,_.useState)(v);return(0,_.useEffect)(()=>b(g),[g]),(0,_.useEffect)(()=>S(v),[v]),(0,K.jsxs)(`section`,{className:`settings-general-panel`,children:[(0,K.jsxs)(`div`,{className:`settings-page-heading`,children:[(0,K.jsx)(`div`,{children:(0,K.jsx)(`h1`,{children:m(`generalSettings`)})}),(0,K.jsx)(sI,{isPending:a,isBlocked:o,onConfigure:u,request:m(`setupRequestReviewAll`),label:m(`configureOpenPi`)})]}),c&&(0,K.jsx)(`p`,{className:`settings-pending-hint`,role:`status`,children:l||m(`settingsSetupBusyHint`)}),(0,K.jsx)(oI,{catalog:e,error:t,onRefresh:p}),h&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{className:`settings-section-block`,children:[(0,K.jsx)(`h2`,{children:m(`agentBehavior`)}),(0,K.jsxs)(`div`,{className:`settings-chat-controls`,children:[(0,K.jsxs)(`label`,{className:`settings-inline-control`,children:[(0,K.jsx)(St,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:m(`capabilityDiscovery`)}),(0,K.jsx)(`select`,{value:h.capabilities.discovery,disabled:a||o,onChange:e=>void u(m(`setupRequestDiscovery`,{mode:e.target.value})),children:[`explicit`,`adaptive`].map(e=>(0,K.jsx)(`option`,{value:e,children:m(`capabilityDiscovery_${e}`)},e))})]}),(0,K.jsxs)(`form`,{className:`settings-limits-control`,onSubmit:e=>{e.preventDefault(),!a&&!o&&u(m(`setupRequestLimits`,{concurrency:y,calls:x}))},children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(ke,{"aria-hidden":`true`}),m(`workflowLimits`)]}),(0,K.jsx)(`small`,{children:m(`workflowLimitsValue`,{concurrency:h.workflows.concurrency,calls:h.workflows.maxAgentCalls})}),(0,K.jsxs)(`label`,{children:[m(`workflowConcurrency`),(0,K.jsx)(`input`,{type:`number`,min:1,value:y,disabled:a||o,onChange:e=>b(Number(e.target.value)),required:!0})]}),(0,K.jsxs)(`label`,{children:[m(`workflowCalls`),(0,K.jsx)(`input`,{type:`number`,min:1,value:x,disabled:a||o,onChange:e=>S(Number(e.target.value)),required:!0})]}),(0,K.jsx)(`button`,{type:`submit`,disabled:a||o||y===h.workflows.concurrency&&x===h.workflows.maxAgentCalls,children:m(`configureViaSetup`)})]}),(0,K.jsx)(rF,{label:m(`nextActionSuggestions`),value:h.suggestions.enabled,size:`sm`,width:`100%`,labelPosition:`start`,labelSpacing:`spread`,isDisabled:a||o,isLoading:a,onChange:e=>void u(m(e?`setupRequestEnableSuggestions`:`setupRequestDisableSuggestions`))}),h.suggestions.model&&(0,K.jsx)(`small`,{children:`${h.suggestions.model.provider}/${h.suggestions.model.model} · ${h.suggestions.model.reasoning}`}),(0,K.jsxs)(`div`,{className:`settings-inline-control`,children:[(0,K.jsx)(ce,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[m(`postEditCommand`),` ·`,` `,m(h.postEditConfigured?`configured`:`disabled`)]}),(0,K.jsx)(sI,{isPending:a,isBlocked:o,onConfigure:u,request:m(`setupRequestPostEdit`),label:m(`configurePostEdit`)})]}),(0,K.jsx)(`small`,{children:m(`agentSettingsSetupHint`)})]})]}),(0,K.jsxs)(`section`,{className:`settings-section-block`,children:[(0,K.jsx)(`h2`,{children:m(`resultDisplay`)}),(0,K.jsxs)(`div`,{className:`settings-chat-controls`,children:[[[`subagentResultDisplay`,`subagentResults`],[`bashToolDisplay`,`bashOperations`],[`fileMutationDisplay`,`fileMutations`]].map(([e,t])=>(0,K.jsxs)(`label`,{className:`settings-inline-control`,children:[(0,K.jsx)(`span`,{children:m(t)}),(0,K.jsxs)(`select`,{value:h.ui[e],disabled:s,onChange:t=>{let n=t.target.value;(n===`full`||n===`compact`)&&d({[e]:n})},children:[(0,K.jsx)(`option`,{value:`compact`,children:m(`detailDisplay_compact`)}),(0,K.jsx)(`option`,{value:`full`,children:m(`detailDisplay_full`)})]})]},e)),(0,K.jsx)(rF,{label:m(`terminalFooter`),value:h.ui.customFooter,size:`sm`,width:`100%`,labelPosition:`start`,labelSpacing:`spread`,isDisabled:s,isLoading:s,onChange:e=>void d({customFooter:e})}),(0,K.jsxs)(`label`,{className:`settings-inline-control`,children:[(0,K.jsx)(`span`,{children:m(`terminalFooterStyle`)}),(0,K.jsxs)(`select`,{value:h.ui.footerStyle,disabled:s||!h.ui.customFooter,onChange:e=>{let t=e.target.value;(t===`plain`||t===`powerline`||t===`powerline-mono`)&&d({footerStyle:t})},children:[(0,K.jsx)(`option`,{value:`plain`,children:`Plain`}),(0,K.jsx)(`option`,{value:`powerline`,children:`Powerline`}),(0,K.jsx)(`option`,{value:`powerline-mono`,children:`Powerline Mono`})]})]}),(0,K.jsx)(`small`,{children:m(`terminalFooterHint`)})]})]})]}),(0,K.jsxs)(`section`,{className:`settings-section-block`,children:[(0,K.jsx)(`h2`,{children:m(`sessionSettings`)}),(0,K.jsxs)(`dl`,{className:`settings-summary-list`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:m(`selectedModel`)}),(0,K.jsx)(`dd`,{children:n?.label??m(`noModels`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:m(`thinkingLevel`)}),(0,K.jsx)(`dd`,{children:r})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:m(`currentWorkspace`)}),(0,K.jsx)(`dd`,{title:i,children:i})]})]}),(0,K.jsx)(qc,{label:m(`openRuntimeDetails`),variant:`secondary`,size:`sm`,icon:(0,K.jsx)(we,{"aria-hidden":`true`}),className:`settings-runtime-action`,onClick:f})]})]})}function uI(e){return e.split(/[\\/]/u).filter(Boolean).at(-1)||e}function dI({kind:e,query:t,scope:n,onQuery:r,onScope:i,onAdd:a}){let{t:o}=cr();return(0,K.jsxs)(`div`,{className:`settings-resource-toolbar`,children:[(0,K.jsxs)(`div`,{className:`settings-resource-toolbar-heading`,children:[(0,K.jsx)(`strong`,{children:o(e===`skills`?`skillsSettings`:`pluginsSettings`)}),(0,K.jsx)(qc,{label:o(e===`skills`?`addSkill`:`addPlugin`),variant:`secondary`,size:`sm`,icon:(0,K.jsx)(lt,{"aria-hidden":`true`}),onClick:a})]}),(0,K.jsxs)(`label`,{className:`settings-resource-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`input`,{type:`search`,"aria-label":o(`searchResources`),placeholder:o(`searchResources`),value:t,onChange:e=>r(e.target.value)})]}),(0,K.jsxs)(`select`,{"aria-label":o(`filterResourceScope`),value:n,onChange:e=>i(e.target.value),children:[(0,K.jsx)(`option`,{value:`all`,children:o(`allResourceScopes`)}),[`project`,`user`,`temporary`].map(e=>(0,K.jsx)(`option`,{value:e,children:o(`resourceScope_${e}`)},e))]})]})}function fI({kind:e,pending:t,onConfigure:n,onCancel:r}){let{t:i}=cr(),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(`user`);return(0,K.jsxs)(`section`,{className:`settings-resource-install`,children:[(0,K.jsx)(`header`,{className:`settings-detail-heading`,children:(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{children:i(`resourceManagement`)}),(0,K.jsx)(`h1`,{children:i(e===`skills`?`addSkill`:`addPlugin`)}),(0,K.jsx)(`p`,{children:i(`resourceInstallIntro`)})]})}),(0,K.jsxs)(`form`,{className:`settings-edit-form`,onSubmit:r=>{r.preventDefault(),!t&&a.trim()&&n(i(`setupResourceInstallRequest`,{kind:i(e===`skills`?`skillsSettings`:`pluginsSettings`),source:JSON.stringify(a.trim()),scope:s}))},children:[(0,K.jsxs)(`label`,{className:`settings-form-field`,children:[i(`resourcePackageSource`),(0,K.jsx)(`input`,{required:!0,maxLength:1e3,value:a,placeholder:i(`resourcePackageSourcePlaceholder`),disabled:t,onChange:e=>{o(e.target.value)}})]}),(0,K.jsxs)(`label`,{className:`settings-form-field`,children:[i(`scope`),(0,K.jsxs)(`select`,{value:s,disabled:t,onChange:e=>{c(e.target.value)},children:[(0,K.jsx)(`option`,{value:`user`,children:i(`resourceScope_user`)}),(0,K.jsx)(`option`,{value:`project`,children:i(`resourceScope_project`)})]})]}),(0,K.jsxs)(`div`,{className:`settings-resource-actions`,children:[(0,K.jsx)(qc,{type:`submit`,label:i(`configureViaSetup`),variant:`secondary`,size:`sm`,isDisabled:t||!a.trim()}),(0,K.jsx)(qc,{label:i(`cancel`),variant:`ghost`,size:`sm`,onClick:r})]}),(0,K.jsx)(`small`,{children:i(`resourceInstallReview`)})]}),e===`skills`&&(0,K.jsxs)(`a`,{className:`settings-resource-link`,href:`https://skills.sh`,target:`_blank`,rel:`noreferrer`,children:[i(`browseSkills`),(0,K.jsx)(he,{"aria-hidden":`true`})]})]})}function pI({catalog:e,pending:t,onReload:n,kind:r,onConfigure:i,children:a}){let{t:o}=cr(),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null);return(0,K.jsxs)(`section`,{className:`settings-resource-management`,children:[a&&(0,K.jsx)(`div`,{className:`settings-resource-actions`,children:a}),(0,K.jsxs)(`div`,{className:`settings-resource-reload`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:o(`resourceSessionState`)}),(0,K.jsx)(`p`,{children:o(`resourcesReloadNote`)})]}),(0,K.jsx)(qc,{label:o(`reloadResources`),variant:`secondary`,size:`sm`,icon:(0,K.jsx)(dt,{"aria-hidden":`true`}),isDisabled:t||l||!e?.sessionPath||!n,isLoading:l,onClick:()=>c(!0)})]}),d&&(0,K.jsx)(`p`,{className:`settings-resource-notice`,role:`status`,children:d}),(0,K.jsxs)(`details`,{className:`settings-resource-advanced`,children:[(0,K.jsx)(`summary`,{children:o(`advancedResourceConfiguration`)}),(0,K.jsx)(cI,{pending:t,onConfigure:i,placeholder:o(r===`skills`?`setupSkillsPlaceholder`:`setupPluginsPlaceholder`)})]}),s&&(0,K.jsx)(qP,{isOpen:!0,onOpenChange:c,title:o(`reloadResources`),description:o(`resourceReloadReview`),cancelLabel:o(`cancel`),actionLabel:o(`reloadResources`),onAction:()=>{c(!1),u(!0),f(null),n?.().then(()=>f(o(`resourceReloaded`)),e=>f(e instanceof Error?e.message:o(`resourceReloadFailed`))).finally(()=>u(!1))}})]})}function mI({catalog:e}){let{t}=cr();if(!e)return null;let{diagnostics:n,truncation:r}=e.resources;return!n.settingsErrors&&!n.extensionErrors&&!n.skillErrors&&!r.truncated?null:(0,K.jsxs)(`p`,{className:`settings-resource-notice`,role:`status`,children:[t(`resourceDiagnostics`,n),n.settingsErrors?` ${t(`resourceConfigurationDiagnostics`,{count:n.settingsErrors})}`:``,r.truncated&&` ${t(`resourceCatalogTruncated`)}`]})}function hI({catalog:e,error:t,onRefresh:n,setupPending:r,onConfigure:i,onReload:a}){let{t:o}=cr(),s=e?.resources.skills??[],[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(`all`),[f,p]=(0,_.useState)(!1),m=(0,_.useMemo)(()=>s.filter(e=>(u===`all`||e.scope===u)&&`${e.name} ${e.description} ${e.source}`.toLocaleLowerCase().includes(c.trim().toLocaleLowerCase())),[s,c,u]),h=(0,_.useMemo)(()=>[`project`,`user`,`temporary`].map(e=>({scope:e,skills:m.filter(t=>t.scope===e)})).filter(e=>e.skills.length>0),[m]),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)(null),x=m.find(e=>e.id===g)??m[0],S=m.filter(e=>e.canManage!==!1),C=JSON.stringify(S.map(e=>e.filePath)),w=new TextEncoder().encode(C).length>12e3;(0,_.useEffect)(()=>{s.length&&!s.some(e=>e.id===g)&&v(s[0].id)},[g,s]);let T=e=>{b(null),wd(`/skill:${e.name} `).then(e=>b(e?`copied`:`failed`))};return(0,K.jsxs)(`section`,{className:`settings-split-panel settings-managed-panel`,children:[(0,K.jsxs)(`aside`,{className:`settings-resource-sidebar`,children:[(0,K.jsx)(dI,{kind:`skills`,query:c,scope:u,onQuery:l,onScope:d,onAdd:()=>p(!0)}),(0,K.jsxs)(`div`,{className:`settings-resource-list`,children:[h.map(e=>(0,K.jsxs)(`section`,{className:`settings-resource-group`,children:[(0,K.jsx)(`span`,{className:`settings-sidebar-label`,children:o(`resourceScope_${e.scope}`)}),e.skills.map(e=>(0,K.jsxs)(`button`,{type:`button`,className:`settings-resource-item`,"aria-current":e.id===x?.id?`page`:void 0,onClick:()=>{v(e.id),b(null),p(!1)},children:[(0,K.jsx)(St,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:e.name}),(0,K.jsx)(`small`,{children:o(e.disableModelInvocation?`explicitOnly`:`availableToModel`)})]})]},e.id))]},e.scope)),!e&&!t&&(0,K.jsx)(oI,{catalog:e,error:t,onRefresh:n}),e&&!m.length&&(0,K.jsx)(`p`,{className:`settings-resource-empty`,children:o(s.length?`noMatchingResources`:`noSkillsFound`)})]}),(0,K.jsxs)(`div`,{className:`settings-sidebar-footer`,children:[(0,K.jsx)(`span`,{children:o(`skillCount`,{count:s.length})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o(`refreshStatus`),onClick:n,children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{className:`settings-resource-detail`,children:[(0,K.jsx)(mI,{catalog:e}),f?(0,K.jsx)(fI,{kind:`skills`,pending:r,onConfigure:i,onCancel:()=>p(!1)}):t?(0,K.jsx)(oI,{catalog:e,error:t,onRefresh:n}):x?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`header`,{className:`settings-detail-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`span`,{children:[o(`resourceScope_${x.scope}`),` · `,o(`skill`)]}),(0,K.jsx)(`h1`,{children:x.name}),(0,K.jsx)(`p`,{children:x.description})]}),(0,K.jsx)(qc,{label:o(y===`copied`?`copiedMessage`:`copySkillInvocation`),variant:`secondary`,size:`sm`,icon:y===`copied`?(0,K.jsx)(I,{}):(0,K.jsx)(oe,{}),onClick:()=>T(x)})]}),(0,K.jsxs)(`dl`,{className:`settings-detail-metadata`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`source`)}),(0,K.jsx)(`dd`,{children:x.source===`auto`?o(`resourceSourceAuto`):x.source===`local`?o(`resourceSourceLocal`):x.source===`builtin`?o(`builtIn`):x.source})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`scope`)}),(0,K.jsx)(`dd`,{children:o(`resourceScope_${x.scope}`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`invocation`)}),(0,K.jsx)(`dd`,{children:(0,K.jsx)(`code`,{children:`/skill:${x.name}`})})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`modelInvocation`)}),(0,K.jsx)(`dd`,{children:o(x.disableModelInvocation?`explicitOnly`:`availableToModel`)})]})]}),(0,K.jsxs)(`section`,{className:`settings-path-block`,children:[(0,K.jsx)(Se,{"aria-hidden":`true`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:o(`skillFile`)}),(0,K.jsx)(`code`,{children:x.filePath})]})]}),(0,K.jsxs)(`div`,{className:`settings-resource-actions`,children:[(0,K.jsx)(sI,{isPending:r,isBlocked:x.canManage===!1,onConfigure:i,label:o(x.disableModelInvocation?`enableSkillInvocation`:`disableSkillInvocation`),request:o(`setupSkillInvocationRequest`,{path:x.filePath,disabled:!x.disableModelInvocation})}),(0,K.jsx)(sI,{isPending:r,isBlocked:x.canManage===!1,onConfigure:i,label:o(`updateResource`),request:o(`setupSkillManageRequest`,{action:`update`,path:JSON.stringify(x.filePath),source:JSON.stringify(x.source),scope:x.scope})}),(0,K.jsx)(sI,{isPending:r,isBlocked:x.canManage===!1,onConfigure:i,label:o(`removeResource`),request:o(`setupSkillManageRequest`,{action:`remove`,path:JSON.stringify(x.filePath),source:JSON.stringify(x.source),scope:x.scope})})]}),x.canManage===!1&&(0,K.jsx)(`p`,{className:`settings-resource-notice`,children:o(`resourceTargetTruncated`)}),y===`failed`&&(0,K.jsx)(`p`,{className:`inspection-warning`,children:o(`copyFailed`)})]}):(0,K.jsxs)(`div`,{className:`settings-empty-detail`,children:[(0,K.jsx)(St,{"aria-hidden":`true`}),(0,K.jsx)(`h1`,{children:o(s.length?`noMatchingResources`:`skillsEmptyTitle`)}),(0,K.jsx)(`p`,{children:o(`skillsEmptyIntro`)}),(0,K.jsx)(qc,{label:o(`addSkill`),variant:`secondary`,size:`sm`,icon:(0,K.jsx)(lt,{"aria-hidden":`true`}),onClick:()=>p(!0)})]}),!f&&(0,K.jsxs)(pI,{catalog:e,pending:r,onReload:a,kind:`skills`,onConfigure:i,children:[S.length>1&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(sI,{isPending:r,isBlocked:w,onConfigure:i,label:o(`enableVisibleSkills`,{count:S.length}),request:o(`setupSkillsBulkRequest`,{paths:C,disabled:!1})}),(0,K.jsx)(sI,{isPending:r,isBlocked:w,onConfigure:i,label:o(`disableVisibleSkills`,{count:S.length}),request:o(`setupSkillsBulkRequest`,{paths:C,disabled:!0})})]}),w&&(0,K.jsx)(`p`,{className:`settings-resource-caption`,children:o(`resourceBulkTooLarge`)})]})]})]})}function gI({catalog:e,error:t,currentModel:n,models:r,activity:i,setupPending:a,setupBlocked:o=!1,onConfigure:s,onRefresh:c}){let{t:l}=cr(),[u,d]=(0,_.useState)(`explorer`),f=e?.setup.subagents.roleModels[u],[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(1);(0,_.useEffect)(()=>{let t=e?.setup.subagents.roleModels[u];m(t?`${t.provider}/${t.model}`:``),g(e?.setup.workflows.concurrency??1)},[u,e]);let v=i?.items.filter(e=>e.status===`running`).length??0,y=i?.items.filter(e=>e.status!==`running`).length??0;return(0,K.jsxs)(`section`,{className:`settings-subagents-panel`,children:[(0,K.jsxs)(`header`,{className:`settings-subagent-summary`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:l(`subagentConfiguration`)}),(0,K.jsx)(`span`,{children:l(`subagentConfigurationIntro`)})]}),e&&(0,K.jsxs)(`div`,{className:`settings-subagent-metrics`,children:[(0,K.jsx)(`span`,{children:l(`subagentActiveCount`,{count:v})}),(0,K.jsx)(`span`,{children:l(`subagentCompletedCount`,{count:y})}),(0,K.jsx)(`span`,{children:l(`subagentConcurrency`,{count:e.setup.workflows.concurrency})})]})]}),(0,K.jsxs)(`div`,{className:`settings-split-panel settings-subagent-split`,children:[(0,K.jsxs)(`aside`,{className:`settings-resource-sidebar`,children:[(0,K.jsxs)(`div`,{className:`settings-resource-list`,children:[(0,K.jsx)(`span`,{className:`settings-sidebar-label`,children:l(`builtInRoles`)}),aI.map(e=>(0,K.jsxs)(`button`,{type:`button`,className:`settings-resource-item`,"aria-current":e===u?`page`:void 0,onClick:()=>d(e),children:[(0,K.jsx)(M,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:l(`subagentRole_${e}`)}),(0,K.jsx)(`small`,{children:l(`subagentRoleShort_${e}`)})]})]},e))]}),(0,K.jsx)(`div`,{className:`settings-sidebar-footer settings-sidebar-footer-action`,children:(0,K.jsx)(sI,{isPending:a,isBlocked:o,onConfigure:s,request:l(`setupRequestSubagents`),label:l(`configureRoles`)})})]}),(0,K.jsxs)(`div`,{className:`settings-resource-detail`,children:[(0,K.jsx)(oI,{catalog:e,error:t,onRefresh:c}),e&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`header`,{className:`settings-detail-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{children:l(`builtInRole`)}),(0,K.jsx)(`h1`,{children:l(`subagentRole_${u}`)}),(0,K.jsx)(`p`,{children:l(`subagentRoleDescription_${u}`)})]}),(0,K.jsx)(`span`,{className:`settings-status-badge`,children:l(`builtIn`)})]}),(0,K.jsxs)(`dl`,{className:`settings-detail-metadata settings-detail-metadata-wide`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:l(`modelAssignment`)}),(0,K.jsx)(`dd`,{children:f?`${f.provider}/${f.model}`:l(`inheritParentModel`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:l(`effectiveModel`)}),(0,K.jsx)(`dd`,{children:f?`${f.provider}/${f.model}`:n?.label??l(`unknownState`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:l(`workflowConcurrencyLabel`)}),(0,K.jsx)(`dd`,{children:e.setup.workflows.concurrency})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:l(`workflowCallLimit`)}),(0,K.jsx)(`dd`,{children:e.setup.workflows.maxAgentCalls})]})]}),(0,K.jsxs)(`section`,{className:`settings-role-principles`,children:[(0,K.jsxs)(`form`,{className:`settings-edit-form`,onSubmit:e=>{e.preventDefault(),!a&&s(l(`setupRoleFormRequest`,{role:u,model:p||l(`inheritParentModel`),concurrency:h}))},children:[(0,K.jsxs)(`label`,{className:`settings-form-field`,children:[l(`modelAssignment`),(0,K.jsxs)(`select`,{value:p,disabled:a,onChange:e=>m(e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:l(`inheritParentModel`)}),p&&!r.some(e=>`${e.provider}/${e.id}`===p)&&(0,K.jsx)(`option`,{value:p,children:p}),r.map(e=>(0,K.jsx)(`option`,{value:`${e.provider}/${e.id}`,children:e.label},`${e.provider}/${e.id}`))]})]}),(0,K.jsxs)(`label`,{className:`settings-form-field`,children:[l(`workflowConcurrencyLabel`),(0,K.jsx)(`input`,{type:`number`,min:1,max:64,required:!0,value:h,disabled:a,onChange:e=>g(Number(e.target.value))})]}),(0,K.jsx)(`button`,{type:`submit`,disabled:a,children:l(`configureViaSetup`)}),(0,K.jsx)(`small`,{children:l(`setupFormDetail`)})]}),(0,K.jsx)(`h2`,{children:l(`runtimeBoundaries`)}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(Fe,{"aria-hidden":`true`}),(0,K.jsx)(`p`,{children:l(`subagentAuthorityNote`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(fe,{"aria-hidden":`true`}),(0,K.jsx)(`p`,{children:l(`subagentModelNote`)})]})]})]})]})]})]})}function _I(e){return e.extensions.length+e.skills.length+e.prompts.length+e.themes.length}function vI(e){return e.enabled===!1?`disabled`:e.configured&&!e.installed?`missing`:e.diagnostics?.length?`error`:_I(e)?`loaded`:e.installed?`installed`:`notLoaded`}function yI({catalog:e,error:t,onRefresh:n,setupPending:r,onConfigure:i,onReload:a}){let{t:o}=cr(),s=e?.resources.plugins??[],[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(`all`),[f,p]=(0,_.useState)(!1),m=(0,_.useMemo)(()=>s.filter(e=>(u===`all`||e.scope===u)&&`${e.name??``} ${e.source}`.toLocaleLowerCase().includes(c.trim().toLocaleLowerCase())),[s,c,u]),[h,g]=(0,_.useState)(``),v=m.find(e=>e.id===h)??m[0],y=m.filter(e=>e.configured&&e.canManage!==!1),b=e=>e.name??(e.source===`auto`?o(`resourceSourceAuto`):e.source===`builtin`?o(`builtIn`):uI(e.source)),x=JSON.stringify(y.map(({source:e,scope:t,baseDir:n})=>({source:e,scope:t,path:n}))),S=new TextEncoder().encode(x).length>12e3;return(0,_.useEffect)(()=>{s.length&&!s.some(e=>e.id===h)&&g(s[0].id)},[s,h]),(0,K.jsxs)(`section`,{className:`settings-split-panel settings-managed-panel`,children:[(0,K.jsxs)(`aside`,{className:`settings-resource-sidebar`,children:[(0,K.jsx)(dI,{kind:`plugins`,query:c,scope:u,onQuery:l,onScope:d,onAdd:()=>p(!0)}),(0,K.jsxs)(`div`,{className:`settings-resource-list`,children:[m.map(e=>(0,K.jsxs)(`button`,{type:`button`,className:`settings-resource-item`,"aria-current":e.id===v?.id?`page`:void 0,onClick:()=>{g(e.id),p(!1)},children:[(0,K.jsx)(ct,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:b(e)}),(0,K.jsxs)(`small`,{children:[o(`resourceScope_${e.scope}`),` ·`,` `,o(`pluginState_${vI(e)}`)]})]})]},e.id)),!e&&!t&&(0,K.jsx)(oI,{catalog:e,error:t,onRefresh:n}),e&&!m.length&&(0,K.jsx)(`p`,{className:`settings-resource-empty`,children:o(s.length?`noMatchingResources`:`noPluginsFound`)})]}),(0,K.jsxs)(`div`,{className:`settings-sidebar-footer`,children:[(0,K.jsx)(`span`,{children:e?o(`pluginCount`,{count:s.length}):o(`settingsCatalogLoading`)}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o(`refreshStatus`),onClick:n,children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{className:`settings-resource-detail`,children:[(0,K.jsx)(mI,{catalog:e}),f?(0,K.jsx)(fI,{kind:`plugins`,pending:r,onConfigure:i,onCancel:()=>p(!1)}):t?(0,K.jsx)(oI,{catalog:e,error:t,onRefresh:n}):v?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`header`,{className:`settings-detail-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{children:o(`resourceScope_${v.scope}`)}),(0,K.jsx)(`h1`,{children:b(v)}),(0,K.jsx)(`code`,{children:v.source})]}),(0,K.jsx)(`span`,{className:`settings-status-badge ${vI(v)===`loaded`?`healthy`:``}`,children:o(`pluginState_${vI(v)}`)})]}),(0,K.jsxs)(`dl`,{className:`settings-detail-metadata settings-detail-metadata-wide`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`scope`)}),(0,K.jsx)(`dd`,{children:o(`resourceScope_${v.scope}`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`resourceOrigin`)}),(0,K.jsx)(`dd`,{children:o(`resourceOrigin_${v.origin}`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`installedVersion`)}),(0,K.jsx)(`dd`,{children:v.installedVersion??o(`notReported`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`configuredVersion`)}),(0,K.jsx)(`dd`,{children:v.configuredVersion??o(`resourceVersionUnpinned`)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`resources`)}),(0,K.jsx)(`dd`,{children:o(`pluginResourceSummary`,{extensions:v.extensions.length,skills:v.skills.length,prompts:v.prompts.length,themes:v.themes.length})})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:o(`baseDirectory`)}),(0,K.jsx)(`dd`,{title:v.baseDir,children:v.baseDir??o(`notReported`)})]})]}),[...new Set(v.diagnostics)].map(e=>(0,K.jsx)(`p`,{className:`settings-resource-notice`,role:`status`,children:e},e)),v.canManage===!1&&(0,K.jsx)(`p`,{className:`settings-resource-notice`,children:o(`resourceTargetTruncated`)}),v.configured&&v.canManage!==!1&&(0,K.jsx)(`div`,{className:`settings-resource-actions settings-resource-primary-actions`,children:[v.enabled===!1?`enable`:`disable`,`update`,`remove`].map(e=>(0,K.jsx)(sI,{isPending:r,onConfigure:i,label:o(`pluginAction_${e}`),request:o(`setupPluginOperationRequest`,{action:e,source:JSON.stringify(v.source),path:JSON.stringify(v.baseDir??null),scope:v.scope})},e))}),(0,K.jsx)(`p`,{className:`settings-resource-caption`,children:o(`pluginLoadedResources`,{count:_I(v)})}),(0,K.jsxs)(`section`,{className:`settings-resource-groups`,children:[v.extensions.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:o(`extensions`)}),(0,K.jsx)(`ul`,{children:v.extensions.map(e=>(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:e.name}),(0,K.jsx)(`code`,{children:e.path})]}),(0,K.jsx)(`span`,{children:o(`extensionSurfaceCount`,{tools:e.toolCount,commands:e.commandCount})})]},e.path))})]}),v.skills.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:o(`skillsSettings`)}),(0,K.jsx)(`p`,{children:v.skills.join(` · `)})]}),v.prompts.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:o(`prompts`)}),(0,K.jsx)(`p`,{children:v.prompts.join(` · `)})]}),v.themes.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{children:o(`themes`)}),(0,K.jsx)(`p`,{children:v.themes.join(` · `)})]})]})]}):(0,K.jsxs)(`div`,{className:`settings-empty-detail`,children:[(0,K.jsx)(ct,{"aria-hidden":`true`}),(0,K.jsx)(`h1`,{children:o(s.length?`noMatchingResources`:`pluginsEmptyTitle`)}),(0,K.jsx)(`p`,{children:o(`pluginsEmptyIntro`)}),(0,K.jsx)(qc,{label:o(`addPlugin`),variant:`secondary`,size:`sm`,icon:(0,K.jsx)(lt,{"aria-hidden":`true`}),onClick:()=>p(!0)})]}),!f&&(0,K.jsxs)(pI,{catalog:e,pending:r,onReload:a,kind:`plugins`,onConfigure:i,children:[y.length>1&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(sI,{isPending:r,isBlocked:S,onConfigure:i,label:o(`enableVisiblePlugins`,{count:y.length}),request:o(`setupPluginsBulkRequest`,{packages:x,disabled:!1})}),(0,K.jsx)(sI,{isPending:r,isBlocked:S,onConfigure:i,label:o(`disableVisiblePlugins`,{count:y.length}),request:o(`setupPluginsBulkRequest`,{packages:x,disabled:!0})})]}),S&&(0,K.jsx)(`p`,{className:`settings-resource-caption`,children:o(`resourceBulkTooLarge`)})]})]})]})}function bI(e,t=``,n){let r=(0,_.useMemo)(()=>new lf,[]),[i,a]=(0,_.useState)(0),o=JSON.stringify([e,t]),s=(0,_.useRef)(o);s.current=o;let c=(0,_.useRef)(0),[l,u]=(0,_.useState)(null),d=(0,_.useCallback)(()=>a(e=>e+1),[]);return(0,_.useEffect)(()=>{let t=new AbortController,n=++c.current;return u(e=>({owner:o,catalog:e?.owner===o?e.catalog:null,error:null})),r.settingsCatalog(e,t.signal).then(e=>{!t.signal.aborted&&c.current===n&&u({owner:o,catalog:e,error:null})},e=>{!t.signal.aborted&&c.current===n&&u(t=>({owner:o,catalog:t?.owner===o?t.catalog:null,error:e instanceof Error?e.message:String(e)}))}),()=>t.abort()},[r,i,e,o,n]),{catalog:l?.owner===o?l.catalog:null,error:l?.owner===o?l.error:null,refresh:d,updateSetup:e=>{s.current===o&&(c.current++,u(t=>t?.owner===o&&t.catalog?{...t,catalog:{...t.catalog,setup:e}}:t))}}}var xI=[`default`,`mist`,`rose`,`pine`],SI=[`codex`,`sans`,`serif`,`mono`],CI=[`system`,`light`,`dark`],wI={palette:`default`,accent:``,background:``,foreground:``,font:`codex`};function TI(e){return e===`pine`?`dark`:e===`mist`||e===`rose`?`light`:e}function EI(e,t){return e===`mist`||e===`rose`||e===`pine`?e:t.palette}function DI(e,t){switch(e){case`mist`:return t?{background:`#182126`,foreground:`#EDF3F5`}:{background:`#F8FBFC`,foreground:`#253239`};case`rose`:return t?{background:`#251C20`,foreground:`#F5EDF0`}:{background:`#FFFAFB`,foreground:`#392B2F`};case`pine`:return t?{background:`#16201C`,foreground:`#EDF3EF`}:{background:`#F5FAF7`,foreground:`#24382D`};default:return t?{background:`#17191C`,foreground:`#EDF0F2`}:{background:`#FFFFFF`,foreground:`#1A1C1F`}}}function OI(e){if(e.length>2e3)return null;try{let t=JSON.parse(e);if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;if(Object.keys(n).sort().join(`,`)!==`appearance,theme,version`||n.version!==1)return null;let r=CI.find(e=>e===n.theme);if(!r||!n.appearance||typeof n.appearance!=`object`||Array.isArray(n.appearance))return null;let i=n.appearance;if(Object.keys(i).sort().join(`,`)!==`accent,background,font,foreground,palette`)return null;let a=xI.find(e=>e===i.palette),o=i.font===`system`?`codex`:SI.find(e=>e===i.font),{accent:s,background:c,foreground:l}=i;return!a||!o||typeof s!=`string`||typeof c!=`string`||typeof l!=`string`||![s,c,l].every(e=>e===``||/^#[0-9a-f]{6}$/iu.test(e))?null:{theme:r,appearance:{palette:a,font:o,accent:s,background:c,foreground:l}}}catch{return null}}var kI=[``,`#2563EB`,`#7C3AED`,`#DB2777`,`#D97706`,`#16A34A`];function AI({label:e,value:t,options:n,disabled:r,onSelect:i}){let a=n.find(e=>e.id===t);return(0,K.jsx)(IA,{button:{label:a?.label??t,"aria-label":e,variant:`secondary`,size:`sm`,className:`appearance-menu-trigger`,isDisabled:r,...a?.color?{icon:(0,K.jsx)(`span`,{className:`appearance-color-dot`,style:{background:a.color}})}:{}},menuWidth:200,alignment:`end`,items:n.map(e=>({id:e.id||`default`,label:e.label,isDisabled:r,...e.color?{icon:(0,K.jsx)(`span`,{className:`appearance-color-dot`,style:{background:e.color}})}:{},endContent:t===e.id?(0,K.jsx)(I,{"aria-hidden":`true`}):void 0,onClick:()=>i(e.id)}))})}function jI({label:e,value:t,fallback:n,disabled:r,onSave:i}){let a=(t||n).toUpperCase(),[o,s]=(0,_.useState)(a);(0,_.useEffect)(()=>s(a),[a]);let c=e=>{s(e),e!==a&&/^#[0-9a-f]{6}$/iu.test(e)&&i(e).then(e=>{e||s(a)})};return(0,K.jsxs)(`div`,{className:`appearance-color-input`,children:[(0,K.jsxs)(`label`,{className:`appearance-color-picker`,children:[(0,K.jsx)(`span`,{className:`appearance-color-dot`,style:{background:a}}),(0,K.jsx)(`input`,{"aria-label":`${e} — ${a}`,type:`color`,value:a,disabled:r,onChange:e=>c(e.target.value.toUpperCase())})]}),(0,K.jsx)(`input`,{className:`appearance-color-hex`,type:`text`,"aria-label":e,value:o,maxLength:7,spellCheck:!1,disabled:r,onChange:e=>c(e.target.value.toUpperCase()),onBlur:()=>s(a)})]})}function MI({catalog:e,theme:t,pending:n,error:r,onRefresh:i,onUpdatePreferences:a}){let{t:o}=cr(),{mode:s}=lu(),c=e?.setup,l=c?.ui.webTheme??t,u=c?.ui.webAppearance??wI,d=EI(l,u),f=TI(l),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(``),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(null),[w,T]=(0,_.useState)(c?.ui.webChatWidth??820),[E,D]=(0,_.useState)(c?.ui.webChatFontSize??14);(0,_.useEffect)(()=>{c&&(T(c.ui.webChatWidth),D(c.ui.webChatFontSize))},[c]);let O=e?.setupWritable===!1||!!e?.resources.diagnostics.settingsErrors,k=n||!c||!!r||O,A=OI(v),j=e=>a({appearance:e}),M=()=>{n||(g(!1),y(``),x(!1))},N=DI(d,f===`dark`||f===`system`&&s===`dark`);return(0,K.jsxs)(`section`,{className:`settings-content-page settings-appearance-panel`,children:[(0,K.jsx)(`h1`,{children:o(`appearance`)}),(!c||r||O)&&(0,K.jsxs)(`div`,{className:`settings-load-state`,role:r||O?`alert`:`status`,children:[(0,K.jsx)(dt,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:o(O?`configurationReadFailure`:r?`settingsCatalogFailed`:`settingsCatalogLoading`)}),(r||O)&&(0,K.jsx)(`button`,{type:`button`,onClick:i,children:o(`retryAdmissionCheck`)})]}),(0,K.jsxs)(`section`,{className:`appearance-section`,"aria-labelledby":`appearance-visual-title`,children:[(0,K.jsx)(`h2`,{id:`appearance-visual-title`,children:o(`appearanceVisualStyle`)}),(0,K.jsxs)(`div`,{className:`appearance-card appearance-mode-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceMode`)}),(0,K.jsx)(`div`,{role:`radiogroup`,"aria-label":o(`appearanceMode`),className:`appearance-mode-options`,children:CI.map(e=>(0,K.jsx)(Cd,{content:o(e===`system`?`themeSystem`:e===`light`?`themeLight`:`themeDark`),children:(0,K.jsxs)(`label`,{className:`appearance-mode-option`,children:[(0,K.jsx)(`input`,{type:`radio`,name:`openpi-appearance-mode`,"aria-label":o(e===`system`?`themeSystem`:e===`light`?`themeLight`:`themeDark`),checked:f===e,disabled:k,onChange:()=>void a({theme:e})}),(0,K.jsxs)(`span`,{"aria-hidden":`true`,className:`appearance-mode-preview`,"data-mode":e,"data-selected":f===e,children:[(0,K.jsxs)(`span`,{className:`appearance-mini-window`,children:[(0,K.jsx)(`span`,{className:`appearance-mini-sidebar`}),(0,K.jsxs)(`span`,{className:`appearance-mini-chat`,children:[(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`b`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`b`,{}),(0,K.jsx)(`em`,{})]})]}),e===`system`&&(0,K.jsxs)(`span`,{className:`appearance-mini-window appearance-mini-dark`,children:[(0,K.jsx)(`span`,{className:`appearance-mini-sidebar`}),(0,K.jsxs)(`span`,{className:`appearance-mini-chat`,children:[(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`b`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`b`,{}),(0,K.jsx)(`em`,{})]})]})]})]})},e))})]}),(0,K.jsxs)(`div`,{className:`appearance-card`,children:[(0,K.jsxs)(`div`,{className:`appearance-row appearance-theme-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceTheme`)}),(0,K.jsxs)(`div`,{className:`appearance-theme-actions`,children:[(0,K.jsx)(Cd,{content:o(`appearanceImport`),children:(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":o(`appearanceImport`),disabled:k,onClick:()=>{x(!1),g(!0)},children:(0,K.jsx)(pe,{"aria-hidden":`true`})})}),(0,K.jsx)(Cd,{content:o(`appearanceCopy`),children:(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":o(`appearanceCopy`),disabled:k,onClick:()=>{wd(JSON.stringify({version:1,theme:f,appearance:{...u,palette:d}})).then(e=>C(e?`saved`:`failed`))},children:(0,K.jsx)(ue,{"aria-hidden":`true`})})}),(0,K.jsx)(AI,{label:o(`appearanceTheme`),value:d,options:xI.map(e=>({id:e,label:e==="default"?`OpenPI`:o(`theme${e[0].toUpperCase()}${e.slice(1)}`)})),disabled:k,onSelect:e=>{let t=xI.find(t=>t===e);t&&j({palette:t})}})]})]}),(0,K.jsxs)(`div`,{className:`appearance-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceAccent`)}),(0,K.jsxs)(`div`,{className:`appearance-accent-controls`,children:[(0,K.jsx)(AI,{label:o(`appearanceAccent`),value:u.accent,options:kI.map((e,t)=>({id:e,label:o(`appearanceAccent${t}`),color:e||`var(--text)`})),disabled:k,onSelect:e=>void j({accent:e})}),(0,K.jsx)(jI,{label:o(`appearanceCustomAccent`),value:u.accent,fallback:`#2563EB`,disabled:k,onSave:e=>j({accent:e})})]})]}),(0,K.jsxs)(`div`,{className:`appearance-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceBackground`)}),(0,K.jsx)(jI,{label:o(`appearanceBackground`),value:u.background,fallback:N.background,disabled:k,onSave:e=>j({background:e})})]}),(0,K.jsxs)(`div`,{className:`appearance-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceForeground`)}),(0,K.jsx)(jI,{label:o(`appearanceForeground`),value:u.foreground,fallback:N.foreground,disabled:k,onSave:e=>j({foreground:e})})]}),(0,K.jsxs)(`div`,{className:`appearance-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceFont`)}),(0,K.jsx)(AI,{label:o(`appearanceFont`),value:u.font===`system`?`codex`:u.font,options:SI.map(e=>({id:e,label:o(`appearanceFont_${e}`)})),disabled:k,onSelect:e=>{let t=SI.find(t=>t===e);t&&j({font:t})}})]})]}),S&&(0,K.jsx)(`p`,{role:S===`failed`?`alert`:`status`,className:`appearance-share-status`,children:o(S===`saved`?`appearanceCopied`:`appearanceCopyFailed`)})]}),(0,K.jsxs)(`section`,{className:`appearance-section`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`appearance-advanced-toggle`,"aria-expanded":p,"aria-controls":`appearance-advanced`,onClick:()=>m(!p),children:[o(`appearanceAdvanced`),p?(0,K.jsx)(L,{"aria-hidden":`true`}):(0,K.jsx)(ee,{"aria-hidden":`true`})]}),p&&c&&(0,K.jsxs)(`div`,{id:`appearance-advanced`,className:`appearance-card appearance-advanced-content`,children:[(0,K.jsxs)(`div`,{className:`appearance-row`,children:[(0,K.jsx)(`span`,{children:o(`expandThinkingByDefault`)}),(0,K.jsx)(rF,{label:o(`expandThinkingByDefault`),isLabelHidden:!0,value:c.ui.webExpandThinking,size:`sm`,isDisabled:k,onChange:e=>void a({expandThinking:e})})]}),(0,K.jsxs)(`div`,{className:`appearance-slider-row`,children:[(0,K.jsxs)(`div`,{className:`settings-slider-heading`,children:[(0,K.jsx)(`span`,{children:o(`chatContentWidth`)}),(0,K.jsxs)(`output`,{children:[w,`px`]}),(0,K.jsx)(`button`,{type:`button`,className:`settings-reset-button`,"aria-label":o(`resetChatContentWidth`),disabled:k||w===820,onClick:()=>{T(820),a({chatWidth:820}).then(e=>{e||T(c.ui.webChatWidth)})},children:(0,K.jsx)(ft,{"aria-hidden":`true`})})]}),(0,K.jsx)(iI,{label:o(`chatContentWidth`),isLabelHidden:!0,value:w,min:820,max:2e3,step:10,width:`100%`,valueDisplay:`none`,isDisabled:k,onChange:e=>T(e),onChangeEnd:e=>{e!==c.ui.webChatWidth&&a({chatWidth:e}).then(e=>{e||T(c.ui.webChatWidth)})}})]}),(0,K.jsxs)(`div`,{className:`appearance-slider-row`,children:[(0,K.jsxs)(`div`,{className:`settings-slider-heading`,children:[(0,K.jsx)(`span`,{children:o(`chatFontSize`)}),(0,K.jsxs)(`output`,{children:[E,`px`]}),(0,K.jsx)(`button`,{type:`button`,className:`settings-reset-button`,"aria-label":o(`resetChatFontSize`),disabled:k||E===14,onClick:()=>{D(14),a({chatFontSize:14}).then(e=>{e||D(c.ui.webChatFontSize)})},children:(0,K.jsx)(ft,{"aria-hidden":`true`})})]}),(0,K.jsx)(iI,{label:o(`chatFontSize`),isLabelHidden:!0,value:E,min:12,max:24,step:1,width:`100%`,valueDisplay:`none`,isDisabled:k,onChange:e=>D(e),onChangeEnd:e=>{e!==c.ui.webChatFontSize&&a({chatFontSize:e}).then(e=>{e||D(c.ui.webChatFontSize)})}})]}),(0,K.jsxs)(`div`,{className:`appearance-row`,children:[(0,K.jsx)(`span`,{children:o(`appearanceReset`)}),(0,K.jsxs)(`button`,{type:`button`,className:`appearance-reset`,disabled:k,onClick:()=>void a({theme:`system`,appearance:wI,chatWidth:820,chatFontSize:14,expandThinking:!1}),children:[(0,K.jsx)(ft,{"aria-hidden":`true`}),o(`appearanceResetAction`)]})]})]})]}),(0,K.jsxs)(iM,{isOpen:h,onOpenChange:e=>{e||M()},"aria-label":o(`appearanceImport`),width:480,className:`appearance-import-dialog`,children:[(0,K.jsx)(`h2`,{className:`appearance-import-title`,children:o(`appearanceImport`)}),(0,K.jsxs)(`form`,{className:`appearance-import-form`,onSubmit:e=>{e.preventDefault(),!(!A||k)&&(x(!1),a(A).then(e=>{e?(g(!1),y(``)):x(!0)}))},children:[(0,K.jsxs)(`label`,{children:[o(`appearanceThemeValue`),(0,K.jsx)(`textarea`,{maxLength:2e3,value:v,disabled:n,placeholder:o(`appearanceImportPlaceholder`),onChange:e=>{x(!1),y(e.target.value)}})]}),v&&!A&&(0,K.jsx)(`p`,{role:`alert`,children:o(`appearanceImportInvalid`)}),b&&(0,K.jsx)(`p`,{role:`alert`,children:o(`settingsPreferencesSaveFailed`)}),(0,K.jsxs)(`div`,{className:`appearance-import-actions`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:n,onClick:M,children:o(`cancel`)}),(0,K.jsx)(`button`,{type:`submit`,disabled:k||!A,children:o(n?`savingSettings`:`appearanceImportAction`)})]})]})]})]})}function NI({workspaces:e,onRestore:t}){let{t:n,i18n:r}=cr(),i=(0,_.useMemo)(()=>new lf,[]),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(`updated`),[d,f]=(0,_.useState)(new Set),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(null),[b,x]=(0,_.useState)(null),[w,T]=(0,_.useState)(new Set),E=(0,_.useRef)(new Set),D=(0,_.useRef)(null),O=(0,_.useRef)(!1),k=JSON.stringify([a.trim(),s,l]),A=(0,_.useRef)({key:k});A.current.key!==k&&(A.current={key:k});let j=p?.scope===k?p:null,M=v?.scope===k?v:null,N=(0,_.useCallback)(async(e,t=0)=>{D.current?.abort();let n=new AbortController;D.current=n,g(!0),y(null);let r={query:a.trim(),sort:l,...s?{cwd:s}:{},limit:25};try{let a=await i.listArchivedSessions({...r,...e?{cursor:e}:{}},n.signal);if(n.signal.aborted||D.current!==n)return;let o=[...a.sessions];for(;!e&&o.length!o.some(t=>t.path===e.path));if(o.push(...e),!e.length)break}m(t=>({...a,scope:k,sessions:e&&t?.scope===k?[...t.sessions,...o.filter(e=>!t.sessions.some(t=>t.path===e.path))]:o}))}catch(t){!n.signal.aborted&&D.current===n&&y({scope:k,stale:t instanceof sf&&t.code===`ARCHIVED_SESSION_CURSOR_STALE`,...e?{cursor:e}:{}})}finally{D.current===n&&(D.current=null,g(!1))}},[i,s,a,k,l]);(0,_.useEffect)(()=>(O.current=!0,()=>{O.current=!1}),[]),(0,_.useEffect)(()=>(x(null),N(),()=>{D.current?.abort(),D.current=null}),[N]);let P=async e=>{if(E.current.has(e))return;E.current.add(e),T(new Set(E.current)),x(null);let n=A.current;try{let r=await t(e);if(!O.current||A.current!==n)return;if(!r){x(e);return}let i=j?.sessions.length??0;m(t=>t?{...t,sessions:t.sessions.filter(t=>t.path!==e)}:null),await N(void 0,i)}catch{O.current&&A.current===n&&x(e)}finally{E.current.delete(e),O.current&&T(new Set(E.current))}},F=new Map;for(let e of j?.sessions??[]){let t=e.workspacePath??e.cwd,n=F.get(t)??[];n.push(e),F.set(t,n)}let I=t=>e.find(e=>e.path===t)?.name??t.split(/[\\/]/u).filter(Boolean).at(-1)??t,R=[...new Set([...e.map(e=>e.path),...F.keys(),...s?[s]:[]])];return(0,K.jsxs)(`section`,{className:`settings-content-page settings-archive-panel`,children:[(0,K.jsx)(`h1`,{children:n(`settingsArchivedChats`)}),(0,K.jsxs)(`div`,{className:`settings-archive-toolbar`,children:[(0,K.jsxs)(`label`,{className:`settings-archive-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`input`,{type:`search`,"aria-label":n(`searchArchivedChats`),placeholder:n(`searchArchivedChats`),maxLength:160,value:a,onChange:e=>o(e.target.value)}),a&&(0,K.jsx)(`button`,{type:`button`,"aria-label":n(`settingsClearSearch`),onClick:()=>o(``),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]}),(0,K.jsxs)(`select`,{"aria-label":n(`archiveProjectFilter`),value:s,onChange:e=>c(e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:n(`archiveAllProjects`)}),R.map(e=>(0,K.jsx)(`option`,{value:e,children:I(e)},e))]}),(0,K.jsxs)(`select`,{"aria-label":n(`archiveSort`),value:l,onChange:e=>u(e.target.value===`created`?`created`:`updated`),children:[(0,K.jsx)(`option`,{value:`updated`,children:n(`archiveSortUpdated`)}),(0,K.jsx)(`option`,{value:`created`,children:n(`archiveSortCreated`)})]}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":n(`refreshArchives`),disabled:h,onClick:()=>void N(void 0,j?.sessions.length),children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]}),M&&(0,K.jsxs)(`div`,{className:`settings-archive-error`,role:`alert`,children:[(0,K.jsx)(`span`,{children:n(M.stale?`archiveCursorStale`:`archiveLoadFailed`)}),(0,K.jsx)(`button`,{type:`button`,disabled:h,onClick:()=>void N(M.stale?void 0:M.cursor),children:n(`retryAdmissionCheck`)})]}),b&&(0,K.jsx)(`div`,{className:`settings-archive-error`,role:`alert`,children:n(`restoreFailed`)}),h&&(0,K.jsx)(`p`,{role:`status`,className:`settings-archive-status`,children:n(`loadingArchives`)}),!h&&!M&&j?.sessions.length===0&&(0,K.jsxs)(`div`,{className:`settings-archive-empty`,children:[(0,K.jsx)(C,{"aria-hidden":`true`}),(0,K.jsx)(`p`,{children:n(a.trim()||s?`noMatchingScannedArchives`:j.truncation.truncated?`noScannedArchives`:`noArchivedSessions`)})]}),(0,K.jsx)(`div`,{className:`settings-archive-groups`,children:[...F].map(([e,t])=>(0,K.jsxs)(`section`,{className:`settings-archive-group`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`settings-archive-group-heading`,"aria-label":n(`archiveProjectGroup`,{project:I(e),count:t.length}),"aria-expanded":!d.has(e),"aria-controls":`archive-group-${encodeURIComponent(e)}`,onClick:()=>f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),children:[d.has(e)?(0,K.jsx)(ee,{"aria-hidden":`true`}):(0,K.jsx)(L,{"aria-hidden":`true`}),(0,K.jsx)(De,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{title:e,children:I(e)}),(0,K.jsx)(`small`,{children:t.length})]}),!d.has(e)&&(0,K.jsx)(`ul`,{id:`archive-group-${encodeURIComponent(e)}`,className:`settings-archive-list`,children:t.map(e=>{let t=e.name||e.firstMessage||n(`untitledSession`),i=new Date(l===`created`?e.created:e.modified);return(0,K.jsxs)(`li`,{className:`settings-archive-row`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`settings-archive-chat-title`,title:t,children:t}),(0,K.jsx)(`time`,{dateTime:Number.isNaN(i.getTime())?void 0:i.toISOString(),children:Number.isNaN(i.getTime())?n(`unknownState`):new Intl.DateTimeFormat(r.language,{dateStyle:`medium`}).format(i)})]}),(0,K.jsxs)(`button`,{type:`button`,"aria-label":n(`restoreArchivedChat`,{title:t}),disabled:w.has(e.path),onClick:()=>void P(e.path),children:[(0,K.jsx)(S,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:n(w.has(e.path)?`restoringConversation`:`restoreConversation`)})]})]},e.path)})})]},e))}),!!j?.truncation.recordsUnscanned&&(0,K.jsx)(`p`,{className:`settings-archive-status`,children:n(`archiveScanBounded`,{count:j.truncation.recordsUnscanned})}),j?.nextCursor&&(0,K.jsx)(`button`,{type:`button`,className:`settings-archive-more`,disabled:h,onClick:()=>void N(j.nextCursor),children:n(`moreArchives`)})]})}var PI=[{id:`general`,group:`settingsPersonal`,label:`generalSettings`,Icon:xt,terms:[`agentBehavior`,`resultDisplay`,`workflowLimits`]},{id:`appearance`,group:`settingsPersonal`,label:`appearance`,Icon:Dt,terms:[`appearanceTheme`,`appearanceAccent`,`appearanceFont`,`chatContentWidth`,`chatFontSize`]},{id:`archived-chats`,group:`settingsPersonal`,label:`settingsArchivedChats`,Icon:C,terms:[`restoreConversation`]},{id:`configuration`,group:`settingsPersonal`,label:`configurationSettings`,Icon:bt,terms:[`configurationApproval`,`configurationSandbox`,`configurationVerbosity`,`configurationSummary`,`configurationReasoningLevels`,`configurationDependencies`]},{id:`models`,group:`settingsAgent`,label:`modelSettings`,Icon:fe,terms:[`modelDefaultTitle`]},{id:`subagents`,group:`settingsAgent`,label:`subagentsSettings`,Icon:M,terms:[]},{id:`web-search`,group:`settingsAgent`,label:`webSearchSettings`,Icon:ht,terms:[]},{id:`skills`,group:`settingsIntegrations`,label:`skillsSettings`,Icon:Ie,terms:[]},{id:`plugins`,group:`settingsIntegrations`,label:`pluginsSettings`,Icon:ct,terms:[]},{id:`browser`,group:`settingsIntegrations`,label:`browserSettings`,Icon:me,terms:[]}];function FI(e){return PI.find(({id:t})=>t===e)?.id}function II({sessionId:e,sessionPath:t,cwd:n,entry:r=`general`,models:i,currentModel:a,thinkingLevel:o,theme:s,preferences:c,workspaces:l=[],onRestoreSession:u,capabilities:d,setupBusy:f,setupBlockedReason:p,plan:m,planSelectionPending:h=!1,onExitPlan:g,setupOutcome:v,onConfigureOpenPi:y,interaction:b,onPreferencesChanged:x,onSelectModel:S,onOpenRuntimeStatus:C,onClose:w}){let{t:T}=cr(),E=f||!!p,D=(0,_.useRef)(null),O=(0,_.useRef)(null),[k,A]=(0,_.useState)(``),[j,M]=(0,_.useState)(r===`credentials`?`models`:r),[N,P]=(0,_.useState)(r===`credentials`||r===`models`),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(!1),[ee,z]=(0,_.useState)(`general`),B=(0,_.useRef)(!1),V=(0,_.useRef)(!1),H=(0,_.useRef)(0),[te,ne]=(0,_.useState)(!1),re=(0,_.useRef)(!1),[ie,ae]=(0,_.useState)(!1),[U,oe]=(0,_.useState)(null),[se,ce]=(0,_.useState)(!1),[le,ue]=(0,_.useState)(!1),[de,fe]=(0,_.useState)(null),pe=le,me=(0,_.useRef)(void 0),W=m!==void 0&&m!==`inactive`,he=F||E||W||h,ge=L&&ee!==j||!L&&(j===`skills`||j===`plugins`||j===`web-search`)?void 0:!L||v?.requestId!==me.current?v:void 0,{catalog:_e,error:ve,refresh:ye,updateSetup:be}=bI(e,a?`${a.provider}/${a.id}`:``,JSON.stringify(c)),xe=ge!==void 0&&[`failed`,`cancelled`,`unconfirmed`].includes(ge.status);(0,_.useEffect)(()=>{D.current?.focus()},[]),(0,_.useEffect)(()=>{if(L){if(ge&&ge.status!==`pending`&&B.current){B.current=!1,V.current=!1,window.clearTimeout(H.current),ye(),x();return}if(E){V.current=!0;return}!V.current||!B.current||(B.current=!1,V.current=!1,window.clearTimeout(H.current),ye(),x())}},[x,ye,E,L,ge]),(0,_.useEffect)(()=>()=>window.clearTimeout(H.current),[]);let Se=async e=>{if(ae(!1),he)return!1;me.current=v?.requestId,z(j),I(!0),R(!1),B.current=!1,V.current=!1,window.clearTimeout(H.current),oe(null);try{let t=await y(e);return t?(R(!0),B.current=!0,H.current=window.setTimeout(()=>{!B.current||V.current||(B.current=!1,V.current=!1,ye(),x())},2e3)):oe(T(`setupRequestFailed`)),t}catch(e){return I(!1),oe(e instanceof Error?e.message:T(`setupRequestFailed`)),!1}finally{I(!1)}},Ce=async()=>{if(he||!_e?.sessionPath)throw Error(T(`resourceReloadFailed`));I(!0);try{await new lf().reloadSettingsResources(e,_e.sessionPath),ye(),x()}finally{I(!1)}},we=async e=>{if(re.current||!_e)return!1;re.current=!0,ne(!0),ae(!1),oe(null);try{let t=await new lf().savePreferences(e);return be(t.setup),ae(!0),x(),!0}catch{return oe(T(`settingsPreferencesSaveFailed`)),!1}finally{re.current=!1,ne(!1)}},Te=e=>{pe||(M(e),A(``),e===`models`&&P(!0),oe(null))};(0,_.useEffect)(()=>{let e=new URL(window.location.href);e.searchParams.set(`settings`,j),window.history.replaceState(window.history.state,``,e)},[j]);let G=PI.filter(({label:e,terms:t})=>[e,...t].some(e=>T(e).normalize(`NFKC`).toLocaleLowerCase().includes(k.trim().normalize(`NFKC`).toLocaleLowerCase()))),Ee=(e,t=!1)=>{if(!pe){if(se&&!t){fe(e);return}fe(null),e.kind===`runtime`?C():w()}};return(0,K.jsxs)(iM,{isOpen:!0,purpose:`info`,padding:0,width:`calc(100vw - 32px)`,maxHeight:`calc(100dvh - 16px)`,className:`provider-settings-dialog`,"aria-label":T(`settings`),onOpenChange:e=>{!e&&!de&&Ee({kind:`close`})},children:[(0,K.jsxs)(`section`,{className:`provider-settings-surface`,children:[(0,K.jsxs)(`aside`,{className:`provider-settings-sidebar`,children:[(0,K.jsxs)(`header`,{className:`provider-settings-header`,children:[(0,K.jsx)(`strong`,{className:`provider-settings-title`,children:T(`settings`)}),(0,K.jsx)(`select`,{className:`provider-settings-mobile-picker`,"aria-label":T(`settingsNavigation`),disabled:pe,value:j,onChange:e=>{let t=PI.find(({id:t})=>t===e.target.value);t&&Te(t.id)},children:PI.map(({id:e,label:t})=>(0,K.jsx)(`option`,{value:e,children:T(t)},e))})]}),(0,K.jsxs)(`label`,{className:`provider-settings-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`input`,{type:`search`,"aria-label":T(`settingsSearch`),placeholder:T(`settingsSearch`),value:k,onChange:e=>A(e.target.value),disabled:pe}),k&&(0,K.jsx)(`button`,{type:`button`,"aria-label":T(`settingsClearSearch`),onClick:()=>A(``),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]}),(0,K.jsxs)(`div`,{className:`provider-settings-navigation`,ref:O,"aria-label":T(`settingsNavigation`),role:`tablist`,"aria-orientation":`vertical`,children:[[`settingsPersonal`,`settingsAgent`,`settingsIntegrations`].map(e=>(0,K.jsxs)(`div`,{className:`provider-settings-nav-group`,children:[G.some(t=>t.group===e)&&(0,K.jsx)(`p`,{children:T(e)}),G.filter(t=>t.group===e).map(({id:e,label:t,Icon:n})=>(0,K.jsxs)(`button`,{type:`button`,role:`tab`,disabled:pe,id:`settings-tab-${e}`,tabIndex:j===e||!G.some(e=>e.id===j)&&G[0]?.id===e?0:-1,"aria-selected":j===e,"aria-controls":`settings-panel-${e}`,className:`provider-settings-tab`,title:T(t),onClick:()=>Te(e),onKeyDown:t=>{if(t.altKey||t.ctrlKey||t.metaKey||t.nativeEvent.isComposing)return;let n=G.findIndex(t=>t.id===e),r=t.key===`Home`?0:t.key===`End`?G.length-1:t.key===`ArrowDown`||t.key===`ArrowRight`?(n+1)%G.length:t.key===`ArrowUp`||t.key===`ArrowLeft`?(n+G.length-1)%G.length:void 0;if(r===void 0)return;t.preventDefault();let i=G[r].id;Te(i),O.current?.querySelector(`#settings-tab-${i}`)?.focus()},children:[(0,K.jsx)(n,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:T(t)})]},e))]},e)),G.length===0&&(0,K.jsx)(`p`,{className:`provider-settings-no-results`,role:`status`,children:T(`settingsNoResults`)})]}),(0,K.jsx)(`button`,{ref:D,type:`button`,className:`icon-button provider-settings-close`,"aria-label":T(`close`),disabled:pe,title:T(pe?`savingSettings`:`close`),onClick:()=>Ee({kind:`close`}),children:(0,K.jsx)(Lt,{})})]}),(0,K.jsxs)(`div`,{className:`provider-settings-body`,children:[W&&j!==`browser`&&(0,K.jsxs)(`div`,{className:`settings-plan-notice`,role:`status`,children:[(0,K.jsx)(`span`,{children:T(E?`setupPlanBusy`:`setupPlanBlocked`)}),(0,K.jsx)(qc,{label:T(`planModeExit`),variant:`secondary`,size:`sm`,isDisabled:E||h||!g,onClick:()=>void g?.()})]}),(0,K.jsxs)(`div`,{className:`provider-settings-main`,children:[(0,K.jsx)(`div`,{id:`settings-panel-configuration`,"aria-labelledby":`settings-tab-configuration`,"aria-label":T(`configurationSettings`),role:`tabpanel`,hidden:j!==`configuration`,children:j===`configuration`&&(0,K.jsx)(fF,{catalog:_e,error:ve,pending:he||L&&ee===`configuration`&&(!ge||ge.status===`pending`),preferencePending:te,onConfigure:Se,onUpdatePreferences:we,onRefresh:ye,onOpenRuntimeStatus:()=>Ee({kind:`runtime`})})}),(0,K.jsx)(`div`,{id:`settings-panel-appearance`,"aria-labelledby":`settings-tab-appearance`,"aria-label":T(`appearance`),role:`tabpanel`,hidden:j!==`appearance`,children:(0,K.jsx)(MI,{catalog:_e,theme:s,pending:te,error:ve,onRefresh:ye,onUpdatePreferences:we})}),(0,K.jsx)(`div`,{id:`settings-panel-archived-chats`,"aria-labelledby":`settings-tab-archived-chats`,"aria-label":T(`settingsArchivedChats`),role:`tabpanel`,hidden:j!==`archived-chats`,children:j===`archived-chats`&&(0,K.jsx)(NI,{workspaces:l,onRestore:u??(async()=>!1)})}),(0,K.jsx)(`div`,{id:`settings-panel-web-search`,"aria-labelledby":`settings-tab-web-search`,"aria-label":T(`webSearchSettings`),role:`tabpanel`,hidden:j!==`web-search`,children:j===`web-search`&&(0,K.jsx)(pF,{catalog:_e,error:ve,pending:he,onConfigure:Se,onRefresh:ye})}),(0,K.jsx)(`div`,{id:`settings-panel-browser`,"aria-labelledby":`settings-tab-browser`,"aria-label":T(`browserSettings`),role:`tabpanel`,hidden:j!==`browser`,children:j===`browser`&&(0,K.jsx)(uF,{onConfigure:Se,setupPending:he})}),(0,K.jsx)(`div`,{id:`settings-panel-general`,"aria-labelledby":`settings-tab-general`,"aria-label":T(`generalSettings`),role:`tabpanel`,hidden:j!==`general`,children:(0,K.jsx)(lI,{catalog:_e,error:ve,currentModel:a,thinkingLevel:o,cwd:n,setupPending:F||E,preferencePending:te||!_e,setupBusy:E,setupBlockedReason:p,setupBlocked:W||h,onConfigure:Se,onUpdatePreferences:we,onOpenRuntimeStatus:()=>Ee({kind:`runtime`}),onRefresh:ye})}),(0,K.jsx)(`section`,{id:`settings-panel-models`,"aria-labelledby":`settings-tab-models`,"aria-label":T(`modelSettings`),className:`settings-models`,role:`tabpanel`,hidden:j!==`models`,children:N&&(0,K.jsx)(KF,{sessionId:e,sessionPath:t,models:i,currentModel:a,busy:E,focusCredentials:r===`credentials`,onSaved:async()=>(ye(),x()),onSelectModel:S,onDraftChange:ce,onSavingChange:ue},e)}),(0,K.jsx)(`div`,{id:`settings-panel-skills`,"aria-labelledby":`settings-tab-skills`,"aria-label":T(`skillsSettings`),role:`tabpanel`,hidden:j!==`skills`,children:(0,K.jsx)(hI,{catalog:_e,error:ve,onRefresh:ye,setupPending:he,onConfigure:Se,onReload:Ce},e)}),(0,K.jsx)(`div`,{id:`settings-panel-subagents`,"aria-labelledby":`settings-tab-subagents`,"aria-label":T(`subagentsSettings`),role:`tabpanel`,hidden:j!==`subagents`,children:(0,K.jsx)(gI,{catalog:_e,error:ve,currentModel:a,models:i,activity:d?.subagents,setupPending:F||E,setupBlocked:W||h,onConfigure:Se,onRefresh:ye})}),(0,K.jsx)(`div`,{id:`settings-panel-plugins`,"aria-labelledby":`settings-tab-plugins`,"aria-label":T(`pluginsSettings`),role:`tabpanel`,hidden:j!==`plugins`,children:(0,K.jsx)(yI,{catalog:_e,error:ve,onRefresh:ye,setupPending:he,onConfigure:Se,onReload:Ce},e)})]}),b,U&&(0,K.jsx)(`div`,{className:`settings-global-error`,role:`alert`,children:U}),(te||ie)&&!U&&!xe&&(0,K.jsx)(`div`,{className:`settings-global-status`,role:`status`,children:T(te?`savingSettings`:`settingsPreferencesSaved`)}),!te&&(!ie||xe)&&(L&&ee===j||ge)&&!U&&(0,K.jsxs)(`div`,{className:ge?.status===`failed`?`settings-global-error`:`settings-global-status`,role:ge?.status===`failed`?`alert`:`status`,children:[T(ge?(j===`skills`||j===`plugins`||j===`web-search`)&&[`unconfirmed`,`saved`,`unchanged`].includes(ge.status)?`resourceRequestFinished`:`setupOutcome_${ge.status}`:E?`setupRequestRunning`:j===`skills`||j===`plugins`||j===`web-search`?`resourceRequestSubmitted`:`setupRequestAccepted`),ge?.error&&(0,K.jsx)(`p`,{children:ge.error})]})]})]}),de&&(0,K.jsx)(qP,{isOpen:!0,onOpenChange:e=>{e||fe(null)},title:T(`unsavedSettingsTitle`),description:T(`unsavedSettingsDetail`),cancelLabel:T(`keepEditing`),actionLabel:T(`discardAndContinue`),onAction:()=>Ee(de,!0)})]})}function LI({identity:e}){let t=0;for(let n of e)t=t*31+n.charCodeAt(0)>>>0;let n=t%6;return(0,K.jsx)(`span`,{className:`subagent-avatar tone-${n}`,"aria-hidden":`true`,children:(0,K.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.3`,children:[(0,K.jsxs)(`g`,{children:[(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,K.jsx)(`ellipse`,{cx:`12`,cy:`12`,rx:`4`,ry:`9`}),(0,K.jsx)(`path`,{d:`M3 12h18M5 6.5c4 3 10 3 14 0M5 17.5c4-3 10-3 14 0`})]},`sphere`),(0,K.jsx)(`g`,{children:(0,K.jsx)(`path`,{d:`M4 20V4a16 16 0 0 1 16 16H4ZM4 4l16 16M4 9l11 11M4 14l6 6M10 5l-6 15M16 10L4 20`})},`fan`),(0,K.jsxs)(`g`,{children:[(0,K.jsx)(`path`,{d:`m12 2 3 6 7-1-4 5 4 5-7-1-3 6-3-6-7 1 4-5-4-5 7 1Z`}),(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`})]},`rosette`),(0,K.jsxs)(`g`,{children:[(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,K.jsx)(`path`,{d:`M3 12h18M12 3a9 9 0 0 0 0 18M12 6a6 6 0 0 0 0 12M12 9a3 3 0 0 0 0 6M12 3v18`})]},`arcs`),(0,K.jsx)(`g`,{children:(0,K.jsx)(`path`,{d:`m12 2 9 5v10l-9 5-9-5V7Zm0 0v20M3 7l18 10M21 7 3 17M3 7l9 5 9-5M3 17l9-5 9 5`})},`prism`),(0,K.jsxs)(`g`,{children:[(0,K.jsx)(`path`,{d:`M12 12V2c6 0 10 4 10 10H12Zm0 0v10C6 22 2 18 2 12h10ZM12 12H2C2 6 6 2 12 2v10Zm0 0h10c0 6-4 10-10 10V12Z`}),(0,K.jsx)(`circle`,{cx:`12`,cy:`12`,r:`2`,fill:`currentColor`})]},`windmill`)][n]})})}function RI(e,t,n,r){let i=(0,_.useMemo)(()=>new lf,[]),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(0),p=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!n)return;let r=new AbortController;return p.current=r,c(!0),u(!1),i.sessionSources(e,t,r.signal).then(n=>{!r.signal.aborted&&n.sessionId===e&&n.path===t&&o(n)}).catch(()=>{r.signal.aborted||u(!0)}).finally(()=>{r.signal.aborted||(c(!1),p.current=null)}),()=>{r.abort(),p.current?.abort(),p.current=null}},[i,e,t,n,r,d]),{page:a?.sessionId===e&&a.path===t?a:null,loading:s,error:l,loadMore:async()=>{if(p.current||!a||a.nextOffset===void 0)return;let n=new AbortController;p.current=n,c(!0),u(!1);try{let r=await i.sessionSources(e,t,n.signal,a.nextOffset,a.revision);!n.signal.aborted&&r.sessionId===e&&r.path===t&&r.revision===a.revision&&o({...r,sources:[...a.sources,...r.sources]})}catch{n.signal.aborted||u(!0)}finally{n.signal.aborted||(c(!1),p.current=null)}},refresh:()=>f(e=>e+1)}}function zI({sessionId:e,path:t,source:n,thumbnail:r=!1,active:i=!0}){let{t:a}=cr(),o=(0,_.useRef)(null),[s,c]=(0,_.useState)(!1),l=JSON.stringify([e,t,n.entryId,n.partIndex]),[u,d]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(!r||!o.current||typeof IntersectionObserver>`u`)return;let e=new IntersectionObserver(([e])=>c(!!e?.isIntersecting));return e.observe(o.current),()=>e.disconnect()},[r]),(0,_.useEffect)(()=>{if(!i||r&&!s){d(null);return}let a=new AbortController,o;return d({identity:l}),new lf().sourceImage(e,t,n.entryId,n.partIndex,a.signal).then(e=>{if(a.signal.aborted)return;if(![`image/png`,`image/jpeg`,`image/gif`,`image/webp`].includes(e.mimeType)||e.data.length>Jd)throw Error(`Invalid image`);let t=atob(e.data);if(t.length>10485760||btoa(t)!==e.data)throw Error(`Invalid image`);let n=Uint8Array.from(t,e=>e.charCodeAt(0));o=URL.createObjectURL(new Blob([n],{type:e.mimeType})),d({identity:l,url:o})}).catch(()=>{a.signal.aborted||d({identity:l,failed:!0})}),()=>{a.abort(),o&&URL.revokeObjectURL(o)}},[e,t,n.entryId,n.partIndex,l,i,r,s]);let f=i&&(!r||s)&&u?.identity===l?u:null;return(0,K.jsx)(`span`,{ref:o,className:`session-source-image`,"data-thumbnail":r||void 0,children:f?.url&&!f.failed?(0,K.jsx)(`img`,{src:f.url,alt:r?``:n.name||a(`attachedImage`),onError:()=>d({identity:l,failed:!0})}):r?(0,K.jsx)(Ne,{"aria-hidden":`true`}):(0,K.jsx)(`p`,{role:f?.failed?`alert`:`status`,children:a(f?.failed?`imagePreviewFailed`:`readingFile`)})})}function BI({source:e,sessionId:t,path:n,onOpen:r,thumbnail:i=!0}){let{t:a}=cr();return(0,K.jsxs)(`button`,{type:`button`,className:`session-overview-row session-source-row`,title:e.reference||e.name||a(`attachedImage`),onClick:r,children:[(0,K.jsx)(`span`,{className:`session-source-icon`,children:e.kind===`image`?i?(0,K.jsx)(zI,{sessionId:t,path:n,source:e,thumbnail:!0}):(0,K.jsx)(Ne,{"aria-hidden":`true`}):(0,K.jsx)(Se,{"aria-hidden":`true`})}),(0,K.jsx)(`span`,{children:e.name||a(`attachedImage`)})]})}function VI({sessionId:e,path:t,open:n,source:r,data:i,onSelect:a,onClose:o}){let{t:s}=cr(),[c,l]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{r?.id,l(!1)},[e,t,r?.id]),(0,K.jsx)(iM,{isOpen:n,onOpenChange:e=>!e&&o(),purpose:`info`,width:800,maxHeight:`calc(100dvh - 32px)`,padding:0,"aria-label":s(`sessionSources`),children:(0,K.jsxs)(`div`,{className:`session-sources-dialog draft-image-preview`,children:[(0,K.jsxs)(`header`,{children:[r&&i&&(0,K.jsx)(`button`,{type:`button`,"aria-label":s(`sourcesBack`),onClick:()=>a(null),children:(0,K.jsx)(T,{})}),(0,K.jsx)(`strong`,{title:r?.name,children:r?r.name||s(`attachedImage`):s(`sessionSources`)}),r&&(0,K.jsx)(`button`,{type:`button`,"aria-pressed":c,onClick:()=>l(e=>!e),children:s(c?`fitImage`:`originalImageSize`)}),(0,K.jsx)(`button`,{type:`button`,"data-autofocus":!0,"aria-label":s(`close`),onClick:o,children:(0,K.jsx)(Lt,{})})]}),r?(0,K.jsx)(`section`,{className:`draft-image-preview-body`,"data-mode":c?`original`:`fit`,"aria-label":s(`imageViewMode`),tabIndex:c?0:void 0,children:(0,K.jsx)(zI,{sessionId:e,path:t,source:r,active:n},JSON.stringify([e,t,r.id]))}):(0,K.jsxs)(`div`,{className:`session-sources-list`,children:[!i?.loading&&!i?.error&&!i?.page?.sources.length&&(0,K.jsx)(`p`,{children:s(`sourcesEmpty`)}),i?.page?.sources.map(n=>(0,K.jsx)(BI,{source:n,sessionId:e,path:t,onOpen:()=>a(n),thumbnail:!1},n.id)),i?.error&&(0,K.jsxs)(`p`,{role:`alert`,children:[s(`sourcesFailed`),` `,(0,K.jsx)(`button`,{type:`button`,onClick:i.refresh,children:s(`gitReviewRetry`)})]}),i?.loading&&(0,K.jsx)(`p`,{role:`status`,children:s(`readingFile`)}),i?.page?.nextOffset!==void 0&&(0,K.jsx)(`button`,{className:`sources-load-more`,type:`button`,disabled:i.loading,onClick:()=>void i.loadMore(),children:s(`sourcesLoadMore`)}),i?.page?.truncated&&(0,K.jsx)(`p`,{children:s(`sourcesPartial`)})]})]})})}function HI({sessionId:e,workspace:t,agents:n,omitted:r,review:i,onSubagents:a,onReview:o,sessionPath:s,revision:c,onAddSources:l,reviewLoading:u=!1,reviewError:d}){let{t:f}=cr(),[p,m]=(0,_.useState)(!1),h=(0,_.useRef)(null),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(null),x=RI(e,s??``,!!(s&&(p||g)),c),S=(0,_.useContext)(_k),C=i?.ok?i.snapshot.totals:void 0,w=e=>{e?.kind===`file`&&e.reference?(v(!1),A(()=>S?.open(e.reference,void 0,h.current??void 0))):A(()=>{b(e),v(!0)})},T=n.filter(e=>e.state===`running`),E=n.filter(e=>e.state===`done`),D=n.length-T.length-E.length,O=[...T,...n.filter(e=>e.state!==`running`)].slice(0,4),k=[T.length?f(`subagentSummaryRunning`,{count:T.length}):``,E.length?f(`subagentSummaryDone`,{count:E.length}):``,D?f(`subagentSummaryOther`,{count:D}):``].filter(Boolean).join(` · `)||f(`subagentNoneYet`),A=e=>{m(!1),h.current?.focus(),e()};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(gd,{isOpen:p,onOpenChange:m,placement:`below`,alignment:`end`,width:`min(340px, calc(100vw - 24px))`,label:f(`sessionOverview`),closeButtonLabel:f(`close`),isModal:!1,content:(0,K.jsxs)(`div`,{className:`session-overview`,children:[(0,K.jsx)(`p`,{className:`session-overview-title`,children:t}),(0,K.jsxs)(`button`,{type:`button`,className:`session-overview-row`,title:f(`sessionOverviewChanges`),onClick:()=>A(o),children:[(0,K.jsx)(ye,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:f(`overviewChanges`)}),C&&!d?(0,K.jsxs)(`span`,{className:`session-overview-diff`,title:f(C.complete?`overviewLineTotals`:`overviewPartialTotals`),children:[(0,K.jsxs)(`span`,{className:`review-additions`,children:[`+`,C.additions.toLocaleString()]}),(0,K.jsxs)(`span`,{className:`review-deletions`,children:[`−`,C.deletions.toLocaleString()]}),!C.complete&&(0,K.jsx)(`span`,{className:`session-overview-note`,children:f(`gitReviewPartialLabel`)})]}):(0,K.jsx)(`span`,{className:`session-overview-note`,children:f(u?`overviewCounting`:i?.ok?`overviewCountsUnknown`:`overviewReviewUnavailable`)})]}),(0,K.jsxs)(`div`,{className:`session-overview-section`,children:[(0,K.jsx)(`p`,{children:f(`subagentDetails`)}),(0,K.jsxs)(`button`,{type:`button`,className:`session-overview-row session-overview-agents`,onClick:()=>A(a),"aria-label":`${f(`subagentDetails`)}: ${k}`,children:[O.length>0&&(0,K.jsx)(`span`,{className:`subagent-avatar-stack`,children:O.map(t=>(0,K.jsx)(LI,{identity:`${e}:${t.id}`},t.id))}),(0,K.jsx)(`span`,{className:`session-overview-agent-counts`,children:k.split(` · `).map(e=>(0,K.jsx)(`span`,{children:e},e))}),(0,K.jsx)(ee,{"aria-hidden":`true`})]}),r>0&&(0,K.jsx)(`small`,{children:f(`subagentListTruncated`,{count:r})})]}),s&&(0,K.jsxs)(`div`,{className:`session-overview-section`,children:[(0,K.jsxs)(`div`,{className:`session-overview-section-heading`,children:[(0,K.jsx)(`span`,{children:f(`sessionSources`)}),l&&(0,K.jsx)(`button`,{type:`button`,"aria-label":f(`sourcesAdd`),title:f(`sourcesAdd`),onClick:()=>A(l),children:(0,K.jsx)(lt,{})})]}),x.page?.sources.slice(0,3).map(t=>(0,K.jsx)(BI,{source:t,sessionId:e,path:s,onOpen:()=>w(t)},t.id)),x.error?(0,K.jsxs)(`p`,{role:`alert`,children:[f(`sourcesFailed`),` `,(0,K.jsx)(`button`,{type:`button`,onClick:x.refresh,children:f(`gitReviewRetry`)})]}):!x.page?.sources.length&&(0,K.jsx)(`p`,{children:f(x.loading?`readingFile`:`sourcesEmpty`)}),!!(x.page&&(x.page.sources.length>3||x.page.nextOffset!==void 0))&&(0,K.jsxs)(`button`,{type:`button`,className:`session-overview-row sources-view-all`,onClick:()=>w(null),children:[(0,K.jsx)(Re,{}),(0,K.jsx)(`span`,{children:f(`sourcesViewAll`)}),(0,K.jsx)(ee,{})]})]})]}),children:e=>(0,K.jsx)(`button`,{...e,ref:t=>{e.ref(t),h.current=t},type:`button`,className:`task-tools-trigger`,title:f(`sessionOverview`),"aria-label":f(`sessionOverview`),children:(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.8`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,K.jsx)(`circle`,{cx:`5.5`,cy:`7`,r:`2.8`}),(0,K.jsx)(`circle`,{cx:`5.5`,cy:`17`,r:`2.8`}),(0,K.jsx)(`path`,{d:`M12 7h8M12 17h8`})]})})}),s&&(0,K.jsx)(VI,{sessionId:e,path:s,open:g,source:y,data:x,onSelect:w,onClose:()=>{v(!1),b(null)}})]})}var UI=(0,_.createContext)(null);UI.displayName=`ListContext`;var WI={list:{kogj98:`x1ghz6dp`,kZCmMZ:`x1c1uobl`,kH6xsr:`x3ct3a4`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x1lsbc85`,$$css:!0},withDividers:{kOIVth:`xxhr3t`,$$css:!0},withCounter:{kt6KFK:`xif0320`,$$css:!0}},GI={kt6KFK:`x1khind5`,$$css:!0},KI={counterStart:e=>[GI,{"--x-counterReset":`astryx-list ${e}`==null?void 0:`astryx-list ${e}`}]};function qI({children:e,density:t=`balanced`,hasDividers:n=!1,header:r,listStyle:i=`none`,start:a,xstyle:o,className:s,style:c,"data-testid":l,ref:u,...d}){let f=(0,_.useId)(),p=i===`decimal`,m=p?`ol`:`ul`,h=(0,_.useMemo)(()=>({density:t,hasDividers:n,listStyle:i}),[t,n,i]),g=(0,K.jsx)(m,{ref:u,...d,"data-testid":l,...r==null?null:{"aria-labelledby":f},...p&&a!=null&&a!==1?{start:a}:{},role:`list`,...oa(ba(`list`,{density:t,listStyle:i}),Sr(WI.list,n&&WI.withDividers,i!==`none`&&(a!=null&&a!==1?KI.counterStart(a-1):WI.withCounter),o),s,c),children:e});return r==null?(0,K.jsx)(UI,{value:h,children:g}):(0,K.jsx)(UI,{value:h,children:(0,K.jsxs)(`div`,{className:`x78zum5 xdt5ytf`,children:[(0,K.jsx)(`div`,{id:f,className:`x1p37lm5`,children:r}),g]})})}qI.displayName=`List`;var JI={withCounter:{kAmcRD:`xfrknyr`,$$css:!0},withDivider:{kt9PQ7:`x92x3c3`,kfdmCh:`x1q0q8m5`,kL6WhQ:`xw8gpjh`,$$css:!0}},YI={noRadius:{kaIpWk:`x2u8bby`,$$css:!0}};function XI({label:e,description:t,startContent:n,endContent:r,onClick:i,interactiveRef:a,href:o,target:s,rel:c,isDisabled:l=!1,isSelected:u=!1,xstyle:d,className:f,style:p,ref:m,...h}){let g=(0,_.use)(UI),v=g?.density??`balanced`,y=g?.hasDividers??!1,b=g?.listStyle??`none`;return(0,K.jsx)(Qk,{as:`li`,ref:m,marker:b===`disc`?(0,K.jsx)(`span`,{className:`xoi2r2e x9f619 x78zum5 x6s0dn4 xl56j7k x2lah0s x12xnipv x1233pnv`,children:(0,K.jsx)(`span`,{className:`x1v4s8kt xols6we x16rqkct x19aspcf`})}):b===`circle`?(0,K.jsx)(`span`,{className:`xoi2r2e x9f619 x78zum5 x6s0dn4 xl56j7k x2lah0s x12xnipv x1233pnv`,children:(0,K.jsx)(`span`,{className:`x1v4s8kt xols6we x16rqkct xmkeg23 x1y0btm7 xqcx1ss xjbqb8w`})}):b===`decimal`?(0,K.jsx)(`span`,{className:`xoi2r2e x2lah0s x1tgivj0 xjm74w1 xw6l6zx x12xnipv xc2ndz5`}):null,startContent:n,label:e,description:t,endContent:r,onClick:i,interactiveRef:a,href:o,target:s,rel:c,isDisabled:l,isSelected:u,density:v,xstyle:[b!==`none`&&JI.withCounter,y&&JI.withDivider,y&&YI.noRadius,d],...oa(ba(`list-item`),{className:f,style:p}),...h})}XI.displayName=`ListItem`;function ZI(e){let t=new Map;return e.map(e=>{let n=JSON.stringify(e),r=t.get(n)??0;return t.set(n,r+1),{item:e,key:`${n}:${r}`}})}function QI({name:e,args:t,output:n,state:r}){let{t:i}=cr();return(0,K.jsxs)(`details`,{className:`subagent-tool ${r}`,"data-status":r,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(`code`,{children:e}),(0,K.jsx)(`span`,{className:`subagent-state ${r}`,children:i(`subagentTool_${r}`)})]}),t&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`strong`,{className:`subagent-tool-label`,children:i(`trajectoryArguments`)}),(0,K.jsx)(`pre`,{children:t})]}),n&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`strong`,{className:`subagent-tool-label`,children:i(`trajectoryOutput`)}),(0,K.jsx)(`pre`,{children:n})]})]})}function $I({sessionId:e,id:t,kind:n=`subagents`,activity:r,client:i,saved:a,liveAvailable:o,fullView:s,readOnlyNote:c=!0,active:l=!0,refreshRevision:u=0,onDetail:d}){let{t:f}=cr(),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!0),[b,x]=(0,_.useState)(0),[S,C]=(0,_.useState)(null),w=(0,_.useRef)(null),T=(0,_.useRef)(!0),E=(0,_.useRef)(d);E.current=d,(0,_.useEffect)(()=>{if(!l)return;if(!o){y(!1),g(f(`subagentUnavailable`));return}let a=new AbortController,s,c=!1,u=async()=>{if(c||a.signal.aborted||document.visibilityState===`hidden`)return;c=!0;let o=r?.status===`running`;try{let r=await(n===`workflows`?i.workflowAgentDetail(e,t,a.signal):i.subagentDetail(e,t,a.signal));if(a.signal.aborted)return;if(r.sessionId!==e||r.detail.kind!==n||r.detail.id!==t)throw m(null),o=!1,Error(f(`inspectionChanged`));o=r.detail.status===`running`,m(r.detail),r.detail.kind===`subagents`&&E.current?.(r.detail),g(null),C(new Date().toLocaleTimeString())}catch(e){if(a.signal.aborted)return;g(e instanceof sf&&[404,501].includes(e.status)?f(`subagentUnavailable`):e instanceof Error?e.message:f(`inspectionUnavailable`))}finally{c=!1,a.signal.aborted||(y(!1),o&&(s=setTimeout(()=>void u(),1e3)))}},d=()=>{document.visibilityState===`visible`&&(clearTimeout(s),u())};return document.addEventListener(`visibilitychange`,d),u(),()=>{a.abort(),clearTimeout(s),document.removeEventListener(`visibilitychange`,d)}},[l,i,e,t,n,r?.status,b,u,o,f]),(0,_.useLayoutEffect)(()=>{let e=w.current;e&&T.current&&(e.scrollTop=e.scrollHeight)},[p]);let D=new Map(p?.transcript.flatMap(e=>e.kind===`toolResult`?[[e.toolId,e]]:[])),O=new Set(p?.transcript.flatMap(e=>e.kind===`assistant`?e.parts.flatMap(e=>e.type===`toolCall`?[e.toolId]:[]):[])),k=p?.outcome===`interrupted`?`interrupted`:p?.status,A=p?.transcript.some(e=>e.kind===`assistant`&&e.parts.flatMap(e=>e.type===`text`?[e.text]:[]).join(` +`).trim()===p.finalText.trim()),j=s?`h2`:`h3`;return(0,K.jsxs)(`section`,{className:`subagent-detail`,"aria-label":f(`subagentDetails`),hidden:!l,children:[(0,K.jsxs)(`header`,{className:`subagent-detail-heading`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`subagent-state ${k??`unknown`}`,children:k?f(`subagentState_${k}`):a?.state?`${f(`subagentRecordedState`)}: ${f(`subagentState_${a.state}`)}`:f(`unknownState`)}),p&&(0,K.jsx)(`span`,{className:`subagent-duration`,children:sj(p.createdAt,p.settledAt)})]}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":f(`refreshStatus`),disabled:v||!o,onClick:()=>{y(!0),x(e=>e+1)},children:(0,K.jsx)(dt,{})})]}),v&&!p&&(0,K.jsx)(`p`,{role:`status`,children:f(`inspectionLoading`)}),h&&(0,K.jsxs)(`div`,{className:`inspection-warning`,role:`alert`,children:[(0,K.jsx)(`p`,{children:f(p?`subagentStale`:`subagentUnavailable`)}),h!==f(`subagentUnavailable`)&&(0,K.jsx)(`small`,{children:h})]}),p&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`subagent-metadata`,children:[(0,K.jsx)(`code`,{children:p.id}),p.model&&(0,K.jsx)(`span`,{children:p.model}),(0,K.jsx)(`span`,{title:p.cwd,children:p.cwd})]}),(0,K.jsxs)(`details`,{className:`subagent-task`,children:[(0,K.jsx)(`summary`,{children:f(`subagentTask`)}),(0,K.jsx)(`pre`,{children:p.prompt})]}),p.errorText&&(0,K.jsx)(`p`,{className:`inspection-warning`,role:`alert`,children:p.errorText}),p.truncated&&(0,K.jsx)(`p`,{className:`inspection-note`,children:f(`subagentTruncated`,{count:p.omittedEntries})}),p.kind===`workflows`&&p.transcriptUnavailable&&(0,K.jsx)(`p`,{className:`inspection-note`,children:f(`subagentTranscriptUnavailable`)}),(0,K.jsxs)(`div`,{className:`subagent-transcript`,ref:w,role:`log`,"aria-label":f(`subagentTranscript`),onScroll:e=>{let t=e.currentTarget;T.current=t.scrollHeight-t.clientHeight-t.scrollTop<48},children:[ZI(p.transcript).map(({item:e,key:t})=>(0,K.jsx)(`div`,{className:`subagent-message ${e.kind}`,"data-role":e.kind,children:e.kind===`user`?(0,K.jsx)(`p`,{className:`subagent-user-message`,children:e.text}):e.kind===`toolResult`?O.has(e.toolId)?null:(0,K.jsx)(QI,{name:e.name,output:e.outputPreview,state:e.isError?`error`:`done`}):ZI(e.parts).map(({item:e,key:t})=>e.type===`text`?(0,K.jsx)(Dk,{children:e.text},t):e.type===`thinking`?(0,K.jsxs)(`details`,{className:`subagent-thinking done`,"data-status":`done`,children:[(0,K.jsx)(`summary`,{children:f(`thinkingDone`)}),(0,K.jsx)(`pre`,{children:e.redacted?f(`subagentThinkingRedacted`):e.text})]},t):(0,K.jsx)(QI,{name:e.name,args:e.argsPreview,output:D.get(e.toolId)?.outputPreview??p.liveTools.find(t=>t.toolId===e.toolId)?.outputPreview,state:D.has(e.toolId)?D.get(e.toolId).isError?`error`:`done`:p.liveTools.some(t=>t.toolId===e.toolId&&!t.done)?`running`:`unknown`},e.toolId))},t)),p.liveAssistant?.thinking&&(0,K.jsxs)(`details`,{className:`subagent-thinking running`,"data-status":`running`,children:[(0,K.jsx)(`summary`,{children:f(`thinkingActive`)}),(0,K.jsx)(`pre`,{children:p.liveAssistant.thinking})]}),p.liveAssistant?.text&&(0,K.jsx)(`div`,{className:`subagent-message assistant live`,"data-role":`assistant`,children:(0,K.jsx)(Dk,{children:p.liveAssistant.text})}),p.liveTools.filter(e=>!O.has(e.toolId)).map(e=>(0,K.jsx)(QI,{name:e.name,args:e.argsPreview,output:e.outputPreview,state:e.done?e.isError?`error`:`done`:`running`},e.toolId)),p.finalText&&!A&&(0,K.jsxs)(`section`,{className:`subagent-final`,children:[(0,K.jsx)(j,{children:f(`subagentResult`)}),(0,K.jsx)(Dk,{children:p.finalText})]}),p.status===`running`&&(0,K.jsx)(`p`,{className:`subagent-live`,role:`status`,children:f(`subagentLive`)}),!p.transcript.length&&!p.liveAssistant?.text&&!(p.kind===`workflows`&&p.transcriptUnavailable)&&!p.finalText&&(0,K.jsx)(`p`,{children:f(`subagentNoMessages`)})]}),(c||S)&&(0,K.jsxs)(`p`,{className:`subagent-footnote`,children:[c&&f(`subagentReadOnly`),c&&S&&` · `,S]})]}),!p&&!v&&a&&(0,K.jsxs)(`section`,{className:`subagent-transcript`,"aria-label":f(`subagentSaved`),children:[(0,K.jsx)(j,{children:f(`subagentSaved`)}),(0,K.jsx)(`p`,{className:`inspection-note`,children:f(`subagentSavedHint`)}),a.state&&(0,K.jsxs)(`p`,{children:[f(`subagentRecordedState`),`: `,f(`subagentState_${a.state}`)]}),a.result&&(0,K.jsx)(Dk,{children:a.result}),a.receipt&&(0,K.jsxs)(`details`,{className:`subagent-task`,children:[(0,K.jsx)(`summary`,{children:f(`subagentSpawnReceipt`)}),(0,K.jsx)(`pre`,{children:a.receipt})]})]})]})}function eL({sessionId:e,initialId:t,initialKind:n=`subagents`,activity:r,workflows:i,observed:a=!0,records:o=[],liveAvailable:s=!0,onClose:c}){let{t:l,i18n:u}=cr(),[d,f]=(0,_.useState)([]),p=(0,_.useRef)(null),m=(0,_.useRef)(0),[h,g]=(0,_.useState)(t?{id:t,kind:n}:null),[v,y]=(0,_.useState)(h),b=h?.id;(0,_.useLayoutEffect)(()=>{!b&&p.current&&(p.current.scrollTop=m.current)},[b]);let x=(e,t=`subagents`)=>{let n=e?{id:e,kind:t}:null;n&&y(n),g(n)},[S,C]=(0,_.useState)(()=>window.matchMedia?.(`(max-width: 1100px)`).matches??!1);(0,_.useEffect)(()=>{let e=window.matchMedia?.(`(max-width: 1100px)`);if(!e)return;let t=()=>C(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let w=(0,_.useMemo)(()=>new lf,[]),E=s?r?.items??[]:[],D=s?i?.items??[]:[],O=dj(E,o,D,a),k=(r?.omitted??0)+D.reduce((e,t)=>e+(t.children?.omitted??0),0),A=O.find(e=>e.id===b&&e.kind===h?.kind),j=h?.kind===`subagents`?o.find(e=>e.id===b):void 0,N=(0,_.useRef)(null),P=(0,_.useRef)(document.activeElement);(0,_.useEffect)(()=>{N.current?.focus()},[h]),(0,_.useEffect)(()=>()=>{queueMicrotask(()=>{!document.querySelector(`.subagent-panel`)&&P.current instanceof HTMLElement&&P.current.isConnected&&P.current.focus()})},[]);let F=[{key:`active`,label:`subagentActiveGroup`,items:O.filter(e=>e.state===`running`),empty:`subagentNoneRunning`},{key:`done`,label:`subagentFinishedGroup`,items:O.filter(e=>e.state===`done`),empty:`subagentNoneFinished`},{key:`attention`,label:`subagentOtherGroup`,items:O.filter(e=>e.state===`error`||e.state===`interrupted`)},{key:`saved`,label:`subagentUnconfirmedGroup`,items:O.filter(e=>!e.state)}],I=e=>{let t=Math.max(0,Date.now()-e),n=t<36e5?`minute`:t<864e5?`hour`:`day`,r=n===`minute`?6e4:n===`hour`?36e5:864e5;return new Intl.RelativeTimeFormat(u.language,{numeric:`auto`}).format(-Math.floor(t/r),n)},L=S?`main`:`aside`,R=S?`h1`:`h2`,ee=S?`h2`:`h3`;return(0,K.jsxs)(L,{className:`subagent-panel`,"aria-label":l(`subagentDetails`),onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing&&!e.defaultPrevented&&(e.preventDefault(),b?x(null):c())},children:[(0,K.jsxs)(`header`,{className:`subagent-panel-heading`,children:[(0,K.jsxs)(`div`,{className:`subagent-breadcrumb`,children:[b&&(0,K.jsx)(`button`,{ref:N,type:`button`,className:`icon-button`,"aria-label":l(`backToSubagents`),onClick:()=>x(null),children:(0,K.jsx)(T,{})}),b?(0,K.jsx)(LI,{identity:`${e}:${b}`}):(0,K.jsx)(M,{"aria-hidden":`true`}),(0,K.jsx)(R,{children:b?A?.title||j?.title||b:l(`subagentDetails`)})]}),(0,K.jsx)(`button`,{ref:b?void 0:N,type:`button`,className:`icon-button`,"aria-label":l(`close`),onClick:c,children:(0,K.jsx)(Lt,{})})]}),v&&(0,K.jsx)($I,{sessionId:e,id:v.id,kind:v.kind,activity:v.kind===`subagents`?E.find(e=>e.id===v.id):D.flatMap(e=>e.children?.items??[]).find(e=>e.id===v.id),client:w,saved:v.kind===`subagents`?o.find(e=>e.id===v.id):void 0,liveAvailable:s,fullView:S,active:!!b},`${e}:${v.kind}:${v.id}`),!b&&(0,K.jsxs)(`nav`,{className:`subagent-list`,"aria-label":l(`subagentTasks`),ref:p,onScroll:e=>{m.current=e.currentTarget.scrollTop},children:[F.map(t=>{if(!t.items.length&&!t.empty)return null;let n=d.includes(t.key)?t.items:t.items.slice(0,t.key===`active`?4:10);return(0,K.jsxs)(`section`,{className:`subagent-list-group`,children:[(0,K.jsxs)(ee,{children:[l(t.label),(0,K.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,K.jsx)(`span`,{children:t.items.length})]}),!t.items.length&&t.empty&&(0,K.jsx)(`p`,{children:l(t.empty)}),(0,K.jsx)(qI,{density:`compact`,children:n.map(t=>(0,K.jsx)(XI,{className:`subagent-task-row`,onClick:()=>x(t.id,t.kind),label:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`subagent-task-title`,title:t.title||t.id,children:t.title||t.id}),(0,K.jsx)(`span`,{className:`sr-only`,children:` · ${l(`subagentState_${t.state??`unknown`}`)}`})]}),description:t.saved?l(`subagentSaved`):t.state===`error`||t.state===`interrupted`?l(`subagentState_${t.state}`):void 0,startContent:(0,K.jsx)(LI,{identity:`${e}:${t.id}`}),endContent:(0,K.jsx)(`span`,{className:`subagent-task-end`,children:t.state===`running`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(He,{className:`subagent-running-icon`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`sr-only`,children:l(`subagentState_running`)})]}):t.timestamp?(0,K.jsx)(`time`,{dateTime:new Date(t.timestamp).toISOString(),title:new Date(t.timestamp).toLocaleString(u.language),children:I(t.timestamp)}):null})},`${t.kind}:${t.id}`))}),n.lengthf(e=>[...e,t.key]),children:l(`subagentShowMore`,{count:t.items.length-n.length})})]},t.key)}),k>0&&(0,K.jsx)(`p`,{children:l(`subagentListTruncated`,{count:k})}),!!i?.omitted&&(0,K.jsx)(`p`,{children:l(`subagentWorkflowsTruncated`,{count:i?.omitted})})]})]})}var tL=`openpi:subagent-panel:v1`;function nL(){try{let e=JSON.parse(sessionStorage.getItem(tL)??`null`);if(!e||typeof e!=`object`)return null;let{sessionId:t,sessionPath:n}=e;return typeof t!=`string`||!t||t.length>160||typeof n!=`string`||!n||n.length>4096?null:{sessionId:t,sessionPath:n,navigation:0}}catch{return null}}function rL(e){try{e?sessionStorage.setItem(tL,JSON.stringify({sessionId:e.sessionId,sessionPath:e.sessionPath})):sessionStorage.removeItem(tL)}catch{}}function iL(e){switch(e.toLowerCase()){case`read`:return{action:`read`,Icon:j};case`write`:return{action:`write`,Icon:at};case`edit`:return{action:`edit`,Icon:at};case`bash`:return{action:`command`,Icon:Tt};case`grep`:case`rg`:case`find`:case`fd`:case`glob`:case`tool_search`:return{action:`search`,Icon:ht};case`ls`:return{action:`list`,Icon:De};case`webfetch`:case`websearch`:case`web_fetch`:case`web_search`:return{action:`web`,Icon:je};case`plan_ready`:return{action:`plan`,Icon:U};case`tasks_add`:case`tasks_update`:case`tasks_list`:return{action:`task`,Icon:ze};case`get_goal`:case`create_goal`:case`update_goal`:return{action:`goal`,Icon:Ot};case`git_show`:case`git_diff`:case`git_log`:return{action:`git`,Icon:Ae};default:return e.startsWith(`bg_`)?{action:`command`,Icon:Tt}:e.startsWith(`subagent`)?{action:`agent`,Icon:M}:e.startsWith(`workflow`)?{action:`workflow`,Icon:Ft}:{action:`call`,Icon:It}}}function aL(e,t,n){let{action:r}=iL(t);return n===`returned`?e(`toolActionDone_${r}`):e(`toolActivity_${[`running`,`failed`,`cancelled`,`timed_out`].includes(n)?n:`unknown`}`,{action:e(`toolAction_${r}`)})}function oL(e){let{action:t}=iL(e);return t===`command`?`run`:t===`workflow`?`flow`:t===`call`?e:t}function sL(e,t){let{action:n}=iL(e),r=n===`search`?t.pattern??t.query??t.path:n===`web`?t.url??t.query:t.path??t.command??t.url??t.query??t.id??t.runId;return typeof r==`string`?r:``}function cL(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&(n.kind!==`event`||n.message||n.input!==void 0||n.result))return n}return e.at(-1)}function lL(e){let t=[];for(let n of e){(n.kind===`user`||!t.length)&&t.push({key:n.key,...n.kind===`user`?{prompt:n}:{},runs:[]});let e=t.at(-1),r=e.runs.at(-1);n.kind===`event`&&r?.[0]?.kind===`event`?r.push(n):e.runs.push([n])}return t}function uL(e){let t=new Map(e.map((e,t)=>[e.id,t])),n=new Map,r=new Map,i=new Map;for(let a of e){let e=`message`in a?a.message:void 0;for(let t of e?.parts??[])t.type===`toolCall`&&t.id&&r.set(t.id,(r.get(t.id)??0)+1);if(e?.role===`toolResult`&&e.toolCallId){let r=i.get(e.toolCallId)??[];r.push(e),n.set(e,t.get(a.id)??-1),i.set(e.toolCallId,r)}}let a=new Set,o=[];for(let s of e){let e=`message`in s?s.message:void 0;if(!e){o.push({key:s.id,kind:`event`,title:s.type,timestamp:s.timestamp});continue}if(e.role!==`toolResult`){(e.role!==`assistant`||e.content||!e.parts?.length||e.parts?.some(e=>e.type!==`toolCall`))&&o.push({key:s.id,kind:e.role===`user`?`user`:e.role===`assistant`?`assistant`:`event`,title:e.customType||e.role||s.type,timestamp:s.timestamp,message:e});for(let[c,l]of(e.parts??[]).entries()){if(l.type!==`toolCall`)continue;let u=l.id?i.get(l.id):void 0,d=l.id&&r.get(l.id)===1&&u?.length===1&&u[0]?.toolName===l.name&&!l.id.includes(`[truncated]`)&&(n.get(u[0])??-1)>(t.get(s.id)??-1)?u[0]:void 0;d&&a.add(d),o.push({key:`${s.id}:call:${c}`,kind:`call`,title:l.name,timestamp:s.timestamp,callId:l.id,input:l.arguments,message:e,result:d,outcome:d?.isError===!0?`error`:d?.isError===!1?`returned`:`unknown`})}}}let s=new Map(o.map(e=>[e.key,t.get(e.key)??-1]));for(let n of e){let e=`message`in n?n.message:void 0;e?.role===`toolResult`&&!a.has(e)&&(o.push({key:n.id,kind:`result`,title:e.toolName||`toolResult`,timestamp:n.timestamp,callId:e.toolCallId,result:e,outcome:e.isError===!0?`error`:e.isError===!1?`returned`:`unknown`}),s.set(n.id,t.get(n.id)??0));for(let[r,i]of(e?.parts??[]).entries())i.type===`toolCall`&&s.set(`${n.id}:call:${r}`,t.get(n.id)??0)}return o.sort((e,t)=>(s.get(e.key)??0)-(s.get(t.key)??0)),o}var dL=[];function fL(e){return e.kind===`call`||e.kind===`result`?``:(e.message?.parts??[]).filter(e=>e.type===`thinking`).map(e=>e.text).join(` -`)}function cL(e,t){return e.kind===`event`?t(`trajectoryEvent_${e.title}`,{defaultValue:e.title}):e.kind===`call`||e.kind===`result`?e.title:e.kind===`assistant`&&!e.message?.content&&sL(e)?t(`trajectoryReasoningTitle`):t(`trajectory_${e.kind}`)}function lL(e){if(e.input)try{let t=JSON.parse(e.input);if(t&&typeof t==`object`&&!Array.isArray(t)){let n=nL(e.title,t);if(n)return n}}catch{}return e.input||e.message?.content||sL(e)||e.result?.content||``}function uL({node:e}){let t=e.kind===`call`||e.kind===`result`?$I(e.title).Icon:e.kind===`user`?O:e.kind===`event`?_t:!e.message?.content&&sL(e)?Le:Xe;return(0,K.jsx)(t,{"aria-hidden":`true`})}function dL({node:e}){let{t}=cr();if(!e.outcome)return null;let n=e.outcome===`returned`?I:e.outcome===`error`?Lt:ne;return(0,K.jsxs)(`span`,{className:`trajectory-outcome ${e.outcome}`,title:t(`trajectory_${e.outcome}`),children:[(0,K.jsx)(n,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:t(`trajectory_${e.outcome}`)})]})}function fL({label:e,value:t}){return(0,K.jsxs)(`section`,{className:`trajectory-evidence`,children:[(0,K.jsx)(`h3`,{children:e}),(0,K.jsx)(`pre`,{children:t})]})}function pL({node:e,number:t}){let{t:n,i18n:r}=cr(),i=(0,_.useId)(),[a,o]=(0,_.useState)(`summary`),s=e.result,c=e.message,l=sL(e),u=e.kind===`call`||e.kind===`result`,d=[{key:`summary`,label:n(`trajectorySummary`)},...e.input===void 0?[]:[{key:`input`,label:n(`trajectoryInputTab`)}],...u?[{key:`output`,label:n(`trajectoryResultTab`)}]:[]],f=e.timestamp?new Date(e.timestamp):null,p=f&&Number.isFinite(f.getTime())?f.toLocaleString(r.language,{hour12:!1}):e.timestamp,m=(0,K.jsxs)(K.Fragment,{children:[s?(0,K.jsx)(fL,{label:n(`trajectoryOutput`),value:s.content||n(`noOutput`)}):(0,K.jsx)(`p`,{className:`trajectory-missing`,children:n(`trajectoryMissingResult`)}),a===`output`&&s?.details!==void 0&&(0,K.jsxs)(`details`,{className:`trajectory-disclosure`,children:[(0,K.jsx)(`summary`,{children:n(`trajectoryStructured`)}),(0,K.jsx)(`pre`,{children:JSON.stringify(s.details,null,2)})]})]}),h=c&&(0,K.jsxs)(K.Fragment,{children:[c.content&&(0,K.jsx)(fL,{label:n(`trajectoryRecordedContent`),value:c.content}),l&&(0,K.jsxs)(`details`,{className:`trajectory-disclosure trajectory-reasoning`,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(Le,{"aria-hidden":`true`}),n(`trajectoryThinking`)]}),(0,K.jsx)(`pre`,{children:l})]}),!c.content&&!l&&(0,K.jsx)(`p`,{children:n(`noOutput`)})]});return(0,K.jsxs)(`section`,{className:`trajectory-inspector`,"aria-label":n(`trajectoryDetails`),tabIndex:0,children:[(0,K.jsxs)(`header`,{className:`trajectory-inspector-heading`,children:[(0,K.jsx)(`span`,{className:`trajectory-inspector-icon`,children:(0,K.jsx)(uL,{node:e})}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`p`,{children:[u&&(0,K.jsxs)(K.Fragment,{children:[n(`trajectory_${e.kind}`),` · `]}),n(`trajectoryRecordNumber`,{number:t})]}),(0,K.jsx)(`h2`,{id:`${i}-title`,children:cL(e,n)})]})]}),e.outcome&&(0,K.jsx)(dL,{node:e}),d.length>1&&(0,K.jsx)(`div`,{className:`trajectory-tabs`,role:`tablist`,"aria-label":n(`trajectoryDetails`),onKeyDown:e=>{let t=d.findIndex(e=>e.key===a),n=e.key===`ArrowRight`?(t+1)%d.length:e.key===`ArrowLeft`?(t+d.length-1)%d.length:e.key===`Home`?0:e.key===`End`?d.length-1:void 0;n!==void 0&&(e.preventDefault(),o(d[n].key),e.currentTarget.querySelectorAll(`button`)[n]?.focus())},children:d.map(e=>(0,K.jsx)(`button`,{type:`button`,role:`tab`,id:`${i}-${e.key}`,"aria-controls":`${i}-panel`,"aria-selected":a===e.key,tabIndex:a===e.key?0:-1,onClick:()=>o(e.key),children:e.label},e.key))}),(0,K.jsxs)(`section`,{className:`trajectory-detail-content`,role:d.length>1?`tabpanel`:void 0,id:`${i}-panel`,"aria-labelledby":d.length>1?`${i}-${a}`:`${i}-title`,children:[(c?.truncation||s?.truncation)&&(0,K.jsx)(`p`,{className:`trajectory-warning`,children:n(`trajectoryEvidenceTruncated`)}),(a===`summary`||a===`input`)&&e.input!==void 0&&(0,K.jsx)(fL,{label:n(`trajectoryArguments`),value:e.input}),(a===`summary`||a===`output`)&&u&&m,!u&&h,e.kind===`event`&&!c&&(0,K.jsx)(`p`,{className:`trajectory-missing`,children:n(`trajectoryEventOnly`)}),(0,K.jsxs)(`details`,{className:`trajectory-disclosure trajectory-metadata`,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(Pe,{"aria-hidden":`true`}),n(`trajectoryRecordInfo`)]}),(0,K.jsxs)(`dl`,{children:[p&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{children:n(`trajectoryRecordedAt`)}),(0,K.jsx)(`dd`,{children:(0,K.jsx)(`time`,{dateTime:e.timestamp,children:p})})]}),e.callId&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{children:n(`trajectoryCallId`)}),(0,K.jsx)(`dd`,{children:e.callId})]}),(0,K.jsx)(`dt`,{children:n(`trajectoryRecordId`)}),(0,K.jsx)(`dd`,{children:e.key}),e.kind===`event`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{children:n(`trajectoryEventType`)}),(0,K.jsx)(`dd`,{children:e.title})]})]})]})]})]})}var mL=(0,_.memo)(function({snapshot:e,running:t}){let{t:n}=cr(),r=e.selectedSession?.entries??oL,i=(0,_.useMemo)(()=>aL(r),[r]),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(50),[d,f]=(0,_.useState)(new Set),p=(0,_.useMemo)(()=>{let e=s.trim().toLocaleLowerCase();return e?i.filter(t=>[cL(t,n),t.title,t.callId,t.input,lL(t),t.result?.content,sL(t)].some(t=>t?.toLocaleLowerCase().includes(e))):i},[i,s,n]),m=p.findIndex(e=>e.key===a),h=Math.min(Math.max(0,p.length-l),m<0?p.length:m),g=p.slice(h),v=g.find(e=>e.key===a)??rL(g),y=(0,_.useRef)(null);(0,_.useEffect)(()=>{v?.key&&y.current?.querySelector(`.trajectory-record[aria-pressed="true"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[v?.key]);let b=(0,_.useMemo)(()=>iL(i),[i]),x=new Set(g.map(e=>e.key)),S=b.flatMap(e=>{let t=e.runs.map(e=>e.filter(e=>x.has(e.key))).filter(e=>e.length>0);return t.length?[{...e,runs:t}]:[]}),C=new Map(i.map((e,t)=>[e.key,t+1])),w=e.selectedSession?.truncation;function T(e){let t=lL(e);return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":e.key===v?.key,onClick:()=>o(e.key),className:`trajectory-record ${e.kind}`,title:ej(t,220),children:[(0,K.jsx)(`span`,{className:`trajectory-record-icon`,children:(0,K.jsx)(uL,{node:e})}),(0,K.jsxs)(`span`,{className:`trajectory-record-main`,children:[(0,K.jsxs)(`span`,{className:`trajectory-record-title`,children:[(0,K.jsx)(`strong`,{children:cL(e,n)}),(0,K.jsx)(`span`,{className:`trajectory-kind`,children:n(`trajectory_${e.kind}`)})]}),t&&(0,K.jsx)(`span`,{className:`trajectory-preview`,children:ej(t,180)})]}),(0,K.jsxs)(`span`,{className:`trajectory-record-end`,children:[(0,K.jsx)(dL,{node:e}),(0,K.jsx)(`time`,{dateTime:e.timestamp,children:tj(e.timestamp)})]})]})},e.key)}return(0,K.jsxs)(`section`,{className:`conversation trajectory`,"aria-label":n(`trajectory`),children:[(0,K.jsxs)(`header`,{className:`trajectory-toolbar`,children:[(0,K.jsxs)(`div`,{className:`trajectory-context`,children:[(0,K.jsx)(Ve,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:n(`trajectoryOrder`)}),(0,K.jsx)(`span`,{className:`trajectory-count`,children:n(s.trim()?`trajectoryMatches`:`trajectoryRecordCount`,{count:p.length})}),(0,K.jsxs)(`details`,{className:`trajectory-scope`,children:[(0,K.jsx)(`summary`,{"aria-label":n(`trajectoryScope`),title:n(`trajectoryScope`),children:(0,K.jsx)(Pe,{"aria-hidden":`true`})}),(0,K.jsx)(`p`,{children:n(`trajectoryScope`)})]})]}),(0,K.jsxs)(`label`,{className:`trajectory-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`input`,{type:`search`,"aria-label":n(`trajectorySearch`),placeholder:n(`trajectorySearch`),value:s,onChange:e=>c(e.currentTarget.value)})]})]}),t&&(0,K.jsx)(`p`,{className:`trajectory-live`,role:`status`,children:n(`trajectoryRunning`)}),w?.truncated&&(0,K.jsx)(`p`,{className:`trajectory-warning`,children:n(`trajectoryTruncated`,{entries:w.entriesOmitted,parts:w.messagePartsOmitted,messages:w.messagesTruncated})}),g.length?(0,K.jsxs)(`div`,{className:`trajectory-body`,children:[(0,K.jsxs)(`div`,{className:`trajectory-ledger`,ref:y,children:[h>0&&(0,K.jsx)(`button`,{type:`button`,className:`trajectory-load`,onClick:()=>u(e=>e+50),children:n(`trajectoryEarlier`,{count:h})}),S.map(e=>{let t=!d.has(e.key);return(0,K.jsxs)(`section`,{className:`trajectory-group`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`trajectory-group-heading`,"aria-expanded":t,onClick:()=>f(n=>{let r=new Set(n);return t?r.add(e.key):r.delete(e.key),r}),children:[(0,K.jsx)(ee,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:e.prompt?t&&!s.trim()?n(`trajectoryConversationGroup`):ej(e.prompt.message?.content||n(`trajectory_user`),80):n(`trajectoryEarlierGroup`)})]}),t&&(0,K.jsx)(`ol`,{children:e.runs.map(e=>e.length===1?T(e[0]):(0,K.jsx)(`li`,{className:`trajectory-event-group`,children:(0,K.jsxs)(`details`,{open:e.some(e=>e.key===v?.key)||!!s.trim(),children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(_t,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:n(`trajectoryEventCount`,{count:e.length})}),(0,K.jsx)(ee,{"aria-hidden":`true`})]}),(0,K.jsx)(`ol`,{children:e.map(T)})]})},e[0].key))})]},e.key)})]}),v&&(0,K.jsx)(pL,{node:v,number:C.get(v.key)},v.key)]}):(0,K.jsxs)(`div`,{className:`trajectory-empty`,children:[(0,K.jsx)(Ve,{"aria-hidden":`true`}),(0,K.jsx)(`p`,{children:n(s.trim()?`trajectoryNoMatches`:`trajectoryEmpty`)})]})]})}),hL=`openpi:reading-positions:v1`;function gL(){let e=new Map;try{let t=localStorage.getItem(`openpi:reading-positions:v1`)??`[]`,n=t.length<=32768?JSON.parse(t):[];if(Array.isArray(n)&&n.length<=4)for(let t of n){if(!Array.isArray(t)||t.length!==2)continue;let[n,r]=t;if(typeof n!=`string`||n.length>4600)continue;let i;try{i=JSON.parse(n)}catch{continue}!Array.isArray(i)||i.length!==2||!i.every(e=>typeof e==`string`&&e.length>0)||typeof r!=`object`||!r||!(`key`in r)||typeof r.key!=`string`||!r.key||r.key.length>512||`entryId`in r&&(typeof r.entryId!=`string`||!r.entryId||r.entryId.length>128)||!(`offset`in r)||typeof r.offset!=`number`||!Number.isFinite(r.offset)||Math.abs(r.offset)>1e6||!(`scrollTop`in r)||typeof r.scrollTop!=`number`||!Number.isFinite(r.scrollTop)||r.scrollTop<0||!(`pinned`in r)||typeof r.pinned!=`boolean`||e.set(n,{position:{key:r.key,offset:r.offset,...`entryId`in r&&typeof r.entryId==`string`?{entryId:r.entryId}:{},scrollTop:r.scrollTop,pinned:r.pinned}})}}catch{}return e.persist=()=>{try{localStorage.setItem(hL,JSON.stringify([...e].flatMap(([e,t])=>t.position?.key?[[e,{key:t.position.key,entryId:t.position.entryId,offset:t.position.offset,scrollTop:t.position.scrollTop,pinned:t.position.pinned}]]:[])))}catch{}},e}function _L(e){return JSON.stringify([e?.id,e?.path])}function vL(e,t,n){let r={...e.get(t),...n};e.delete(t),e.set(t,r),e.size>4&&e.delete(e.keys().next().value),e.persist?.()}var yL={base:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kaIpWk:`x16rqkct`,kmuXW:`x2lah0s`,kzqmXN:`x1xc55vz`,kZKoxP:`xdk7pt`,$$css:!0},pulsing:{kKVMdj:`x1mta51n`,k44tkh:`x1c74tu6`,kyAemX:`x4hg4is`,ko0y90:`xa4qsjk`,$$css:!0},reducedMotion:{kjO2d4:`x1aquc0h`,$$css:!0}},bL={success:{kWkggS:`xdsz4j9`,kMwMTN:`xri61p4`,$$css:!0},warning:{kWkggS:`x1q8g9m5`,kMwMTN:`xrebv38`,$$css:!0},error:{kWkggS:`x1pjz0fi`,kMwMTN:`x1m024r3`,$$css:!0},accent:{kWkggS:`x1ewilqj`,kMwMTN:`x17wrial`,$$css:!0},neutral:{kWkggS:`x1q5y3ey`,kMwMTN:`xrkvqaz`,$$css:!0}};function xL({variant:e,label:t,isPulsing:n=!1,tooltip:r,icon:i,xstyle:a,className:o,style:s,ref:c,...l}){let u=Ea(i),d=(0,K.jsx)(`span`,{ref:c,role:`img`,"aria-label":t,...oa(ba(`status-dot`,{variant:e},{legacyNames:[`statusdot`]}),Sr(yL.base,bL[e],n&&yL.pulsing,n&&yL.reducedMotion,a),o,s),...l,children:u&&(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`x78zum5 x6s0dn4 xl56j7k x14ju556 x1xc55vz xdk7pt`,children:i})});return r?(0,K.jsx)(Cd,{content:r,children:d}):d}xL.displayName=`StatusDot`;function SL(e){if(e.role!==`custom`||e.customType!==`openpi-setup-request`||e.truncation?.details)return e;let t=e.details;return!t||typeof t!=`object`||Array.isArray(t)||!(`command`in t)||t.command!==`openpi-setup`&&t.command!==`my-pi-setup`||!(`request`in t)||typeof t.request!=`string`?e:{...e,role:`user`,content:`/${t.command}${t.request?` ${t.request}`:``}`,parts:void 0}}function CL(e,t){let n=e.parentId,r=new Set;for(let e=0;n&&e<32;e++){if(r.has(n))return;r.add(n);let e=t(n);if(!e||e.id!==n)return;if(e.message?.role!==`system`)return e.message;n=e.parentId}}function wL(e,t){let n=SL(e);return e.customType===`openpi-setup-request`&&n.role===`user`&&t?.role===`user`&&t.customType===`openpi-web-command-input`&&typeof t.commandId==`string`&&t.commandId.length>0&&t.commandId.length<=128&&!/[\u0000-\u001f\u007f]/u.test(t.commandId)&&t.content===n.content}function TL({identity:e,title:t,label:n,state:r=`unknown`,onInspect:i}){let{t:a}=cr(),o=(0,_.useId)();return(0,K.jsxs)(i?`button`:`div`,{className:`subagent-card-open`,type:i?`button`:void 0,"aria-label":i?a(`inspectSubagent`,{name:t}):void 0,"aria-describedby":i?o:void 0,onClick:i,children:[(0,K.jsx)(MI,{identity:e}),(0,K.jsx)(`span`,{className:`subagent-activity-title`,title:t,children:t}),(0,K.jsx)(`span`,{id:o,className:`subagent-state ${r}`,children:n})]})}function EL(e,t){let n=Math.max(0,Math.floor(e/1e3)),r=Math.floor(n/3600),i=Math.floor(n/60)%60,a=n%60;return t.startsWith(`zh`)?[r?`${r}h`:``,i||r?`${i}m`:``,`${a}s`].filter(Boolean).join(` `):`${r?`${r}h`:``}${i||r?`${i}m`:``}${a}s`}function DL({elapsedMs:e,waiting:t=!1}){let{t:n,i18n:r}=cr(),i=(0,_.useRef)({elapsedMs:e,clock:performance.now()}),[a,o]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let t=performance.now();i.current={elapsedMs:Math.max(e,i.current.elapsedMs+t-i.current.clock),clock:t},o(i.current.elapsedMs)},[e]),(0,_.useEffect)(()=>{let e=window.setInterval(()=>{o(i.current.elapsedMs+performance.now()-i.current.clock)},1e3);return()=>window.clearInterval(e)},[]),(0,K.jsx)(`span`,{className:`turn-elapsed-running`,role:`timer`,"aria-live":`off`,children:n(t?`compactionElapsed`:`turnElapsedRunning`,{duration:EL(a,r.language)})})}function OL({timing:e}){let{t,i18n:n}=cr();return(0,K.jsx)(`span`,{children:t(`turnElapsedFinished`,{duration:EL(e.elapsedMs,n.language)})})}function kL({compaction:e,observed:t=!0}){let{t:n}=cr(),r=e.state===`running`,i=r&&!t,a=i?`unavailable`:e.state;return(0,K.jsxs)(`div`,{className:`context-compaction`,"data-state":a,children:[(0,K.jsxs)(`div`,{className:`context-compaction-heading`,children:[(0,K.jsxs)(`span`,{className:`context-compaction-label`,role:`status`,children:[(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,K.jsx)(`path`,{d:`M4 4v13a3 3 0 0 0 3 3h3M14 4h3a3 3 0 0 1 3 3v13M8 10h8M8 14h4`}),(0,K.jsx)(`circle`,{cx:`4`,cy:`4`,r:`1.7`,fill:`currentColor`,stroke:`none`}),(0,K.jsx)(`circle`,{cx:`20`,cy:`20`,r:`1.7`,fill:`currentColor`,stroke:`none`})]}),(0,K.jsx)(`span`,{className:`context-compaction-text`,children:n({running:`compactionRunning`,completed:`compactionCompleted`,failed:`compactionInterrupted`,cancelled:`compactionInterrupted`,unchanged:`compactionUnchanged`,unavailable:`compactionUnavailable`}[a])})]}),r&&t&&e.elapsedMs!==void 0&&(0,K.jsx)(DL,{elapsedMs:e.elapsedMs,waiting:!0},e.startedAt)]}),i&&(0,K.jsx)(`p`,{children:n(`compactionReconnectHelp`)})]})}function AL(e,t,n,r){if(e.name!==`codemode`||!e.id||t?.forkSnapshotToolResult)return;let i=t!==void 0&&r!==`running`,a=new Set([e.id]),o=[];for(let e of n)!e.parentToolCallId||!a.has(e.parentToolCallId)||(e.call.id&&a.add(e.call.id),o.push(e));let s=Pd(t?.details),c=Array.isArray(s.calls)?s.calls:[],l=new Set(c.flatMap(e=>{let t=Pd(e);return t.status===`cancelled`&&typeof t.id==`string`?[t.id]:[]})),u=t?.nestedCalls,d=[];for(let e of u?.calls??[]){let t=o.find(t=>t.call.id===e.call.id&&t.call.name===e.call.name),n=e.status!==`ok`&&l.has(e.call.id??``)?`cancelled`:e.status===`ok`?`returned`:e.status===`error`?`failed`:t&&[`returned`,`failed`,`cancelled`,`timed_out`].includes(t.state)?Vd(t.call,t.result,t.state).state:`unknown`;d.push({call:e.call,result:t?.result,state:n,outputMissing:!t?.result,argumentsOmitted:e.argumentsOmitted,error:e.error})}for(let e of o)d.some(t=>t.call.id===e.call.id)||i&&u?.complete||d.push({call:e.call,result:e.result,state:i&&e.state===`running`?`unknown`:e.result?.isError!==!1&&l.has(e.call.id??``)?`cancelled`:Vd(e.call,e.result,e.state).state,outputMissing:!1});let f=c.some(e=>{let t=Pd(e);return!i&&t.status===`running`&&typeof t.id==`string`&&t.id.endsWith(`/?`)?!1:!d.some(e=>e.call.id===t.id&&e.call.name===t.name)});return{children:d,incomplete:u?.complete===!1||f||i&&!u&&c.length>d.length,showWrapper:d.length===0||f||t?.isError===!0||r===`running`&&!d.some(e=>e.state===`running`)}}function jL(e){let t=new Map(XM(e).map(e=>[e.start,e]));return()=>n=>{let r=[],i=e=>{if(e.type===`link`){let n=t.get(e.position?.start.offset??-1);n&&n.end===e.position?.end.offset&&r.push(n);return}if(`children`in e)for(let t of e.children)i(t)};i(n);let a=[],o=0;for(let t of r)a.push({type:`text`,value:e.slice(o,t.start)},{type:`element`,tagName:`a`,properties:{href:t.reference},children:[{type:`text`,value:t.name}]}),o=t.end;a.push({type:`text`,value:e.slice(o)}),n.children=[{type:`paragraph`,children:[],data:{hChildren:a}}]}}function ML({reference:e,label:t}){let{t:n}=cr(),r=(0,_.useContext)(fk),[i,a]=(0,_.useState)(!1),o=e;try{o=decodeURIComponent(e)}catch{}let s=t===o&&o.split(/[\\/]/u).at(-1)||t;return(0,K.jsxs)(`span`,{className:`user-file-reference`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`user-file-reference-open`,disabled:!r||r.disabled,title:s,onClick:t=>r?.open(e,r.parent,t.currentTarget),children:[(0,K.jsx)(Se,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:s})]}),(0,K.jsx)(`button`,{type:`button`,className:`user-file-reference-details`,"aria-label":`${n(`artifactFileDetails`)} ${s}`,"aria-expanded":i,onClick:()=>a(e=>!e),children:(0,K.jsx)(L,{"aria-hidden":`true`})}),i&&(0,K.jsx)(`span`,{className:`user-file-reference-path`,children:o})]})}var NL={p:({children:e})=>(0,K.jsx)(`div`,{className:`message-body user-message-content`,children:e}),a:({href:e,node:t})=>(0,K.jsx)(ML,{reference:e??``,label:t?.children.map(e=>e.type===`text`?e.value:``).join(``)??``})};function PL({content:e,incomplete:t=!1}){let n=jL(e);return t?(0,K.jsx)(`div`,{className:`message-body`,children:e}):(0,K.jsx)(wb,{remarkPlugins:[n],urlTransform:e=>e,components:NL,children:e})}function FL({preview:e,sessionId:t,sessionPath:n,entryId:r,markdown:i,fullText:a,onComplete:o,onProgress:s,purpose:c,partIndex:l}){let{t:u}=cr(),d=(0,_.useMemo)(()=>new rf,[]),f=(0,_.useRef)(null),p=(0,_.useRef)(null),m=(0,_.useRef)(null),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(0),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(!1);(0,_.useEffect)(()=>()=>f.current?.abort(),[]);let w=(0,_.useCallback)(async()=>{if(f.current||v===null)return;let e=new AbortController;f.current=e,x(!0),C(!1);try{let i=[t,n,r,v,e.signal],a=await(c===`thinking`?d.sessionItem(...i,c,l):c?d.sessionItem(...i,c):d.sessionItem(...i));if(e.signal.aborted)return;if(a.entryId!==r||c===`plan`&&a.planStatus!==`ready`||c===`thinking`&&a.partIndex!==l||a.nextCursor!==null&&a.nextCursor<=v)throw Error(`Message identity changed`);let u=v===0?[a.text]:[...h??[],a.text];g(u),y(a.nextCursor),a.nextCursor===null?(o?.(u.join(``)),document.activeElement===p.current&&!m.current?.closest(`[hidden]`)&&m.current?.focus()):s?.(u.join(``))}catch{e.signal.aborted||C(!0)}finally{f.current===e&&(f.current=null,e.signal.aborted||x(!1))}},[d,t,n,r,v,c,l,h,o,s]);(0,_.useEffect)(()=>{if(c!==`thinking`||a!==void 0||h!==null||S)return;let e=m.current;if(!e)return;if(typeof IntersectionObserver>`u`){e.closest(`[hidden], details:not([open])`)||w();return}let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(t.disconnect(),w())});return t.observe(e),()=>t.disconnect()},[c,a,h,S,w]);let T=a??h?.join(``)??e;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{ref:m,className:`message-full-text`,tabIndex:-1,children:i?(0,K.jsx)(Sk,{children:T}):(0,K.jsx)(PL,{content:T,incomplete:a===void 0&&v!==null})}),c===`thinking`&&a===void 0&&v!==null&&(0,K.jsx)(`p`,{className:`evidence-warning`,children:u(`thinkingPartialText`)}),a===void 0&&v!==null&&(0,K.jsx)(`button`,{ref:p,type:`button`,className:`message-load-full`,"aria-disabled":b,onClick:()=>void w(),children:u(b?c===`plan`?`planCardLoadingFull`:c===`thinking`?`thinkingLoadingFull`:`messageLoadingFull`:S?c===`plan`?`planCardLoadFailed`:c===`thinking`?`thinkingLoadFailed`:`messageLoadFailed`:h?`messageLoadMore`:c===`plan`?`planCardLoadFull`:c===`thinking`?`thinkingLoadFull`:`messageLoadFull`)})]})}function IL(e){if(e?.toolName!==`plan_ready`||e.isError!==!1)return;let t=Pd(e.details);if(t.status===`ready`&&typeof t.plan==`string`&&t.plan.trim())return{markdown:t.plan,ready:!0,truncated:!1};if(e.truncation?.details&&e.content.trim())return{markdown:e.content,ready:!1,truncated:!0}}function LL({result:e,sessionId:t,sessionPath:n,entryId:r}){let{t:i}=cr(),a=(0,_.useId)(),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null),f=JSON.stringify([t,n,r]),p=u?.source===f?u:void 0,m=p?.complete?p.markdown:void 0,h=IL(e),g=h?.truncated&&p?{markdown:p.markdown,ready:p.complete,truncated:!p.complete}:h,v=(0,_.useRef)({source:f,markdown:g?.markdown});v.current={source:f,markdown:g?.markdown};let y=c?.source===f&&c?.markdown===g?.markdown?c.status:null;return g?(0,K.jsxs)(`section`,{className:`plan-card`,"aria-label":i(`planCardLabel`),children:[(0,K.jsxs)(`div`,{className:`plan-card-header`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`plan-card-toggle`,"aria-expanded":o,"aria-controls":a,onClick:()=>s(!o),children:[(0,K.jsx)(Se,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:i(g.ready?`planCardReady`:`planCardResult`)}),(0,K.jsx)(`span`,{className:`plan-card-disclosure`,children:i(o?`planCardCollapse`:`planCardExpand`)})]}),(0,K.jsx)(`button`,{type:`button`,className:`plan-card-copy`,"aria-label":i(g.truncated?`planCardCopyPreview`:`planCardCopy`),title:i(g.truncated?`planCardCopyPreview`:`planCardCopy`),onClick:async()=>{let e=await wd(g.markdown);v.current.source===f&&v.current.markdown===g.markdown&&l({source:f,markdown:g.markdown,status:e?`copiedMessage`:`copyFailed`})},children:y===`copiedMessage`?(0,K.jsx)(I,{"aria-hidden":`true`}):(0,K.jsx)(oe,{"aria-hidden":`true`})})]}),(0,K.jsxs)(`div`,{id:a,hidden:!o,className:`plan-card-body`,children:[(0,K.jsx)(`p`,{className:`plan-card-note`,children:i(`planCardNotApproval`)}),g.truncated&&(0,K.jsx)(`p`,{className:`plan-card-note`,children:i(`planCardTruncated`)}),h?.truncated&&t&&n&&r?(0,K.jsx)(FL,{preview:h.markdown,sessionId:t,sessionPath:n,entryId:r,markdown:!0,purpose:`plan`,fullText:m,onProgress:e=>d({source:f,markdown:e,complete:!1}),onComplete:e=>d({source:f,markdown:e,complete:!0})},f):(0,K.jsx)(Sk,{children:g.markdown}),(0,K.jsxs)(`details`,{className:`plan-card-evidence`,children:[(0,K.jsx)(`summary`,{children:i(`planCardEvidence`)}),(0,K.jsx)(`pre`,{className:`tool-evidence`,children:Fd(e.content).text})]})]}),y&&(0,K.jsx)(`span`,{className:`plan-card-feedback`,role:`status`,children:i(y)})]}):null}var RL=500,zL=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(.*)$/u;function BL(e){let t=[],n=e=>{t.push({id:t.length,...e})},r=0,i=0,a=!1,o=0,s=0,c=e.split(` -`);c.at(-1)===``&&c.pop();for(let e of c){let t=zL.exec(e);if(t){r=Number(t[1]),i=Number(t[3]),o=t[2]===void 0?1:Number(t[2]),s=t[4]===void 0?1:Number(t[4]),a=!0,n({kind:`meta`,marker:``,code:t[5]?.trim()||e});continue}if(!a){if(!e||e.startsWith(`diff --git `)||e.startsWith(`index `)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`new file mode `)||e.startsWith(`deleted file mode `))continue;n({kind:`meta`,marker:``,code:e});continue}if(e.startsWith(`+`)&&s>0){n({kind:`added`,newLine:i,marker:`+`,code:e.slice(1)}),i+=1,--s;continue}if(e.startsWith(`-`)&&o>0){n({kind:`removed`,oldLine:r,marker:`-`,code:e.slice(1)}),r+=1,--o;continue}if(e.startsWith(`\\ No newline`)){n({kind:`meta`,marker:``,code:e});continue}if(!e.startsWith(` `)||o<=0||s<=0){a=!1,n({kind:`meta`,marker:``,code:e});continue}n({kind:`context`,oldLine:r,newLine:i,marker:` `,code:e.startsWith(` `)?e.slice(1):e}),r+=1,i+=1,--o,--s}return t}function VL({file:e,onReferenceLine:t}){let{t:n}=cr(),r=(0,_.useMemo)(()=>BL(e.diff),[e.diff]),i=r.slice(0,RL),a=(0,_.useRef)(null),[o,s]=(0,_.useState)(null),c=o?.file===e?o.id:void 0,l=n=>{let i=n.newLine===void 0?`old`:`new`,a=n.newLine??n.oldLine;if(!(!t||e.binary||!a||a<1||!Number.isSafeInteger(a)||e.diffTruncated&&!e.diff.endsWith(` +`)}function pL(e,t){return e.kind===`event`?t(`trajectoryEvent_${e.title}`,{defaultValue:e.title}):e.kind===`call`||e.kind===`result`?e.title:e.kind===`assistant`&&!e.message?.content&&fL(e)?t(`trajectoryReasoningTitle`):t(`trajectory_${e.kind}`)}function mL(e){if(e.input)try{let t=JSON.parse(e.input);if(t&&typeof t==`object`&&!Array.isArray(t)){let n=sL(e.title,t);if(n)return n}}catch{}return e.input||e.message?.content||fL(e)||e.result?.content||``}function hL({node:e}){let t=e.kind===`call`||e.kind===`result`?iL(e.title).Icon:e.kind===`user`?O:e.kind===`event`?_t:!e.message?.content&&fL(e)?Le:Xe;return(0,K.jsx)(t,{"aria-hidden":`true`})}function gL({node:e}){let{t}=cr();if(!e.outcome)return null;let n=e.outcome===`returned`?I:e.outcome===`error`?Lt:ne;return(0,K.jsxs)(`span`,{className:`trajectory-outcome ${e.outcome}`,title:t(`trajectory_${e.outcome}`),children:[(0,K.jsx)(n,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:t(`trajectory_${e.outcome}`)})]})}function _L({label:e,value:t}){return(0,K.jsxs)(`section`,{className:`trajectory-evidence`,children:[(0,K.jsx)(`h3`,{children:e}),(0,K.jsx)(`pre`,{children:t})]})}function vL({node:e,number:t}){let{t:n,i18n:r}=cr(),i=(0,_.useId)(),[a,o]=(0,_.useState)(`summary`),s=e.result,c=e.message,l=fL(e),u=e.kind===`call`||e.kind===`result`,d=[{key:`summary`,label:n(`trajectorySummary`)},...e.input===void 0?[]:[{key:`input`,label:n(`trajectoryInputTab`)}],...u?[{key:`output`,label:n(`trajectoryResultTab`)}]:[]],f=e.timestamp?new Date(e.timestamp):null,p=f&&Number.isFinite(f.getTime())?f.toLocaleString(r.language,{hour12:!1}):e.timestamp,m=(0,K.jsxs)(K.Fragment,{children:[s?(0,K.jsx)(_L,{label:n(`trajectoryOutput`),value:s.content||n(`noOutput`)}):(0,K.jsx)(`p`,{className:`trajectory-missing`,children:n(`trajectoryMissingResult`)}),a===`output`&&s?.details!==void 0&&(0,K.jsxs)(`details`,{className:`trajectory-disclosure`,children:[(0,K.jsx)(`summary`,{children:n(`trajectoryStructured`)}),(0,K.jsx)(`pre`,{children:JSON.stringify(s.details,null,2)})]})]}),h=c&&(0,K.jsxs)(K.Fragment,{children:[c.content&&(0,K.jsx)(_L,{label:n(`trajectoryRecordedContent`),value:c.content}),l&&(0,K.jsxs)(`details`,{className:`trajectory-disclosure trajectory-reasoning`,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(Le,{"aria-hidden":`true`}),n(`trajectoryThinking`)]}),(0,K.jsx)(`pre`,{children:l})]}),!c.content&&!l&&(0,K.jsx)(`p`,{children:n(`noOutput`)})]});return(0,K.jsxs)(`section`,{className:`trajectory-inspector`,"aria-label":n(`trajectoryDetails`),tabIndex:0,children:[(0,K.jsxs)(`header`,{className:`trajectory-inspector-heading`,children:[(0,K.jsx)(`span`,{className:`trajectory-inspector-icon`,children:(0,K.jsx)(hL,{node:e})}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`p`,{children:[u&&(0,K.jsxs)(K.Fragment,{children:[n(`trajectory_${e.kind}`),` · `]}),n(`trajectoryRecordNumber`,{number:t})]}),(0,K.jsx)(`h2`,{id:`${i}-title`,children:pL(e,n)})]})]}),e.outcome&&(0,K.jsx)(gL,{node:e}),d.length>1&&(0,K.jsx)(`div`,{className:`trajectory-tabs`,role:`tablist`,"aria-label":n(`trajectoryDetails`),onKeyDown:e=>{let t=d.findIndex(e=>e.key===a),n=e.key===`ArrowRight`?(t+1)%d.length:e.key===`ArrowLeft`?(t+d.length-1)%d.length:e.key===`Home`?0:e.key===`End`?d.length-1:void 0;n!==void 0&&(e.preventDefault(),o(d[n].key),e.currentTarget.querySelectorAll(`button`)[n]?.focus())},children:d.map(e=>(0,K.jsx)(`button`,{type:`button`,role:`tab`,id:`${i}-${e.key}`,"aria-controls":`${i}-panel`,"aria-selected":a===e.key,tabIndex:a===e.key?0:-1,onClick:()=>o(e.key),children:e.label},e.key))}),(0,K.jsxs)(`section`,{className:`trajectory-detail-content`,role:d.length>1?`tabpanel`:void 0,id:`${i}-panel`,"aria-labelledby":d.length>1?`${i}-${a}`:`${i}-title`,children:[(c?.truncation||s?.truncation)&&(0,K.jsx)(`p`,{className:`trajectory-warning`,children:n(`trajectoryEvidenceTruncated`)}),(a===`summary`||a===`input`)&&e.input!==void 0&&(0,K.jsx)(_L,{label:n(`trajectoryArguments`),value:e.input}),(a===`summary`||a===`output`)&&u&&m,!u&&h,e.kind===`event`&&!c&&(0,K.jsx)(`p`,{className:`trajectory-missing`,children:n(`trajectoryEventOnly`)}),(0,K.jsxs)(`details`,{className:`trajectory-disclosure trajectory-metadata`,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(Pe,{"aria-hidden":`true`}),n(`trajectoryRecordInfo`)]}),(0,K.jsxs)(`dl`,{children:[p&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{children:n(`trajectoryRecordedAt`)}),(0,K.jsx)(`dd`,{children:(0,K.jsx)(`time`,{dateTime:e.timestamp,children:p})})]}),e.callId&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{children:n(`trajectoryCallId`)}),(0,K.jsx)(`dd`,{children:e.callId})]}),(0,K.jsx)(`dt`,{children:n(`trajectoryRecordId`)}),(0,K.jsx)(`dd`,{children:e.key}),e.kind===`event`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dt`,{children:n(`trajectoryEventType`)}),(0,K.jsx)(`dd`,{children:e.title})]})]})]})]})]})}var yL=(0,_.memo)(function({snapshot:e,running:t}){let{t:n}=cr(),r=e.selectedSession?.entries??dL,i=(0,_.useMemo)(()=>uL(r),[r]),[a,o]=(0,_.useState)(null),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(50),[d,f]=(0,_.useState)(new Set),p=(0,_.useMemo)(()=>{let e=s.trim().toLocaleLowerCase();return e?i.filter(t=>[pL(t,n),t.title,t.callId,t.input,mL(t),t.result?.content,fL(t)].some(t=>t?.toLocaleLowerCase().includes(e))):i},[i,s,n]),m=p.findIndex(e=>e.key===a),h=Math.min(Math.max(0,p.length-l),m<0?p.length:m),g=p.slice(h),v=g.find(e=>e.key===a)??cL(g),y=(0,_.useRef)(null);(0,_.useEffect)(()=>{v?.key&&y.current?.querySelector(`.trajectory-record[aria-pressed="true"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[v?.key]);let b=(0,_.useMemo)(()=>lL(i),[i]),x=new Set(g.map(e=>e.key)),S=b.flatMap(e=>{let t=e.runs.map(e=>e.filter(e=>x.has(e.key))).filter(e=>e.length>0);return t.length?[{...e,runs:t}]:[]}),C=new Map(i.map((e,t)=>[e.key,t+1])),w=e.selectedSession?.truncation;function T(e){let t=mL(e);return(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":e.key===v?.key,onClick:()=>o(e.key),className:`trajectory-record ${e.kind}`,title:aj(t,220),children:[(0,K.jsx)(`span`,{className:`trajectory-record-icon`,children:(0,K.jsx)(hL,{node:e})}),(0,K.jsxs)(`span`,{className:`trajectory-record-main`,children:[(0,K.jsxs)(`span`,{className:`trajectory-record-title`,children:[(0,K.jsx)(`strong`,{children:pL(e,n)}),(0,K.jsx)(`span`,{className:`trajectory-kind`,children:n(`trajectory_${e.kind}`)})]}),t&&(0,K.jsx)(`span`,{className:`trajectory-preview`,children:aj(t,180)})]}),(0,K.jsxs)(`span`,{className:`trajectory-record-end`,children:[(0,K.jsx)(gL,{node:e}),(0,K.jsx)(`time`,{dateTime:e.timestamp,children:oj(e.timestamp)})]})]})},e.key)}return(0,K.jsxs)(`section`,{className:`conversation trajectory`,"aria-label":n(`trajectory`),children:[(0,K.jsxs)(`header`,{className:`trajectory-toolbar`,children:[(0,K.jsxs)(`div`,{className:`trajectory-context`,children:[(0,K.jsx)(Ve,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:n(`trajectoryOrder`)}),(0,K.jsx)(`span`,{className:`trajectory-count`,children:n(s.trim()?`trajectoryMatches`:`trajectoryRecordCount`,{count:p.length})}),(0,K.jsxs)(`details`,{className:`trajectory-scope`,children:[(0,K.jsx)(`summary`,{"aria-label":n(`trajectoryScope`),title:n(`trajectoryScope`),children:(0,K.jsx)(Pe,{"aria-hidden":`true`})}),(0,K.jsx)(`p`,{children:n(`trajectoryScope`)})]})]}),(0,K.jsxs)(`label`,{className:`trajectory-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`input`,{type:`search`,"aria-label":n(`trajectorySearch`),placeholder:n(`trajectorySearch`),value:s,onChange:e=>c(e.currentTarget.value)})]})]}),t&&(0,K.jsx)(`p`,{className:`trajectory-live`,role:`status`,children:n(`trajectoryRunning`)}),w?.truncated&&(0,K.jsx)(`p`,{className:`trajectory-warning`,children:n(`trajectoryTruncated`,{entries:w.entriesOmitted,parts:w.messagePartsOmitted,messages:w.messagesTruncated})}),g.length?(0,K.jsxs)(`div`,{className:`trajectory-body`,children:[(0,K.jsxs)(`div`,{className:`trajectory-ledger`,ref:y,children:[h>0&&(0,K.jsx)(`button`,{type:`button`,className:`trajectory-load`,onClick:()=>u(e=>e+50),children:n(`trajectoryEarlier`,{count:h})}),S.map(e=>{let t=!d.has(e.key);return(0,K.jsxs)(`section`,{className:`trajectory-group`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`trajectory-group-heading`,"aria-expanded":t,onClick:()=>f(n=>{let r=new Set(n);return t?r.add(e.key):r.delete(e.key),r}),children:[(0,K.jsx)(ee,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:e.prompt?t&&!s.trim()?n(`trajectoryConversationGroup`):aj(e.prompt.message?.content||n(`trajectory_user`),80):n(`trajectoryEarlierGroup`)})]}),t&&(0,K.jsx)(`ol`,{children:e.runs.map(e=>e.length===1?T(e[0]):(0,K.jsx)(`li`,{className:`trajectory-event-group`,children:(0,K.jsxs)(`details`,{open:e.some(e=>e.key===v?.key)||!!s.trim(),children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(_t,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:n(`trajectoryEventCount`,{count:e.length})}),(0,K.jsx)(ee,{"aria-hidden":`true`})]}),(0,K.jsx)(`ol`,{children:e.map(T)})]})},e[0].key))})]},e.key)})]}),v&&(0,K.jsx)(vL,{node:v,number:C.get(v.key)},v.key)]}):(0,K.jsxs)(`div`,{className:`trajectory-empty`,children:[(0,K.jsx)(Ve,{"aria-hidden":`true`}),(0,K.jsx)(`p`,{children:n(s.trim()?`trajectoryNoMatches`:`trajectoryEmpty`)})]})]})}),bL=`openpi:reading-positions:v1`;function xL(){let e=new Map;try{let t=localStorage.getItem(`openpi:reading-positions:v1`)??`[]`,n=t.length<=32768?JSON.parse(t):[];if(Array.isArray(n)&&n.length<=4)for(let t of n){if(!Array.isArray(t)||t.length!==2)continue;let[n,r]=t;if(typeof n!=`string`||n.length>4600)continue;let i;try{i=JSON.parse(n)}catch{continue}!Array.isArray(i)||i.length!==2||!i.every(e=>typeof e==`string`&&e.length>0)||typeof r!=`object`||!r||!(`key`in r)||typeof r.key!=`string`||!r.key||r.key.length>512||`entryId`in r&&(typeof r.entryId!=`string`||!r.entryId||r.entryId.length>128)||!(`offset`in r)||typeof r.offset!=`number`||!Number.isFinite(r.offset)||Math.abs(r.offset)>1e6||!(`scrollTop`in r)||typeof r.scrollTop!=`number`||!Number.isFinite(r.scrollTop)||r.scrollTop<0||!(`pinned`in r)||typeof r.pinned!=`boolean`||e.set(n,{position:{key:r.key,offset:r.offset,...`entryId`in r&&typeof r.entryId==`string`?{entryId:r.entryId}:{},scrollTop:r.scrollTop,pinned:r.pinned}})}}catch{}return e.persist=()=>{try{localStorage.setItem(bL,JSON.stringify([...e].flatMap(([e,t])=>t.position?.key?[[e,{key:t.position.key,entryId:t.position.entryId,offset:t.position.offset,scrollTop:t.position.scrollTop,pinned:t.position.pinned}]]:[])))}catch{}},e}function SL(e){return JSON.stringify([e?.id,e?.path])}function CL(e,t,n){let r={...e.get(t),...n};e.delete(t),e.set(t,r),e.size>4&&e.delete(e.keys().next().value),e.persist?.()}var wL={base:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kaIpWk:`x16rqkct`,kmuXW:`x2lah0s`,kzqmXN:`x1xc55vz`,kZKoxP:`xdk7pt`,$$css:!0},pulsing:{kKVMdj:`x1mta51n`,k44tkh:`x1c74tu6`,kyAemX:`x4hg4is`,ko0y90:`xa4qsjk`,$$css:!0},reducedMotion:{kjO2d4:`x1aquc0h`,$$css:!0}},TL={success:{kWkggS:`xdsz4j9`,kMwMTN:`xri61p4`,$$css:!0},warning:{kWkggS:`x1q8g9m5`,kMwMTN:`xrebv38`,$$css:!0},error:{kWkggS:`x1pjz0fi`,kMwMTN:`x1m024r3`,$$css:!0},accent:{kWkggS:`x1ewilqj`,kMwMTN:`x17wrial`,$$css:!0},neutral:{kWkggS:`x1q5y3ey`,kMwMTN:`xrkvqaz`,$$css:!0}};function EL({variant:e,label:t,isPulsing:n=!1,tooltip:r,icon:i,xstyle:a,className:o,style:s,ref:c,...l}){let u=Ea(i),d=(0,K.jsx)(`span`,{ref:c,role:`img`,"aria-label":t,...oa(ba(`status-dot`,{variant:e},{legacyNames:[`statusdot`]}),Sr(wL.base,TL[e],n&&wL.pulsing,n&&wL.reducedMotion,a),o,s),...l,children:u&&(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`x78zum5 x6s0dn4 xl56j7k x14ju556 x1xc55vz xdk7pt`,children:i})});return r?(0,K.jsx)(Cd,{content:r,children:d}):d}EL.displayName=`StatusDot`;function DL(e){if(e.role!==`custom`||e.customType!==`openpi-setup-request`||e.truncation?.details)return e;let t=e.details;return!t||typeof t!=`object`||Array.isArray(t)||!(`command`in t)||t.command!==`openpi-setup`&&t.command!==`my-pi-setup`||!(`request`in t)||typeof t.request!=`string`?e:{...e,role:`user`,content:`/${t.command}${t.request?` ${t.request}`:``}`,parts:void 0}}function OL(e,t){let n=e.parentId,r=new Set;for(let e=0;n&&e<32;e++){if(r.has(n))return;r.add(n);let e=t(n);if(!e||e.id!==n)return;if(e.message?.role!==`system`)return e.message;n=e.parentId}}function kL(e,t){let n=DL(e);return e.customType===`openpi-setup-request`&&n.role===`user`&&t?.role===`user`&&t.customType===`openpi-web-command-input`&&typeof t.commandId==`string`&&t.commandId.length>0&&t.commandId.length<=128&&!/[\u0000-\u001f\u007f]/u.test(t.commandId)&&t.content===n.content}function AL({identity:e,title:t,label:n,state:r=`unknown`,onInspect:i}){let{t:a}=cr(),o=(0,_.useId)();return(0,K.jsxs)(i?`button`:`div`,{className:`subagent-card-open`,type:i?`button`:void 0,"aria-label":i?a(`inspectSubagent`,{name:t}):void 0,"aria-describedby":i?o:void 0,onClick:i,children:[(0,K.jsx)(LI,{identity:e}),(0,K.jsx)(`span`,{className:`subagent-activity-title`,title:t,children:t}),(0,K.jsx)(`span`,{id:o,className:`subagent-state ${r}`,children:n})]})}function jL(e,t){let n=Math.max(0,Math.floor(e/1e3)),r=Math.floor(n/3600),i=Math.floor(n/60)%60,a=n%60;return t.startsWith(`zh`)?[r?`${r}h`:``,i||r?`${i}m`:``,`${a}s`].filter(Boolean).join(` `):`${r?`${r}h`:``}${i||r?`${i}m`:``}${a}s`}function ML({elapsedMs:e,waiting:t=!1}){let{t:n,i18n:r}=cr(),i=(0,_.useRef)({elapsedMs:e,clock:performance.now()}),[a,o]=(0,_.useState)(e);return(0,_.useEffect)(()=>{let t=performance.now();i.current={elapsedMs:Math.max(e,i.current.elapsedMs+t-i.current.clock),clock:t},o(i.current.elapsedMs)},[e]),(0,_.useEffect)(()=>{let e=window.setInterval(()=>{o(i.current.elapsedMs+performance.now()-i.current.clock)},1e3);return()=>window.clearInterval(e)},[]),(0,K.jsx)(`span`,{className:`turn-elapsed-running`,role:`timer`,"aria-live":`off`,children:n(t?`compactionElapsed`:`turnElapsedRunning`,{duration:jL(a,r.language)})})}function NL({timing:e}){let{t,i18n:n}=cr();return(0,K.jsx)(`span`,{children:t(`turnElapsedFinished`,{duration:jL(e.elapsedMs,n.language)})})}function PL({compaction:e,observed:t=!0}){let{t:n}=cr(),r=e.state===`running`,i=r&&!t,a=i?`unavailable`:e.state;return(0,K.jsxs)(`div`,{className:`context-compaction`,"data-state":a,children:[(0,K.jsxs)(`div`,{className:`context-compaction-heading`,children:[(0,K.jsxs)(`span`,{className:`context-compaction-label`,role:`status`,children:[(0,K.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,K.jsx)(`path`,{d:`M4 4v13a3 3 0 0 0 3 3h3M14 4h3a3 3 0 0 1 3 3v13M8 10h8M8 14h4`}),(0,K.jsx)(`circle`,{cx:`4`,cy:`4`,r:`1.7`,fill:`currentColor`,stroke:`none`}),(0,K.jsx)(`circle`,{cx:`20`,cy:`20`,r:`1.7`,fill:`currentColor`,stroke:`none`})]}),(0,K.jsx)(`span`,{className:`context-compaction-text`,children:n({running:`compactionRunning`,completed:`compactionCompleted`,failed:`compactionInterrupted`,cancelled:`compactionInterrupted`,unchanged:`compactionUnchanged`,unavailable:`compactionUnavailable`}[a])})]}),r&&t&&e.elapsedMs!==void 0&&(0,K.jsx)(ML,{elapsedMs:e.elapsedMs,waiting:!0},e.startedAt)]}),i&&(0,K.jsx)(`p`,{children:n(`compactionReconnectHelp`)})]})}function FL(e,t,n,r){if(e.name!==`codemode`||!e.id||t?.forkSnapshotToolResult)return;let i=t!==void 0&&r!==`running`,a=new Set([e.id]),o=[];for(let e of n)!e.parentToolCallId||!a.has(e.parentToolCallId)||(e.call.id&&a.add(e.call.id),o.push(e));let s=Rd(t?.details),c=Array.isArray(s.calls)?s.calls:[],l=new Set(c.flatMap(e=>{let t=Rd(e);return t.status===`cancelled`&&typeof t.id==`string`?[t.id]:[]})),u=t?.nestedCalls,d=[];for(let e of u?.calls??[]){let t=o.find(t=>t.call.id===e.call.id&&t.call.name===e.call.name),n=e.status!==`ok`&&l.has(e.call.id??``)?`cancelled`:e.status===`ok`?`returned`:e.status===`error`?`failed`:t&&[`returned`,`failed`,`cancelled`,`timed_out`].includes(t.state)?Kd(t.call,t.result,t.state).state:`unknown`;d.push({call:e.call,result:t?.result,state:n,outputMissing:!t?.result,argumentsOmitted:e.argumentsOmitted,error:e.error})}for(let e of o)d.some(t=>t.call.id===e.call.id)||i&&u?.complete||d.push({call:e.call,result:e.result,state:i&&e.state===`running`?`unknown`:e.result?.isError!==!1&&l.has(e.call.id??``)?`cancelled`:Kd(e.call,e.result,e.state).state,outputMissing:!1});let f=c.some(e=>{let t=Rd(e);return!i&&t.status===`running`&&typeof t.id==`string`&&t.id.endsWith(`/?`)?!1:!d.some(e=>e.call.id===t.id&&e.call.name===t.name)});return{children:d,incomplete:u?.complete===!1||f||i&&!u&&c.length>d.length,showWrapper:d.length===0||f||t?.isError===!0||r===`running`&&!d.some(e=>e.state===`running`)}}function IL(e){let t=new Map(tN(e).map(e=>[e.start,e]));return()=>n=>{let r=[],i=e=>{if(e.type===`link`){let n=t.get(e.position?.start.offset??-1);n&&n.end===e.position?.end.offset&&r.push(n);return}if(`children`in e)for(let t of e.children)i(t)};i(n);let a=[],o=0;for(let t of r)a.push({type:`text`,value:e.slice(o,t.start)},{type:`element`,tagName:`a`,properties:{href:t.reference},children:[{type:`text`,value:t.name}]}),o=t.end;a.push({type:`text`,value:e.slice(o)}),n.children=[{type:`paragraph`,children:[],data:{hChildren:a}}]}}function LL({reference:e,label:t}){let{t:n}=cr(),r=(0,_.useContext)(_k),[i,a]=(0,_.useState)(!1),o=e;try{o=decodeURIComponent(e)}catch{}let s=t===o&&o.split(/[\\/]/u).at(-1)||t;return(0,K.jsxs)(`span`,{className:`user-file-reference`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`user-file-reference-open`,disabled:!r||r.disabled,title:s,onClick:t=>r?.open(e,r.parent,t.currentTarget),children:[(0,K.jsx)(Se,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:s})]}),(0,K.jsx)(`button`,{type:`button`,className:`user-file-reference-details`,"aria-label":`${n(`artifactFileDetails`)} ${s}`,"aria-expanded":i,onClick:()=>a(e=>!e),children:(0,K.jsx)(L,{"aria-hidden":`true`})}),i&&(0,K.jsx)(`span`,{className:`user-file-reference-path`,children:o})]})}var RL={p:({children:e})=>(0,K.jsx)(`div`,{className:`message-body user-message-content`,children:e}),a:({href:e,node:t})=>(0,K.jsx)(LL,{reference:e??``,label:t?.children.map(e=>e.type===`text`?e.value:``).join(``)??``})};function zL({content:e,incomplete:t=!1}){let n=IL(e);return t?(0,K.jsx)(`div`,{className:`message-body`,children:e}):(0,K.jsx)(kb,{remarkPlugins:[n],urlTransform:e=>e,components:RL,children:e})}function BL({preview:e,sessionId:t,sessionPath:n,entryId:r,markdown:i,fullText:a,onComplete:o,onProgress:s,purpose:c,partIndex:l}){let{t:u}=cr(),d=(0,_.useMemo)(()=>new lf,[]),f=(0,_.useRef)(null),p=(0,_.useRef)(null),m=(0,_.useRef)(null),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(0),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(!1);(0,_.useEffect)(()=>()=>f.current?.abort(),[]);let w=(0,_.useCallback)(async()=>{if(f.current||v===null)return;let e=new AbortController;f.current=e,x(!0),C(!1);try{let i=[t,n,r,v,e.signal],a=await(c===`thinking`?d.sessionItem(...i,c,l):c?d.sessionItem(...i,c):d.sessionItem(...i));if(e.signal.aborted)return;if(a.entryId!==r||c===`plan`&&a.planStatus!==`ready`||c===`thinking`&&a.partIndex!==l||a.nextCursor!==null&&a.nextCursor<=v)throw Error(`Message identity changed`);let u=v===0?[a.text]:[...h??[],a.text];g(u),y(a.nextCursor),a.nextCursor===null?(o?.(u.join(``)),document.activeElement===p.current&&!m.current?.closest(`[hidden]`)&&m.current?.focus()):s?.(u.join(``))}catch{e.signal.aborted||C(!0)}finally{f.current===e&&(f.current=null,e.signal.aborted||x(!1))}},[d,t,n,r,v,c,l,h,o,s]);(0,_.useEffect)(()=>{if(c!==`thinking`||a!==void 0||h!==null||S)return;let e=m.current;if(!e)return;if(typeof IntersectionObserver>`u`){e.closest(`[hidden], details:not([open])`)||w();return}let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(t.disconnect(),w())});return t.observe(e),()=>t.disconnect()},[c,a,h,S,w]);let T=a??h?.join(``)??e;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{ref:m,className:`message-full-text`,tabIndex:-1,children:i?(0,K.jsx)(Dk,{children:T}):(0,K.jsx)(zL,{content:T,incomplete:a===void 0&&v!==null})}),c===`thinking`&&a===void 0&&v!==null&&(0,K.jsx)(`p`,{className:`evidence-warning`,children:u(`thinkingPartialText`)}),a===void 0&&v!==null&&(0,K.jsx)(`button`,{ref:p,type:`button`,className:`message-load-full`,"aria-disabled":b,onClick:()=>void w(),children:u(b?c===`plan`?`planCardLoadingFull`:c===`thinking`?`thinkingLoadingFull`:`messageLoadingFull`:S?c===`plan`?`planCardLoadFailed`:c===`thinking`?`thinkingLoadFailed`:`messageLoadFailed`:h?`messageLoadMore`:c===`plan`?`planCardLoadFull`:c===`thinking`?`thinkingLoadFull`:`messageLoadFull`)})]})}function VL(e){if(e?.toolName!==`plan_ready`||e.isError!==!1)return;let t=Rd(e.details);if(t.status===`ready`&&typeof t.plan==`string`&&t.plan.trim())return{markdown:t.plan,ready:!0,truncated:!1};if(e.truncation?.details&&e.content.trim())return{markdown:e.content,ready:!1,truncated:!0}}function HL({result:e,sessionId:t,sessionPath:n,entryId:r}){let{t:i}=cr(),a=(0,_.useId)(),[o,s]=(0,_.useState)(!0),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null),f=JSON.stringify([t,n,r]),p=u?.source===f?u:void 0,m=p?.complete?p.markdown:void 0,h=VL(e),g=h?.truncated&&p?{markdown:p.markdown,ready:p.complete,truncated:!p.complete}:h,v=(0,_.useRef)({source:f,markdown:g?.markdown});v.current={source:f,markdown:g?.markdown};let y=c?.source===f&&c?.markdown===g?.markdown?c.status:null;return g?(0,K.jsxs)(`section`,{className:`plan-card`,"aria-label":i(`planCardLabel`),children:[(0,K.jsxs)(`div`,{className:`plan-card-header`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`plan-card-toggle`,"aria-expanded":o,"aria-controls":a,onClick:()=>s(!o),children:[(0,K.jsx)(Se,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:i(g.ready?`planCardReady`:`planCardResult`)}),(0,K.jsx)(`span`,{className:`plan-card-disclosure`,children:i(o?`planCardCollapse`:`planCardExpand`)})]}),(0,K.jsx)(`button`,{type:`button`,className:`plan-card-copy`,"aria-label":i(g.truncated?`planCardCopyPreview`:`planCardCopy`),title:i(g.truncated?`planCardCopyPreview`:`planCardCopy`),onClick:async()=>{let e=await wd(g.markdown);v.current.source===f&&v.current.markdown===g.markdown&&l({source:f,markdown:g.markdown,status:e?`copiedMessage`:`copyFailed`})},children:y===`copiedMessage`?(0,K.jsx)(I,{"aria-hidden":`true`}):(0,K.jsx)(oe,{"aria-hidden":`true`})})]}),(0,K.jsxs)(`div`,{id:a,hidden:!o,className:`plan-card-body`,children:[(0,K.jsx)(`p`,{className:`plan-card-note`,children:i(`planCardNotApproval`)}),g.truncated&&(0,K.jsx)(`p`,{className:`plan-card-note`,children:i(`planCardTruncated`)}),h?.truncated&&t&&n&&r?(0,K.jsx)(BL,{preview:h.markdown,sessionId:t,sessionPath:n,entryId:r,markdown:!0,purpose:`plan`,fullText:m,onProgress:e=>d({source:f,markdown:e,complete:!1}),onComplete:e=>d({source:f,markdown:e,complete:!0})},f):(0,K.jsx)(Dk,{children:g.markdown}),(0,K.jsxs)(`details`,{className:`plan-card-evidence`,children:[(0,K.jsx)(`summary`,{children:i(`planCardEvidence`)}),(0,K.jsx)(`pre`,{className:`tool-evidence`,children:Bd(e.content).text})]})]}),y&&(0,K.jsx)(`span`,{className:`plan-card-feedback`,role:`status`,children:i(y)})]}):null}var UL=500,WL=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(.*)$/u;function GL(e){let t=[],n=e=>{t.push({id:t.length,...e})},r=0,i=0,a=!1,o=0,s=0,c=e.split(` +`);c.at(-1)===``&&c.pop();for(let e of c){let t=WL.exec(e);if(t){r=Number(t[1]),i=Number(t[3]),o=t[2]===void 0?1:Number(t[2]),s=t[4]===void 0?1:Number(t[4]),a=!0,n({kind:`meta`,marker:``,code:t[5]?.trim()||e});continue}if(!a){if(!e||e.startsWith(`diff --git `)||e.startsWith(`index `)||e.startsWith(`--- `)||e.startsWith(`+++ `)||e.startsWith(`new file mode `)||e.startsWith(`deleted file mode `))continue;n({kind:`meta`,marker:``,code:e});continue}if(e.startsWith(`+`)&&s>0){n({kind:`added`,newLine:i,marker:`+`,code:e.slice(1)}),i+=1,--s;continue}if(e.startsWith(`-`)&&o>0){n({kind:`removed`,oldLine:r,marker:`-`,code:e.slice(1)}),r+=1,--o;continue}if(e.startsWith(`\\ No newline`)){n({kind:`meta`,marker:``,code:e});continue}if(!e.startsWith(` `)||o<=0||s<=0){a=!1,n({kind:`meta`,marker:``,code:e});continue}n({kind:`context`,oldLine:r,newLine:i,marker:` `,code:e.startsWith(` `)?e.slice(1):e}),r+=1,i+=1,--o,--s}return t}function KL({file:e,onReferenceLine:t}){let{t:n}=cr(),r=(0,_.useMemo)(()=>GL(e.diff),[e.diff]),i=r.slice(0,UL),a=(0,_.useRef)(null),[o,s]=(0,_.useState)(null),c=o?.file===e?o.id:void 0,l=n=>{let i=n.newLine===void 0?`old`:`new`,a=n.newLine??n.oldLine;if(!(!t||e.binary||!a||a<1||!Number.isSafeInteger(a)||e.diffTruncated&&!e.diff.endsWith(` `)&&n.id===r.at(-1)?.id))return{filePath:i===`old`?e.previousPath??e.path:e.path,side:i,line:a,code:n.code}},u=i.filter(e=>l(e)),d=Math.max(0,r.length-i.length),f=String(i.reduce((e,t)=>Math.max(e,t.oldLine??0,t.newLine??0),0)).length;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`figure`,{ref:a,className:`review-file-diff`,"aria-label":n(`changeDiff`),children:(0,K.jsx)(`pre`,{children:i.map(r=>{let i=l(r),o=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`review-diff-gutter`,style:{width:`${f+1}ch`},"aria-hidden":`true`,children:r.oldLine??``}),(0,K.jsx)(`span`,{className:`review-diff-gutter`,style:{width:`${f+1}ch`},"aria-hidden":`true`,children:r.newLine??``})]});return(0,K.jsxs)(`span`,{className:`review-diff-line`,"data-kind":r.kind,"data-selected":c===r.id||void 0,children:[i?(0,K.jsx)(`button`,{type:`button`,className:`review-diff-line-select`,"data-diff-row":r.id,"aria-label":n(i.side===`new`?`reviewSelectNewLine`:`reviewSelectOldLine`,{line:i.line}),"aria-pressed":c===r.id,tabIndex:(c??u[0]?.id)===r.id?0:-1,onClick:()=>s({file:e,id:r.id}),onKeyDown:t=>{let n=u.indexOf(r),i;if(t.key===`ArrowDown`)i=u[Math.min(n+1,u.length-1)];else if(t.key===`ArrowUp`)i=u[Math.max(n-1,0)];else if(t.key===`Home`)i=u[0];else if(t.key===`End`)i=u.at(-1);else return;t.preventDefault(),t.stopPropagation(),i&&(s({file:e,id:i.id}),a.current?.querySelector(`[data-diff-row="${i.id}"]`)?.focus({preventScroll:!0}))},children:o}):o,(0,K.jsx)(`span`,{className:`review-diff-marker`,"aria-hidden":`true`,children:r.marker}),(0,K.jsx)(`span`,{className:`review-diff-code`,children:r.code}),i&&c===r.id&&(0,K.jsxs)(`button`,{type:`button`,className:`review-diff-reference`,onMouseDown:e=>e.preventDefault(),onClick:e=>{let n=e.currentTarget.closest(`.review-diff-line`)?.querySelector(`.review-diff-code`),r=window.getSelection(),a=n?.contains(r?.anchorNode??null)&&n.contains(r?.focusNode??null)?r?.toString():void 0;t?.({...i,code:a||i.code})},children:[(0,K.jsx)(Ye,{"aria-hidden":`true`}),n(`reviewQuoteLine`)]}),` -`]},r.id)})})}),d>0&&(0,K.jsx)(`p`,{className:`review-hidden-lines`,children:n(`gitReviewHiddenLines`,{count:d})}),e.diffTruncated&&(0,K.jsx)(`p`,{className:`review-hidden-lines`,children:n(`gitReviewDiffTruncated`)})]})}function HL(e){return/^@@ |^--- .*\n\+\+\+ /mu.test(e)?BL(e):e.split(` -`).map((e,t)=>{let n=/^([ +-])\s*(\d+) (.*)$/u.exec(e),r=n?.[1]??e[0]??``,i=r===`+`?`added`:r===`-`?`removed`:`context`,a=n?Number(n[2]):void 0,o=a&&Number.isSafeInteger(a)?a:void 0;return{id:t,kind:i,oldLine:i===`removed`?o:void 0,newLine:i===`removed`?void 0:o,marker:i===`context`?` `:r,code:n?.[3]??(i===`context`?e:e.slice(1))}})}function UL({children:e,className:t,"aria-label":n}){return(0,K.jsx)(`figure`,{"aria-label":n,children:(0,K.jsx)(`pre`,{className:t,children:e})})}function WL({call:e,result:t,liveState:n,observed:r=!0,cwd:i,defaultOpen:a=!1}){let{t:o}=cr(),[s,c]=(0,_.useState)(null),l=(0,_.useContext)(fk),u=Vd(e,t,n),d=!r&&u.state===`running`?`unknown`:u.state,f=t?.forkSnapshotToolResult?o(`toolSnapshotMissingResult`):o(`toolState_${d}`),p=u.resolvedPath??u.path,m=u.path??``,h=Math.max(m.lastIndexOf(`/`),m.lastIndexOf(`\\`)),g=m.slice(h+1)||m,{Icon:v}=$I(e.name),y=Fd(u.command??nL(e.name,Id(e))).text,b=u.kind===`terminal`||u.kind===`test`,x=[u.command?`$ ${u.command}`:``,u.output].filter(Boolean).join(` +`]},r.id)})})}),d>0&&(0,K.jsx)(`p`,{className:`review-hidden-lines`,children:n(`gitReviewHiddenLines`,{count:d})}),e.diffTruncated&&(0,K.jsx)(`p`,{className:`review-hidden-lines`,children:n(`gitReviewDiffTruncated`)})]})}function qL(e){return/^@@ |^--- .*\n\+\+\+ /mu.test(e)?GL(e):e.split(` +`).map((e,t)=>{let n=/^([ +-])\s*(\d+) (.*)$/u.exec(e),r=n?.[1]??e[0]??``,i=r===`+`?`added`:r===`-`?`removed`:`context`,a=n?Number(n[2]):void 0,o=a&&Number.isSafeInteger(a)?a:void 0;return{id:t,kind:i,oldLine:i===`removed`?o:void 0,newLine:i===`removed`?void 0:o,marker:i===`context`?` `:r,code:n?.[3]??(i===`context`?e:e.slice(1))}})}function JL({children:e,className:t,"aria-label":n}){return(0,K.jsx)(`figure`,{"aria-label":n,children:(0,K.jsx)(`pre`,{className:t,children:e})})}function YL({call:e,result:t,liveState:n,observed:r=!0,cwd:i,defaultOpen:a=!1}){let{t:o}=cr(),[s,c]=(0,_.useState)(null),l=(0,_.useContext)(_k),u=Kd(e,t,n),d=!r&&u.state===`running`?`unknown`:u.state,f=t?.forkSnapshotToolResult?o(`toolSnapshotMissingResult`):o(`toolState_${d}`),p=u.resolvedPath??u.path,m=u.displayResolvedPath||u.displayPath||`File reference`,h=u.displayPath||u.path||``,g=Math.max(h.lastIndexOf(`/`),h.lastIndexOf(`\\`)),v=h.slice(g+1)||h,{Icon:y}=iL(e.name),b=Bd(u.command??sL(e.name,Vd(e))).text,x=u.kind===`terminal`||u.kind===`test`,S=[u.command?`$ ${u.command}`:``,u.output].filter(Boolean).join(` -`),S=`${e.id}:${x}`,C=s?.source===S?s.status:null,w=`${e.id}:diff:${u.diff}`,T=s?.source===w?s.status:null,E=u.output.split(` -`).map((e,t)=>({text:e,number:u.offset+t})),D=u.diff?HL(u.diff):[],O=D.filter(e=>e.kind===`added`).length,k=D.filter(e=>e.kind===`removed`).length,A=u.diff||u.change===`created`?(0,K.jsxs)(`span`,{className:`evidence-summary-meta`,title:o(`toolDiffStatsHelp`),children:[(0,K.jsxs)(`span`,{className:`review-additions`,children:[`+`,O.toLocaleString()]}),(0,K.jsxs)(`span`,{className:`review-deletions`,children:[`−`,k.toLocaleString()]}),u.truncated&&(0,K.jsx)(`span`,{children:o(`gitReviewPartialLabel`)})]}):null,j=u.tests?.failures.map((e,t)=>({text:e,number:t+1}))??[];return(0,K.jsxs)(`details`,{className:`tool-evidence-card evidence-${u.kind}`,"data-state":d,"data-tool":e.name,open:a||void 0,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(`span`,{className:`evidence-icon`,"aria-hidden":`true`,children:(0,K.jsx)(v,{})}),(0,K.jsx)(`span`,{className:`tool-kind`,"aria-hidden":`true`,title:e.name,children:tL(e.name)}),(0,K.jsxs)(`span`,{className:`evidence-target`,title:u.path||y,children:[(0,K.jsx)(`span`,{className:`tool-action`,children:d===`returned`&&u.change===`created`?o(`toolFileChange_created`):eL(o,e.name,d)}),m?(0,K.jsx)(`span`,{className:`evidence-filename`,children:g}):y?(0,K.jsx)(`span`,{className:`evidence-command`,children:y}):null]}),A,(0,K.jsx)(ee,{className:`evidence-chevron`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`evidence-status`,children:f})]}),(0,K.jsxs)(`div`,{className:`evidence-content`,children:[u.path&&!u.diff&&(0,K.jsxs)(`p`,{children:[(0,K.jsx)(`strong`,{children:o(`toolRequestedFile`)}),` `,l&&p?(0,K.jsx)(`button`,{className:`artifact-link`,type:`button`,onClick:()=>l.open(p),children:(0,K.jsx)(`code`,{children:p})}):(0,K.jsx)(`code`,{children:p}),i&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`br`,{}),(0,K.jsxs)(`small`,{children:[o(`toolWorkspace`),`: `,i]})]})]}),b&&(0,K.jsxs)(`figure`,{className:`evidence-shell`,"aria-label":o(`toolCallOutput`),children:[(0,K.jsxs)(`figcaption`,{children:[(0,K.jsx)(`span`,{children:`Shell`}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o(C===`copiedCode`?`copiedCode`:`copyCode`),title:o(C===`copiedCode`?`copiedCode`:`copyCode`),onClick:async()=>{let e=await wd(x);c({source:S,status:e?`copiedCode`:`copyCodeFailed`})},children:C===`copiedCode`?(0,K.jsx)(I,{}):(0,K.jsx)(oe,{})})]}),(0,K.jsx)(`pre`,{children:x||o(`noOutput`)}),(0,K.jsxs)(`div`,{className:`evidence-process-meta`,children:[f,u.exitCode===void 0?u.signal?` · ${u.signal}`:``:` · exit ${u.exitCode}`]}),C===`copyCodeFailed`&&(0,K.jsx)(`p`,{role:`status`,className:`evidence-warning`,children:o(C)})]}),u.truncated&&(0,K.jsx)(`p`,{className:`evidence-warning`,children:o(`toolPartialEvidence`)}),u.change&&!u.diff&&(0,K.jsx)(`p`,{children:o(`toolFileChange_${u.change}`)}),u.kind===`change`&&!u.diff&&!u.change&&(0,K.jsx)(`p`,{children:u.evidenceUnavailable??o(`toolChangeUnavailable`)}),u.tests&&(0,K.jsxs)(`figure`,{"aria-label":`Test evidence`,children:[(0,K.jsx)(`figcaption`,{children:(0,K.jsx)(`strong`,{children:o(`toolTestResults`,{format:u.tests.format})})}),(0,K.jsx)(`p`,{children:o(`toolTestCounts`,u.tests)}),(0,K.jsx)(`p`,{children:o(`toolTestCountsHelp`)}),j.map(e=>(0,K.jsx)(UL,{"aria-label":`Failure excerpt ${e.number}`,children:e.text},e.number))]}),b?null:u.diff?(0,K.jsxs)(`figure`,{className:`evidence-diff`,"aria-label":`Change diff`,children:[(0,K.jsxs)(`figcaption`,{children:[l&&p?(0,K.jsx)(`button`,{className:`evidence-diff-file`,type:`button`,title:p,"aria-label":p,onClick:()=>l.open(p),children:g}):(0,K.jsx)(`span`,{className:`evidence-diff-file`,title:p,children:g}),A,(0,K.jsx)(`button`,{className:`evidence-copy`,type:`button`,"aria-label":o(T===`copiedCode`?`copiedCode`:`copyCode`),title:o(T===`copiedCode`?`copiedCode`:`copyCode`),onClick:async()=>{let e=await wd(u.diff??``);c({source:w,status:e?`copiedCode`:`copyCodeFailed`})},children:T===`copiedCode`?(0,K.jsx)(I,{}):(0,K.jsx)(oe,{})})]}),(0,K.jsx)(`pre`,{className:`evidence-diff-lines`,children:D.map(e=>(0,K.jsxs)(`span`,{className:`evidence-diff-row diff-${e.kind}`,children:[(0,K.jsx)(`span`,{className:`evidence-line-number`,"aria-hidden":`true`,children:e.newLine??e.oldLine??``}),(0,K.jsx)(`span`,{className:`evidence-diff-marker`,children:e.marker}),(0,K.jsx)(`span`,{children:e.code}),` -`]},e.id))}),T===`copyCodeFailed`&&(0,K.jsx)(`p`,{role:`status`,className:`evidence-warning`,children:o(T)})]}):u.numberLines?(0,K.jsx)(UL,{className:`evidence-lines`,"aria-label":`File content`,children:E.map(e=>(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`evidence-line-number`,"aria-hidden":`true`,children:e.number}),e.text,` -`]},e.number))}):(0,K.jsx)(UL,{className:`evidence-log`,"aria-label":`Tool output`,children:u.output||o(`noOutput`)}),u.kind===`file`&&u.truncated&&(0,K.jsx)(`p`,{children:o(`toolReadMore`)}),u.recovery&&(0,K.jsxs)(`p`,{children:[o(`toolFullOutputReference`),` `,(0,K.jsx)(`code`,{children:u.recovery})]}),u.readRecovery&&(0,K.jsx)(`p`,{className:`evidence-warning`,children:u.readRecovery}),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{children:o(`toolRawEvidence`)}),(0,K.jsx)(`p`,{children:(0,K.jsx)(`code`,{children:e.name})}),(0,K.jsx)(`p`,{children:(0,K.jsx)(`strong`,{children:o(`toolCallArguments`)})}),(0,K.jsx)(`pre`,{children:u.rawArguments}),(0,K.jsx)(`p`,{children:(0,K.jsx)(`strong`,{children:o(`toolCallOutput`)})}),(0,K.jsx)(`pre`,{children:u.rawResult})]})]})]})}function GL({changes:e,onReview:t}){let{t:n}=cr(),[r,i]=(0,_.useState)(!1),a=(0,_.useId)();if(e.state===`unavailable`||e.files.length===0)return null;let o=e.state===`partial`,s=e.source===`file-tools`,c=e.fileCount===null,l=r?e.files:e.files.slice(0,3);return(0,K.jsxs)(`section`,{className:`turn-changes`,"aria-label":n(`turnChangesReview`),children:[(0,K.jsxs)(`header`,{className:`turn-changes-header`,children:[(0,K.jsx)(`span`,{className:`turn-changes-icon`,"aria-hidden":`true`,children:(0,K.jsx)(ye,{})}),(0,K.jsxs)(`div`,{className:`turn-changes-summary`,children:[(0,K.jsx)(`strong`,{title:n(s?`turnEditsScope`:`turnChangesScope`),children:n(s?c?`turnEditsPartial`:`turnEdits`:o?`turnChangesPartial`:`turnChanges`,{count:e.fileCount??e.files.length})}),!c&&!e.files.some(e=>e.binary||e.statsUnavailable)&&(0,K.jsxs)(`span`,{className:`turn-changes-totals`,children:[(0,K.jsxs)(`span`,{className:`review-additions`,children:[`+`,e.additions]}),(0,K.jsxs)(`span`,{className:`review-deletions`,children:[`−`,e.deletions]})]}),o&&!s&&(0,K.jsx)(`span`,{className:`turn-changes-warning`,children:n(`turnChangesIncomplete`)})]}),(0,K.jsx)(`button`,{type:`button`,className:`turn-changes-review-button`,"aria-label":n(`turnChangesReview`),disabled:!t,onClick:()=>t?.(e.promptEntryId,e.files[0]?.path),children:n(`reviewChanges`)})]}),(0,K.jsx)(`div`,{className:`turn-changes-list`,id:a,children:l.map(r=>{let i=Math.max(r.path.lastIndexOf(`/`),r.path.lastIndexOf(`\\`));return(0,K.jsxs)(`button`,{type:`button`,className:`turn-changes-file`,title:r.path,disabled:!t,onClick:()=>t?.(e.promptEntryId,r.path),children:[(0,K.jsxs)(`span`,{className:`turn-changes-path`,children:[(0,K.jsx)(`span`,{children:r.path.slice(0,i+1)}),(0,K.jsx)(`strong`,{children:r.path.slice(i+1)})]}),(0,K.jsx)(`span`,{className:`turn-changes-file-stats`,children:r.binary?(0,K.jsx)(`span`,{children:n(`gitReviewBinaryShort`)}):r.statsUnavailable?(0,K.jsx)(`span`,{title:n(`turnEditReason_${r.statsUnavailable}`),children:n(`turnEditStatsUnknown`)}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`review-additions`,children:[`+`,r.additions]}),(0,K.jsxs)(`span`,{className:`review-deletions`,children:[`−`,r.deletions]})]})})]},r.path)})}),e.files.length>3&&(0,K.jsxs)(`button`,{type:`button`,className:`turn-changes-more`,"aria-expanded":r,"aria-controls":a,onClick:()=>i(e=>!e),children:[n(r?`turnChangesLess`:`turnChangesMore`,{count:e.files.length-3}),(0,K.jsx)(L,{className:r?`up`:``,"aria-hidden":`true`})]})]})}function KL({item:e,position:t,current:n,onNavigate:r,onPreview:i}){let{t:a}=cr(),o=(0,_.useRef)(()=>{}),s=yd({placement:`start`,delay:150,hideDelay:100,touchTrigger:`none`,onShow:(0,_.useCallback)(()=>i(e.entryId,()=>o.current()),[e.entryId,i])});return o.current=s.hide,(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{ref:s.ref,className:`turn-tick`,type:`button`,"data-turn-entry":e.entryId,"aria-label":a(`conversationTurnPosition`,{position:t}),"aria-describedby":s.describedBy,"aria-current":n?`location`:void 0,onClick:()=>{s.hide(),r(e.entryId)},children:(0,K.jsx)(`span`,{className:`turn-tick-mark`,"aria-hidden":`true`})}),s.renderHoverCard((0,K.jsx)(`span`,{className:`turn-preview`,children:e.previewState===`idle`||e.previewState===`loading`?(0,K.jsx)(`span`,{role:`status`,children:a(`turnPreviewLoading`)}):e.previewState===`unavailable`?(0,K.jsx)(`span`,{role:`status`,children:a(`turnPreviewUnavailable`)}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`turn-preview-prompt`,children:e.title}),e.reply&&(0,K.jsx)(`span`,{className:`turn-preview-reply`,children:e.reply})]})}),{className:`turn-preview-layer`})]})}function qL({items:e,viewport:t,onNavigate:n,readingHistory:r,onRequestPreview:i,enabled:a=!0,onHidden:o}){let{t:s}=cr(),c=(0,_.useRef)(null),l=JSON.stringify(e.map(e=>e.entryId)),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(!1),p=(0,_.useRef)(0),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)({top:0,height:0,visible:!1,current:[]}),y=(0,_.useCallback)(()=>{u.current?.hide(),u.current=null,d.current&&d.current.captureTarget.hasPointerCapture?.(d.current.pointerId)&&d.current.captureTarget.releasePointerCapture(d.current.pointerId),d.current=null,p.current++,o?.()},[o]),b=(0,_.useCallback)((e,n)=>{if(!a||!t.current||!c.current||c.current.style.visibility===`hidden`||t.current.checkVisibility?.()===!1||c.current.checkVisibility?.()===!1||getComputedStyle(t.current).display===`none`||getComputedStyle(c.current).display===`none`){n();return}u.current?.entryId!==e&&u.current?.hide(),u.current={entryId:e,hide:n},i?.(e)},[a,t,i]),x=(0,_.useCallback)((e,t=!1)=>{u.current?.hide();let r=++p.current;h(!1),Promise.resolve(n(e,t)).then(e=>{p.current===r&&e===!1&&h(!0)})},[n]);return(0,_.useLayoutEffect)(()=>{let e=t.current,n=e?.parentElement,i=JSON.parse(l);if(!e||!n){y();return}let o,s=r?n.querySelector(`.jump-to-latest`):null,u=()=>{o=void 0;let t=e.getBoundingClientRect(),r=n.getBoundingClientRect(),l=new Map;for(let t of e.querySelectorAll(`[data-history-entry]`)){let e=t.dataset.historyEntry;e&&!l.has(e)&&l.set(e,t)}let u=e.querySelector(`.conversation-turn`)??l.values().next().value,d=e.offsetWidth>0?t.width/e.offsetWidth:1,f=a&&t.height>0&&d>0&&!!u&&(t.right-u.getBoundingClientRect().right)/d>=48&&e.checkVisibility?.()!==!1&&getComputedStyle(e).display!==`none`&&(!c.current||getComputedStyle(c.current).display!==`none`);f||y();let p=s?.getBoundingClientRect(),m=Math.min(t.bottom-8,p&&p.height>0?p.top-12:1/0),h=Math.max(0,m-t.top-8),g=i.flatMap(e=>{let n=l.get(e);if(!n)return[];let r=(n.closest(`.conversation-turn`)??n).getBoundingClientRect();return r.bottom>t.top+16&&r.tope.top===_.top&&e.height===_.height&&e.visible===f&&e.current.join(`\0`)===g.join(`\0`)?e:_)},d=()=>{o===void 0&&(o=requestAnimationFrame(u))};u(),e.addEventListener(`scroll`,d),window.addEventListener(`resize`,d);let f=typeof ResizeObserver>`u`?void 0:new ResizeObserver(d);f?.observe(e),f?.observe(n),s&&f?.observe(s);for(let t of e.children)f?.observe(t);let p=new MutationObserver(d);return p.observe(e,{childList:!0,subtree:!0}),()=>{o!==void 0&&cancelAnimationFrame(o),e.removeEventListener(`scroll`,d),window.removeEventListener(`resize`,d),f?.disconnect(),p.disconnect()}},[l,t,r,a,y]),(0,_.useLayoutEffect)(()=>{if(g.height,!g.visible||d.current)return;let e=c.current,t=Array.from(e?.querySelectorAll(`[data-turn-entry]`)??[]),n=t.find(e=>e===document.activeElement)??t.find(e=>e.matches(`:hover`))??t.find(e=>g.current.includes(e.dataset.turnEntry??``));if(!e||!n)return;let r=e.getBoundingClientRect(),i=n.getBoundingClientRect();i.topr.bottom&&(e.scrollTop+=i.bottom-r.bottom)},[g.current,g.height,g.visible,l]),(0,_.useLayoutEffect)(()=>{let n=t.current;if(!n)return;let r=t=>{if(!a||t.defaultPrevented||t.isComposing||!t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||![`ArrowUp`,`ArrowDown`].includes(t.key)||!n.parentElement?.contains(document.activeElement)||n.checkVisibility?.()===!1||getComputedStyle(n).display===`none`||getComputedStyle(n).visibility===`hidden`||n.getBoundingClientRect().height<=0)return;let r=new Map;for(let e of n.querySelectorAll(`[data-history-entry]`)){let t=e.dataset.historyEntry;t&&!r.has(t)&&r.set(t,e)}let i=e.flatMap((e,t)=>{let n=r.get(e.entryId);return n?[{item:e,index:t,top:n.getBoundingClientRect().top}]:[]}),o=n.getBoundingClientRect().top,s;if(t.key===`ArrowDown`){let t=i.findIndex(e=>e.top>o+24);s=i.length===0?e[0]:t<0?e[i.at(-1).index+1]:e[(i[t-1]?.index??-1)+1]}else{for(let t=i.length-1;t>=0;t--){let n=i[t];if(Math.abs(n.top-o)<=24){s=e[n.index-1];break}if(n.tope.top>o+24)&&(s=i[0]?.item),i.length===0&&(s=e.at(-1))}s&&(t.preventDefault(),x(s.entryId))};return document.addEventListener(`keydown`,r),()=>document.removeEventListener(`keydown`,r)},[t,a,e,x]),(0,_.useLayoutEffect)(()=>()=>y(),[y]),e.length<4?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`nav`,{ref:c,className:`turn-rail`,"aria-label":s(`conversationTurns`),style:{top:g.top,maxHeight:g.height,visibility:g.visible?`visible`:`hidden`},onClickCapture:e=>{f.current&&=(e.preventDefault(),e.stopPropagation(),!1)},onPointerDown:e=>{if(!e.isPrimary||e.button!==0)return;let t=e.target instanceof Element?e.target.closest(`.turn-tick`):null;!t||!e.currentTarget.contains(t)||(f.current=!1,d.current={pointerId:e.pointerId,captureTarget:t,y:e.clientY,moved:!1},t.setPointerCapture?.(e.pointerId))},onPointerMove:e=>{let t=d.current;if(!t||t.pointerId!==e.pointerId||Math.abs(e.clientY-t.y)<3&&!t.moved)return;t.moved=!0,f.current=!0;let n=Array.from(e.currentTarget.querySelectorAll(`[data-turn-entry]`)).find(t=>{let n=t.getBoundingClientRect();return e.clientY>=n.top&&e.clientY{let t=d.current;d.current=null,t?.captureTarget.hasPointerCapture?.(e.pointerId)&&t.captureTarget.releasePointerCapture(e.pointerId)},onPointerCancel:e=>{let t=d.current;d.current=null,t?.captureTarget.hasPointerCapture?.(e.pointerId)&&t.captureTarget.releasePointerCapture(e.pointerId),f.current=!1},children:e.map((e,t)=>(0,K.jsx)(KL,{item:e,position:t+1,current:g.current.includes(e.entryId),onNavigate:x,onPreview:b},e.entryId))}),m&&(0,K.jsx)(`span`,{className:`turn-navigation-error`,role:`status`,children:s(`turnPreviewUnavailable`)})]})}function JL({message:e,sessionId:t,path:n,entryId:r}){let{t:i}=cr(),[a,o]=(0,_.useState)(null),s=JSON.stringify([t,n,r]),c=e.parts?.filter(e=>e.type===`image`)??[];if(c.length===0)return null;let l=new Map,u=a?.scope===s?a:null,d=()=>o(e=>e?{...e,open:!1}:null);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`section`,{className:`message-attachments`,"aria-label":i(`imageAttachments`),children:c.map(e=>{let a=`${e.mimeType}:${e.name??``}:${e.previewUrl??``}`,c=l.get(a)??0;l.set(a,c+1);let u=`${a}:${c}`,d=t&&n&&r&&typeof e.sourcePartIndex==`number`&&Number.isSafeInteger(e.sourcePartIndex)&&e.sourcePartIndex>=0?{id:`${r}:${e.sourcePartIndex}`,entryId:r,partIndex:e.sourcePartIndex,kind:`image`,name:e.name??i(`attachedImage`)}:null,f=e.previewUrl?(0,K.jsx)(`img`,{src:e.previewUrl,alt:e.name??i(`attachedImage`)},`preview`):d&&t&&n?(0,K.jsx)(`span`,{className:`message-attachment-preview`,children:(0,K.jsx)(PI,{sessionId:t,path:n,source:d,thumbnail:!0})},`preview`):(0,K.jsx)(Ne,{"aria-hidden":`true`},`preview`),p=(0,K.jsx)(`span`,{children:e.name??i(`attachedImage`)},`name`);return d?(0,K.jsxs)(`button`,{className:`message-attachment`,type:`button`,title:d.name,"aria-label":d.name,onClick:()=>o({scope:s,source:d,open:!0}),children:[f,p]},u):(0,K.jsxs)(`div`,{className:`message-attachment`,children:[f,p]},u)})}),t&&n&&u&&(0,K.jsx)(II,{sessionId:t,path:n,source:u.source,open:u.open,onSelect:d,onClose:d})]})}function YL(e,t,n){let r=(0,_.useMemo)(()=>new rf,[]),i=e?.history?.leafEntryId??e?.entries.at(-1)?.id,a=e?.id,o=e?.path,s=JSON.stringify([e?.id,e?.path,i]),c=(0,_.useRef)(s);c.current=s;let[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)({}),p=(0,_.useRef)(new Map),m=(0,_.useMemo)(()=>a&&o&&i?{sessionId:a,sessionPath:o,entryId:i}:null,[a,o,i]);(0,_.useEffect)(()=>{if(u(null),f({}),!n||!m)return;let e=new AbortController,t=async()=>{try{let t=null,n=[],i=new Set;for(let a=0;a<10;a++){let a=await r.sessionPromptHistory(m,t,e.signal);if(e.signal.aborted||c.current!==s||a.sessionId!==m.sessionId||a.sessionPath!==m.sessionPath||a.anchorEntryId!==m.entryId||a.requestedBeforeEntryId!==t||a.entryIds.length>100||a.entryIds.some(e=>!e||i.has(e))||new Set(a.entryIds).size!==a.entryIds.length||a.nextBeforeEntryId!==null&&(a.entryIds.length===0||a.nextBeforeEntryId!==a.entryIds[0]))return;for(let e of a.entryIds)i.add(e);if(n=[...a.entryIds,...n],a.nextBeforeEntryId===null){u({scope:s,ids:n});return}t=a.nextBeforeEntryId}}catch{}},i=typeof window.requestIdleCallback==`function`?window.requestIdleCallback(()=>void t(),{timeout:2e3}):void 0,a=i===void 0?window.setTimeout(()=>void t(),0):void 0;return()=>{e.abort(),i!==void 0&&window.cancelIdleCallback(i),a!==void 0&&window.clearTimeout(a);for(let e of p.current.values())e.abort();p.current.clear()}},[s,n,m,r]);let h=(0,_.useMemo)(()=>{let e=new Map(t.map(e=>[e.entryId,e]));if(l?.scope!==s)return t;let n=new Set(l.ids);return[...l.ids.map(t=>e.get(t)??d[t]??{entryId:t,title:``,previewState:`idle`}),...t.filter(e=>!n.has(e.entryId))]},[l,s,t,d]),g=(0,_.useRef)(h);return g.current=h,{items:h,requestPreview:(0,_.useCallback)(e=>{if(!n||!m||c.current!==s||p.current.has(e))return;let t=g.current.find(t=>t.entryId===e);if(!t||t.previewState===void 0||t.previewState===`ready`)return;let i=new AbortController;p.current.set(e,i),f(t=>({...t,[e]:{entryId:e,title:``,previewState:`loading`}})),r.sessionPromptPreview(m,e,i.signal).then(t=>{if(!(i.signal.aborted||c.current!==s)){if(t.sessionId!==m.sessionId||t.sessionPath!==m.sessionPath||t.anchorEntryId!==m.entryId||t.entryId!==e||typeof t.prompt!=`string`||typeof t.response!=`string`||Array.from(t.prompt).length>240||Array.from(t.response).length>240)throw Error(`Unverified preview`);f(n=>({...n,[e]:{entryId:e,title:t.prompt,reply:t.response,previewState:`ready`}}))}}).catch(()=>{!i.signal.aborted&&c.current===s&&f(t=>({...t,[e]:{entryId:e,title:``,previewState:`unavailable`}}))}).finally(()=>{p.current.get(e)===i&&p.current.delete(e)})},[n,m,s,r])}}var XL=1e3,ZL=Wd*4;function QL(e,t){return t.history?.leafEntryId===e.validatedLeaf||t.history?.anchorEntryId===e.anchor&&t.history.anchorOnBranch===!0}function $L(e,t,n=t.entriesOmitted){let r=e.filter(e=>e.message?.truncation).length,i=e.reduce((e,t)=>e+(t.message?.truncation?.partsOmitted??0),0);return{...t,entriesOmitted:n,messagesTruncated:r,messagePartsOmitted:i,truncated:n>0||r>0||i>0}}function eR(e,t){let n=t.history?.leafEntryId??null;if(n===e.validatedLeaf)return e;let r=t.entries.findIndex(t=>t.id===e.anchor),i=r>=0?t.entries.slice(r+1):t.entries[0]?.parentId===e.anchor?t.entries:null,a=i?.reduce((e,t)=>e+Kd(t)+1,0)??0;return i&&e.session.entries.length+i.length<=XL&&e.session.bytes+a<=ZL?{...e,anchor:n??e.anchor,validatedLeaf:n,session:{...e.session,entries:[...e.session.entries,...i],bytes:e.session.bytes+a,truncation:$L([...e.session.entries,...i],e.session.truncation)}}:{...e,validatedLeaf:n}}function tR(e,t,n,r){let i=(0,_.useMemo)(()=>new rf,[]),a=(0,_.useMemo)(()=>n??new Map,[n]),o=_L(e),s=(0,_.useRef)({scope:o,state:a.get(o)});s.current.scope!==o&&(s.current={scope:o,state:a.get(o)});let c=(0,_.useRef)({selected:e,callbacks:t});c.current={selected:e,callbacks:t};let l=(0,_.useRef)(s.current.state?.window??null),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(null),[p,m]=(0,_.useState)(l.current),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(null),[b,x]=(0,_.useState)(0),S=(0,_.useRef)(o),C=(0,_.useRef)(null),w=r?JSON.stringify([r.sessionId,r.sessionPath,r.entryId,r.revision]):null,T=r&&e&&w!==C.current&&r.sessionId===e.id&&r.sessionPath===e.path&&r.session.id===e.id&&r.session.path===e.path&&r.session.history?.anchorEntryId===r.entryId&&r.session.history.anchorOnBranch===!0&&r.session.entries.some(e=>e.id===r.entryId)?{session:r.session,anchor:r.session.entries.at(-1).id,validatedLeaf:r.session.history?.leafEntryId??null}:null,E=(0,_.useCallback)(e=>{l.current=e,vL(a,_L(e.session),{window:e}),m(e),c.current.callbacks.onAnchorChange?.({sessionId:e.session.id,sessionPath:e.session.path,entryId:e.anchor})},[a]),D=(0,_.useCallback)((e=!1)=>{u.current?.controller.abort(),u.current=null,d.current=null,a.delete(_L(l.current?.session??c.current.selected)),l.current=null,a.persist?.(),m(null),g(!1),y(e?`historyChanged`:null),f.current=null,c.current.callbacks.onAnchorChange?.(null),x(e=>e+1)},[a]),O=(0,_.useCallback)((e=!1)=>{let t=l.current,n=c.current.selected;if(!t||!n)return;let r=JSON.stringify([_L(n),t.anchor,n.history?.leafEntryId]);if(!e&&f.current===r)return;f.current=r,y(null);let i=()=>{f.current===r&&l.current===t&&(u.current?.controller.abort(),u.current=null,g(!1),y(`historyValidationUnavailable`))};c.current.callbacks.onAnchorChange?.({sessionId:t.session.id,sessionPath:t.session.path,entryId:t.anchor});let a=c.current.callbacks.onRefresh?.();if(!a){i();return}a.then(e=>{e||i()}).catch(i)},[]),k=(0,_.useCallback)(e=>{let t=l.current,n=c.current.selected;if(!e.page||!e.consuming||u.current!==e||e.controller.signal.aborted||!t||!n||e.scope!==_L(n)||t.session.history?.beforeEntryId!==e.before||!QL(t,n))return;let r=e.page,i=new Set(t.session.entries.map(e=>e.id)),a=[...r.entries.filter(e=>!i.has(e.id)),...t.session.entries],o=Kd(a);for(;a.length>XL||o>ZL;){let e=a.pop();if(!e)break;o-=Kd(e)+ +!!a.length}c.current.callbacks.beforePrepend(),E({...t,anchor:a.at(-1)?.id??t.anchor,session:{...t.session,entries:a,bytes:o,truncation:$L(a,t.session.truncation,r.truncation.entriesOmitted),history:{...t.session.history,beforeEntryId:r.history?.beforeEntryId??null}}}),u.current=null,g(!1),y(null)},[E]);(0,_.useLayoutEffect)(()=>{if(T&&w!==C.current){S.current=o,u.current?.controller.abort(),u.current=null,d.current=null,f.current=null,g(!1),y(null),C.current=w,E(T);return}S.current!==o&&(S.current=o,u.current?.controller.abort(),u.current=null,d.current=null,l.current=s.current.state?.window??null,m(l.current),g(!1),y(null),f.current=null,x(e=>e+1),l.current||c.current.callbacks.onAnchorChange?.(null));let t=u.current;t&&!t.consuming&&e&&!QL(t.source,e)&&(t.controller.abort(),u.current=null);let n=l.current;if(!(!n||!e)){if(e.history?.anchorEntryId===n.anchor&&e.history.anchorOnBranch===!1){D(!0),c.current.callbacks.onRefresh?.();return}if(!QL(n,e)){O();return}y(e=>e===`historyValidationUnavailable`?null:e),(e.history?.leafEntryId??null)!==n.validatedLeaf&&(n=eR(n,e),E(n)),u.current?.page&&k(u.current)}},[o,e,D,O,E,k,T,w]),(0,_.useLayoutEffect)(()=>{let e=l.current;return e&&(vL(a,o,{...s.current.state,window:e}),c.current.callbacks.onAnchorChange?.({sessionId:e.session.id,sessionPath:e.session.path,entryId:e.anchor})),()=>{u.current?.controller.abort(),u.current=null,d.current=null,c.current.callbacks.onAnchorChange?.(null)}},[o,a]);let A=(0,_.useCallback)(()=>{let e=c.current.selected;return!l.current&&e?.history?.leafEntryId&&E({session:e,anchor:e.history.leafEntryId,validatedLeaf:e.history.leafEntryId}),l.current},[E]),j=(0,_.useCallback)((e,t)=>{let n=c.current.selected;if(!n||u.current)return;let r=e.session.history?.beforeEntryId;if(!r)return;let a={controller:new AbortController,scope:_L(n),before:r,source:e,consuming:t,anchor:{sessionId:n.id,sessionPath:n.path,entryId:e.anchor}};return u.current=a,t&&(g(!0),y(null)),a.done=(async()=>{try{let e=await i.sessionHistory(a.anchor,r,a.controller.signal);if(u.current!==a||a.controller.signal.aborted||a.scope!==_L(c.current.selected))return;if(e.id!==n.id||e.path!==n.path||e.anchorEntryId!==a.anchor.entryId||e.requestedBeforeEntryId!==r||e.history?.anchorEntryId!==a.anchor.entryId||e.history.anchorOnBranch!==!0)throw new tf(`Session history identity changed`,409,`SESSION_HISTORY_CHANGED`);a.page=e,a.consuming&&(k(a),u.current===a&&O())}catch(e){if(u.current!==a||a.controller.signal.aborted||(u.current=null,!a.consuming))return;g(!1),e instanceof tf&&e.code===`SESSION_HISTORY_CHANGED`?(D(!0),c.current.callbacks.onRefresh?.()):y(`historyUnavailable`)}})(),a.done},[k,D,i,O]),M=(0,_.useCallback)(async()=>{let e=c.current.selected;if(!e?.history?.leafEntryId)return;let t=l.current;if(t&&!QL(t,e)){O(!0);return}if(t||=A(),!t)return;let n=u.current;if(n){if(n.scope===_L(e)&&n.before===t.session.history?.beforeEntryId&&QL(n.source,e))return n.consuming=!0,g(!0),y(null),n.page&&k(n),n.done;n.controller.abort(),u.current=null}return j(t,!0)},[k,j,O,A]);(0,_.useEffect)(()=>{if(!t.preload){let e=u.current;e&&!e.consuming&&(e.controller.abort(),u.current=null,d.current=null);return}if(v||u.current||!e||p!==l.current)return;let n=p;if(n&&!QL(n,e))return;let r=n??(e.history?.leafEntryId?{session:e,anchor:e.history.leafEntryId,validatedLeaf:e.history.leafEntryId}:null);if(!r?.session.history?.beforeEntryId)return;let i=JSON.stringify([o,n?r.anchor:`initial`,n?r.session.history.beforeEntryId:null]);d.current!==i&&(d.current=i,j(r,!1))},[t.preload,v,o,e,p,j]);let N=p&&_L(p.session)===o?p:null,P=T??(N&&e&&QL(N,e)?eR(N,e):N),F=(0,_.useCallback)(()=>D(),[D]),I=!!(P&&e&&!QL(P,e));return{session:P?.session??e,engaged:!!P,hasMore:!!(P?.session??e)?.history?.beforeEntryId,hasNewer:!!(P&&P.anchor!==e?.history?.leafEntryId),verifying:I,loading:h,error:v,reset:b,retainReading:A,loadOlder:M,resetToLatest:F}}function nR(e){return e&&typeof e==`object`?e:{}}function rR(e){try{return nR(JSON.parse(e))}catch{return{}}}function iR(e){return e===`running`?`running`:e===`done`||e===`completed`?`done`:[`error`,`failed`,`aborted`,`killed`,`timed_out`].includes(String(e))?`error`:e===`uncertain`?`warn`:`unknown`}function aR(e,t){if(e?.forkSnapshotToolResult)return`unknown`;if(t===`running`)return`running`;if(t===`unknown`||!e)return`unknown`;if(e.isError)return`error`;let n=iR(nR(e.details).status);return n===`unknown`?e.isError===!1?`done`:`unknown`:n}function oR({status:e}){let{t}=cr();return e===`running`?(0,K.jsx)(`span`,{className:`status-mark running`,role:`img`,"aria-label":t(`toolState_running`),children:(0,K.jsx)(`i`,{})}):e===`done`?(0,K.jsx)(I,{className:`status-mark done`,"aria-label":t(`execution_done`)}):e===`error`?(0,K.jsx)(Lt,{className:`status-mark error`,"aria-label":t(`toolState_failed`)}):e===`warn`?(0,K.jsx)(`span`,{className:`status-mark warn`,role:`img`,"aria-label":t(`toolState_unknown`),children:`?`}):null}function sR({label:e,message:t,children:n}){return(0,K.jsxs)(`div`,{className:`execution-error`,role:`alert`,"aria-label":e,children:[(0,K.jsx)(V,{"aria-hidden":`true`}),(0,K.jsxs)(`div`,{className:`execution-error-content`,children:[(0,K.jsx)(`p`,{children:t}),n]})]})}function cR({failed:e,error:t,retryPrompt:n,retryEntryId:r,canRetry:i,onRetry:a}){let{t:o}=cr(),[s,c]=(0,_.useState)(!1);return e?(0,K.jsx)(sR,{label:o(`modelRequestFailed`),message:t||o(`modelFailureUnknown`),children:n!==void 0&&r&&(0,K.jsx)(`div`,{className:`provider-outcome-actions`,children:(0,K.jsxs)(`button`,{type:`button`,disabled:!i||s,onClick:()=>{c(!0),a(n,r).finally(()=>c(!1))},children:[(0,K.jsx)(ft,{"aria-hidden":`true`}),o(s?`retryingPrompt`:`retryPrompt`)]})})}):(0,K.jsx)(`div`,{className:`provider-outcome aborted`,role:`status`,children:o(`modelRequestStopped`)})}function lR({attempts:e,state:t,retry:n,observed:r=!0}){let{t:i}=cr(),a=t===`retrying`&&!r,o=n?.attempt,s=n?.maxAttempts,c=typeof o==`number`&&Number.isSafeInteger(o)&&o>0&&typeof s==`number`&&Number.isSafeInteger(s)&&s>=o,l=e.length>0||!!n?.errorMessage,u=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Pt,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{role:t===`retrying`?`status`:void 0,children:[i(a?`modelReconnectUnknown`:t===`recovered`?`modelRequestRecovered`:t===`retrying`?n?`modelReconnecting`:`modelEarlierAttempts`:t===`interrupted`?`modelRequestStopped`:`modelEarlierAttempts`),t===`retrying`&&c&&` ${o}/${s}`]}),t!==`retrying`&&(0,K.jsx)(`span`,{children:i(`modelFailedAttempts`,{count:e.length})}),l&&(0,K.jsx)(ee,{className:`reconnect-chevron`,"aria-hidden":`true`})]}),d=`provider-attempts ${t}${a?` unavailable`:``}`;return l?(0,K.jsxs)(`details`,{className:d,children:[(0,K.jsx)(`summary`,{children:u}),(0,K.jsxs)(`ol`,{children:[e.length===0&&(0,K.jsx)(`li`,{children:(0,K.jsx)(`p`,{children:n?.errorMessage})}),e.map(({entry:e,content:t})=>(0,K.jsxs)(`li`,{"data-history-entry":e.entryId??e.key,children:[(0,K.jsx)(`p`,{children:e.message.errorMessage||i(`modelFailureUnknown`)}),t?.map(e=>(0,K.jsx)(_.Fragment,{children:e.content},e.key))]},e.key))]})]}):(0,K.jsx)(`div`,{className:d,children:u})}function uR(e,t){let n=new Set,r=new Map,i=[],a=-1,o=(o,s=!1,c=!1)=>{if(i.length>0){let l=e[a]?.message.stopReason,u=o?.outcome===`cancelled`||l===`aborted`,d=l===`error`&&!u&&!(s&&t)&&!c;d&&n.add(a);let f=d?i.slice(0,-1):i,p=f.at(-1);p!==void 0&&r.set(p,{attempts:f.map(t=>e[t]),state:u?`interrupted`:l===`stop`||l===`length`||l===`toolUse`?`recovered`:s&&t?`retrying`:`earlier`})}i=[],a=-1};return e.forEach((e,t)=>{e.optimistic||(e.timing?o(e.timing):e.forkSnapshotBoundary?o(void 0,!1,!0):e.message.role===`user`||e.message.role===`custom`&&e.message.customType===`openpi-setup-request`?o():e.message.role===`assistant`&&(a=t,e.message.stopReason===`error`&&i.push(t)))}),o(void 0,!0),{finalErrors:n,groups:r}}function dR(e,t){return ej(nL(e,t).split(` -`).find(Boolean),120)}function fR(e){let t=e.split(` -`).map(e=>e.trim()).find(Boolean);return t?ej(t.replace(/^#{1,6}\s+/u,``).replace(/^>\s*/u,``).replace(/[*_~`]+/gu,``).replace(/\[([^\]]+)\]\([^)]*\)/gu,`$1`).trim(),600):``}function pR({body:e,icon:t,name:n,status:r,summary:i,output:a,evidenceState:o,note:s,rawDetails:c,snapshotMissingResult:l=!1,defaultOpen:u=!1}){let{t:d}=cr(),[f,p]=(0,_.useState)(u);(0,_.useEffect)(()=>p(u),[u]);let m=o??(r===`done`?`returned`:r===`error`?`failed`:r===`running`?`running`:`unknown`);return(0,K.jsxs)(`details`,{className:`message-details tool-line ${r}`,"data-tool":n,open:f,onToggle:e=>p(e.currentTarget.open),children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(`span`,{className:`tool-icon`,"aria-hidden":`true`,children:t}),(0,K.jsx)(`span`,{className:`tool-kind`,"aria-hidden":$I(n).action!==`call`,title:n,children:tL(n)}),(0,K.jsxs)(`span`,{className:`details-title`,children:[(0,K.jsx)(`span`,{className:`tool-action`,children:eL(d,n,m)}),i&&(0,K.jsx)(`span`,{className:`tool-summary`,children:i})]}),l&&(0,K.jsx)(`span`,{className:`evidence-status`,children:d(`toolSnapshotMissingResult`)}),(0,K.jsx)(ee,{className:`tool-disclosure`,"aria-hidden":`true`}),(0,K.jsx)(oR,{status:r})]}),s&&(0,K.jsx)(`p`,{className:`evidence-note`,children:s}),a===void 0?(0,K.jsx)(`pre`,{className:`details-body tool-evidence`,children:Fd(e).text}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`figure`,{"aria-label":d(`toolCallArguments`),style:{margin:0},children:(0,K.jsx)(`pre`,{className:`details-body tool-evidence`,children:Fd(e).text})}),(0,K.jsx)(`figure`,{"aria-label":d(`toolCallOutput`),style:{margin:0},children:(0,K.jsx)(`pre`,{className:`details-body tool-evidence`,children:Fd(a).text||d(`noOutput`)})})]}),c!==void 0&&(0,K.jsxs)(`details`,{className:`evidence-raw`,children:[(0,K.jsx)(`summary`,{children:d(`toolRawEvidence`)}),(0,K.jsx)(`pre`,{children:Fd(JSON.stringify(c,null,2)).text})]})]})}function mR({body:e,family:t,meta:n,status:r,title:i,defaultOpen:a=!1}){return(0,K.jsxs)(`details`,{className:`message-details activity-card ${t}`,open:a||void 0,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(`span`,{className:`activity-icon`,"aria-hidden":`true`,children:t===`subagent`?(0,K.jsx)(M,{}):(0,K.jsx)(Ft,{})}),(0,K.jsxs)(`span`,{className:`activity-main`,children:[(0,K.jsx)(`span`,{className:`activity-title`,children:i}),n&&(0,K.jsx)(`span`,{className:`activity-meta`,children:n})]}),(0,K.jsx)(oR,{status:r}),(0,K.jsx)(ee,{className:`tool-disclosure`,"aria-hidden":`true`})]}),(0,K.jsx)(`pre`,{className:`details-body tool-evidence`,children:e})]})}function hR(e,t,n={sessionId:``}){if(t?.forkSnapshotToolResult)return null;let{sessionId:r,subagents:i=[],records:a=[],workflows:o=[],onInspectSubagent:s,liveState:c,defaultOpen:l=!1,observed:u=!0}=n,d=e.name||``,f=rR(e.arguments),p=nR(t?.details),m=aR(t,c),h=!u&&m===`running`?`unknown`:m;if(d===`subagent_spawn`)return(0,K.jsx)(gR,{sessionId:r,id:typeof p.id==`string`?p.id:void 0,title:String(p.title||f.name||`subagent`),body:t?.content||String(f.prompt||e.arguments),activity:i.find(e=>e.id===p.id),saved:a.find(e=>e.id===p.id),spawnFailed:t?.isError===!0,observed:u,defaultOpen:l,onInspect:s});if(d.startsWith(`subagent`)){let n=d.replaceAll(`_`,` `).replace(/^subagent /u,``),r=i.find(e=>e.id===f.id)??a.find(e=>e.id===f.id);return(0,K.jsx)(mR,{family:`subagent`,defaultOpen:l,title:`${n[0]?.toUpperCase()||``}${n.slice(1)} · ${r?.title||f.id||`Subagent`}`,body:t?.content||e.arguments,status:h})}if(d===`workflow`){let n=typeof f.script==`string`?f.script:e.arguments,i=String(p.name||n.match(/\bname:\s*["'`]([^"'`]+)["'`]/u)?.[1]||`unnamed`),a=nR(p.agents),c=o.find(e=>e.runId===p.runId)?.children,l=[p.runId,p.status,a.total?`${Number(a.total)-Number(a.running||0)}/${a.total} agents`:``].filter(Boolean).join(` · `);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(mR,{family:`workflow`,title:`Workflow · ${i}`,meta:l,body:t?.content||n,status:h}),(0,K.jsx)(_R,{sessionId:r,tasks:c,observed:u,onInspect:s})]})}return d.startsWith(`workflow`)?(0,K.jsx)(mR,{family:`workflow`,title:d.replaceAll(`_`,` `),meta:String(f.runId||``),body:t?.content||e.arguments,status:h}):null}function gR({sessionId:e,id:t,title:n,body:r,activity:i,saved:a,spawnFailed:o,onInspect:s,defaultOpen:c=!1,observed:l=!0}){let{t:u}=cr(),d=i?.outcome===`interrupted`?`interrupted`:i?.status??(a?.state===`running`?void 0:a?.state),f=!l&&(d===`running`||!d&&!o)?`unknown`:d,p=u(f===`unknown`?`toolState_unknown`:f?`subagentState_${f}`:o?`subagentSpawnFailed`:t?`subagentStateUnavailable`:`subagentStarting`);return(0,K.jsxs)(`section`,{className:`activity-card subagent subagent-activity`,children:[(0,K.jsx)(TL,{identity:`${e}:${t??n}`,title:n,state:f,label:p,onInspect:t&&s?()=>s(t):void 0}),(c||o)&&(0,K.jsxs)(`details`,{className:`subagent-receipt`,open:c||void 0,children:[(0,K.jsx)(`summary`,{children:u(`subagentSpawnReceipt`)}),(0,K.jsx)(`p`,{children:u(`subagentSpawnReceiptHint`)}),(0,K.jsx)(`pre`,{className:`details-body tool-evidence`,children:r})]})]})}function _R({sessionId:e,tasks:t,observed:n,onInspect:r}){let{t:i}=cr();return(0,K.jsxs)(K.Fragment,{children:[t?.items.map(t=>{let a=t.outcome===`interrupted`?`interrupted`:!n&&t.status===`running`?`unknown`:t.status;return(0,K.jsx)(TL,{identity:`${e}:${t.id}`,title:t.title,state:a,label:i(a===`unknown`?`toolState_unknown`:`subagentState_${a}`),onInspect:r?()=>r(t.id,`workflows`):void 0},t.id)}),!!t?.omitted&&(0,K.jsx)(`p`,{className:`inspection-note`,children:i(`subagentListTruncated`,{count:t?.omitted})})]})}function vR({body:e,duration:t,status:n,level:r,defaultOpen:i,truncated:a,source:o}){let{t:s}=cr(),c=n===`running`,[l,u]=(0,_.useState)(i),[d,f]=(0,_.useState)();(0,_.useEffect)(()=>u(i),[i]);let p=t===void 0?``:nj(0,t),m=fR(e),h=[n===`unknown`?s(`toolState_unknown`):c?r?s(`thinkingActiveLevel`,{level:r}):s(`thinkingActive`):s(`thinkingDone`),p].filter(Boolean).join(` · `);return(0,K.jsxs)(`details`,{className:`message-details tool-line thinking-line ${n}`,open:l,onToggle:e=>u(e.currentTarget.open),children:[(0,K.jsxs)(`summary`,{"aria-label":[h,m].filter(Boolean).join(` · `),title:m,children:[(0,K.jsx)(`span`,{className:`tool-icon`,"aria-hidden":`true`,children:(0,K.jsx)(Le,{})}),(0,K.jsx)(`span`,{className:`details-title`,children:(0,K.jsx)(`span`,{className:`tool-summary`,children:m||h})}),(0,K.jsx)(ee,{className:`tool-disclosure`,"aria-hidden":`true`})]}),l&&(0,K.jsx)(`div`,{className:`details-body thinking-evidence`,children:a&&o&&!c?(0,K.jsx)(FL,{...o,preview:e,markdown:!0,purpose:`thinking`,fullText:d,onComplete:f}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Sk,{children:e}),a&&(0,K.jsx)(`p`,{className:`evidence-warning`,children:s(`thinkingPreviewOnly`)})]})})]})}function yR({content:e,editable:t,copyRequiresFull:n=!1,timestamp:r,onResend:i,onRegenerate:a,onFork:o,canFork:s=!1,forkPending:c=!1}){let{t:l}=cr(),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(0),v=(0,_.useRef)(void 0);(0,_.useEffect)(()=>()=>{g.current+=1,window.clearTimeout(v.current)},[]);let[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(e),[C,w]=(0,_.useState)(!1),T=(0,_.useRef)(null),E=(0,_.useId)();(0,_.useEffect)(()=>{y&&T.current?.focus()},[y]);let D=async()=>{if(!(C||!x.trim()||!t)){w(!0);try{await i(x.trim())&&b(!1)}finally{w(!1)}}};if(y)return(0,K.jsxs)(`div`,{className:`message-editor`,children:[(0,K.jsx)(`textarea`,{ref:T,value:x,"aria-label":l(`editMessage`),"aria-describedby":E,readOnly:C,onChange:e=>S(e.target.value),onKeyDown:e=>{e.nativeEvent.isComposing||C||(e.key===`Escape`&&b(!1),e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),D()))}}),(0,K.jsx)(`p`,{className:`message-edit-hint`,id:E,children:l(`editMessageHint`)}),(0,K.jsxs)(`div`,{className:`message-edit-actions`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:C,onClick:()=>b(!1),children:l(`cancel`)}),(0,K.jsx)(`button`,{type:`button`,className:`confirm`,disabled:C||!x.trim()||!t,onClick:()=>void D(),children:l(`confirmEdit`)})]})]});let O=tj(r);return(0,K.jsxs)(`div`,{className:`message-actions${f?` copy-failed`:``}`,children:[O&&(0,K.jsx)(`time`,{dateTime:r,children:O}),o&&(0,K.jsx)(`button`,{type:`button`,"aria-label":l(`forkMessage`),title:l(c?`forkSessionPending`:s?`forkMessageHint`:`forkSessionUnavailable`),disabled:!s||c,onClick:()=>void o(),children:(0,K.jsx)(Ae,{"aria-hidden":`true`})}),t&&(0,K.jsx)(`button`,{type:`button`,"aria-label":l(`editMessage`),title:l(`editMessage`),onClick:()=>{S(e),b(!0)},children:(0,K.jsx)(at,{})}),a&&(0,K.jsx)(`button`,{type:`button`,"aria-label":l(`regenerateMessage`),title:l(`regenerateMessageHint`),disabled:!s||c,onClick:()=>void a(),children:(0,K.jsx)(ft,{"aria-hidden":`true`})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":l(u?`copiedMessage`:`copyMessage`),title:l(n?`messageCopyRequiresFull`:u?`copiedMessage`:`copyMessage`),disabled:m||n,onClick:()=>{let t=++g.current;window.clearTimeout(v.current),h(!0),d(!1),p(!1),wd(e).then(e=>{t===g.current&&(h(!1),d(e),p(!e),e&&(v.current=window.setTimeout(()=>d(!1),1200)))})},children:u?(0,K.jsx)(I,{}):(0,K.jsx)(oe,{})}),f&&(0,K.jsx)(`span`,{className:`copy-error`,role:`status`,children:l(`copyFailed`)})]})}function bR({message:e,fullSubagent:t=!1,sessionId:n,onInspectSubagent:r}){let{t:i}=cr();if(e.customType===`openpi-web-command-feedback`)return(0,K.jsxs)(`div`,{className:`command-feedback`,role:`status`,children:[e.content,e.truncation?.truncated&&(0,K.jsx)(`p`,{children:i(`commandFeedbackTruncated`)})]});let a=nR(e.details);if(e.customType===`openpi-setup-request`||e.customType===`openpi-setup-closed`)return(0,K.jsx)(pR,{body:e.content,icon:(0,K.jsx)(It,{}),name:i(`configureOpenPi`),summary:e.customType===`openpi-setup-closed`?ej(e.content):void 0,status:`unknown`});if(e.customType===`subagent-result`){let o=Array.isArray(a.results)?a.results.map(nR):[a],s=new Set(aj([e]).map(e=>e.id));return(0,K.jsxs)(`section`,{className:`activity-card subagent subagent-activity`,children:[o.map(e=>{let t=typeof e.id==`string`?e.id:``,a=e.outcome===`interrupted`?`interrupted`:e.status===`done`||e.status===`error`||e.status===`running`?e.status:`unknown`;return(0,K.jsx)(TL,{identity:`${n}:${t}`,title:String(e.title||t||i(`subagentDetails`)),state:a,label:i(a===`unknown`?`unknownState`:`subagentState_${a}`),onInspect:r&&s.has(t)?()=>r(t):void 0},t||JSON.stringify(e))}),(0,K.jsxs)(`details`,{className:`subagent-result-evidence`,open:t||void 0,children:[(0,K.jsx)(`summary`,{children:i(`subagentBackgroundResult`,{count:o.length})}),(0,K.jsx)(`pre`,{className:`details-body tool-evidence`,children:!t&&typeof a.displayContent==`string`?a.displayContent:e.content})]})]})}if(e.customType===`workflow-result`){let t=Array.isArray(a.entries)?a.entries.map(nR):[],n=t.map(e=>iR(e.status)),r=n.includes(`error`)?`error`:n.includes(`warn`)?`warn`:n.length>0&&n.every(e=>e===`done`)?`done`:n.includes(`running`)?`running`:`unknown`,i=t.length?t.map(e=>`${e.status===`completed`?`✓`:`✗`} ${String(e.summary||e.runId||`run`)}${e.resultPreview?`\nResult: ${e.resultPreview}`:``}`).join(` -`):e.content;return(0,K.jsx)(mR,{family:`workflow`,title:t.length>1?`Workflow results · ${t.length} runs`:`Workflow ${String(t[0]?.runId||`result`)}`,body:i,status:r})}return null}function xR(e){return[``,`[]`,`{}`,`null`].includes(e.trim())}function SR(e){if(e.role===`toolResult`&&e.toolCallId)return`tool-result-${e.toolCallId}`;if(e.timestamp!==void 0)return`message-${e.role}-${e.timestamp}`}function CR(e){return[`assistant`,`toolResult`].includes(e.role??``)&&!e.truncation?.truncated?JSON.stringify(e):null}function wR(e){return JSON.stringify([e.role,e.content,(e.parts??[]).filter(t=>e.role!==`user`||t.type!==`text`).map(t=>t.type===`image`?[t.type,t.mimeType,e.role===`user`?void 0:t.name]:t.type),e.stopReason,e.errorMessage,e.toolCallId])}function TR(e){return e.role===`user`?wR(e):JSON.stringify({...e,timestamp:void 0})}var ER=new WeakMap;function DR(e,t){let n=ER.get(e),r=n?.get(t);if(r&&r.length===e.length&&r.head===e[0]&&r.tail===e[e.length-1])return r.projection;let i=new Map(e.map(e=>[e.id,e])),a=new Map;for(let t of e){let e=t.message&&CR(t.message);if(!e)continue;let n=a.get(e)??[];n.push(t),a.set(e,n)}let o=e.flatMap(e=>{if(e.forkSnapshotBoundary)return[{key:e.id,entryId:e.id,timestamp:e.timestamp,forkSnapshotBoundary:!0,message:{role:`custom`,content:``}}];if(e.type===`compaction`)return[{key:e.id,entryId:e.id,timestamp:e.timestamp,compaction:!0,message:{role:`custom`,content:``}}];if(`turnTiming`in e&&e.turnTiming&&e.turnTiming.sessionId===t)return[{key:e.id,timestamp:e.timestamp,timing:e.turnTiming,message:{role:`custom`,content:``}}];if(e.type!==`message`||!e.message)return[];let n=SL(e.message),r=CL(e,e=>i.get(e));return wL(e.message,r)?[]:[{key:e.id,entryId:e.id,timestamp:e.timestamp,message:n}]}),s=new Map,c=new Map;o.forEach((e,t)=>{if(e.entryId&&s.set(e.entryId,t),e.timing||e.compaction||e.forkSnapshotBoundary)return;let n=SR(e.message)??e.entryId??e.key,r=c.get(n)??[];r.push(t),c.set(n,r)});let l=new Map,u=0;for(let t of e){if(t.message?.role!==`custom`||t.message.truncation?.truncated)continue;let e=TR(t.message),n=l.get(e)??[];n.push(u),l.set(e,n),u++}let d=o.map(e=>({identity:SR(e.message),signature:TR(e.message)})),f=new Map,p=new Map;d.forEach((e,t)=>{let n=p.get(e.signature)??[];if(n.push(t),p.set(e.signature,n),e.identity===void 0)return;let r=f.get(e.identity)??[];r.push(t),f.set(e.identity,r)});let m=new Map(e.map((e,t)=>[e.id,t])),h=o.filter(e=>e.message.role===`user`).map(e=>({key:e.entryId??e.key,position:m.get(e.entryId??e.key),parentId:i.get(e.entryId??e.key)?.parentId,signature:wR(e.message)})),g=new Map;for(let e of h){let t=g.get(e.signature)??[];t.push(e),g.set(e.signature,t)}let _={nativeById:i,exactNative:a,baseEntries:o,indexById:s,lookupIndexes:c,customIndexes:l,nativeByIdentity:f,nativeByLegacySignature:p,nativeMessages:d,promptCandidates:h,promptsBySignature:g,commandInputs:new Map(o.flatMap(e=>e.message.role===`user`&&e.message.customType===`openpi-web-command-input`&&e.message.commandId?[[e.message.commandId,e.entryId??e.key]]:[])),persistedPositions:m};return n||(n=new Map,ER.set(e,n)),n.set(t,{projection:_,length:e.length,head:e[0],tail:e[e.length-1]}),_}function OR(e,t){if(!e)return-1;for(let n of e)if(!t.has(n))return n;return-1}function kR(e,t){let n=[e.timingKey,e.key,e.entryId,SR(e.message)];for(let e of n){if(!e)continue;let n=t[e];if(n!==void 0)return n}}function AR(e,t,n){let r=e.selectedSession,i=DR(r?.entries??[],r?.id);for(let e of n.keys())i.nativeById.has(e)||n.delete(e);let a=new Map;for(let e of t){if(e.optimistic)continue;let t=CR(e.message);if(!t)continue;let n=a.get(t)??[];n.push(e),a.set(t,n)}let o=new Set(n.values());for(let[e,t]of i.exactNative){let r=a.get(e);if(t.length!==1||r?.length!==1)continue;let s=t[0].id,c=r[0].key;n.has(s)||o.has(c)||i.nativeById.has(c)||(n.set(s,c),o.add(c))}let s=new Map;for(let e of t){let t=SR(e.message)??e.key,n=i.lookupIndexes.get(t);if(n)for(let t of n)s.set(t,e.key)}let c=new Set(t.flatMap(e=>e.optimistic?.projectedEntryId?[e.optimistic.projectedEntryId]:[])),l=[],u=[],d=e.selectedExecution?.sessionId===r?.id&&e.selectedExecution?.sessionPath===r?.path?e.selectedExecution:void 0,f=d?.pendingFollowUps??0,p=Math.max(0,t.filter(e=>e.optimistic?.admitted&&!e.optimistic.projectedEntryId&&!i.commandInputs.has(e.optimistic.commandId)).length-f),m=0,h=new Set,g=new Set,_=new Set,v=[];for(let e of t){if(e.optimistic?.projectedEntryId)continue;if(e.message.role===`custom`&&!e.message.truncation?.truncated){let t=TR(e.message),n=OR(i.customIndexes.get(t),g);if(n>=0){g.add(n);continue}}let n=e.optimistic?.commandId??(e.key.startsWith(`optimistic-`)?e.key.slice(11):void 0),a=n?i.commandInputs.get(n):void 0;if(a){e.optimistic&&l.push({key:e.key,entryId:a});continue}let o=SL(e.message);if(o.role===`user`&&e.optimistic){let t=e.optimistic.afterEntryId===null?-1:i.persistedPositions.get(e.optimistic.afterEntryId),n=!e.optimistic.admitted||m>=p?void 0:i.promptsBySignature.get(wR(o))?.find(n=>n.position!==void 0&&(t===void 0?n.parentId===e.optimistic?.afterEntryId:n.position>t)&&!c.has(n.key));if(n){c.add(n.key),l.push({key:e.key,entryId:n.key}),m++;continue}}else{let e=o.role===`user`?t.find(e=>e.optimistic?.admitted&&!e.optimistic.projectedEntryId&&!h.has(e.key)&&!l.some(t=>t.key===e.key)&&e.optimistic.sessionId===r?.id&&e.optimistic.sessionPath===r?.path&&wR(SL(e.message))===wR(o)):void 0;if(e){h.add(e.key);continue}let n=SR(o),a=TR(o),s=n===void 0?OR(i.nativeByLegacySignature.get(a),_):(i.nativeByIdentity.get(n)??[]).find(e=>!_.has(e)&&i.nativeMessages[e]?.signature===a)??-1;if(s>=0){_.add(s);continue}}let s={key:e.key,timingKey:e.key,timestamp:e.timestamp??new Date().toISOString(),message:o,optimistic:e.optimistic};o.role===`user`&&e.optimistic?u.push(s):v.push(s)}let y=new Map;for(let e of d?.queuedMessages??[])y.set(e,(y.get(e)??0)+1);let b=u.filter(e=>{if(!e.optimistic?.admitted||e.optimistic.commandId===d?.activeTurn?.commandId)return!0;let t=y.get(e.message.content)??0;return!t||(y.set(e.message.content,t-1),!1)}),x=new Map(t.flatMap(e=>e.optimistic?.projectedEntryId?[[e.optimistic.projectedEntryId,e.key]]:[]));for(let e of l)x.set(e.entryId,e.key);let S=i.baseEntries,C=(e,t)=>{S===i.baseEntries&&(S=i.baseEntries.slice()),S[e]=t};for(let[e,t]of s){let n=S[e];!n||n.timingKey===t||C(e,{...n,timingKey:t})}for(let[e,t]of n){let n=i.indexById.get(e);if(n===void 0)continue;let r=S[n];!r||r.key===t||C(n,{...r,key:t})}for(let[e,t]of x){let n=i.indexById.get(e);if(n===void 0)continue;let r=S[n];!r||r.key===t||C(n,{...r,key:t})}return{entries:S.concat(v,b),projectedPrompts:l}}function jR(e){let[t,n]=(0,_.useState)(()=>({row:e,since:Date.now()}));return(0,_.useEffect)(()=>{if(e?.key===t.row?.key)return;if(!e||!t.row){n({row:e,since:Date.now()});return}let r=window.setTimeout(()=>n({row:e,since:Date.now()}),Math.max(0,1e3-(Date.now()-t.since)));return()=>window.clearTimeout(r)},[e,t]),!e||e.key===t.row?.key?e:t.row??e}function MR({rows:e,active:t}){let{t:n}=cr(),r,[i,a]=(0,_.useState)(t),o=e.length===1,s=(0,_.useRef)(o),c=(0,_.useRef)(null),l=(0,_.useRef)(!0),u=(0,_.useRef)(0),d=(0,_.useRef)(void 0),[f,p]=(0,_.useState)({above:!1,below:!1}),m=(0,_.useCallback)(()=>{let e=c.current;if(!e)return;let t=e.scrollTop>1,n=e.scrollHeight-e.clientHeight-e.scrollTop>1;p(e=>e.above===t&&e.below===n?e:{above:t,below:n})},[]);(0,_.useEffect)(()=>a(t),[t]),(0,_.useLayoutEffect)(()=>{let n=c.current,r=s.current&&!o;s.current=o,!(!n||o||!i||e.length===0)&&(!r&&n.scrollTop!==u.current&&n.scrollHeight-n.clientHeight-n.scrollTop>24&&(l.current=!1),r&&!l.current&&(n.scrollTop=u.current),t&&l.current&&(n.scrollTop=n.scrollHeight,u.current=n.scrollTop),m())},[e,t,i,o,m]),(0,_.useEffect)(()=>{let e=c.current,n=e?.firstElementChild;if(!e||!n||o||typeof ResizeObserver>`u`)return;let r=new ResizeObserver(()=>{i&&t&&l.current&&(e.scrollTop=e.scrollHeight,u.current=e.scrollTop),m()});return r.observe(e),r.observe(n),()=>r.disconnect()},[t,i,o,m]);let h=e.filter(e=>e.processType===`thinking`).length,g=e.filter(e=>e.processType===`tool`).length,v=e.filter(e=>e.processType===`activity`).length,y=[h?n(`processThinkingCount`,{count:h}):``,g?n(`processToolCount`,{count:g}):``,v?n(`processActivityCount`,{count:v}):``].filter(Boolean),b=[...e].reverse().find(e=>e.processStatus===`running`),x=jR(b),S=x?.processPreview??(t?[...e].reverse():e).find(e=>e.processPreview)?.processPreview,C=x?.processToolName&&[`read`,`write`,`edit`].includes(x.processToolName)?S?.slice(Math.max(S.lastIndexOf(`/`),S.lastIndexOf(`\\`))+1):S,w=e.some(e=>e.error||e.processStatus===`error`),T=b?`running`:w?`error`:e.some(e=>e.processStatus===`warn`)?`warn`:e.every(e=>e.processStatus===`done`)?`done`:`unknown`,E=e.flatMap(e=>e.processToolName?[e.processToolName]:[]),D=[...new Set(E.map(e=>$I(e).action))],O=D.map(e=>n(`toolActionGroup_${e}`)),k=D.length?n(`toolGroup_${T===`done`?`done`:T===`running`?`running`:`unknown`}`,{actions:O.join(n(`toolGroupSeparator`))}):n(T===`running`?`processRunning`:`processDetails`),A=x?.processToolName?eL(n,x.processToolName,`running`):x?.processType===`thinking`?n(`thinkingActive`):k,j=x?.processToolName??E[0],M=x?.processType===`thinking`?Le:j?$I(j).Icon:It;return(0,K.jsxs)(`details`,{className:`process-sequence ${o?`single-process `:``}${T}`,open:o||i,"data-status":T,"data-running":T===`running`?`true`:void 0,"data-history-entry":e[0]?.key,onToggle:e=>{o||a(e.currentTarget.open)},children:[(0,K.jsxs)(`summary`,{hidden:o,"aria-label":[A,b?S:``,...y].filter(Boolean).join(` · `),children:[(0,K.jsx)(`span`,{className:`tool-icon`,"aria-hidden":`true`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(`span`,{className:`process-sequence-title`,title:[O.join(n(`toolGroupSeparator`)),...y].filter(Boolean).join(` · `),children:(0,K.jsx)(`strong`,{children:A})}),S&&(b||!D.length)&&(0,K.jsx)(`span`,{className:`process-sequence-preview`,title:S,children:C}),(0,K.jsx)(`span`,{className:`process-sequence-counts`,children:y.join(` · `)}),(0,K.jsx)(ee,{className:`tool-disclosure`,"aria-hidden":`true`}),(0,K.jsx)(oR,{status:T})]}),(0,K.jsx)(`section`,{ref:c,className:`process-sequence-scroll`,"aria-label":o?void 0:[n(`processDetails`),...y].join(` · `),tabIndex:o?void 0:0,"data-scroll-above":f.above||void 0,"data-scroll-below":f.below||void 0,onScrollCapture:e=>{let t=e.target;if(o&&t instanceof HTMLElement&&t.classList.contains(`thinking-evidence`)){let n=t.getBoundingClientRect().top-e.currentTarget.getBoundingClientRect().top+t.scrollTop,r=n>u.current;u.current=n,l.current=(l.current||r)&&t.scrollHeight-t.clientHeight-t.scrollTop<=24}},onScroll:e=>{if(o)return;let t=e.currentTarget,n=t.scrollTop>u.current;u.current=t.scrollTop,l.current=(l.current||n)&&t.scrollHeight-t.clientHeight-t.scrollTop<=24,m()},onWheel:e=>{!e.defaultPrevented&&!e.ctrlKey&&!e.metaKey&&e.deltaY<0&&(o||VR(e.nativeEvent,e.currentTarget))&&(l.current=!1)},onKeyDown:e=>{let t=e.target;!e.defaultPrevented&&!e.altKey&&!e.metaKey&&(!e.ctrlKey||e.key===`Home`)&&([`ArrowUp`,`PageUp`,`Home`].includes(e.key)||e.key===` `&&e.shiftKey)&&t instanceof HTMLElement&&!t.isContentEditable&&!t.closest(`input, textarea, select`)&&!(e.key===` `&&t.closest(`button, summary`))&&(o||VR(e.nativeEvent,e.currentTarget))&&(l.current=!1)},onTouchStart:e=>{d.current=e.touches[0]?.clientY},onTouchMove:e=>{let t=e.touches[0]?.clientY;t!==void 0&&d.current!==void 0&&t>d.current&&(o||VR(e.nativeEvent,e.currentTarget))&&(l.current=!1),d.current=t},children:(0,K.jsx)(`div`,{className:`process-sequence-body`,children:e.map(e=>{e.processType===`thinking`?r=e.processMessageKey:e.processMessageKey!==r&&(r=void 0);let t=r!==void 0&&e.processType!==`thinking`;return(0,K.jsx)(`div`,{className:`process-step ${o?`single-tool-step `:``}${t?`thought-tool-step `:``}${e.processStatus??`unknown`}`,"data-status":e.processStatus??`unknown`,children:e.content},e.key)})})})]})}function NR(e,t){let n=[];for(let t of e){let e=n.at(-1),r=t.kind===`process`;r&&e?.process?e.rows.push(t):n.push({process:r,rows:[t]})}return n.flatMap((e,r)=>{let i=`${e.process?`process`:`rows`}-${e.rows[0]?.key}`;return e.process?(0,K.jsx)(MR,{rows:e.rows,active:t&&r===n.length-1},i):e.rows.map(e=>(0,K.jsx)(_.Fragment,{children:e.content},e.key))})}function PR({rows:e,timing:t,active:n,timedTurn:r}){let{t:i}=cr(),a=(0,_.useId)(),[o,s]=(0,_.useState)(t?.outcome!==`completed`),c=(0,_.useRef)(t?.outcome);(0,_.useEffect)(()=>{c.current!==t?.outcome&&t?.outcome===`completed`&&s(!1),c.current=t?.outcome},[t?.outcome]);let l=!!(t||r),u=[];for(let r of e){if(r.content===null)continue;let e=t?.resultEntryId?r.responseEntryId===t.resultEntryId&&r.final!==!1:!n&&r.final,i=r.kind!==`prompt`&&!e,a=u.at(-1);i&&a?.foldable?a.rows.push(r):u.push({foldable:i,rows:[r]})}let d=u.filter(e=>e.foldable),f=e=>e===0?a:`${a}-${e}`,p=d.length>0,m=t?(0,K.jsx)(OL,{timing:t}):r?(0,K.jsx)(DL,{elapsedMs:r.elapsedMs},JSON.stringify([r.sessionId,r.sessionPath,r.commandId,r.epoch,r.startedAt])):null;return(0,K.jsxs)(K.Fragment,{children:[l&&(0,K.jsxs)(`header`,{className:`turn-duration`,"data-outcome":t?.outcome,children:[p?(0,K.jsxs)(`button`,{type:`button`,className:`turn-duration-toggle`,"aria-expanded":o,"aria-controls":d.map((e,t)=>f(t)).join(` `),onClick:()=>s(e=>!e),children:[m,(0,K.jsx)(ee,{"aria-hidden":`true`})]}):m,t&&t.outcome!==`completed`&&(0,K.jsx)(`span`,{className:`turn-duration-outcome`,children:i(`turnElapsedOutcome_${t.outcome}`)})]}),l?u.map(e=>e.foldable?(0,K.jsx)(`div`,{className:`turn-response-body`,id:f(d.indexOf(e)),hidden:!o,children:NR(e.rows,n&&e===d.at(-1))},e.rows[0].key):(0,K.jsx)(_.Fragment,{children:NR(e.rows,!1)},e.rows[0].key)):NR(e,n)]})}function FR({id:e,rows:t,active:n,observed:r=!0,changes:i,session:a,timedTurn:o,onReviewTurn:s}){let{t:c}=cr(),l=[...t].reverse().find(e=>e.outcome||e.timing),u=l?.timing?.outcome??l?.outcome,d=t.some(e=>e.kind===`response`),f=t.find(e=>e.kind===`prompt`),p=!!(f?.promptEntryId&&t.some(e=>e.commandHandledInputId===f.promptEntryId&&e.commandHandledCommandId===f.promptCommandId)),m=t.some(e=>e.forkSnapshotBoundary),h=m?`forked`:n?r?`running`:`unknown`:u===`failed`?`failed`:u===`interrupted`||u===`cancelled`?`interrupted`:u===`completed`||d||p?`complete`:`waiting`,g=h===`failed`?`error`:h===`interrupted`?`warning`:h===`running`?`accent`:h===`complete`?`success`:`neutral`,v=c(h===`unknown`?`toolState_unknown`:`turnState_${h}`),y=t.some(e=>e.timing&&e.timing.commandId===o?.commandId&&e.timing.epoch===o?.epoch)?void 0:o,b=[],x=[],S=0,C=(e,t=!1)=>{b.push((0,K.jsx)(PR,{rows:x,timing:e,active:n&&t,timedTurn:t?y:void 0},`run-${S++}`)),x=[]};for(let e of t)e.kind===`prompt`?x.length?x.push(e):b.push((0,K.jsx)(_.Fragment,{children:e.content},e.key)):e.timing?C(e.timing):x.push(e);(x.length||y)&&C(void 0,!0);let w=!!(o||t.some(e=>e.timing));return(0,K.jsxs)(`section`,{className:`conversation-turn${e===0?` prelude`:``}`,"data-turn":e,children:[e>0&&h!==`complete`&&(!w||m)&&(0,K.jsxs)(`header`,{className:`turn-heading`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:c(`turnLabel`,{number:e})}),(0,K.jsxs)(`span`,{className:`turn-state ${h}`,children:[(0,K.jsx)(xL,{variant:g,label:v,isPulsing:h===`running`,icon:h===`failed`||h===`interrupted`?(0,K.jsx)(Lt,{"aria-hidden":`true`}):h===`forked`?(0,K.jsx)(Ae,{"aria-hidden":`true`}):void 0}),v]})]}),b,i&&a&&(0,K.jsx)(GL,{changes:i,onReview:s},`${a.id}:${a.path}:${i.promptEntryId}`)]})}function IR(e,t,n,r){let i=new Map;for(let t=0;t{if(!t)return;let r=i.get(t);if(!(r===void 0||r>=n)){for(let t=r+1;te.rows.some(e=>e.promptCommandId===n||r?.promptEntryId&&e.promptEntryId===r.promptEntryId)):void 0,l=s.length-1;for(;l>=0&&s[l].id!==0&&!s[l].rows.some(e=>e.kind===`prompt`&&!e.pendingPrompt);)l--;return{turns:s,activeTurn:c?.id??s[l]?.id}}function LR(e,t,n,r,i,a,o,s=!0){let{turns:c,activeTurn:l}=IR(e,t,n,a);return c.map(e=>(0,K.jsx)(FR,{id:e.id,rows:e.rows,active:t&&e.id===l&&!e.rows.some(e=>e.forkSnapshotBoundary),observed:s,changes:r?.get(e.rows.find(e=>e.kind===`prompt`&&!e.pendingPrompt)?.promptEntryId??``),session:i,timedTurn:t&&e.id===l&&!e.rows.some(e=>e.forkSnapshotBoundary)?a:void 0,onReviewTurn:o},`turn-group-${e.rows[0]?.key}`))}function RR(e,t,n){let r=e.getBoundingClientRect(),i=r.top,a=Array.from(e.querySelectorAll(`[data-history-entry], [data-history-message], [data-history-result]`)).filter(t=>{let n=t.getBoundingClientRect(),i=Math.max(n.top,r.top),a=Math.min(n.bottom,r.bottom);for(let n=t;n&&n!==e;n=n.parentElement){if(n.hidden||n instanceof HTMLDetailsElement&&!n.open&&n!==t&&!n.querySelector(`:scope > summary`)?.contains(t))return!1;if(n===t)continue;let e=getComputedStyle(n);if(!/^(auto|scroll|overlay|hidden|clip)$/.test(e.overflowY))continue;let r=n.getBoundingClientRect();i=Math.max(i,r.top),a=Math.min(a,r.bottom)}return a>i}),o=a.find(e=>!a.some(t=>t!==e&&e.contains(t))),s=o?.dataset.historyResult??o?.dataset.historyEntry??o?.dataset.historyMessage,c=o?.dataset.historyResult??o?.dataset.historyMessage,l=n?.entries.find(e=>e.id===c||e.id===s)?.id;if(!l&&s)for(let e of n?.entries??[])s.startsWith(`${e.id}-`)&&(!l||e.id.length>l.length)&&(l=e.id);return{key:l?s:void 0,entryId:l,offset:(o?.getBoundingClientRect().top??i)-i,scrollTop:e.scrollTop,pinned:t}}function zR(e,t){let n=!1;for(let r=e.parentElement;r&&r!==t;r=r.parentElement)if(r instanceof HTMLDetailsElement&&(r.open=!0),r.classList.contains(`turn-response-body`)&&r.hidden){let e=Array.from(t.querySelectorAll(`button[aria-controls]`)).find(e=>e.getAttribute(`aria-controls`)?.split(` `).includes(r.id));e&&(e.click(),n=!0)}return n}function BR(e,t,n){if(e.scrollIntoView?.({block:`nearest`,inline:`nearest`,behavior:`instant`}),n){t.scrollTop=n.scrollTop;for(let r=e.parentElement;r&&r!==t;r=r.parentElement)!/^(auto|scroll|overlay)$/.test(getComputedStyle(r).overflowY)||r.scrollHeight<=r.clientHeight||(r.scrollTop+=e.getBoundingClientRect().top-t.getBoundingClientRect().top-n.offset)}return Math.max(0,t.scrollTop+e.getBoundingClientRect().top-t.getBoundingClientRect().top-(n?.offset??24))}function VR(e,t){for(let n of e.composedPath()){if(n===t)return!0;if(!(n instanceof HTMLElement))continue;let e=getComputedStyle(n);if(/^(auto|scroll|overlay)$/.test(e.overflowY)&&(n.scrollTop>0||/^(contain|none)$/.test(e.overscrollBehaviorY)))return!1}return!1}function HR(e){let{t}=cr(),n=(0,_.useRef)(null),r=(0,_.useRef)(null),i=(0,_.useRef)(!0),a=(0,_.useRef)(0),o=(0,_.useRef)(void 0),s=(0,_.useRef)(0),c=(0,_.useRef)(e.readingRestorePending);c.current=e.readingRestorePending;let[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null),f=e.activityObserved!==!1&&e.resultExposureEnabled!==!1,p=(0,_.useCallback)(()=>{d.current?.abort(),d.current=null},[]),m=(0,_.useRef)(void 0),h=(0,_.useRef)(e.scrollToBottom),g=(0,_.useRef)(null),v=(0,_.useMemo)(()=>e.readingCache??new Map,[e.readingCache]),y=e.historyNavigation,b=y?JSON.stringify([y.sessionId,y.sessionPath,y.entryId,y.revision]):null,x=(0,_.useRef)(null),[S,C]=(0,_.useState)(null),T=tR(e.snapshot.selectedSession,{onAnchorChange:e.onHistoryAnchorChange,onRefresh:e.onRefreshHistory,preload:e.activityObserved!==!1&&e.resultExposureEnabled!==!1,beforePrepend:()=>{let e=n.current;e&&(g.current={...RR(e,!1,D.current),scrollHeight:e.scrollHeight},i.current=!1)}},v,y),E=T.session,D=(0,_.useRef)(E);D.current=E;let O=E?.id,k=E?.path,A=E?.cwd,j=S&&S.sessionId===O&&S.sessionPath===k?S.entryId:void 0,M=JSON.stringify([O,k]),N=JSON.stringify([e.snapshot.selectedSession?.id,e.snapshot.selectedSession?.path,e.snapshot.selectedSession?.history?.leafEntryId??e.snapshot.selectedSession?.entries.at(-1)?.id]);(0,_.useLayoutEffect)(()=>(f||p(),p),[N,b,f,p]),(0,_.useLayoutEffect)(()=>{let e=n.current;if(!e||!O||!k)return;let t=()=>{c.current||vL(v,M,{position:RR(e,i.current,D.current)})};window.addEventListener(`pagehide`,t);let r=()=>{document.visibilityState===`hidden`&&t()};return document.addEventListener(`visibilitychange`,r),()=>{window.clearTimeout(s.current),window.removeEventListener(`pagehide`,t),document.removeEventListener(`visibilitychange`,r),t()}},[M,v,O,k]);let P=(0,_.useRef)(M),[F,I]=(0,_.useState)({});(0,_.useLayoutEffect)(()=>{P.current!==M&&(P.current=M,I({}))},[M]);let L=(0,_.useMemo)(()=>new Map((E?.entries??[]).flatMap(e=>e.turnChanges&&e.turnChanges.sessionId===E?.id?[[e.turnChanges.promptEntryId,e.turnChanges]]:[])),[E?.entries,E?.id]),R=(0,_.useRef)(T.reset),ee=T.hasNewer||T.verifying,z=rj(e.snapshot,E),B=e.snapshot.selectedExecution?.sessionId===E?.id&&e.snapshot.selectedExecution?.sessionPath===E?.path?e.snapshot.selectedExecution:void 0,V=z&&e.liveActiveTurn!==void 0?e.liveRunning:z&&e.liveRunning||(B?B.status===`running`:z&&e.snapshot.runtime.status===`running`),H=!ee&&V?B?B.retry:z?e.liveRetry??void 0:void 0:void 0,te=(0,_.useRef)({scope:M,keys:new Map});te.current.scope!==M&&(te.current={scope:M,keys:new Map});let{entries:ne,projectedPrompts:re}=(0,_.useMemo)(()=>AR({...e.snapshot,selectedSession:E},ee?[]:e.liveMessages.filter(e=>e.optimistic?e.optimistic.sessionId===E?.id&&e.optimistic.sessionPath===E?.path:z),te.current.keys),[e.snapshot,E,z,ee,e.liveMessages]);(0,_.useEffect)(()=>{E&&re.length>0&&e.onPromptProjection?.(E.id,E.path,re)},[E,re,e.onPromptProjection]),(0,_.useEffect)(()=>{let e=n.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{i.current&&(typeof e.scrollTo==`function`?e.scrollTo({top:e.scrollHeight,behavior:`instant`}):e.scrollTop=e.scrollHeight,a.current=e.scrollTop)});return t.observe(e),r.current&&t.observe(r.current),()=>t.disconnect()},[]);let{rows:ie,turns:ae}=(0,_.useMemo)(()=>{let n=aj(ne.map(e=>e.message)),r=uR(ne,V&&!ee),i=[...r.finalErrors].at(-1),a=-1;for(let e=ne.length-1;e>=0;e--)if(ne[e].message.role===`assistant`){a=e;break}let o=new Map,s,c=new Map,l=new Set,u=z?e.snapshot.runtime.liveTools??[]:[],d=B?.liveTools??[],f=ee?[]:[...u,...d.filter(e=>!u.some(t=>t.call.id===e.call.id))];ne.forEach(e=>{let{message:t}=e;t.role===`toolResult`&&t.toolCallId&&c.set(t.toolCallId,e),t.parts?.forEach(e=>{e.type===`toolCall`&&e.id&&![`ask_user`,`human_handoff`].includes(e.name)&&l.add(e.id)})});let p=[],m=0,h,g=-1,_=-1;for(let e=ne.length-1;e>=0;e--){if(ne[e]?.message.role===`user`){_=e;break}if(ne[e]?.message.role===`custom`&&ne[e]?.message.customType===`openpi-setup-request`)break}let v=new Set,y=-1;ne.forEach(({message:e},t)=>{e.role===`user`||e.role===`custom`&&e.customType===`openpi-setup-request`?(y>=0&&v.add(y),y=-1):e.role===`assistant`&&e.content.trim()&&(y=t)}),y>=0&&v.add(y);let b=ne.flatMap((u,d)=>{let y=u.message;if(u.forkSnapshotBoundary)return[{key:u.key,turn:m,kind:`custom`,forkSnapshotBoundary:!0,content:null}];if(u.timing)return[{key:u.key,turn:m,kind:`custom`,timing:u.timing,content:null}];if(u.compaction)return[{key:u.key,turn:m,kind:`custom`,content:(0,K.jsx)(kL,{compaction:{state:`completed`}})}];if(y.role===`custom`){if(y.customType===`openpi-web-command-handled`){let e=y.details;return e&&typeof e==`object`&&`inputEntryId`in e&&typeof e.inputEntryId==`string`?[{key:u.key,turn:m,kind:`custom`,commandHandledInputId:e.inputEntryId,commandHandledCommandId:`commandId`in e&&typeof e.commandId==`string`?e.commandId:void 0,content:null}]:[]}return y.display===!1||![`openpi-web-command-feedback`,`openpi-setup-request`,`openpi-setup-closed`,`subagent-result`,`workflow-result`].includes(y.customType??``)?[]:(y.customType===`openpi-setup-request`&&(h=void 0,g=-1,m++),[{key:u.key,turn:m,kind:`custom`,content:(0,K.jsx)(`article`,{className:`message-row assistant detail-only`,"data-history-entry":u.entryId??u.key,tabIndex:-1,children:(0,K.jsx)(`div`,{className:`message-content`,children:(0,K.jsx)(bR,{message:y,sessionId:O??``,onInspectSubagent:e.onInspectSubagent,fullSubagent:e.snapshot.preferences.subagentResultDisplay===`full`})})})}])}if(y.role===`user`){h=y.content,g=d,m++,p.push({entryId:u.entryId??u.key,title:Array.from((y.content||t(`attachedImage`)).replace(/\s+/g,` `).trim()).slice(0,240).join(``)});let n=u.entryId?JSON.stringify([O,k,u.entryId]):``,r=F[n],i=!!(y.truncation?.visibleText&&r===void 0);return[{key:u.key,turn:m,kind:`prompt`,pendingPrompt:!!u.optimistic,promptCommandId:u.optimistic?.commandId??y.commandId,promptEntryId:u.entryId,content:(0,K.jsxs)(`article`,{className:`message-row user`,id:`turn-${m}`,"data-history-entry":u.entryId??u.key,"data-history-highlighted":j&&u.entryId===j||void 0,tabIndex:-1,children:[(0,K.jsxs)(`div`,{className:`message-content`,children:[(0,K.jsx)(JL,{message:y,sessionId:O,path:k,entryId:u.entryId}),(y.content||y.truncation?.visibleText)&&(u.entryId&&O&&k&&y.truncation?.visibleText?(0,K.jsx)(FL,{preview:y.content,sessionId:O,sessionPath:k,entryId:u.entryId,markdown:!1,fullText:r,onComplete:e=>I(t=>({...t,[n]:e}))},`${O}:${k}:${u.entryId}`):(0,K.jsx)(PL,{content:y.content}))]}),(0,K.jsx)(yR,{content:r??y.content,editable:z&&!V&&!!(e.forkAvailable&&e.onEdit&&u.entryId&&O&&k&&!u.optimistic)&&!i,copyRequiresFull:i,timestamp:u.timestamp,onResend:t=>e.onEdit&&u.entryId&&O&&k?e.onEdit({sessionId:O,sessionPath:k,entryId:u.entryId},t):Promise.resolve(!1),onFork:u.entryId&&O&&k&&e.onFork&&!u.optimistic?()=>e.onFork({sessionId:O,sessionPath:k,entryId:u.entryId}):void 0,canFork:z&&!V&&e.forkAvailable,forkPending:e.forkPending})]})}]}if(y.role===`assistant`){let b=p.at(-1);b&&y.content.trim()&&(b.reply=Array.from(y.content.replace(/\s+/g,` `).trim()).slice(0,240).join(``));let x=[],S=y.parts??[],C=y.webSearch??[],w=e=>Math.min(S.length,e.beforePartIndex??0),T=e=>{for(let[t,n]of C.entries()){if(w(n)!==e)continue;let r=n.status===`completed`?`done`:n.status===`failed`?`error`:`warn`;x.push({key:`${u.key}-native-search-${t}`,turn:m,kind:`process`,processType:`tool`,processMessageKey:u.key,processToolName:`web_search`,processPreview:n.query,processStatus:r,error:n.status===`failed`,content:(0,K.jsx)(`article`,{className:`message-row assistant detail-only`,"data-history-entry":`${u.entryId??u.key}-native-search-${t}-body`,"data-history-message":u.entryId??u.key,tabIndex:-1,children:(0,K.jsx)(`div`,{className:`message-content`,children:(0,K.jsx)(pR,{body:n.query,icon:(0,K.jsx)(je,{}),name:`web_search`,summary:n.query,status:r})})})})}},E=S.reduce((e,t,n)=>(t.type===`thinking`||t.type===`text`)&&!t.text.trim()?e:n,-1),D=S.reduce((e,t,n)=>t.type===`text`?n:e,-1),M=!!(u.entryId&&O&&k&&y.truncation?.visibleText),N=y.content,P=u.entryId?JSON.stringify([O,k,u.entryId]):``,L=F[P],R=!!(y.truncation?.visibleText&&L===void 0),te=(t,n,r)=>{M&&!r||!M&&!t.trim()||x.push({key:n,turn:m,kind:`response`,responseEntryId:u.entryId,final:r&&(y.stopReason===`stop`||y.stopReason===`length`),content:(0,K.jsxs)(`article`,{className:`message-row assistant response${r&&v.has(d)?` final-response`:``}`,"data-history-message":u.entryId??u.key,"data-history-highlighted":j&&u.entryId===j||void 0,tabIndex:-1,"data-history-entry":u.entryId?`${u.entryId}-${n.slice(u.key.length+1)}`:n,children:[(0,K.jsx)(`div`,{className:`message-content`,children:M&&O&&k&&u.entryId?(0,K.jsx)(FL,{preview:N,sessionId:O,sessionPath:k,entryId:u.entryId,markdown:!0,fullText:L,onComplete:e=>I(t=>({...t,[P]:e}))},`${O}:${k}:${u.entryId}`):(0,K.jsx)(Sk,{children:t})}),r&&v.has(d)&&(0,K.jsx)(yR,{content:L??y.content,editable:!1,copyRequiresFull:R,timestamp:u.timestamp,onResend:e.onResend,onRegenerate:b?.entryId&&O&&k&&e.onRegenerate&&!u.optimistic&&!y.isError&&(y.stopReason===`stop`||y.stopReason===`length`)?()=>e.onRegenerate({sessionId:O,sessionPath:k,entryId:b.entryId}):void 0,onFork:u.entryId&&O&&k&&e.onFork?()=>e.onFork({sessionId:O,sessionPath:k,entryId:u.entryId}):void 0,canFork:z&&!V&&e.forkAvailable,forkPending:e.forkPending})]})})};y.parts?.forEach((r,i)=>{if(T(i),r.type===`text`&&(S[i-1]?.type!==`text`||C.some(e=>w(e)===i))){let e=r.text,t=i+1;for(;S[t]?.type===`text`&&!C.some(e=>w(e)===t);){let n=S[t];n?.type===`text`&&(e+=n.text),t++}te(e,`${u.key}-text-${i}`,t>D)}if(r.type===`thinking`&&r.text.trim()){let t=!ee&&!H&&!y.stopReason&&B?.compaction?.state!==`running`&&V&&d===ne.length-1&&i===E?e.activityObserved===!1?`unknown`:`running`:`done`;x.push({key:`${u.key}-thinking-${i}`,turn:m,kind:`process`,processType:`thinking`,processMessageKey:u.key,processPreview:fR(r.text),processStatus:t,content:(0,K.jsx)(`article`,{className:`message-row assistant detail-only`,"data-history-entry":`${u.entryId??u.key}-thinking-${i}-body`,"data-history-message":u.entryId??u.key,"data-history-highlighted":j&&u.entryId===j||void 0,tabIndex:-1,children:(0,K.jsx)(`div`,{className:`message-content`,children:(0,K.jsx)(vR,{body:r.text,truncated:r.textTruncated,source:u.entryId&&O&&k&&r.sourcePartIndex!==void 0?{sessionId:O,sessionPath:k,entryId:u.entryId,partIndex:r.sourcePartIndex}:void 0,status:t,level:t===`running`?e.snapshot.thinking?.level:void 0,duration:kR(u,e.thinkingDurations),defaultOpen:e.snapshot.preferences.expandThinking===!0},JSON.stringify([O,k,u.key,i]))})})})}if(r.type===`toolCall`){let a=r,o=f.find(e=>e.call.id===a.id),s=a.id?c.get(a.id):void 0,d=s?.message??o?.result,p=AL(a,d,f,s?void 0:o?.state),h=p?[...p.children.map(e=>({call:e.call,child:e})),...p.showWrapper?[{call:a}]:[]]:[{call:a}];for(let[r,{call:o,child:g}]of h.entries()){let _=o.name.startsWith(`subagent`)?e.snapshot.preferences.subagentResultDisplay===`full`:o.name===`bash`?e.snapshot.preferences.bashToolDisplay===`full`:o.name===`write`||o.name===`edit`?e.snapshot.preferences.fileMutationDisplay===`full`:!1,v=o.id?f.find(e=>e.call.id===o.id):void 0,y=g?s:o.id?c.get(o.id):void 0,b=g?void 0:y?.message,S=g?g.result:b??v?.result,C=g?g.state:b?void 0:v?.state,w=g?g.state===`returned`?`done`:g.state===`failed`?`error`:g.state===`cancelled`||g.state===`timed_out`?`warn`:g.state:aR(S,C),T=e.activityObserved===!1&&w===`running`?`unknown`:w,E=o.name===`plan_ready`&&S&&IL(S)?(0,K.jsx)(LL,{result:S,sessionId:O,sessionPath:k,entryId:y?.entryId},`${u.key}-${o.id||i}-plan`):Ld(o.name)&&!g?.outputMissing?(0,K.jsx)(WL,{call:o,result:S,liveState:C,observed:e.activityObserved,cwd:A,defaultOpen:_},`${u.key}-${o.id||i}-evidence`):g?.outputMissing?null:hR(o,S,{sessionId:O??``,subagents:z?e.snapshot.runtime.capabilities.subagents?.items:void 0,workflows:z?e.snapshot.runtime.capabilities.workflows?.items:void 0,records:n,onInspectSubagent:e.onInspectSubagent,liveState:C,defaultOpen:_,observed:e.activityObserved!==!1}),D=rR(o.arguments),{Icon:M,action:N}=$I(o.name),P=(0,K.jsx)(M,{},`${u.key}-${o.id||i}-icon`);x.push({key:`${u.key}-tool-${o.id||i}`,turn:m,kind:o.name===`plan_ready`&&S&&IL(S)?`response`:E&&(o.name===`subagent_spawn`||o.name===`workflow`)?`custom`:`process`,processType:/^(subagent|workflow)/u.test(o.name)?`activity`:`tool`,processMessageKey:u.key,processToolName:o.name,processPreview:nL(o.name,D).split(` -`).find(Boolean),processStatus:T,error:T===`error`,content:(0,K.jsx)(`article`,{className:`message-row assistant detail-only`,"data-history-message":u.entryId??u.key,"data-history-result":y?.entryId,"data-history-highlighted":j&&(u.entryId===j||y?.entryId===j)||void 0,tabIndex:-1,children:(0,K.jsxs)(`div`,{className:`message-content`,children:[E||(0,K.jsx)(pR,{body:o.name===`bash`&&typeof D.command==`string`?D.command:o.arguments,icon:P,name:o.name||`tool`,summary:N===`search`&&typeof D.path==`string`?t(`toolSearchTarget`,{path:D.path,pattern:dR(o.name,D)}):dR(o.name,D),output:g?g.error??S?.content:o.id&&l.has(o.id)?S?.content:void 0,status:T,evidenceState:e.activityObserved===!1&&g?.state===`running`?`unknown`:g?.state,rawDetails:p?.showWrapper&&o.id===a.id?d?.details:void 0,note:g?.outputMissing?t(g.argumentsOmitted?`toolNestedArgumentsMissing`:`toolNestedOutputMissing`):void 0,snapshotMissingResult:S?.forkSnapshotToolResult,defaultOpen:_}),p?.incomplete&&r===h.length-1&&(0,K.jsx)(`p`,{className:`evidence-note`,role:`status`,children:t(`toolNestedIncomplete`)}),p&&r===h.length-1&&!p.showWrapper&&(0,K.jsxs)(`details`,{className:`evidence-raw`,children:[(0,K.jsx)(`summary`,{children:t(`toolCodemodeDetails`)}),(0,K.jsx)(`pre`,{children:Fd(a.arguments).text}),(0,K.jsx)(`pre`,{children:Fd(d?.content??``).text})]})]})})})}}}),T(S.length),D<0&&te(y.content,`${u.key}-answer`,!0),y.stopReason===`error`&&!r.finalErrors.has(d)&&(o.set(u.key,[...x]),x.length=0);let re=r.groups.get(d);if(re&&(re.state===`retrying`&&H&&(s=`${re.attempts[0].key}-attempts`),x.push({key:`${re.attempts[0].key}-attempts`,turn:m,kind:`outcome`,outcome:re.state===`interrupted`?`interrupted`:void 0,content:(0,K.jsx)(`article`,{className:`message-row assistant outcome-row`,children:(0,K.jsx)(lR,{state:re.state,retry:re.state===`retrying`?H:void 0,observed:e.activityObserved!==!1&&B?.status!==`unknown`,attempts:re.attempts.map(e=>({entry:e,content:o.get(e.key)}))})})})),r.finalErrors.has(d)||y.stopReason===`aborted`){let t=y.stopReason===`error`,n=g===_&&d===i&&d===a?h:void 0;x.push({key:`${u.key}-outcome`,turn:m,kind:`outcome`,error:t,outcome:t?`failed`:`interrupted`,content:(0,K.jsx)(`article`,{className:`message-row assistant outcome-row`,children:(0,K.jsx)(cR,{failed:t,error:y.errorMessage,retryPrompt:n,retryEntryId:u.entryId,canRetry:z&&!ee&&!V,onRetry:e.onResend})})})}else(y.stopReason===`stop`||y.stopReason===`length`)&&x.push({key:`${u.key}-completed`,turn:m,kind:`outcome`,outcome:`completed`,content:null});return x}if(y.role===`toolResult`){if(y.toolCallId&&l.has(y.toolCallId))return[];if(IL(y))return[{key:u.key,turn:m,kind:`response`,content:(0,K.jsx)(`article`,{className:`message-row assistant detail-only`,"data-history-message":u.entryId??u.key,"data-history-highlighted":j&&u.entryId===j||void 0,tabIndex:-1,children:(0,K.jsx)(`div`,{className:`message-content`,children:(0,K.jsx)(LL,{result:y,sessionId:O,sessionPath:k,entryId:u.entryId})})})}];let n=y.toolName?.startsWith(`subagent`)?`subagent`:y.toolName?.startsWith(`workflow`)?`workflow`:null,r=aR(y),i=e.activityObserved===!1&&r===`running`?`unknown`:r,a=y.toolName||`tool`,o=n===`subagent`?e.snapshot.preferences.subagentResultDisplay===`full`:a===`bash`?e.snapshot.preferences.bashToolDisplay===`full`:a===`write`||a===`edit`?e.snapshot.preferences.fileMutationDisplay===`full`:!1,{Icon:s}=$I(a),c=(0,K.jsx)(s,{},`${u.key}-icon`),d=n&&!y.forkSnapshotToolResult?(0,K.jsx)(mR,{family:n,title:`${a.replaceAll(`_`,` `)} · ${ej(y.content)}`,body:y.content,status:i,defaultOpen:o},`${u.key}-card`):xR(y.content)&&!y.forkSnapshotToolResult?(0,K.jsxs)(`div`,{className:`tool-line-empty`,children:[(0,K.jsx)(`span`,{className:`tool-icon`,children:c}),(0,K.jsx)(`span`,{className:`tool-name`,children:a}),(0,K.jsx)(`span`,{className:`tool-summary`,children:t(`noOutput`)}),(0,K.jsx)(oR,{status:i})]},`${u.key}-empty`):(0,K.jsx)(pR,{body:y.content,icon:c,name:a,summary:ej(y.content),status:i,snapshotMissingResult:y.forkSnapshotToolResult,defaultOpen:o},`${u.key}-evidence`);return[{key:u.key,turn:m,kind:a===`ask_user`||a===`human_handoff`?`response`:`process`,processType:n?`activity`:`tool`,processToolName:a,processStatus:i,error:i===`error`,content:(0,K.jsx)(`article`,{className:`message-row assistant detail-only`,"data-history-entry":`${u.entryId??u.key}-body`,"data-history-message":u.entryId??u.key,"data-history-highlighted":j&&u.entryId===j||void 0,tabIndex:-1,children:(0,K.jsx)(`div`,{className:`message-content`,children:d})})}]}return[]}),x=b.length;for(;x>0&&b[x-1].pendingPrompt;)x--;let S=b.length-x,C=b[x-1]?.turn??0;H&&!s&&(s=`native-retry`,b.splice(x,0,{key:`native-retry`,turn:C,kind:`outcome`,content:(0,K.jsx)(`article`,{className:`message-row assistant outcome-row`,children:(0,K.jsx)(lR,{attempts:[],state:`retrying`,retry:H,observed:e.activityObserved!==!1&&B?.status!==`unknown`})})}));let w=!ee&&B?.compaction;if(w&&w.state!==`completed`){let n=b.findIndex(e=>e.key===s),r={key:`native-compaction-${w.startedAt??w.state}`,turn:b[n]?.turn??C,kind:`custom`,content:(0,K.jsx)(kL,{compaction:w,observed:e.activityObserved!==!1&&B?.status!==`unknown`})};b.splice(n<0?x:n,0,r),w.state===`failed`&&w.errorMessage&&b.splice(b.length-S,0,{key:`native-compaction-error`,turn:r.turn,kind:`custom`,content:(0,K.jsx)(`article`,{className:`message-row assistant outcome-row`,children:(0,K.jsx)(sR,{label:t(`compactionFailed`),message:w.errorMessage})})})}return{rows:b,turns:p}},[z,V,B,H,e.activityObserved,ee,ne,e.onResend,e.onEdit,e.onRegenerate,e.onFork,e.forkAvailable,e.forkPending,e.onInspectSubagent,e.snapshot.runtime.capabilities.subagents,e.snapshot.runtime.capabilities.workflows?.items,e.snapshot.preferences.expandThinking,e.snapshot.preferences.subagentResultDisplay,e.snapshot.preferences.bashToolDisplay,e.snapshot.preferences.fileMutationDisplay,e.snapshot.thinking?.level,e.thinkingDurations,e.snapshot.runtime.liveTools,O,k,A,F,j,t]),U=YL(e.snapshot.selectedSession,ae,f),oe=(0,_.useCallback)(async(t,r=!1)=>{if(p(),!f||!O||!k)return!1;let o=n.current,s=Array.from(o?.querySelectorAll(`[data-history-entry]`)??[]).find(e=>e.dataset.historyEntry===t);if(o&&s){i.current=!1,u(!0),C({sessionId:O,sessionPath:k,entryId:t});let e=Math.max(0,o.scrollTop+s.getBoundingClientRect().top-o.getBoundingClientRect().top-16),n=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;return o.scrollTo?.({top:e,behavior:r||n?`instant`:`smooth`}),typeof o.scrollTo!=`function`&&(o.scrollTop=e),a.current=o.scrollTop,s.focus({preventScroll:!0}),!0}if(r)return;if(!e.onNavigateToMessage)return!1;let c=new AbortController;d.current=c;let l=await e.onNavigateToMessage({sessionId:O,sessionPath:k,entryId:t},c.signal);if(!(c.signal.aborted||d.current!==c))return d.current=null,l},[p,f,O,k,e.onNavigateToMessage]);(0,_.useLayoutEffect)(()=>{let t=n.current;if(!t||!E)return;let r=_L(E),o=m.current!==r,s=R.current!==T.reset,l=o||s;R.current=T.reset;let d=h.current!==e.scrollToBottom;if(h.current=e.scrollToBottom,y&&b!==x.current&&y.sessionId===E.id&&y.sessionPath===E.path){i.current=!1,g.current=null,m.current=r;return}if(d&&T.engaged){g.current=null,T.resetToLatest();return}let f=o&&!s&&!d?v.get(r)?.position:void 0,p=f?.key&&Array.from(t.querySelectorAll(`[data-history-entry], [data-history-message], [data-history-result]`)).some(e=>e.dataset.historyEntry===f.key||e.dataset.historyMessage===f.key||e.dataset.historyResult===f.key),_=g.current??(f&&!f.pinned&&(!c.current||p)?{...f,scrollHeight:t.scrollHeight}:null);if(g.current=null,_&&(!l||f)&&!d){let e=Array.from(t.querySelectorAll(`[data-history-entry], [data-history-message], [data-history-result]`)),n=_.key===void 0?void 0:e.find(e=>e.dataset.historyEntry===_.key)??e.reverse().find(e=>e.dataset.historyMessage===_.key||e.dataset.historyResult===_.key);i.current=!1,u(!0),m.current=r;let o=()=>{if(n&&!t.contains(n))return;g.current===_&&(g.current=null);let e=n?BR(n,t,_):_.scrollTop+t.scrollHeight-_.scrollHeight;typeof t.scrollTo==`function`?t.scrollTo({top:e,behavior:`instant`}):t.scrollTop=e,a.current=t.scrollTop};if(n&&zR(n,t)){g.current=_;let e=requestAnimationFrame(o);return()=>cancelAnimationFrame(e)}o();return}(l||d||i.current)&&(i.current=!0,u(!1),typeof t.scrollTo==`function`?t.scrollTo({top:t.scrollHeight,behavior:`instant`}):t.scrollTop=t.scrollHeight,a.current=t.scrollTop),m.current=r},[E,ne,T.reset,T.engaged,T.resetToLatest,e.scrollToBottom,v,y,b]),(0,_.useLayoutEffect)(()=>{let e=n.current;if(!e||!E||!y||b===x.current||y.sessionId!==E.id||y.sessionPath!==E.path)return;let t=Array.from(e.querySelectorAll(`[data-history-entry], [data-history-message], [data-history-result]`)),r=t.filter(e=>e.dataset.historyEntry===y.entryId||e.dataset.historyMessage===y.entryId||e.dataset.historyResult===y.entryId),o=y.restorePosition?.key?t.find(e=>e.dataset.historyEntry===y.restorePosition.key)??[...t].reverse().find(e=>e.dataset.historyMessage===y.restorePosition.key||e.dataset.historyResult===y.restorePosition.key):void 0,s=o??r.find(e=>e.classList.contains(`response`))??r.find(e=>e.dataset.historyMessage===y.entryId||e.dataset.historyResult===y.entryId)??r[0];if(!s)return;zR(s,e);let c=()=>{if(!e.contains(s)||y.restorePosition&&x.current===b)return;let t=BR(s,e,o?y.restorePosition:void 0);e.scrollTo?.({top:t,behavior:`instant`}),typeof e.scrollTo!=`function`&&(e.scrollTop=t),a.current=e.scrollTop,y.restorePosition||s.focus({preventScroll:!0}),i.current=!1,u(!0),y.restorePosition||C(y),x.current=b,vL(v,_L(E),{position:RR(e,!1,E)})},l=document.querySelector(`dialog[open]`),d,f=()=>{d=requestAnimationFrame(c)};return l?l.addEventListener(`close`,f,{once:!0}):f(),()=>{l?.removeEventListener(`close`,f),d!==void 0&&cancelAnimationFrame(d)}},[E,y,b,v]);let se=z?e.liveRetry?`${t(`modelRetrying`)} (${e.liveRetry.attempt}/${e.liveRetry.maxAttempts})`:e.livePhase===`preparing`?t(`modelPreparing`):t(`modelRunning`):t(`backgroundSessionRunning`),ce=z?0:B?.liveTools.filter(e=>e.state===`running`).length??0,le=z&&e.liveActiveTurn!==void 0?e.liveActiveTurn:B?B.activeTurn:z?e.snapshot.runtime.activeTurn:void 0,ue=V&&le&&E&&le.sessionId===E.id&&le.sessionPath===E?.path&&typeof le.startedAt==`number`&&Number.isFinite(le.startedAt)&&typeof le.elapsedMs==`number`&&Number.isFinite(le.elapsedMs)&&le.elapsedMs>=0?le:void 0,de=!T.verifying&&ue&&(!ee||ue.promptEntryId&&ie.some(e=>e.promptEntryId===ue.promptEntryId))?ue:void 0,fe=t=>{T.hasMore&&!T.error&&!T.verifying&&e.activityObserved!==!1&&e.resultExposureEnabled!==!1&&t.scrollTop<=Math.max(t.clientHeight,160)&&T.loadOlder()},pe=()=>{i.current=!1,u(!0),T.retainReading()};return(0,K.jsxs)(`div`,{className:`transcript-surface`,children:[(0,K.jsx)(`div`,{ref:n,className:`conversation`,role:`log`,"aria-label":`Conversation`,tabIndex:0,onPointerDownCapture:()=>{y?.restorePosition&&(x.current=b)},onTouchStartCapture:e=>{o.current=e.touches[0]?.clientY,y?.restorePosition&&(x.current=b)},onTouchMove:e=>{let t=e.touches[0]?.clientY;t!==void 0&&o.current!==void 0&&t>o.current&&VR(e.nativeEvent,e.currentTarget)&&pe(),o.current=t},onScroll:e=>{let t=e.currentTarget,n=t.scrollTopa.current;a.current=t.scrollTop;let o=t.scrollTop+t.clientHeight>=t.scrollHeight-48;i.current=i.current?!n||o:r&&o,i.current||T.retainReading(),u(!i.current),window.clearTimeout(s.current),s.current=window.setTimeout(()=>{!c.current&&O&&k&&t.isConnected&&vL(v,M,{position:RR(t,i.current,D.current)})},200),n&&fe(t)},onWheel:e=>{y?.restorePosition&&(x.current=b),!e.defaultPrevented&&!e.ctrlKey&&!e.metaKey&&e.deltaY<0&&VR(e.nativeEvent,e.currentTarget)&&(pe(),fe(e.currentTarget))},onKeyDown:e=>{y?.restorePosition&&[`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(e.key)&&(x.current=b);let t=e.target;!e.defaultPrevented&&!e.altKey&&!e.metaKey&&(!e.ctrlKey||e.key===`Home`)&&([`ArrowUp`,`PageUp`,`Home`].includes(e.key)||e.key===` `&&e.shiftKey)&&t instanceof HTMLElement&&!t.isContentEditable&&!t.closest(`input, textarea, select`)&&!(e.key===` `&&t.closest(`button, summary`))&&VR(e.nativeEvent,e.currentTarget)&&(pe(),fe(e.currentTarget))},children:(0,K.jsxs)(`div`,{ref:r,className:`conversation-content`,children:[E?.rerun&&e.onOpenOriginal&&(0,K.jsxs)(`div`,{className:`message-branch-origin`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>void e.onOpenOriginal(E.rerun.source),children:[(0,K.jsx)(Ae,{"aria-hidden":`true`}),` `,t(`openOriginalConversation`)]}),(0,K.jsx)(`span`,{children:t(`messageRerunWorkspaceHint`)})]}),(T.hasMore||T.error||T.verifying)&&(0,K.jsxs)(`div`,{className:`conversation-history`,children:[T.error&&(0,K.jsx)(`p`,{role:`alert`,children:t(T.error)}),T.error&&T.error!==`historyChanged`&&(0,K.jsx)(`button`,{type:`button`,className:`secondary`,disabled:T.loading,onClick:()=>void T.loadOlder(),children:t(`retryAdmissionCheck`)}),T.loading&&(0,K.jsx)(`p`,{role:`status`,children:t(`historyLoading`)}),T.verifying&&!T.error&&!T.loading&&(0,K.jsx)(`p`,{role:`status`,children:t(`historyVerifying`)}),T.hasMore&&(0,K.jsx)(`span`,{children:t(`historyOmitted`,{count:E?.truncation.entriesOmitted??0})})]}),LR(ie,V&&(!ee||!!de)&&B?.compaction?.state!==`running`,le?.commandId,L,E,e.activityObserved===!1?void 0:de,e.onReviewTurn,e.activityObserved!==!1),V&&e.activityObserved!==!1&&B?.compaction?.state!==`running`&&(0,K.jsxs)(`div`,{className:`conversation-execution-status sr-only`,role:`status`,"aria-live":`polite`,children:[(0,K.jsx)(`span`,{children:se}),ce>0&&(0,K.jsx)(`span`,{children:t(`observedSessionTools`,{count:ce})}),(B?.pendingFollowUps??0)>0&&(0,K.jsx)(`span`,{children:t(`pendingFollowUpsHint`,{count:B.pendingFollowUps})})]})]})}),(l||T.hasNewer)&&ie.length>0&&(0,K.jsx)(`button`,{className:`jump-to-latest`,type:`button`,"aria-label":t(`jumpToLatest`),title:t(`jumpToLatest`),onClick:()=>{let e=n.current;e&&(i.current=!0,u(!1),C(null),T.resetToLatest(),e.scrollTo({top:e.scrollHeight,behavior:`smooth`}),queueMicrotask(()=>{n.current===e&&(Array.from(e.querySelectorAll(`.message-row[tabindex="-1"]`)).reverse().find(e=>!e.closest(`[hidden], details:not([open])`))??e).focus({preventScroll:!0})}))},children:V&&e.activityObserved!==!1?(0,K.jsxs)(`span`,{className:`latest-activity-dots`,"aria-hidden":`true`,children:[(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{})]}):(0,K.jsx)(w,{"aria-hidden":`true`})}),(0,K.jsx)(qL,{items:U.items,viewport:n,enabled:f,onHidden:p,onRequestPreview:U.requestPreview,readingHistory:l||T.hasNewer,onNavigate:oe},N)]})}function UR(){(0,_.useEffect)(()=>{let e=new rf,t=new AbortController,n,r=async r=>{let i=r.data;if(!(r.source!==window||r.origin!==location.origin||i?.source!==`openpi-browser-extension`||i.type!==`connector-hello`||typeof i.bridgeId!=`string`||!/^[\da-f-]{36}$/.test(i.bridgeId)||!tF(i.browser)||n===i.bridgeId)){n=i.bridgeId;try{let r=await e.request(`/api/browser/connections`,{method:`POST`,signal:t.signal,body:JSON.stringify({browser:i.browser,profileId:i.profileId,extensionId:i.extensionId,extensionOrigin:i.extensionOrigin,version:i.version})});!t.signal.aborted&&n===i.bridgeId&&window.postMessage({source:`openpi-browser-ui`,type:`connector-authorize`,...r},location.origin)}catch{n===i.bridgeId&&(n=void 0)}}},i=()=>window.postMessage({source:`openpi-browser-ui`,type:`connector-probe`},location.origin);window.addEventListener(`message`,r),i();let a=setInterval(i,5e3);return()=>{t.abort(),clearInterval(a),window.removeEventListener(`message`,r)}},[])}function WR(e,t){let n=e.trim();if(!n||n.length>16384)return null;let r=/^[a-z][a-z\d+.-]*:\/\//iu.test(n);try{let e=new URL(r?n:`https://${n}`);return!r&&(e.hostname===`localhost`||e.hostname.endsWith(`.localhost`)||e.hostname===`[::1]`||/^127(?:\.\d{1,3}){3}$/u.test(e.hostname))&&(e=new URL(`http://${n}`)),![`http:`,`https:`].includes(e.protocol)||e.username||e.password||e.origin===t?null:e.href}catch{return null}}function GR(){return document.documentElement.dataset.openpiBrowserExtension===`ready`?[...document.querySelectorAll(`iframe[data-openpi-browser-document]`)].map(e=>({id:e.dataset.openpiBrowserPage,document:e.dataset.openpiBrowserDocument,url:e.dataset.openpiBrowserUrl,title:e.dataset.openpiBrowserTitle||``})):[]}function KR(e,t,n){let r=(0,_.useRef)(n),i=(0,_.useRef)(0);r.current=n,(0,_.useEffect)(()=>{if(!e||!t)return;let n=new rf,a=new AbortController,o,s,c,l=e=>window.postMessage({source:`openpi-browser-ui`,...e},location.origin),u=()=>{c?.(),c=void 0,s&&l({type:`control-cancel`,requestId:s}),s=void 0},d=(r,i,o)=>{r===s&&(c?.(),c=void 0,s=void 0,n.request(`/api/browser/control`,{method:`POST`,signal:a.signal,body:JSON.stringify({sessionId:e,sessionPath:t,requestId:r,result:i,error:o,pages:GR()})}).catch(()=>{}))},f=e=>{let t=e.data;e.source===window&&e.origin===location.origin&&t?.source===`openpi-browser-extension`&&(t.type===`connector-hello`?i.current=Date.now():t.type===`control-result`&&d(t.requestId,t.result,t.error))},p=async(e,t)=>{let n=WR(t||``,location.origin);if(!n){d(e,void 0,`Invalid internal browser URL.`);return}let i=new AbortController;c=()=>i.abort();let o=await r.current(n,AbortSignal.any([a.signal,i.signal]));if(a.signal.aborted||s!==e)return;if(!o){d(e,void 0,`The internal browser has reached its page limit.`);return}let l=()=>{let t=document.getElementById(o)?.querySelector(`iframe[data-openpi-browser-document]`),n=t&&GR().find(e=>e.id===t.dataset.openpiBrowserPage);n&&d(e,{root:n.id})},u=new MutationObserver(l);u.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-openpi-browser-document`]});let f=setTimeout(()=>d(e,void 0,`The internal page did not bind. Inspect the browser's loading or embedding error.`),1e4);c=()=>{i.abort(),u.disconnect(),clearTimeout(f)},l()},m=async()=>{if(Date.now()-i.current>15e3&&document.documentElement.dataset.openpiBrowserExtension!==`ready`){u(),a.signal.aborted||(o=setTimeout(()=>void m(),1e3));return}try{let{pending:r}=await n.request(`/api/browser/control`,{method:`POST`,signal:a.signal,body:JSON.stringify({sessionId:e,sessionPath:t,pages:GR()})});s&&s!==r?.requestId&&u(),r&&!r.running&&r.request&&!s&&(s=r.requestId,r.request.operation===`open`?p(r.requestId,r.request.url).catch(()=>d(r.requestId,void 0,`The embedded browser could not open.`)):r.page?l({type:`control`,id:r.page.id,document:r.page.document,requestId:r.requestId,request:r.request}):d(r.requestId,void 0,`The embedded page is unavailable.`))}catch{u()}a.signal.aborted||(o=setTimeout(()=>void m(),250))};return window.addEventListener(`message`,f),m(),()=>{clearTimeout(o),a.abort(),u(),window.removeEventListener(`message`,f)}},[e,t])}function qR({usage:e,workspace:t,sessionId:n}){let{t:r,i18n:i}=cr(),[a,o]=(0,_.useState)(!1);if(!e)return null;let s=e.context,c=e=>new Intl.NumberFormat(i.resolvedLanguage).format(e),l=e=>new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:0}).format(e).toLowerCase(),u=s?.percent==null?r(`usageUnknown`):`${Math.round(s.percent)}%`,d=s?.percent==null?r(`usageUnknown`):`${new Intl.NumberFormat(i.resolvedLanguage,{maximumFractionDigits:1}).format(s.percent)}%`,f=s?l(s.contextWindow):r(`usageUnknown`);return(0,K.jsx)(`div`,{className:`session-usage`,children:(0,K.jsx)(gd,{isOpen:a,onOpenChange:o,placement:`below`,alignment:`end`,width:`min(360px, calc(100vw - 24px))`,label:r(`sessionUsage`),isModal:!1,hasCloseButton:!1,content:(0,K.jsxs)(`div`,{className:`session-usage-details`,children:[(0,K.jsxs)(`div`,{className:`usage-details-heading`,children:[(0,K.jsx)(`h2`,{children:r(`sessionOverview`)}),(0,K.jsx)(`button`,{className:`icon-button`,type:`button`,"aria-label":r(`close`),onClick:()=>o(!1),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]}),(0,K.jsxs)(`section`,{className:`usage-section`,children:[(0,K.jsxs)(`div`,{className:`usage-context-heading`,children:[(0,K.jsx)(`h3`,{children:r(`usageContextLabel`)}),(0,K.jsx)(`span`,{children:d})]}),(0,K.jsxs)(`p`,{className:`usage-context-value`,children:[(0,K.jsx)(`strong`,{children:s?.tokens==null?r(`usageUnknown`):c(s.tokens)}),s&&(0,K.jsxs)(`span`,{children:[` / `,c(s.contextWindow),` tokens`]})]}),s?.percent!=null&&(0,K.jsx)(`progress`,{value:Math.max(0,Math.min(100,s.percent)),max:100,"aria-label":r(`sessionContextUsage`)}),(0,K.jsx)(`p`,{className:`usage-help`,children:r(`usageContextHelp`)})]}),(0,K.jsxs)(`section`,{className:`usage-section`,children:[(0,K.jsx)(`h3`,{children:r(`usageSessionTotals`)}),(0,K.jsxs)(`dl`,{className:`usage-metrics`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:r(`usageInputLabel`)}),(0,K.jsx)(`dd`,{children:c(e.input)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:r(`usageOutputLabel`)}),(0,K.jsx)(`dd`,{children:c(e.output)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:r(`usageTotalLabel`)}),(0,K.jsx)(`dd`,{children:c(e.total)})]})]}),(0,K.jsx)(`p`,{className:`usage-help`,children:r(`usageTotalsHelp`)})]}),t&&(0,K.jsxs)(`dl`,{className:`usage-workspace`,children:[(0,K.jsx)(`dt`,{children:r(`usageWorkspaceLabel`)}),(0,K.jsx)(`dd`,{children:t})]}),n&&(0,K.jsxs)(`details`,{className:`usage-identity`,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(`span`,{children:r(`usageSessionId`)}),(0,K.jsx)(L,{"aria-hidden":`true`})]}),(0,K.jsx)(`code`,{children:n})]})]}),children:t=>(0,K.jsxs)(`button`,{...t,className:`session-usage-trigger`,type:`button`,"aria-label":r(`usageOpenDetails`,{input:l(e.input),output:l(e.output),percent:u,capacity:f}),children:[(0,K.jsxs)(`span`,{className:`usage-stat`,title:`${r(`sessionInputTokens`)}: ${c(e.input)}`,children:[(0,K.jsx)(k,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:l(e.input)})]}),(0,K.jsxs)(`span`,{className:`usage-stat`,title:`${r(`sessionOutputTokens`)}: ${c(e.output)}`,children:[(0,K.jsx)(w,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:l(e.output)})]}),(0,K.jsxs)(`span`,{className:`usage-stat`,title:`${r(`sessionContextUsage`)}: ${d}`,children:[(0,K.jsx)(ke,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[u,s&&(0,K.jsxs)(`span`,{className:`usage-capacity`,children:[` / `,f]})]})]})]})})})}function JR(e,t){return new Promise((n,r)=>{let i=new FileReader,a=e=>{t.removeEventListener(`abort`,o),e?r(e):typeof i.result==`string`?n(i.result.slice(i.result.indexOf(`,`)+1)):r(Error(`File read failed`))},o=()=>{i.abort(),a(new DOMException(`File read cancelled`,`AbortError`))};i.onload=()=>a(),i.onerror=()=>a(Error(`File read failed`)),t.addEventListener(`abort`,o,{once:!0}),t.aborted?o():i.readAsDataURL(e)})}function YR({name:e,kind:t=`file`,expanded:n=!1}){let r=t===`directory`?`folder`:t===`symlink`?`link`:/\.(?:md|markdown)$/iu.test(e)?`markdown`:/\.(?:csv|tsv|xlsx?)$/iu.test(e)?`sheet`:/\.(?:png|jpe?g|gif|webp|svg|bmp|ico)$/iu.test(e)?`image`:/\.(?:pdf|docx?|pptx?)$/iu.test(e)?`document`:/\.(?:[cm]?[jt]sx?|json|html?|css|py|rs|go|sh|ya?ml|toml|xml)$/iu.test(e)?`code`:`file`;return(0,K.jsx)(r===`folder`?n?G:De:r===`link`?Re:r===`sheet`?yt:r===`image`?be:r===`markdown`||r===`document`?Se:r===`code`?ve:Ce,{className:`file-icon file-icon-${r}`,"aria-hidden":`true`})}function XR({sessionId:e,sessionPath:t,cwd:n,canWrite:r,active:i,selected:a,onSelect:o,dropTarget:s,onShowTree:c,onRemoved:l}){let{t:u}=cr(),d=(0,_.useContext)(fk),f=wk(),p=(0,_.useMemo)(()=>new rf,[]),[m,h]=(0,_.useState)(f?.files?.query??``),[g,v]=(0,_.useState)(f?.files?.expanded??[`.`]),[y,b]=(0,_.useState)({}),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(!1),[D,O]=(0,_.useState)(0),[k,A]=(0,_.useState)(a.includes(`/`)?a.slice(0,a.lastIndexOf(`/`)):`.`),[j,M]=(0,_.useState)(null),[N,P]=(0,_.useState)(``),[F,I]=(0,_.useState)(null),[R,z]=(0,_.useState)(!1),[B,V]=(0,_.useState)(!1),[H,te]=(0,_.useState)([]),[ne,re]=(0,_.useState)(!1),[ie,ae]=(0,_.useState)([]),[U,oe]=(0,_.useState)(null),[se,ce]=(0,_.useState)(`.`),[le,ue]=(0,_.useState)(``),[de,fe]=(0,_.useState)([]),[pe,me]=(0,_.useState)(!1),[he,ge]=(0,_.useState)([]),[_e,ve]=(0,_.useState)(0),[ye,be]=(0,_.useState)(!1),[Se,Ce]=(0,_.useState)(),we=(0,_.useRef)(0),[G,De]=(0,_.useState)([]),[Oe,ke]=(0,_.useState)(!1),[Ae,je]=(0,_.useState)(``),Me=(0,_.useRef)(null),Ne=(0,_.useRef)(null),Pe=(0,_.useRef)(null),Fe=(0,_.useRef)(null),Ie=(0,_.useRef)(null),Le=(0,_.useRef)(!1),Re=(0,_.useRef)(0),Be=(0,_.useRef)(null),Ve=(0,_.useRef)(void 0),He=JSON.stringify([e,t,n]),Ue=(0,_.useRef)(He);Ue.current=He;let We=(0,_.useRef)(r);We.current=r;let Ge=(0,_.useRef)(null);(0,_.useEffect)(()=>(Ue.current=He,()=>{Ue.current=``,Ge.current?.abort(),clearTimeout(Ve.current)}),[He]),(0,_.useEffect)(()=>{Ne.current?.setAttribute(`webkitdirectory`,``)},[]),(0,_.useEffect)(()=>{if(!pe||!i)return;we.current++;let n=new AbortController;return be(!0),p.workspaceTrash(e,t,n.signal).then(r=>{!n.signal.aborted&&r.sessionId===e&&r.sessionPath===t&&(ge(r.entries),ve(r.unavailable??0),Ce(r.nextCursor))}).catch(e=>{n.signal.aborted||(z(!0),I(e instanceof Error?e.message:u(`filesReadFailed`)))}).finally(()=>{n.signal.aborted||be(!1)}),()=>n.abort()},[p,e,t,i,pe,D,u]),(0,_.useEffect)(()=>{U&&(Fe.current?.focus(),Fe.current?.select())},[U]),(0,_.useEffect)(()=>{j&&Pe.current?.focus()},[j]);let Ke=(0,_.useRef)(null),qe=(0,_.useRef)(f?.files?.treeScroll??0);(0,_.useLayoutEffect)(()=>{f?.files&&Object.assign(f.files,{query:m,expanded:g})},[f,m,g]),(0,_.useLayoutEffect)(()=>{!i||!(x||y[`.`])||qe.current!==null&&Ke.current&&(Ke.current.scrollTop=qe.current,qe.current=null)},[i,x,y]);let Je=(0,_.useRef)(y);Je.current=y;let Ye=(0,_.useRef)(x);Ye.current=x;let Xe=(0,_.useRef)(``),Ze=(0,_.useRef)(null),Qe=(0,_.useRef)(new Set),$e=(0,_.useRef)(!1),[et,tt]=(0,_.useState)(!1),nt=!!m.trim();(0,_.useLayoutEffect)(()=>{let e=Be.current;if(!e||!i)return;let t=[...Ke.current?.querySelectorAll(`[data-file-row]`)??[]].find(t=>t.dataset.fileRow===e);t&&(t.focus({preventScroll:!0}),Be.current=null)});let rt=e=>e instanceof tf&&e.code===`ARTIFACT_EXISTS`?u(`filesNameExists`):e instanceof Error?e.message:u(`filesMutationFailed`),it=e=>{h(``);let t=e.path.split(`/`),n=e.kind===`directory`?t.length:t.length-1;v(e=>[...new Set([...e,`.`,...t.slice(0,n).map((e,n)=>t.slice(0,n+1).join(`/`))])]),Be.current=e.path,O(e=>e+1),e.kind===`file`&&(e.bytes??0)<=20971520&&(o(e.path),d?.open(encodeURI(e.path)))},at=()=>{Le.current||(M(null),I(null),Ie.current?.focus({preventScroll:!0}))},ot=async n=>{if(n.preventDefault(),!j||!We.current||Le.current)return;if(!N||N===`.`||N===`..`||/[\\/\u0000-\u001f\u007f]/u.test(N)){z(!0),I(u(`filesNameInvalid`)),Pe.current?.focus();return}Le.current=!0,V(!0),I(null);let r=He;try{let n=await p.mutateWorkspaceFile(e,t,{kind:j,directory:k,name:N});if(Ue.current!==r||n.sessionId!==e||n.sessionPath!==t)return;M(null),P(``),z(!1),I(u(`filesCreated`,{path:n.path})),it(n)}catch(e){Ue.current===r&&(z(!0),I(rt(e)),Pe.current?.focus())}finally{Ue.current===r&&(Le.current=!1,V(!1))}},st=async n=>{if(!We.current||Le.current)return;let r=He;Le.current=!0,V(!0);let i=new AbortController;Ge.current=i;let a=(e,t)=>te(n=>n.map(n=>n.id===e.id?{...n,...t}:n));try{for(let o of n){if(Ue.current!==r)return;if(!We.current){a(o,{state:`error`,message:u(`filesWriteUnavailable`)});continue}if(!(!o.file&&o.kind!==`directory`)){a(o,{state:`running`,message:void 0});try{if(o.kind===`directory`){try{await p.mutateWorkspaceFile(e,t,{kind:`create-directory`,directory:o.directory,name:o.name})}catch(n){if(!(n instanceof tf)||n.code!==`ARTIFACT_EXISTS`)throw n;await p.workspaceFiles(e,t,[o.directory===`.`?``:o.directory,o.name].filter(Boolean).join(`/`),``,i.signal)}if(Ue.current!==r)return;a(o,{state:`done`,message:u(`filesImported`)}),O(e=>e+1);continue}if(!o.file)continue;if(o.file.size>52428800)throw Error(u(`filesImportTooLarge`));let n=await JR(o.file,i.signal);if(Ue.current!==r)return;if(!We.current){a(o,{state:`error`,message:u(`filesWriteUnavailable`)});continue}let s=await p.mutateWorkspaceFile(e,t,{kind:`import-file`,directory:o.directory,name:o.name,data:n,...o.createParents?{createParents:!0}:{}});if(Ue.current!==r||s.sessionId!==e||s.sessionPath!==t)return;a(o,{state:`done`,file:void 0,message:(s.bytes??0)>20971520?u(`filesImportedNoPreview`):u(`filesImported`)}),it(s)}catch(e){if(Ue.current!==r)return;a(o,{state:`error`,message:rt(e)})}}}}finally{Ge.current===i&&(Ge.current=null),Ue.current===r&&(Le.current=!1,V(!1))}},ct=(e,t=[],n=new Map,r=[])=>{if(!We.current||Le.current)return;if(e.length+r.length>2e3){z(!0),I(u(`filesImportFolderLimit`));return}c(!0);let i=[...[...new Set(r)].sort((e,t)=>e.split(`/`).length-t.split(`/`).length).map(e=>({id:++Re.current,name:e.split(`/`).at(-1),directory:[k===`.`?``:k,...e.split(`/`).slice(0,-1)].filter(Boolean).join(`/`)||`.`,kind:`directory`,state:`pending`})),...e.map(e=>{let t=n.get(e)??e.webkitRelativePath;return{id:++Re.current,name:e.name,directory:t?[k===`.`?``:k,...t.split(`/`).slice(0,-1)].filter(Boolean).join(`/`)||`.`:k,createParents:!!t,file:e,state:`pending`}})];te(e=>[...e,...t.map(e=>({id:++Re.current,name:e,directory:k,state:`error`,message:u(`filesImportDirectoryUnsupported`)})),...i]),st(i)},lt=async(n,r)=>{if(!We.current||Le.current)return;let i=He,s=r.filter(e=>!r.some(t=>t.kind===`directory`&&e.path.startsWith(`${t.path}/`)));Le.current=!0,V(!0),fe([]);let c=[],f=new Set;try{for(let r of s){if(Ue.current!==i||!We.current)return;try{if(!r.identity)throw Error(u(`filesRefreshBeforeOrganizing`));let s=await p.mutateWorkspaceFile(e,t,n===`trash`?{kind:n,path:r.path,identity:r.identity}:{kind:n,path:r.path,identity:r.identity,directory:se,name:U?.rename?le:r.name});if(Ue.current!==i||s.sessionId!==e||s.sessionPath!==t)return;if(f.add(r.path),s.trashed&&c.push(s.trashed),s.moved&&Lk(e,t,s.moved.from,s.moved.to),r.kind===`directory`){let e=e=>e===r.path||e.startsWith(`${r.path}/`);if(v(t=>n===`trash`?t.filter(t=>!e(t)):t.map(t=>e(t)?`${s.path}${t.slice(r.path.length)}`:t)),A(t=>e(t)?n===`move`?`${s.path}${t.slice(r.path.length)}`:r.path.split(`/`).slice(0,-1).join(`/`)||`.`:t),n===`move`&&e(a)){let e=`${s.path}${a.slice(r.path.length)}`;o(e),d?.open(encodeURI(e))}}n===`move`&&it(s),fe(e=>[...e,{path:r.path}])}catch(e){if(Ue.current!==i)return;fe(t=>[...t,{path:r.path,error:rt(e)}])}}De(c),n===`trash`&&l([...f]),ae(e=>e.filter(e=>![...f].some(t=>t===e.path||e.path.startsWith(`${t}/`)))),oe(null),O(e=>e+1)}finally{Ue.current===i&&(Le.current=!1,V(!1))}},ut=async n=>{if(!We.current||Le.current)return;let r=He;Le.current=!0,V(!0),fe([]);try{for(let i of n){if(Ue.current!==r||!We.current)return;try{let n=await p.mutateWorkspaceFile(e,t,{kind:`restore`,id:i.id,identity:i.identity});if(Ue.current!==r||n.sessionId!==e||n.sessionPath!==t)return;De(e=>e.filter(e=>e.id!==i.id)),ge(e=>e.filter(e=>e.id!==i.id)),fe(e=>[...e,{path:i.path}]),it(n)}catch(e){if(Ue.current!==r)return;fe(t=>[...t,{path:i.path,error:rt(e)}])}}O(e=>e+1)}finally{Ue.current===r&&(Le.current=!1,V(!1))}},ft=async()=>{if(!Se||ye)return;let n=we.current,r=He;be(!0);try{let i=await p.workspaceTrash(e,t,void 0,Se);if(n!==we.current||Ue.current!==r||i.sessionId!==e||i.sessionPath!==t)return;ge(e=>[...new Map([...e,...i.entries].map(e=>[e.id,e])).values()]),ve(e=>e+(i.unavailable??0)),Ce(i.nextCursor)}catch(e){n===we.current&&Ue.current===r&&(z(!0),I(rt(e)))}finally{n===we.current&&Ue.current===r&&be(!1)}},pt=e=>ae(t=>t.some(t=>t.path===e.path)?t.filter(t=>t.path!==e.path):[...t,e]),mt=(e,t=!1)=>{oe({entries:e,rename:t});let n=e[0]?.path??``;ce(t?n.split(`/`).slice(0,-1).join(`/`)||`.`:k),ue(e[0]?.name??``),I(null)},gt=(0,_.useRef)(ct);gt.current=ct,(0,_.useEffect)(()=>{let e=s.current;if(!e)return;let t=e=>{if(!e.dataTransfer?.types.includes(`Files`))return;e.preventDefault();let t=We.current&&!Le.current;e.dataTransfer.dropEffect=t?`copy`:`none`,ke(t)},n=t=>{(!(t.relatedTarget instanceof Node)||!e.contains(t.relatedTarget))&&ke(!1)},r=e=>{let t=e.dataTransfer;if(!t?.types.includes(`Files`)||(e.preventDefault(),ke(!1),!We.current||Le.current))return;let n=[],r=[],i=[];for(let e of t.items){if(e.kind!==`file`)continue;let t=e.webkitGetAsEntry?.();if(t?.isDirectory&&`createReader`in t)i.push(t);else if(t?.isDirectory)r.push(t.name);else{let t=e.getAsFile();t&&n.push(t)}}if(i.length){let e=Ue.current,t=new Map,a=[],o=0,s=async(r,i)=>{if(Ue.current!==e||!We.current)throw new DOMException(`Import cancelled`,`AbortError`);if(++o>2e3||i.split(`/`).length>64)throw Error(u(`filesImportFolderLimit`));let c=i?`${i}/${r.name}`:r.name;if(r.isDirectory){a.push(c);let e=r.createReader();for(;;){let t=await new Promise((t,n)=>e.readEntries(t,n));if(!t.length)break;for(let e of t)await s(e,c)}}else if(r.isFile){let e=await new Promise((e,t)=>r.file(e,t));t.set(e,c),n.push(e)}};Le.current=!0,V(!0),(async()=>{try{for(let e of i)await s(e,``);if(Ue.current!==e||!We.current)return;Le.current=!1,V(!1),gt.current(n,r,t,a)}catch(t){Ue.current===e&&(z(!0),I(t instanceof Error?t.message:u(`filesMutationFailed`)))}finally{Ue.current===e&&!Ge.current&&(Le.current=!1,V(!1))}})();return}gt.current(t.items.length?n:[...t.files],r)};return e.addEventListener(`dragover`,t),e.addEventListener(`dragleave`,n),e.addEventListener(`drop`,r),()=>{e.removeEventListener(`dragover`,t),e.removeEventListener(`dragleave`,n),e.removeEventListener(`drop`,r)}},[s,u]);let _t=async(e,t)=>{let r=He,i=n.includes(`\\`)?`\\`:`/`,a=await wd(t?`${n.replace(/[\\/]$/u,``)}${i}${e.split(`/`).join(i)}`:e);Ue.current===r&&(clearTimeout(Ve.current),je(u(a?`filesPathCopied`:`copyFailed`,{path:e})),Ve.current=setTimeout(()=>je(``),3e3))};(0,_.useEffect)(()=>{if(!i)return;let n=new AbortController;Ze.current=n;let r;Xe.current!==m.trim()&&(Xe.current=m.trim(),Ye.current=null,S(null)),r=setTimeout(async()=>{if(document.visibilityState!==`hidden`){E(!0);try{let r=async(r,i,a)=>{let o=await p.workspaceFiles(e,t,r,i,n.signal);for(o.nextCursor&&Qe.current.add(o.nextCursor);o.nextCursor&&o.entries.length{document.visibilityState!==`hidden`&&O(e=>e+1)};return window.addEventListener(`focus`,a),document.addEventListener(`visibilitychange`,a),()=>{n.abort(),clearTimeout(r),window.removeEventListener(`focus`,a),document.removeEventListener(`visibilitychange`,a);for(let e of Qe.current)p.releaseFileListing(e).catch(()=>void 0);Qe.current.clear(),$e.current=!1,tt(!1)}},[i,p,g,m,nt,e,t,D,u]);let vt=e=>v(t=>t.includes(e)?t.filter(t=>t!==e&&!t.startsWith(`${e}/`)):[...t,e]),yt=async n=>{let r=nt?Ye.current:Je.current[n],i=Ze.current;if(!(!r?.nextCursor||!i||i.signal.aborted||$e.current||T)){$e.current=!0,tt(!0),w(null);try{let a=await p.workspaceFiles(e,t,n,nt?m.trim():``,i.signal,r.nextCursor);if(Qe.current.delete(r.nextCursor),a.nextCursor&&Qe.current.add(a.nextCursor),i.signal.aborted)return;let o=[...new Map([...r.entries,...a.entries].map(e=>[e.path,e])).values()],s={...a,entries:o};nt?S(s):b(e=>({...e,[n]:s}))}catch(e){i.signal.aborted||w(e instanceof Error?e.message:u(`filesReadFailed`))}finally{i.signal.aborted||($e.current=!1,tt(!1))}}},bt=(e,t)=>t?.nextCursor?(0,K.jsxs)(`li`,{className:`file-tree-more`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:T||et,onClick:()=>void yt(e),children:u(et?`loading`:`filesLoadMore`)}),(0,K.jsx)(`small`,{children:u(`filesLoaded`,{count:t.entries.length})})]}):null,xt=e=>{let t=[...Ke.current?.querySelectorAll(`button[data-file-row]:not(:disabled)`)??[]],n=t.indexOf(document.activeElement),r=t[n];if(!r)return;let i;if(e.key===`ArrowDown`)i=t[Math.min(n+1,t.length-1)];else if(e.key===`ArrowUp`)i=t[Math.max(n-1,0)];else if(e.key===`Home`)i=t[0];else if(e.key===`End`)i=t.at(-1);else if(e.key===`ArrowRight`&&r.getAttribute(`aria-expanded`)===`false`)r.click();else if(e.key===`ArrowLeft`)r.getAttribute(`aria-expanded`)===`true`?r.click():i=t.find(e=>e.dataset.fileRow===r.dataset.fileRow?.split(`/`).slice(0,-1).join(`/`));else return;e.preventDefault(),i?.focus()},St=(e,t=0)=>e.map(e=>{let n=e.kind===`directory`,i=g.includes(e.path),s=r&&!!e.identity&&!e.path.split(`/`).some(e=>[`.git`,`.pi`,`.openpi-trash`].includes(e.toLowerCase()))&&(n||e.kind===`file`);return(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`div`,{className:`file-tree-item`,children:[ne&&(0,K.jsx)(`input`,{type:`checkbox`,className:`file-tree-check`,"aria-label":u(`filesSelectItem`,{name:e.name}),checked:ie.some(t=>t.path===e.path),disabled:!s||B,onChange:()=>pt(e)}),(0,K.jsxs)(`button`,{type:`button`,"data-file-row":e.path,className:`file-tree-row`,style:{paddingInlineStart:10+t*16},"aria-expanded":n?i:void 0,"aria-current":!n&&a===e.path?`true`:void 0,disabled:e.kind===`symlink`||e.kind===`other`,title:e.kind===`symlink`?u(`filesSymlink`):e.path,onClick:t=>{if(s&&(t.metaKey||t.ctrlKey)){re(!0),pt(e);return}n?(A(e.path),nt?(h(``),v([`.`,...e.path.split(`/`).map((e,t,n)=>n.slice(0,t+1).join(`/`))])):vt(e.path)):(A(e.path.includes(`/`)?e.path.slice(0,e.path.lastIndexOf(`/`)):`.`),o(e.path),d?.open(encodeURI(e.path),void 0,t.currentTarget))},children:[n?i?(0,K.jsx)(L,{className:`file-chevron`,"aria-hidden":`true`}):(0,K.jsx)(ee,{className:`file-chevron`,"aria-hidden":`true`}):(0,K.jsx)(`span`,{className:`file-chevron`}),(0,K.jsx)(YR,{name:e.name,kind:e.kind,expanded:i}),(0,K.jsxs)(`span`,{className:`file-tree-name`,children:[e.name,nt&&(0,K.jsx)(`small`,{children:e.path})]})]}),(0,K.jsx)(jA,{button:{label:u(`filesPathActions`,{name:e.name}),icon:(0,K.jsx)(W,{"aria-hidden":`true`}),isIconOnly:!0,size:`sm`,variant:`ghost`,className:`file-path-actions`},items:[{label:u(`filesCopyRelativePath`),onClick:()=>void _t(e.path,!1)},{label:u(`filesCopyAbsolutePath`),onClick:()=>void _t(e.path,!0)},{label:u(`filesRename`),isDisabled:!s||B,onClick:()=>mt([e],!0)},{label:u(`filesMove`),isDisabled:!s||B,onClick:()=>mt([e])},{label:u(`filesTrashAction`),isDisabled:!s||B,onClick:()=>void lt(`trash`,[e])}],menuWidth:200,alignment:`end`,hasChevron:!1})]}),!nt&&n&&i&&(0,K.jsxs)(`ul`,{children:[y[e.path]?St(y[e.path].entries,t+1):(0,K.jsx)(`li`,{className:`file-tree-note`,children:u(`loading`)}),bt(e.path,y[e.path])]})]},e.path)});return(0,K.jsxs)(`aside`,{className:`file-explorer`,"aria-label":u(`filesExplorer`),"data-drag-over":Oe||void 0,children:[(0,K.jsxs)(`div`,{className:`file-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`input`,{value:m,onChange:e=>h(e.currentTarget.value.slice(0,200)),placeholder:u(`filesSearch`),"aria-label":u(`filesSearch`)}),(0,K.jsx)(`span`,{className:`file-search-progress`,"aria-hidden":`true`,"data-loading":T||void 0}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":u(`refreshFiles`),title:u(`refreshFiles`),onClick:()=>O(e=>e+1),disabled:T,children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]}),(0,K.jsxs)(`div`,{className:`file-create-toolbar`,children:[(0,K.jsxs)(`fieldset`,{className:`file-write-actions`,"aria-label":u(`filesWorkspaceActions`),children:[(0,K.jsx)(jA,{button:{ref:Ie,label:u(`filesCreateMenu`),variant:`ghost`,className:`file-toolbar-button`,tooltip:r&&!B?u(`filesCreateMenu`):void 0,isDisabled:!r||B},items:[`create-file`,`create-directory`].map(e=>({label:u(e===`create-file`?`filesNewFile`:`filesNewDirectory`),icon:e===`create-file`?(0,K.jsx)(xe,{"aria-hidden":`true`}):(0,K.jsx)(Ee,{"aria-hidden":`true`}),isDisabled:!r||B,onClick:()=>{M(e),P(``),I(null)}})),menuWidth:190}),(0,K.jsx)(jA,{button:{label:u(`filesImportMenu`),variant:`ghost`,className:`file-toolbar-button`,tooltip:r&&!B?u(`filesImportMenu`):void 0,isDisabled:!r||B},items:[{label:u(`filesImport`),icon:(0,K.jsx)(Mt,{"aria-hidden":`true`}),isDisabled:!r||B,onClick:()=>Me.current?.click()},{label:u(`filesImportFolder`),icon:(0,K.jsx)(Te,{"aria-hidden":`true`}),isDisabled:!r||B,onClick:()=>Ne.current?.click()}],menuWidth:190}),(0,K.jsx)(`input`,{ref:Me,type:`file`,multiple:!0,hidden:!0,"aria-label":u(`filesImportChoose`),onChange:e=>{ct([...e.currentTarget.files??[]]),e.currentTarget.value=``}}),(0,K.jsx)(`input`,{ref:Ne,type:`file`,multiple:!0,hidden:!0,"aria-label":u(`filesImportFolderChoose`),onChange:e=>{ct([...e.currentTarget.files??[]]),e.currentTarget.value=``}}),(0,K.jsxs)(jA,{button:{label:u(`filesMoreMenu`),variant:`ghost`,className:`file-toolbar-button`,tooltip:u(`filesMoreMenu`)},menuWidth:210,children:[(0,K.jsx)(XA,{label:u(`filesSelectMultiple`),icon:(0,K.jsx)(ze,{"aria-hidden":`true`}),value:ne,isDisabled:!r||B,hasCloseOnSelect:!0,onChange:e=>{re(e),ae([])}}),(0,K.jsx)(XA,{label:u(`filesTrash`),icon:(0,K.jsx)(kt,{"aria-hidden":`true`}),value:pe,hasCloseOnSelect:!0,onChange:me})]})]}),(0,K.jsxs)(`p`,{className:`file-write-directory`,title:k,children:[(0,K.jsxs)(`span`,{children:[u(`filesTargetDirectory`),`:`,` `,k===`.`?u(`filesWorkspaceRoot`):k]}),k!==`.`&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>A(`.`),children:u(`filesWorkspaceRoot`)})]})]}),ne&&(0,K.jsxs)(`div`,{className:`file-organization-bar`,children:[(0,K.jsx)(`span`,{children:u(`filesSelectedCount`,{count:ie.length})}),(0,K.jsx)(`button`,{type:`button`,disabled:!ie.length||B||!r,onClick:()=>mt(ie),children:u(`filesMove`)}),(0,K.jsx)(`button`,{type:`button`,disabled:!ie.length||B||!r,onClick:()=>void lt(`trash`,ie),children:u(`filesTrashAction`)})]}),U&&(0,K.jsxs)(`form`,{className:`file-create-form`,onSubmit:e=>{e.preventDefault(),(!U.rename||le.trim())&<(`move`,U.entries)},children:[(0,K.jsxs)(`label`,{children:[u(U.rename?`filesRename`:`filesMoveDestination`),(0,K.jsx)(`input`,{ref:Fe,value:U.rename?le:se,"aria-label":u(U.rename?`filesNewName`:`filesMoveDestination`),disabled:B,onChange:e=>U.rename?ue(e.currentTarget.value):ce(e.currentTarget.value)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`button`,{type:`submit`,disabled:B||!r,children:u(U.rename?`filesRename`:`filesMove`)}),(0,K.jsx)(`button`,{type:`button`,disabled:B,onClick:()=>oe(null),children:u(`cancel`)})]})]}),de.length>0&&(0,K.jsxs)(`div`,{className:`file-import-results`,children:[(0,K.jsx)(`ol`,{"aria-label":u(`filesOrganizationResults`),"aria-live":`polite`,children:de.map(e=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{children:e.path}),(0,K.jsx)(`small`,{role:e.error?`alert`:void 0,children:e.error??u(`filesOperationDone`)})]},e.path))}),G.length>0&&(0,K.jsx)(`button`,{type:`button`,disabled:B||!r,onClick:()=>void ut(G),children:u(`filesUndoTrash`)})]}),pe&&(0,K.jsxs)(`section`,{className:`file-trash-list`,"aria-label":u(`filesTrash`),children:[(0,K.jsx)(`p`,{children:u(`filesTrashDetail`)}),_e>0&&(0,K.jsx)(`p`,{role:`alert`,children:u(`filesTrashUnavailable`,{count:_e})}),ye&&he.length===0?(0,K.jsx)(`p`,{children:u(`loading`)}):he.length===0?(0,K.jsx)(`p`,{children:u(`filesTrashEmpty`)}):(0,K.jsx)(`ul`,{children:he.map(e=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{title:e.path,children:e.path}),(0,K.jsx)(`button`,{type:`button`,disabled:!r||B,"aria-label":u(`filesRestoreItem`,{name:e.path}),onClick:()=>void ut([e]),children:u(`filesRestore`)})]},e.id))}),Se&&(0,K.jsx)(`button`,{type:`button`,disabled:ye,onClick:()=>void ft(),children:u(`filesLoadMore`)})]}),j&&(0,K.jsxs)(`form`,{className:`file-create-form`,onSubmit:e=>void ot(e),onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.stopPropagation(),at())},children:[(0,K.jsxs)(`label`,{children:[u(j===`create-file`?`filesFileName`:`filesDirectoryName`),(0,K.jsx)(`input`,{ref:Pe,value:N,maxLength:255,disabled:B,"aria-invalid":!!(F&&R),onChange:e=>P(e.currentTarget.value)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`button`,{type:`submit`,disabled:!r||B,children:u(B?`filesCreating`:`filesCreate`)}),(0,K.jsx)(`button`,{type:`button`,disabled:B,onClick:at,children:u(`cancel`)})]})]}),F&&(0,K.jsx)(`p`,{className:`file-tree-note${R?` evidence-warning`:``}`,role:R?`alert`:`status`,children:F}),H.length>0&&(0,K.jsxs)(`div`,{className:`file-import-results`,children:[(0,K.jsx)(`p`,{children:u(`filesImportLimit`)}),(0,K.jsx)(`ol`,{"aria-label":u(`filesImportResults`),"aria-live":`polite`,children:H.map(e=>(0,K.jsxs)(`li`,{"data-import-state":e.state,children:[(0,K.jsx)(`span`,{title:`${e.directory}/${e.name}`,children:e.name}),(0,K.jsx)(`small`,{children:e.message??u(e.state===`running`?`filesImporting`:`filesImportPending`)}),e.state===`error`&&(e.file||e.kind===`directory`)&&(0,K.jsx)(`button`,{type:`button`,disabled:!r||B,onClick:()=>void st([e]),children:u(`filesRetryImport`)})]},e.id))}),(0,K.jsx)(`button`,{type:`button`,disabled:B,onClick:()=>te(e=>e.filter(e=>e.state!==`done`)),children:u(`filesClearImported`)})]}),(0,K.jsx)(`span`,{className:`sr-only`,role:`status`,children:Ae}),C&&(0,K.jsx)(`p`,{className:`file-tree-note evidence-warning`,role:`alert`,children:C}),(0,K.jsxs)(`section`,{className:`file-tree`,"aria-label":u(`filesExplorer`),ref:Ke,onKeyDown:xt,onScroll:e=>{f?.files&&(f.files.treeScroll=e.currentTarget.scrollTop)},"aria-busy":T,children:[(0,K.jsxs)(`ul`,{children:[St(nt?x?.entries??[]:y[`.`]?.entries??[]),bt(`.`,nt?x:y[`.`])]}),(nt?x?.truncated:y[`.`]?.truncated)&&(0,K.jsx)(`p`,{className:`file-tree-note`,children:u(`filesTruncated`)}),!T&&!C&&(nt?x?.entries.length===0:y[`.`]?.entries.length===0)&&(0,K.jsx)(`p`,{className:`file-tree-note`,children:u(nt?`filesNoMatches`:`filesEmpty`)})]})]})}function ZR({sessionId:e,sessionPath:t,cwd:n,active:r,canWrite:i=!0}){let{t:a}=cr(),o=wk(),[s,c]=(0,_.useState)(o?.files?.selected??``),[l,u]=(0,_.useState)(o?.files?.treeVisible??!0),d=(0,_.useRef)(null),f=(0,_.useRef)(null);return(0,_.useLayoutEffect)(()=>{o&&(o.files={query:``,expanded:[`.`],treeScroll:0,...o.files,selected:s,treeVisible:l})},[o,s,l]),(0,K.jsx)(`div`,{ref:d,className:`files-workspace`,"data-tree-visible":l,"data-preview-open":!!s,children:(0,K.jsxs)(Bk,{ref:f,sessionId:e,sessionPath:t,embedded:!0,active:r,onClose:()=>{c(``),u(!0)},children:[(0,K.jsx)(Cd,{content:a(l?`filesHideTree`:`filesShowTree`),placement:`below`,children:(0,K.jsx)(`button`,{type:`button`,className:`files-tree-toggle icon-button`,"aria-label":a(l?`filesHideTree`:`filesShowTree`),"aria-pressed":l,onClick:()=>u(e=>!e),children:l?(0,K.jsx)(G,{"aria-hidden":`true`}):(0,K.jsx)(De,{"aria-hidden":`true`})})}),!s&&(0,K.jsxs)(`div`,{className:`files-empty-header`,title:n,children:[(0,K.jsx)(G,{"aria-hidden":`true`}),n.split(/[\\/]/u).filter(Boolean).at(-1)||n]}),!s&&(0,K.jsxs)(`div`,{className:`files-preview-empty`,children:[(0,K.jsx)(Se,{"aria-hidden":`true`}),(0,K.jsx)(`h3`,{children:a(`filesChoose`)}),(0,K.jsx)(`p`,{children:a(`filesChooseDetail`)})]}),(0,K.jsx)(`div`,{className:`files-tree-container`,hidden:!l,children:(0,K.jsx)(XR,{sessionId:e,sessionPath:t,cwd:n,canWrite:i,active:r&&l,selected:s,onSelect:c,dropTarget:d,onShowTree:u,onRemoved:e=>{e.some(e=>e===s||s.startsWith(`${e}/`))&&f.current?.close({restoreFocus:!1})}},JSON.stringify([e,t,n]))})]})})}var QR=(0,_.createContext)(null);QR.displayName=`CollapsibleGroupContext`;var $R=(0,_.createContext)(null);$R.displayName=`CollapsibleGroupPresentationContext`;function ez(e){let{isCollapsible:t,value:n}=e,r=(0,_.use)(QR),i=r!=null&&n!=null,a=t===!0?{}:t||null,o=a!=null,[s,c]=(0,_.useState)(()=>i?!0:a?.isOpen===void 0?a?.defaultIsOpen??!0:a.isOpen),l;return l=i&&n!=null?r.isOpen(n):a?.isOpen===void 0?s:a.isOpen,{isEnabled:o,isOpen:l,toggle:()=>{if(i&&n!=null){r.toggle(n);return}let e=!l;a?.isOpen===void 0&&c(e),a?.onOpenChange?.(e)}}}var tz={info:`info`,warning:`warning`,error:`error`,success:`success`},nz={info:`status`,warning:`alert`,error:`alert`,success:`status`},rz=`status`,iz={info:`accent`,warning:`warning`,error:`error`,success:`success`},az={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kMv6JI:`xjb2p0i`,$$css:!0},rootElevatedCard:{kaIpWk:`x1vf2byn`,$$css:!0},header:{k1xSpc:`x78zum5`,kGNEyG:`x1cy8zhl`,kwnvtZ:`x1a02dak`,k1C7PZ:`xak3so`,khm7nJ:`x4olc9o`,k8WAf4:`x8o8v82`,kg3NbH:`x1pzlopt`,$$css:!0},headerCardStandalone:{kaIpWk:`x1vf2byn`,$$css:!0},headerCardWithContent:{krdFHd:`xwxb7qi`,kfmiAY:`x13nour3`,kVL7Gh:`xbiv7yw`,kT0f0o:`x16uus16`,$$css:!0},headerCentered:{kGNEyG:`x6s0dn4`,$$css:!0},endArea:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kwnvtZ:`x1a02dak`,kjj79g:`x13a6bvl`,kOIVth:`x1txdalj`,kmuXW:`x2lah0s`,ks0D6T:`x193iq5w`,keTefX:`xvc5jky`,kqGvvJ:`x81ka23`,$$css:!0},chevron:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},chevronExpanded:{k3aq6I:`x19jd1h0`,$$css:!0}},oz={info:{kWkggS:`xgcxg3y`,$$css:!0},warning:{kWkggS:`x24i8r5`,$$css:!0},error:{kWkggS:`x1pritpl`,$$css:!0},success:{kWkggS:`xu13z74`,$$css:!0}};function sz(e){return Object.prototype.hasOwnProperty.call(oz,e)}var cz={none:{kGVxlE:`x1gnnqk1`,$$css:!0},low:{kGVxlE:`x1i5ehqx`,$$css:!0},med:{kGVxlE:`x14hfi27`,$$css:!0},high:{kGVxlE:`x1kcpxr7`,$$css:!0}};function lz({status:e,title:t,description:n,icon:r,isDismissable:i=!1,onDismiss:a,dismissLabel:o,endContent:s,container:c=`card`,elevation:l=`none`,collapsible:u=!0,children:d,xstyle:f,className:p,style:m,ref:h,onFocusCapture:g,onPointerDownCapture:v,...y}){let b=Rc(),[x,S]=(0,_.useState)(!1),C=typeof u==`object`&&u?u:{},{isEnabled:w,isOpen:T,toggle:E}=ez({isCollapsible:u!==!1&&{...C,defaultIsOpen:C.defaultIsOpen??!1}}),D=(0,_.useRef)(null),O=(0,_.useId)(),k=tz[e],A=nz[e]??rz,j=iz[e],M=Ea(d),N=b(`@astryx.banner.dismiss`),P=o??N,F=o??(typeof t==`string`?b(`@astryx.banner.dismissTitled`,{dismiss:N,title:t}):N);if(x)return null;let I=(e,t)=>{e instanceof HTMLElement&&e!==document.body&&!t.contains(e)&&(D.current=e)},L=e=>{I(e.relatedTarget,e.currentTarget)},R=e=>{I(document.activeElement,e.currentTarget)},ee=()=>{let e=D.current;S(!0),a?.(),e?.isConnected&&e.focus()},z=w&&M,B=Ea(s)||i||z,V=Ea(s)||i,H=!Ea(n)&&V,te=M&&(!w||T),ne=c===`card`;return(0,K.jsxs)(`div`,{ref:h,role:A,onFocusCapture:ca(g,L),onPointerDownCapture:ca(v,R),...oa(Sr(az.root,cz[l],ne&&l!==`none`&&az.rootElevatedCard,f),p,m),...y,children:[(0,K.jsxs)(`div`,{...oa(ba(`banner`,{container:c,status:e}),Sr(az.header,H&&az.headerCentered,sz(e)&&oz[e],ne&&(te?az.headerCardWithContent:az.headerCardStandalone))),children:[(0,K.jsx)(`div`,{...Ea(r)?oa(ba(`banner-icon`,{status:e}),{className:`x78zum5 x6s0dn4 x2lah0s`}):{className:`x78zum5 x6s0dn4 x2lah0s`},"aria-hidden":`true`,children:Ea(r)?r:k==null?null:(0,K.jsx)(xu,{icon:k,size:`md`,color:j,...ba(`banner-icon`,{status:e})})}),(0,K.jsxs)(`div`,{...{0:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli`},1:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli xgualba`}}[!!Ea(s)<<0],children:[(0,K.jsx)(`div`,{className:`x1ghz6dp xjb2p0i xcr08ib x2mo6ok x1kq96og x1tgivj0 xj0a0fe`,children:t}),Ea(n)&&(0,K.jsx)(`div`,{className:`x1ghz6dp xjb2p0i x141an7d x1sodnla x1ltkj2j xv1l7n4 xj0a0fe`,children:n})]}),B&&(0,K.jsxs)(`div`,{...Sr(az.endArea,rs.inset(Br[`--spacing-2`])),children:[s,z&&(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,label:b(T?`@astryx.banner.collapse`:`@astryx.banner.expand`),tooltip:b(T?`@astryx.banner.collapse`:`@astryx.banner.expand`),icon:(0,K.jsx)(xu,{icon:`chevronDown`,size:`sm`,color:`inherit`,xstyle:[az.chevron,T&&az.chevronExpanded]}),onClick:E,"aria-expanded":T,"aria-controls":te?O:void 0,isIconOnly:!0}),i&&(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,label:F,tooltip:P,icon:(0,K.jsx)(xu,{icon:`close`,size:`sm`,color:`inherit`}),onClick:ee,isIconOnly:!0})]})]}),te&&(0,K.jsx)(`div`,{id:z?O:void 0,...oa(ba(`banner-content`,{container:c,status:e}),{0:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh`},1:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh x1k5g1gk x1eprgri`}}[!!ne<<0]),children:d})]})}lz.displayName=`Banner`;var uz={container:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,k9WMMc:`x2b8uid`,kOIVth:`x18g69wz`,k8WAf4:`xmfvnks`,kg3NbH:`xm7rs69`,$$css:!0},containerCompact:{kOIVth:`x1txdalj`,k8WAf4:`x1na6nto`,kg3NbH:`x1pzlopt`,$$css:!0}};function dz({title:e,description:t,icon:n,actions:r,headingLevel:i=3,isCompact:a=!1,xstyle:o,className:s,style:c,ref:l,...u}){let d=`h${i}`;return(0,K.jsxs)(`div`,{ref:l,...u,role:`status`,...oa(ba(`empty-state`,{variant:a?`compact`:null}),Sr(uz.container,a&&uz.containerCompact,o),s,c),children:[n!=null&&(0,K.jsx)(`div`,{"aria-hidden":`true`,children:n}),(0,K.jsxs)(`div`,{className:`x78zum5 xdt5ytf x6s0dn4 xxc7z9f`,children:[(0,_.createElement)(d,oa(ba(`empty-state-title`,{variant:a?`compact`:null}),{0:{className:`x1ghz6dp xjb2p0i x18juvz8 x2mo6ok xf74fhv x1tgivj0`},1:{className:`x1ghz6dp xjb2p0i x2mo6ok xf74fhv x1tgivj0 xcr08ib`}}[!!a<<0]),e),t!=null&&(0,K.jsx)(`div`,{...oa(ba(`empty-state-description`,{variant:a?`compact`:null}),{0:{className:`x1ghz6dp xjb2p0i xjm74w1 x1sodnla xw6l6zx xv1l7n4`},1:{className:`x1ghz6dp xjb2p0i x1sodnla xw6l6zx xv1l7n4 x141an7d`}}[!!a<<0]),children:t})]}),r!=null&&(0,K.jsx)(`div`,{...{0:{className:`x78zum5 x1q0g3np x6s0dn4 x1txdalj xcsaf9d`},1:{className:`x78zum5 x6s0dn4 x1txdalj xcsaf9d xdt5ytf`}}[!!a<<0],children:r})]})}dz.displayName=`EmptyState`;var fz=1e3,pz=100,mz={root:{kWkggS:`xprdx6m x1j0df82 x1o55y2u`,kSiTet:`xvpkmg4 x1tbh5bv`,$$css:!0},animate:{kILWW9:`xpz12be`,k44tkh:`xqgcaz`,ko0y90:`xa4qsjk`,kKVMdj:`xeuoslp x1aquc0h`,kyAemX:`x193epu2`,$$css:!0}},hz={0:{kaIpWk:`xwksslw`,$$css:!0},1:{kaIpWk:`xx3sua9`,$$css:!0},2:{kaIpWk:`xh6dtrn`,$$css:!0},3:{kaIpWk:`x1hviunn`,$$css:!0},4:{kaIpWk:`x1hviunn`,$$css:!0},none:{kaIpWk:`x2u8bby`,$$css:!0},rounded:{kaIpWk:`xjspbzw`,$$css:!0}},gz={kKxzle:`xvo38ju`,$$css:!0},_z={animationDelay:e=>[gz,{"--x-animationDelay":(e=>typeof e==`number`?e+`ms`:e??void 0)(`${fz+pz*e}ms`)}],dimensions:(e,t)=>[{kzqmXN:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`x5lhr3w`,kZKoxP:(typeof t==`number`?`${t}px`:t)==null?typeof t==`number`?`${t}px`:t:`x16ye13r`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e),"--x-height":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof t==`number`?`${t}px`:t)}]};function vz({width:e=`100%`,height:t=`100%`,radius:n=3,index:r=0,"data-testid":i,xstyle:a,className:o,style:s,ref:c,...l}){return(0,K.jsx)(`div`,{ref:c,"aria-hidden":`true`,"data-testid":i,...oa(ba(`skeleton`),Sr(mz.root,mz.animate,hz[n],_z.dimensions(e,t),_z.animationDelay(r),a),o,s),...l})}vz.displayName=`Skeleton`;function yz({branches:e,value:t,loading:n,onChange:r}){let{t:i}=cr(),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),u=(0,_.useRef)([]),d=(0,_.useRef)(null),f=(0,_.useId)(),p=e.options.filter(e=>`${e.label} ${e.ref}`.toLocaleLowerCase().includes(a.toLocaleLowerCase()));(0,_.useEffect)(()=>{if(!s)return;let e=requestAnimationFrame(()=>l.current?.focus());return()=>cancelAnimationFrame(e)},[s]),(0,_.useEffect)(()=>{if(!s)return;let e=e=>{let t=e.target;d.current=t instanceof Element&&!t.closest(`.review-base-picker, .review-base-popup`)?t.closest(`button:not(:disabled), input:not(:disabled), textarea:not(:disabled), select:not(:disabled), a[href], [tabindex], [contenteditable='true']`):null};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[s]);let m=e.options.find(e=>e.ref===t)?.label??t;return(0,K.jsx)($M,{className:`review-base-picker`,label:i(`gitReviewBaseBranch`),isLabelHidden:!0,value:t??``,triggerLabel:(0,K.jsx)(`span`,{className:`review-base-label`,title:t,children:m||i(`gitReviewChooseBase`)}),variant:`ghost`,size:`sm`,isDisabled:e.options.length===0,isLoading:n,onOpenChange:e=>{c(e),e||(o(``),d.current?.isConnected&&d.current.focus({preventScroll:!0}),d.current=null)},children:(s,c,d)=>(0,K.jsxs)(`div`,{className:`review-base-popup`,children:[(0,K.jsxs)(`label`,{className:`review-base-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`sr-only`,children:i(`gitReviewSearchBranches`)}),(0,K.jsx)(`input`,{ref:l,type:`search`,value:a,"aria-controls":f,placeholder:i(`gitReviewSearchBranches`),onChange:e=>o(e.currentTarget.value),onKeyDown:e=>{e.nativeEvent.isComposing||e.keyCode===229||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),d()):e.key===`ArrowDown`&&p.length&&!n&&(e.preventDefault(),u.current[0]?.focus()))}})]}),e.truncated&&(0,K.jsx)(`p`,{role:`status`,children:i(`gitReviewBranchesTruncated`)}),(0,K.jsxs)(`div`,{id:f,role:`listbox`,"aria-label":i(`gitReviewBaseBranch`),className:`review-base-options`,children:[p.map((e,a)=>(0,K.jsxs)(`button`,{type:`button`,disabled:n,role:`option`,"aria-selected":t===e.ref,title:e.ref,ref:e=>{u.current[a]=e},onClick:()=>{r(e.ref),d()},onKeyDown:e=>{if(!(e.nativeEvent.isComposing||e.keyCode===229)){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),d();else if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`){e.preventDefault();let t=e.key===`Home`?0:e.key===`End`?p.length-1:(a+(e.key===`ArrowDown`?1:p.length-1))%p.length;u.current[t]?.focus()}}},children:[(0,K.jsxs)(`span`,{children:[e.label,(0,K.jsx)(`small`,{children:e.ref.startsWith(`refs/heads/`)?i(`gitReviewLocalBranch`):i(`gitReviewRemoteBranch`)})]}),t===e.ref&&(0,K.jsx)(I,{"aria-hidden":`true`})]},e.ref)),!p.length&&(0,K.jsx)(`p`,{role:`status`,children:i(`gitReviewNoMatchingBranches`)})]})]})})}function bz(e,t){return{path:e,name:t,directories:new Map,files:[]}}function xz({files:e,selectedPath:t,collapsed:n,searching:r,onToggle:i,onSelect:a,viewed:o,onViewedChange:s,viewedLimitReached:c=!1}){let{t:l}=cr(),u=(0,_.useMemo)(()=>{let t=bz(``,``);for(let n of e){let e=t;for(let t of n.path.split(`/`).slice(0,-1)){let n=e.path?`${e.path}/${t}`:t,r=e.directories.get(t);r||(r=bz(n,t),e.directories.set(t,r)),e=r}e.files.push(n)}return t},[e]),d=(e,u)=>(0,K.jsxs)(`ul`,{children:[[...e.directories.values()].map(e=>{let t=e,a=t.name;for(;t.files.length===0&&t.directories.size===1;){let e=t.directories.values().next().value;if(!e)break;t=e,a+=`/${t.name}`}let o=t.path,s=r||!n.has(o);return(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`review-tree-directory`,style:{paddingLeft:8+u*16},title:o,"aria-expanded":s,disabled:r,onClick:()=>i(o),children:[(0,K.jsx)(ee,{"aria-hidden":`true`,"data-open":s}),(0,K.jsx)(`span`,{children:a})]}),s&&d(t,u+1)]},e.path)}),e.files.map(e=>{let n=e.path.split(`/`).at(-1)??e.path,r=/\.(png|jpe?g|gif|webp|svg)$/iu.test(n)?Ne:/\.(md|txt|log)$/iu.test(n)?Se:ve;return(0,K.jsxs)(`li`,{className:`review-tree-file-row`,children:[(0,K.jsxs)(`button`,{className:`session-review-file review-tree-file`,type:`button`,style:{paddingLeft:8+u*16},"data-review-file":e.path,title:e.path,"aria-label":e.path,"aria-description":l(`gitFileStatus_${e.status}`),"aria-current":t===e.path?`true`:void 0,onClick:()=>a(e.path),children:[(0,K.jsx)(r,{"aria-hidden":`true`,className:`review-tree-icon`}),(0,K.jsx)(`span`,{className:`review-tree-name`,children:n}),(0,K.jsx)(`span`,{className:`review-tree-status`,"aria-hidden":`true`,children:l(`gitFileStatus_${e.status}`)}),(0,K.jsx)(`span`,{className:`session-review-stats`,"aria-hidden":`true`,children:e.binary?(0,K.jsx)(`span`,{children:l(`gitReviewBinaryShort`)}):e.statsUnavailable?(0,K.jsx)(`span`,{title:l(`turnEditStatsUnknown`),children:`—`}):(0,K.jsxs)(K.Fragment,{children:[e.additions>0&&(0,K.jsxs)(`span`,{className:`review-additions`,children:[`+`,e.additions]}),e.deletions>0&&(0,K.jsxs)(`span`,{className:`review-deletions`,children:[`-`,e.deletions]})]})})]}),s&&(0,K.jsx)(`label`,{className:`review-viewed-control`,title:l(`gitReviewMarkViewed`,{path:e.path}),children:(0,K.jsx)(`input`,{type:`checkbox`,"aria-label":l(`gitReviewMarkViewed`,{path:e.path}),checked:o?.has(e.path)??!1,disabled:c&&!o?.has(e.path),onChange:t=>s(e.path,t.currentTarget.checked)})})]},e.path)})]});return(0,K.jsx)(`div`,{className:`session-review-list review-file-tree`,children:d(u,0)})}var Sz=20,Cz=200,wz=[0,1,2,3];function Tz(e){return e.split(/[\\/]/u).at(-1)||e}function Ez(e,t){return e?e.reason===`not_git_repository`?t(`gitReviewNotRepository`):e.reason===`unborn_repository`?t(`gitReviewUnborn`):e.reason===`baseline_unavailable`?t(`gitReviewBaselineUnavailable`):e.reason===`base_branch_unavailable`?t(`gitReviewBaseUnavailable`):e.reason===`invalid_base_branch`?t(`gitReviewBaseInvalid`):t(`gitReviewFailed`):null}function Dz({review:e,initialFilePath:t,onClose:n,onOpenTools:r,embedded:i=!1,active:a=!0,onOpenFiles:o,readingScope:s,onReferenceLine:c}){let{t:l}=cr(),u=wk(),d=(0,_.useRef)(void 0);e.result?.branches?d.current=e.result.branches:e.result&&!e.loading&&(d.current=void 0);let f=e.result?.branches??(e.loading?d.current:void 0),p=`${s??e.source??`unstaged`}:${e.baseRef??``}`,m=u?.review?.scope===p?u.review:void 0,h=(0,_.useRef)(JSON.stringify([p,t])),g=(0,_.useRef)(null),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(new Set(m?.collapsedDirectories));(0,_.useEffect)(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(([e])=>{e&&y(e.contentRect.width>=720)});return t.observe(e),()=>t.disconnect()},[]);let S=(0,_.useRef)(null),C=(0,_.useRef)(null),w=(0,_.useRef)(null),E=(0,_.useRef)(!0),D=(0,_.useRef)(!1),O=(0,_.useRef)(m?.listScroll??null),k=(0,_.useRef)(null),[A,j]=(0,_.useState)(m?.visibleFiles??Sz),[M,N]=(0,_.useState)(m?.query??``),[P,F]=(0,_.useState)(null),[I,L]=(0,_.useState)(m?m.selected:t??null),[R,ee]=(0,_.useState)(()=>m?.viewed?{scope:p,revision:m.viewed.revision,paths:new Set(m.viewed.paths.slice(0,Cz))}:null),z=(0,_.useRef)(m?{list:m.listScroll,preview:m.previewScroll}:null);(0,_.useLayoutEffect)(()=>{u&&(u.review={source:e.source??`unstaged`,baseRef:e.baseRef,scope:p,selected:I,query:M,collapsedDirectories:[...b],visibleFiles:A,listScroll:u.review?.scope===p?u.review.listScroll:0,previewScroll:u.review?.scope===p?u.review.previewScroll:0,viewed:R?.scope===p?{revision:R.revision,paths:[...R.paths].slice(0,Cz)}:void 0})},[u,e.source,e.baseRef,p,I,M,b,A,R]);let[B,V]=(0,_.useState)(null),[H,te]=(0,_.useState)(null),[ne,re]=(0,_.useState)(0),[ie,ae]=(0,_.useState)(()=>window.matchMedia?.(`(max-width: 1100px)`).matches??!1);(0,_.useEffect)(()=>{let e=window.matchMedia?.(`(max-width: 1100px)`);if(!e)return;let t=()=>ae(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,_.useEffect)(()=>{let e=JSON.stringify([p,t]);h.current!==e&&(h.current=e,E.current=!!t||!(document.activeElement instanceof Element&&document.activeElement.closest(`.review-base-picker, .review-base-popup`)),O.current=null,L(t??null),N(``),x(new Set),F(null),ee(null))},[t,p]);let U=i?`section`:ie?`main`:`aside`,oe=e.result?.ok?e.result.snapshot:null,se=!e.historical&&I&&P&&P.comparison===(e.source??oe?.comparison)?oe?.revision===P.revision?oe:P:oe,ce=!!(I&&se&&oe&&se.revision!==oe.revision);(0,_.useEffect)(()=>{I&&!P&&oe&&F(oe)},[I,P,oe]);let le=e.source??se?.comparison??`unstaged`,ue=Ez(e.result&&!e.result.ok?e.result:null,l),de=se?.files.find(e=>e.path===I),fe=B?.source===le&&B?.revision===se?.revision&&B?.file.path===I?B.file:de,pe=se?.revision,me=R?.scope===p&&R.revision===pe?R.paths:new Set;(0,_.useEffect)(()=>{pe&&R&&(R.scope!==p||R.revision!==pe)&&ee(null)},[pe,p,R]);let W=(e,t)=>{!pe||!se?.files.some(t=>t.path===e)||ee(n=>{let r=new Set(n?.scope===p&&n.revision===pe?n.paths:[]);if(t){if(r.size>=Cz)return n;r.add(e)}else r.delete(e);return{scope:p,revision:pe,paths:r}})};(0,_.useLayoutEffect)(()=>{!a||!se||!z.current||I&&fe?.diffLoaded===!1||(C.current&&(C.current.scrollTop=z.current.list),w.current&&(w.current.scrollTop=z.current.preview),z.current=null)},[a,se,I,fe?.diffLoaded]);let he=H?.source===le&&H?.path===I&&H?.revision===pe&&de?.diffLoaded===!1?H.message:null;(0,_.useEffect)(()=>{let t=de?.path;if(!a||!t||de?.diffLoaded!==!1||!e.readFile||!pe)return;let n=new AbortController;return te(null),e.readFile(t,n.signal,pe).then(e=>{n.signal.aborted||(e?V({source:le,revision:pe,file:e}):te({source:le,path:t,revision:pe,message:l(`gitReviewFileMissing`)}))},e=>{n.signal.aborted||te({source:le,path:t,revision:pe,message:e instanceof Error?e.message:l(`gitReviewFailed`)})}),()=>n.abort()},[de?.path,a,de?.diffLoaded,pe,le,e.readFile,ne,l]);let ge=(0,_.useMemo)(()=>(se?.files??[]).filter(e=>e.path.toLocaleLowerCase().includes(M.toLocaleLowerCase())).sort((e,t)=>e.path.localeCompare(t.path,`en`,{numeric:!0})),[se?.files,M]),_e=v?ge:ge.slice(0,A);(0,_.useEffect)(()=>{!v||I||!se?.files.length||(E.current=!1,L(se.files[0].path))},[v,I,se]);let be=Math.max(0,ge.length-_e.length),xe=se?.listComplete===!1||se?.listComplete===void 0&&se?.truncated,Se=xe||se?.nextOffset!==void 0,Ce=e.historical?l(se?.evidenceSource===`file-tools`?`turnEditsScope`:`turnChangesScope`):se?se.comparison===`session`?l(`gitReviewSessionSnapshot`):se.comparison===`unstaged`?l(`gitReviewUnstaged`):se.comparison===`staged`?l(`gitReviewStaged`):se.baseBranch?l(`gitReviewComparison`,{current:se.currentBranch??l(`gitReviewDetached`),base:se.baseBranch.replace(/^refs\/(?:heads|remotes)\//u,``)}):l(`gitReviewWorkingTree`):null;(0,_.useEffect)(()=>{let e=a&&!D.current;D.current=a,a&&(!e&&!E.current||(E.current=!1,I?w.current?.focus():i?C.current?.focus():S.current?.focus()))},[a,i,I]);let we=e=>{O.current=C.current?.scrollTop??null,e!==I&&(z.current={list:O.current??0,preview:0},w.current&&(w.current.scrollTop=0),u?.review?.scope===p&&(u.review.previewScroll=0)),E.current=!v,F(se),L(e)};(0,_.useLayoutEffect)(()=>{let e=k.current;if(I||!e||!a)return;k.current=null;let t=C.current;if(!t?.isConnected||t.closest(`[hidden], [inert]`))return;let n=[...t.querySelectorAll(`[data-review-file]`)].find(t=>t.dataset.reviewFile===e);O.current!==null&&(t.scrollTop=O.current),n?n.focus({preventScroll:O.current!==null}):i?t.focus():S.current?.focus()},[a,i,I]);let Te=()=>{let e=I,t=ge.findIndex(t=>t.path===e);t>=A&&j(Math.ceil((t+1)/Sz)*Sz),E.current=!1,k.current=e,L(null),F(null)};return(0,K.jsxs)(U,{ref:g,className:`review-panel${i?` embedded`:``}${v?` review-wide`:``}`,"aria-label":l(`changeEvidence`),"aria-busy":e.loading||void 0,onKeyDown:e=>{e.key!==`Escape`||e.nativeEvent.isComposing||e.keyCode===229||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||e.defaultPrevented||(!I||v)&&i||(e.preventDefault(),e.stopPropagation(),I&&!v?Te():i||n())},children:[(0,K.jsxs)(`div`,{className:`review-source-picker`,children:[e.setSource&&(0,K.jsxs)(`label`,{children:[l(`gitReviewSource`),` `,(0,K.jsxs)(`select`,{value:e.historical?`turn`:e.source??`unstaged`,onChange:t=>e.setSource?.(t.currentTarget.value),children:[e.historical&&(0,K.jsx)(`option`,{value:`turn`,children:l(`turnChangesReview`)}),(0,K.jsx)(`option`,{value:`unstaged`,children:l(`gitReviewUnstaged`)}),(0,K.jsx)(`option`,{value:`staged`,children:l(`gitReviewStaged`)}),(0,K.jsx)(`option`,{value:`branch`,children:l(`gitReviewBranch`)}),(0,K.jsx)(`option`,{value:`session`,children:l(`gitReviewSessionSnapshot`)})]})]}),e.source===`branch`&&e.setBaseRef&&f&&(0,K.jsx)(yz,{branches:f,value:e.baseRef??(e.result?.ok?e.result.snapshot.baseBranch??void 0:void 0),loading:e.loading,onChange:e.setBaseRef}),Ce&&(!e.setSource||e.historical||se?.comparison===`branch`)&&(0,K.jsx)(`span`,{className:`review-source-summary`,title:Ce,children:Ce}),(0,K.jsxs)(`div`,{className:`review-source-actions`,children:[o&&(0,K.jsx)(`button`,{type:`button`,onClick:o,children:l(`sessionFileRecords`)}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":l(`gitReviewRefresh`),title:l(`gitReviewRefresh`),disabled:e.loading,"aria-busy":e.loading||void 0,onClick:()=>{e.loading||e.refresh()},children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]})]}),ce&&(0,K.jsxs)(`div`,{className:`review-update`,role:`status`,children:[(0,K.jsx)(`span`,{children:l(`gitReviewNewVersion`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{w.current?.focus(),F(oe),V(null)},children:l(`gitReviewShowLatest`)})]}),(e.error||ue)&&(0,K.jsx)(lz,{status:`error`,container:`section`,title:e.error||ue,description:se?l(`gitReviewOlderResult`):void 0,className:`review-banner`,endContent:(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,label:l(`gitReviewRetry`),isDisabled:e.loading,isLoading:e.loading,onClick:()=>{e.loading||e.refresh()}})}),(0,K.jsxs)(`div`,{className:`review-workspace`,children:[I&&(0,K.jsxs)(`div`,{className:`review-file-screen`,children:[(0,K.jsxs)(`header`,{className:`review-file-header`,children:[!v&&(0,K.jsx)(qc,{label:l(`gitReviewBackToFiles`),variant:`ghost`,size:`sm`,isIconOnly:!0,icon:(0,K.jsx)(T,{"aria-hidden":`true`}),onClick:Te}),(0,K.jsxs)(`div`,{className:`review-file-heading`,children:[(0,K.jsx)(`strong`,{title:I,children:Tz(I)}),(0,K.jsx)(`span`,{title:I,children:I})]}),fe&&pe&&(0,K.jsxs)(`label`,{className:`review-file-viewed`,children:[(0,K.jsx)(`input`,{type:`checkbox`,"aria-label":l(`gitReviewMarkCurrentViewed`,{path:I}),checked:me.has(I),disabled:me.size>=Cz&&!me.has(I),onChange:e=>W(I,e.currentTarget.checked)}),(0,K.jsx)(`span`,{children:l(`gitReviewViewedLabel`)})]}),!i&&(0,K.jsxs)(`div`,{className:`review-file-actions`,children:[r&&(0,K.jsx)(qc,{label:l(`openTools`),variant:`ghost`,size:`sm`,isIconOnly:!0,icon:(0,K.jsx)(lt,{"aria-hidden":`true`}),onClick:r}),(0,K.jsx)(qc,{label:l(`close`),variant:`ghost`,size:`sm`,isIconOnly:!0,icon:(0,K.jsx)(Lt,{"aria-hidden":`true`}),onClick:n})]})]}),(0,K.jsxs)(`div`,{className:`review-file-toolbar`,children:[(0,K.jsx)(`div`,{className:`review-file-context`,children:fe&&(0,K.jsx)(`span`,{children:l(`gitFileStatus_${fe.status}`)})}),(0,K.jsxs)(RP,{gap:2,align:`center`,className:`session-review-stats`,children:[fe&&!fe.binary&&!fe.statsUnavailable&&fe.additions>0&&(0,K.jsxs)(zo,{type:`supporting`,hasTabularNumbers:!0,className:`review-additions`,children:[`+`,fe.additions]}),fe&&!fe.binary&&!fe.statsUnavailable&&fe.deletions>0&&(0,K.jsxs)(zo,{type:`supporting`,hasTabularNumbers:!0,className:`review-deletions`,children:[`-`,fe.deletions]})]})]}),(0,K.jsx)(`section`,{ref:w,className:`review-file-preview`,"aria-label":l(`gitReviewFilePreview`,{file:I}),tabIndex:-1,onScroll:e=>{u?.review&&(u.review.previewScroll=e.currentTarget.scrollTop)},children:fe?he?(0,K.jsxs)(`div`,{role:`alert`,children:[(0,K.jsx)(`p`,{children:he}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>re(e=>e+1),children:l(`retryAdmissionCheck`)})]}):fe.diffLoaded===!1&&e.readFile?(0,K.jsx)(`p`,{role:`status`,children:l(`gitReviewLoading`)}):fe.binary?(0,K.jsx)(dz,{icon:(0,K.jsx)(ve,{"aria-hidden":`true`}),title:l(`gitReviewBinary`),isCompact:!0}):fe.statsUnavailable?(0,K.jsx)(dz,{icon:(0,K.jsx)(ve,{"aria-hidden":`true`}),title:l(`turnEditStatsUnknown`),description:l(`turnEditReason_${fe.statsUnavailable}`),isCompact:!0}):fe.diff?(0,K.jsxs)(K.Fragment,{children:[fe.diffTruncated&&(0,K.jsx)(`p`,{className:`review-hidden-lines`,children:l(`gitReviewDiffTruncated`)}),(0,K.jsx)(VL,{file:fe,onReferenceLine:c})]}):(0,K.jsx)(dz,{icon:(0,K.jsx)(ve,{"aria-hidden":`true`}),title:l(fe.diffTruncated?`gitReviewDiffTruncated`:`gitReviewNoDiff`),description:fe.diffTruncated?l(`gitReviewDiffTruncated`):void 0,isCompact:!0}):(0,K.jsx)(`p`,{role:`status`,children:l(e.loading?`gitReviewLoading`:`gitReviewFileMissing`)})})]}),(!I||v)&&(0,K.jsxs)(`div`,{className:`review-navigation`,children:[!i&&!v&&(0,K.jsxs)(`header`,{className:`review-heading`,children:[(0,K.jsx)(`div`,{children:(0,K.jsxs)(`h2`,{children:[(0,K.jsx)(ye,{"aria-hidden":`true`}),` `,l(`changeEvidence`)]})}),(0,K.jsxs)(`div`,{className:`review-heading-actions`,children:[r&&(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":l(`openTools`),title:l(`openTools`),onClick:r,children:(0,K.jsx)(lt,{"aria-hidden":`true`})}),(0,K.jsx)(`button`,{ref:S,type:`button`,className:`icon-button review-close`,"aria-label":l(`close`),title:l(`close`),onClick:n,children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{ref:C,onScroll:e=>{u?.review&&(u.review.listScroll=e.currentTarget.scrollTop)},className:`review-body`,tabIndex:i?-1:void 0,children:[se&&(0,K.jsxs)(zP,{gap:1,align:`stretch`,className:`review-summary`,children:[(0,K.jsxs)(RP,{gap:3,align:`center`,justify:`between`,children:[(0,K.jsx)(zo,{type:`label`,children:l(xe?`gitReviewLoadedCount`:`filesChanged`,{count:xe?se.files.length:se.totalFiles??se.files.length})}),se.nextOffset!==void 0&&!xe&&(0,K.jsx)(zo,{type:`supporting`,color:`secondary`,children:l(`gitReviewLoadedCount`,{count:se.files.length})}),!xe&&!se.truncated&&se.nextOffset===void 0&&(se.additions>0||se.deletions>0)&&!se.files.some(e=>e.binary||e.statsUnavailable||e.status===`untracked`&&e.diffLoaded===!1)&&(0,K.jsxs)(RP,{gap:2,align:`center`,className:`review-summary-counts`,"aria-hidden":`true`,children:[se.additions>0&&(0,K.jsxs)(zo,{type:`supporting`,hasTabularNumbers:!0,className:`review-additions`,children:[`+`,se.additions]}),se.deletions>0&&(0,K.jsxs)(zo,{type:`supporting`,hasTabularNumbers:!0,className:`review-deletions`,children:[`-`,se.deletions]})]})]}),me.size>=Cz&&(0,K.jsx)(zo,{type:`supporting`,color:`secondary`,children:l(`gitReviewViewedLimit`,{count:Cz})})]}),e.loading&&!se&&(0,K.jsxs)(`div`,{className:`review-loading`,role:`status`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:l(`gitReviewLoading`)}),(0,K.jsxs)(zP,{gap:2,align:`stretch`,"aria-hidden":`true`,children:[(0,K.jsx)(vz,{width:`42%`,height:16,radius:`rounded`,index:0}),(0,K.jsx)(`div`,{className:`review-loading-list`,children:wz.map(e=>(0,K.jsx)(vz,{width:`100%`,height:36,radius:0,index:e+1},e))})]})]}),se?.truncated&&(0,K.jsx)(lz,{status:`info`,title:l(`gitReviewTruncated`),className:`review-banner`}),se&&se.files.length>0&&(0,K.jsxs)(`label`,{className:`review-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`sr-only`,children:l(Se?`gitReviewSearchLoaded`:`gitReviewSearch`)}),(0,K.jsx)(`input`,{type:`search`,value:M,placeholder:l(Se?`gitReviewSearchLoaded`:`gitReviewSearch`),onChange:e=>{N(e.target.value),j(Sz)}})]}),M&&ge.length===0&&(0,K.jsx)(`p`,{className:`review-search-empty`,role:`status`,children:l(Se?`gitReviewNoLoadedMatch`:`gitReviewNoMatch`)}),se&&se.files.length===0&&(0,K.jsx)(dz,{icon:(0,K.jsx)(Ae,{"aria-hidden":`true`}),title:l(`gitReviewEmpty`),isCompact:!0,className:`review-empty`}),_e.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(xz,{files:_e,selectedPath:I,collapsed:b,searching:!!M,onToggle:e=>x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelect:we,viewed:me,onViewedChange:W,viewedLimitReached:me.size>=Cz}),be>0&&(0,K.jsx)(`div`,{className:`session-review-more`,children:(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,width:`100%`,label:l(`gitReviewShowMore`,{count:Math.min(Sz,be)}),onClick:()=>j(e=>Math.min(e+Sz,ge.length))})})]}),se?.nextOffset!==void 0&&e.loadMore&&(0,K.jsx)(`div`,{className:`session-review-more`,children:(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,width:`100%`,label:l(`gitReviewLoadNext`),isLoading:e.loading,isDisabled:e.loading,onClick:()=>{e.loadMore?.()}})})]})]})]})]})}function Oz(e,t,n,r){let{t:i}=cr(),a=(0,_.useMemo)(()=>new rf,[]),[o,s]=(0,_.useState)(0),[c,l]=(0,_.useState)({identity:``,result:null,error:null}),u=JSON.stringify([e,t,r,o]);(0,_.useEffect)(()=>{if(!r)return;let o=new AbortController;return a.turnChanges(e,t,r,o.signal).then(t=>{if(o.signal.aborted)return;if(!t.ok||t.changes.sessionId!==e||t.changes.promptEntryId!==r||t.changes.state===`unavailable`){l({identity:u,result:null,error:i(`turnChangesUnavailable`)});return}let a=t.changes;l({identity:u,error:null,result:{ok:!0,snapshot:{...a.source?{evidenceSource:a.source}:{},...a.fileCount===null?{}:{totalFiles:a.fileCount,listComplete:!0},repositoryRoot:n,currentBranch:null,baseBranch:null,comparison:`session`,revision:u,files:a.files,additions:a.additions,deletions:a.deletions,truncated:a.state===`partial`}}})},()=>{o.signal.aborted||l({identity:u,result:null,error:i(`turnChangesUnavailable`)})}),()=>o.abort()},[a,e,t,r,u,n,i]);let d=(0,_.useCallback)(async()=>s(e=>e+1),[]);return{result:c.identity===u?c.result:null,error:c.identity===u?c.error:null,loading:!!r&&c.identity!==u,refresh:d,historical:!0}}function kz(e,t,n){let r=(0,_.useRef)({onState:t,onOpen:n});r.current={onState:t,onOpen:n};let[i,a]=(0,_.useState)(),[o,s]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{let t=()=>{let e=document.documentElement.dataset.openpiBrowserExtension===`ready`;s(e),e||a(void 0)};t();let n=new MutationObserver(t);n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-openpi-browser-extension`]});let i=t=>{if(t.source!==window||t.origin!==location.origin)return;let n=t.data;if(!n||n.source!==`openpi-browser-extension`||n.id!==e)return;if(n.type===`lost`){a(void 0);return}if(typeof n.url!=`string`)return;let i=WR(n.url,location.origin);if(i&&(n.type===`open`&&r.current.onOpen(i),n.type===`state`&&typeof n.title==`string`)){let t={id:e,document:typeof n.document==`string`?n.document:void 0,url:i,title:n.title.slice(0,256),canGoBack:n.canGoBack===!0,canGoForward:n.canGoForward===!0};a(t),r.current.onState(t)}};return window.addEventListener(`message`,i),()=>{n.disconnect(),window.removeEventListener(`message`,i)}},[e]),{ready:o,page:o&&i?.id===e?i:void 0,command:t=>window.postMessage({source:`openpi-browser-ui`,type:`command`,id:e,action:t},location.origin)}}var Az=8;function jz({onTitle:e,onOpen:t,initialUrl:n=``,readingId:r}){let{t:i}=cr(),a=(0,_.useId)(),o=(0,_.useRef)(null),s=wk(),c=s?.browser?.pages[r],[l,u]=(0,_.useState)(c?.draft??n),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)({history:c?.history??(n?[n]:[]),index:c?.index??(n?0:-1),revision:0,loaded:!1,unknown:!1}),h=p.history[p.index],g=(0,_.useRef)(h);(0,_.useLayoutEffect)(()=>{s?.browser&&(s.browser.pages[r]={draft:l,history:p.history.map((e,t)=>t===p.index?g.current??e:e),index:p.index})},[s,r,l,p]);let v=`${a}-${p.revision}`,y=kz(v,t=>{g.current=t.url;let n=s?.browser?.pages[r];n&&(n.history=n.history.map((e,r)=>r===n.index?t.url:e)),document.activeElement!==o.current&&u(t.url),e(t.title||new URL(t.url).host)},t),b=y.page?.url??h,x=(t,n)=>{let r=t[n];r&&(g.current=r,m(e=>({history:t,index:n,revision:e.revision+1,loaded:!1,unknown:!1})),u(r),f(null),e(new URL(r).host))};return(0,K.jsxs)(`div`,{className:`browser-tool browser-direct-tool`,children:[(0,K.jsxs)(`form`,{className:`browser-toolbar`,onSubmit:e=>{e.preventDefault();let t=WR(l,window.location.origin);if(!t){f(i(`browserAddressNotAllowed`));return}if(t===h)x(p.history,p.index);else{let e=[...p.history.slice(0,p.index+1),t].slice(-64);x(e,e.length-1)}},children:[(0,K.jsxs)(`div`,{className:`browser-navigation`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`browserBack`),title:i(`browserBack`),disabled:y.page?!y.page.canGoBack:p.unknown||p.index<=0,onClick:()=>y.page?y.command(`back`):x(p.history,p.index-1),children:(0,K.jsx)(T,{"aria-hidden":`true`})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`browserForward`),title:i(`browserForward`),disabled:y.page?!y.page.canGoForward:p.unknown||p.index>=p.history.length-1,onClick:()=>y.page?y.command(`forward`):x(p.history,p.index+1),children:(0,K.jsx)(E,{"aria-hidden":`true`})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`browserReload`),title:i(`browserReload`),disabled:!h,onClick:()=>y.page?y.command(`reload`):x(p.history,p.index),children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]}),(0,K.jsx)(`input`,{ref:o,"aria-label":i(`browserAddress`),title:i(y.page?`browserAddress`:`browserEnteredAddress`),value:l,placeholder:`https://`,spellCheck:!1,onChange:e=>{u(e.currentTarget.value),f(null)}}),(0,K.jsx)(`button`,{type:`submit`,"aria-label":i(`browserGo`),title:i(`browserGo`),disabled:!l.trim(),children:(0,K.jsx)(E,{"aria-hidden":`true`})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`openExternalBrowser`),title:i(`openExternalBrowser`),disabled:!b||!y.page&&p.unknown,onClick:()=>b&&window.open(b,`_blank`,`noopener,noreferrer`),children:(0,K.jsx)(he,{"aria-hidden":`true`})})]}),(0,K.jsxs)(`div`,{className:`browser-feedback`,children:[d&&(0,K.jsx)(`p`,{className:`workbar-error`,role:`alert`,children:d}),p.unknown&&!y.page&&(0,K.jsx)(`p`,{className:`browser-notice`,role:`status`,children:i(`browserLocationUnknown`)})]}),(0,K.jsx)(`div`,{className:`browser-direct-viewport`,children:h?(0,K.jsx)(`iframe`,{"data-openpi-browser-page":v,"data-openpi-browser-document":y.page?.document,"data-openpi-browser-url":y.page?.url,"data-openpi-browser-title":y.page?.title,src:h,title:i(`browserPageTitle`,{address:new URL(h).host}),referrerPolicy:`no-referrer`,sandbox:`allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox`,onLoad:()=>m(e=>e.revision===p.revision?{...e,loaded:!0,unknown:e.loaded}:e)},p.revision):(0,K.jsxs)(`div`,{className:`workbar-empty`,children:[(0,K.jsx)(me,{"aria-hidden":`true`}),(0,K.jsx)(`strong`,{children:i(`browserReady`)}),(0,K.jsx)(`p`,{children:i(`browserDirectDescription`)})]})}),(0,K.jsx)(`p`,{className:`browser-notice`,children:i(y.ready?`browserEnhancedHint`:`browserDirectHint`)})]})}function Mz({onReady:e}={}){let{t}=cr(),n=(0,_.useId)(),r=wk(),[i,a]=(0,_.useState)(r?.browser?.tabs??[{id:0,title:``}]),o=(0,_.useRef)(Math.max(...i.map(e=>e.id))+1),s=(0,_.useRef)(i);s.current=i;let[c,l]=(0,_.useState)(),[u,d]=(0,_.useState)(r?.browser?.selected??0);(0,_.useLayoutEffect)(()=>{r&&(r.browser={tabs:i,selected:u,pages:r.browser?.pages??{}})},[r,i,u]);let f=e=>{requestAnimationFrame(()=>document.getElementById(`${n}-tab-${e}`)?.focus())},p=(e=``)=>{if(s.current.length>=Az){e&&l(e);return}let t={id:o.current++,title:e?new URL(e).host:``,initialUrl:e},r=[...s.current,t];return s.current=r,a(r),d(t.id),l(void 0),f(t.id),`${n}-page-${t.id}`},m=(0,_.useRef)(p);m.current=p,(0,_.useEffect)(()=>(e?.(e=>m.current(e)),()=>e?.(void 0)),[e]);let h=e=>{r?.browser&&delete r.browser.pages[e],l(void 0);let t=i.filter(t=>t.id!==e);if(!t.length){let e={id:o.current++,title:``};a([e]),d(e.id),f(e.id)}else if(a(t),u===e){let n=i.findIndex(t=>t.id===e),r=t[Math.min(n,t.length-1)];d(r.id),f(r.id)}};return(0,K.jsxs)(`div`,{className:`browser-workspace`,children:[(0,K.jsxs)(`div`,{className:`browser-tabs-header`,children:[(0,K.jsx)(`div`,{role:`tablist`,"aria-label":t(`browserTabs`),className:`browser-tabs`,onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;let t=e.target.id,r=i.findIndex(e=>`${n}-tab-${e.id}`===t),a=r;if(e.key===`ArrowRight`)a=(r+1)%i.length;else if(e.key===`ArrowLeft`)a=(r+i.length-1)%i.length;else if(e.key===`Home`)a=0;else if(e.key===`End`)a=i.length-1;else if(e.key===`Delete`){e.preventDefault(),e.stopPropagation(),h(i[r].id);return}else return;e.preventDefault(),e.stopPropagation(),d(i[a].id),f(i[a].id)},children:i.map(e=>(0,K.jsxs)(`div`,{className:`browser-tab`,"data-active":e.id===u,children:[(0,K.jsxs)(`button`,{type:`button`,role:`tab`,id:`${n}-tab-${e.id}`,"aria-selected":e.id===u,"aria-controls":`${n}-page-${e.id}`,tabIndex:e.id===u?0:-1,onClick:()=>d(e.id),children:[(0,K.jsx)(me,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:e.title||t(`browserNewTab`)})]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":t(`browserCloseTab`,{title:e.title||t(`browserNewTab`)}),title:t(`close`),onClick:()=>h(e.id),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]},e.id))}),(0,K.jsx)(`button`,{type:`button`,className:`browser-add-tab`,"aria-label":t(`browserAddTab`),title:i.length>=Az?t(`browserTabLimit`,{count:Az}):t(`browserAddTab`),disabled:i.length>=Az,onClick:()=>p(),children:(0,K.jsx)(lt,{"aria-hidden":`true`})})]}),c&&(0,K.jsxs)(`p`,{className:`browser-notice`,role:`status`,children:[t(`browserTabLimit`,{count:Az}),` ·`,` `,(0,K.jsx)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,children:t(`openExternalBrowser`)})]}),(0,K.jsx)(`div`,{className:`browser-pages`,children:i.map(e=>(0,K.jsx)(`div`,{role:`tabpanel`,id:`${n}-page-${e.id}`,"aria-labelledby":`${n}-tab-${e.id}`,className:`browser-page`,hidden:u!==e.id,children:(0,K.jsx)(jz,{readingId:e.id,initialUrl:e.initialUrl,onOpen:p,onTitle:t=>a(n=>n.map(n=>n.id===e.id?{...n,title:t}:n))})},e.id))})]})}var Nz=2,Pz=1,Fz=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Nz,Math.floor(u/e.css.cell.width)),rows:Math.max(Pz,Math.floor(l/e.css.cell.height))}}},Iz=Object.defineProperty,Lz=Object.getOwnPropertyDescriptor,Rz=(e,t)=>{for(var n in t)Iz(e,n,{get:t[n],enumerable:!0})},zz=(e,t,n,r)=>{for(var i=r>1?void 0:r?Lz(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Iz(t,n,i),i},Bz=(e,t)=>(n,r)=>t(n,r,e),Vz=`Terminal input`,Hz={get:()=>Vz,set:e=>Vz=e},Uz=`Too much output to announce, navigate to rows manually to read`,Wz={get:()=>Uz,set:e=>Uz=e};function Gz(e){return e.replace(/\r?\n/g,`\r`)}function Kz(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function qz(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function Jz(e,t,n,r){e.stopPropagation(),e.clipboardData&&Yz(e.clipboardData.getData(`text/plain`),t,n,r)}function Yz(e,t,n,r){e=Gz(e),e=Kz(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function Xz(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function Zz(e,t,n,r,i){Xz(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function Qz(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function $z(e,t=0,n=e.length){let r=``;for(let i=t;i65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var eB=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},tB=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},nB=``,rB=` `,iB=class e{constructor(){this.fg=0,this.bg=0,this.extended=new aB}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},aB=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},oB=class e extends iB{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new aB,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Qz(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},sB=`di$target`,cB=`di$dependencies`,lB=new Map;function uB(e){return e[cB]||[]}function dB(e){if(lB.has(e))return lB.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);fB(t,e,r)};return t._id=e,lB.set(e,t),t}function fB(e,t,n){t[sB]===t?t[cB].push({id:e,index:n}):(t[cB]=[{id:e,index:n}],t[sB]=t)}var pB=dB(`BufferService`),mB=dB(`CoreMouseService`),hB=dB(`CoreService`),gB=dB(`CharsetService`),_B=dB(`InstantiationService`),vB=dB(`LogService`),yB=dB(`OptionsService`),bB=dB(`OscLinkService`),xB=dB(`UnicodeService`),SB=dB(`DecorationService`),CB=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new oB,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;ti?i.activate(e,t,a):wB(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};CB=zz([Bz(0,pB),Bz(1,yB),Bz(2,bB)],CB);function wB(e,t){if(confirm(`Do you want to navigate to ${t}? +`),C=`${e.id}:${S}`,w=s?.source===C?s.status:null,T=`${e.id}:diff:${u.diff}`,E=s?.source===T?s.status:null,D=u.output.split(` +`).map((e,t)=>({text:e,number:u.offset+t})),O=u.diff?qL(u.diff):[],k=O.filter(e=>e.kind===`added`).length,A=O.filter(e=>e.kind===`removed`).length,j=u.diff||u.change===`created`?(0,K.jsxs)(`span`,{className:`evidence-summary-meta`,title:o(`toolDiffStatsHelp`),children:[(0,K.jsxs)(`span`,{className:`review-additions`,children:[`+`,k.toLocaleString()]}),(0,K.jsxs)(`span`,{className:`review-deletions`,children:[`−`,A.toLocaleString()]}),u.truncated&&(0,K.jsx)(`span`,{children:o(`gitReviewPartialLabel`)})]}):null,M=u.tests?.failures.map((e,t)=>({text:e,number:t+1}))??[];return(0,K.jsxs)(`details`,{className:`tool-evidence-card evidence-${u.kind}`,"data-state":d,"data-tool":e.name,open:a||void 0,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(`span`,{className:`evidence-icon`,"aria-hidden":`true`,children:(0,K.jsx)(y,{})}),(0,K.jsx)(`span`,{className:`tool-kind`,"aria-hidden":`true`,title:e.name,children:oL(e.name)}),(0,K.jsxs)(`span`,{className:`evidence-target`,title:u.path||b,children:[(0,K.jsx)(`span`,{className:`tool-action`,children:d===`returned`&&u.change===`created`?o(`toolFileChange_created`):aL(o,e.name,d)}),h?(0,K.jsx)(`span`,{className:`evidence-filename`,children:v}):b?(0,K.jsx)(`span`,{className:`evidence-command`,children:b}):null]}),j,(0,K.jsx)(ee,{className:`evidence-chevron`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`evidence-status`,children:f})]}),(0,K.jsxs)(`div`,{className:`evidence-content`,children:[(p||u.displayPath||u.pathUnavailable)&&!u.diff&&(0,K.jsxs)(`p`,{children:[(0,K.jsx)(`strong`,{children:o(`toolRequestedFile`)}),` `,l&&p?(0,K.jsx)(`button`,{className:`artifact-link`,type:`button`,onClick:()=>l.open(p),children:(0,K.jsx)(`code`,{children:m})}):(0,K.jsx)(`code`,{children:m}),i&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`br`,{}),(0,K.jsxs)(`small`,{children:[o(`toolWorkspace`),`: `,i]})]})]}),u.pathUnavailable&&(0,K.jsx)(`p`,{className:`evidence-warning`,children:u.pathUnavailable}),x&&(0,K.jsxs)(`figure`,{className:`evidence-shell`,"aria-label":o(`toolCallOutput`),children:[(0,K.jsxs)(`figcaption`,{children:[(0,K.jsx)(`span`,{children:`Shell`}),(0,K.jsx)(`button`,{type:`button`,"aria-label":o(w===`copiedCode`?`copiedCode`:`copyCode`),title:o(w===`copiedCode`?`copiedCode`:`copyCode`),onClick:async()=>{let e=await wd(S);c({source:C,status:e?`copiedCode`:`copyCodeFailed`})},children:w===`copiedCode`?(0,K.jsx)(I,{}):(0,K.jsx)(oe,{})})]}),(0,K.jsx)(`pre`,{children:S||o(`noOutput`)}),(0,K.jsxs)(`div`,{className:`evidence-process-meta`,children:[f,u.exitCode===void 0?u.signal?` · ${u.signal}`:``:` · exit ${u.exitCode}`]}),w===`copyCodeFailed`&&(0,K.jsx)(`p`,{role:`status`,className:`evidence-warning`,children:o(w)})]}),u.truncated&&(0,K.jsx)(`p`,{className:`evidence-warning`,children:o(`toolPartialEvidence`)}),u.change&&!u.diff&&(0,K.jsx)(`p`,{children:o(`toolFileChange_${u.change}`)}),u.kind===`change`&&!u.diff&&!u.change&&(0,K.jsx)(`p`,{children:u.evidenceUnavailable??o(`toolChangeUnavailable`)}),u.tests&&(0,K.jsxs)(`figure`,{"aria-label":`Test evidence`,children:[(0,K.jsx)(`figcaption`,{children:(0,K.jsx)(`strong`,{children:o(`toolTestResults`,{format:u.tests.format})})}),(0,K.jsx)(`p`,{children:o(`toolTestCounts`,u.tests)}),(0,K.jsx)(`p`,{children:o(`toolTestCountsHelp`)}),M.map(e=>(0,K.jsx)(JL,{"aria-label":`Failure excerpt ${e.number}`,children:e.text},e.number))]}),x?null:u.diff?(0,K.jsxs)(`figure`,{className:`evidence-diff`,"aria-label":`Change diff`,children:[(0,K.jsxs)(`figcaption`,{children:[l&&p?(0,K.jsx)(`button`,{className:`evidence-diff-file`,type:`button`,title:p,"aria-label":p,onClick:()=>l.open(p),children:v}):(0,K.jsx)(`span`,{className:`evidence-diff-file`,title:p,children:v}),j,(0,K.jsx)(`button`,{className:`evidence-copy`,type:`button`,"aria-label":o(E===`copiedCode`?`copiedCode`:`copyCode`),title:o(E===`copiedCode`?`copiedCode`:`copyCode`),onClick:async()=>{let e=await wd(u.diff??``);c({source:T,status:e?`copiedCode`:`copyCodeFailed`})},children:E===`copiedCode`?(0,K.jsx)(I,{}):(0,K.jsx)(oe,{})})]}),(0,K.jsx)(`pre`,{className:`evidence-diff-lines`,children:O.map(e=>(0,K.jsxs)(`span`,{className:`evidence-diff-row diff-${e.kind}`,children:[(0,K.jsx)(`span`,{className:`evidence-line-number`,"aria-hidden":`true`,children:e.newLine??e.oldLine??``}),(0,K.jsx)(`span`,{className:`evidence-diff-marker`,children:e.marker}),(0,K.jsx)(`span`,{children:e.code}),` +`]},e.id))}),E===`copyCodeFailed`&&(0,K.jsx)(`p`,{role:`status`,className:`evidence-warning`,children:o(E)})]}):u.numberLines?(0,K.jsx)(JL,{className:`evidence-lines`,"aria-label":`File content`,children:D.map(e=>(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`span`,{className:`evidence-line-number`,"aria-hidden":`true`,children:e.number}),e.text,` +`]},e.number))}):(0,K.jsx)(JL,{className:`evidence-log`,"aria-label":`Tool output`,children:u.output||o(`noOutput`)}),u.kind===`file`&&u.truncated&&(0,K.jsx)(`p`,{children:o(`toolReadMore`)}),u.recovery&&(0,K.jsxs)(`p`,{children:[o(`toolFullOutputReference`),` `,(0,K.jsx)(`code`,{children:u.recovery})]}),u.readRecovery&&(0,K.jsx)(`p`,{className:`evidence-warning`,children:u.readRecovery}),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{children:o(`toolRawEvidence`)}),(0,K.jsx)(`p`,{children:(0,K.jsx)(`code`,{children:e.name})}),(0,K.jsx)(`p`,{children:(0,K.jsx)(`strong`,{children:o(`toolCallArguments`)})}),(0,K.jsx)(`pre`,{children:u.rawArguments}),(0,K.jsx)(`p`,{children:(0,K.jsx)(`strong`,{children:o(`toolCallOutput`)})}),(0,K.jsx)(`pre`,{children:u.rawResult})]})]})]})}function XL({changes:e,onReview:t}){let{t:n}=cr(),[r,i]=(0,_.useState)(!1),a=(0,_.useId)();if(e.state===`unavailable`||e.files.length===0)return null;let o=e.state===`partial`,s=e.source===`file-tools`,c=e.fileCount===null,l=r?e.files:e.files.slice(0,3);return(0,K.jsxs)(`section`,{className:`turn-changes`,"aria-label":n(`turnChangesReview`),children:[(0,K.jsxs)(`header`,{className:`turn-changes-header`,children:[(0,K.jsx)(`span`,{className:`turn-changes-icon`,"aria-hidden":`true`,children:(0,K.jsx)(ye,{})}),(0,K.jsxs)(`div`,{className:`turn-changes-summary`,children:[(0,K.jsx)(`strong`,{title:n(s?`turnEditsScope`:`turnChangesScope`),children:n(s?c?`turnEditsPartial`:`turnEdits`:o?`turnChangesPartial`:`turnChanges`,{count:e.fileCount??e.files.length})}),!c&&!e.files.some(e=>e.binary||e.statsUnavailable)&&(0,K.jsxs)(`span`,{className:`turn-changes-totals`,children:[(0,K.jsxs)(`span`,{className:`review-additions`,children:[`+`,e.additions]}),(0,K.jsxs)(`span`,{className:`review-deletions`,children:[`−`,e.deletions]})]}),o&&!s&&(0,K.jsx)(`span`,{className:`turn-changes-warning`,children:n(`turnChangesIncomplete`)})]}),(0,K.jsx)(`button`,{type:`button`,className:`turn-changes-review-button`,"aria-label":n(`turnChangesReview`),disabled:!t,onClick:()=>t?.(e.promptEntryId,e.files[0]?.path),children:n(`reviewChanges`)})]}),(0,K.jsx)(`div`,{className:`turn-changes-list`,id:a,children:l.map(r=>{let i=Math.max(r.path.lastIndexOf(`/`),r.path.lastIndexOf(`\\`));return(0,K.jsxs)(`button`,{type:`button`,className:`turn-changes-file`,title:r.path,disabled:!t,onClick:()=>t?.(e.promptEntryId,r.path),children:[(0,K.jsxs)(`span`,{className:`turn-changes-path`,children:[(0,K.jsx)(`span`,{children:r.path.slice(0,i+1)}),(0,K.jsx)(`strong`,{children:r.path.slice(i+1)})]}),(0,K.jsx)(`span`,{className:`turn-changes-file-stats`,children:r.binary?(0,K.jsx)(`span`,{children:n(`gitReviewBinaryShort`)}):r.statsUnavailable?(0,K.jsx)(`span`,{title:n(`turnEditReason_${r.statsUnavailable}`),children:n(`turnEditStatsUnknown`)}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`review-additions`,children:[`+`,r.additions]}),(0,K.jsxs)(`span`,{className:`review-deletions`,children:[`−`,r.deletions]})]})})]},r.path)})}),e.files.length>3&&(0,K.jsxs)(`button`,{type:`button`,className:`turn-changes-more`,"aria-expanded":r,"aria-controls":a,onClick:()=>i(e=>!e),children:[n(r?`turnChangesLess`:`turnChangesMore`,{count:e.files.length-3}),(0,K.jsx)(L,{className:r?`up`:``,"aria-hidden":`true`})]})]})}function ZL({item:e,position:t,current:n,onNavigate:r,onPreview:i}){let{t:a}=cr(),o=(0,_.useRef)(()=>{}),s=yd({placement:`start`,delay:150,hideDelay:100,touchTrigger:`none`,onShow:(0,_.useCallback)(()=>i(e.entryId,()=>o.current()),[e.entryId,i])});return o.current=s.hide,(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`button`,{ref:s.ref,className:`turn-tick`,type:`button`,"data-turn-entry":e.entryId,"aria-label":a(`conversationTurnPosition`,{position:t}),"aria-describedby":s.describedBy,"aria-current":n?`location`:void 0,onClick:()=>{s.hide(),r(e.entryId)},children:(0,K.jsx)(`span`,{className:`turn-tick-mark`,"aria-hidden":`true`})}),s.renderHoverCard((0,K.jsx)(`span`,{className:`turn-preview`,children:e.previewState===`idle`||e.previewState===`loading`?(0,K.jsx)(`span`,{role:`status`,children:a(`turnPreviewLoading`)}):e.previewState===`unavailable`?(0,K.jsx)(`span`,{role:`status`,children:a(`turnPreviewUnavailable`)}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`turn-preview-prompt`,children:e.title}),e.reply&&(0,K.jsx)(`span`,{className:`turn-preview-reply`,children:e.reply})]})}),{className:`turn-preview-layer`})]})}function QL({items:e,viewport:t,onNavigate:n,readingHistory:r,onRequestPreview:i,enabled:a=!0,onHidden:o}){let{t:s}=cr(),c=(0,_.useRef)(null),l=JSON.stringify(e.map(e=>e.entryId)),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(!1),p=(0,_.useRef)(0),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)({top:0,height:0,visible:!1,current:[]}),y=(0,_.useCallback)(()=>{u.current?.hide(),u.current=null,d.current&&d.current.captureTarget.hasPointerCapture?.(d.current.pointerId)&&d.current.captureTarget.releasePointerCapture(d.current.pointerId),d.current=null,p.current++,o?.()},[o]),b=(0,_.useCallback)((e,n)=>{if(!a||!t.current||!c.current||c.current.style.visibility===`hidden`||t.current.checkVisibility?.()===!1||c.current.checkVisibility?.()===!1||getComputedStyle(t.current).display===`none`||getComputedStyle(c.current).display===`none`){n();return}u.current?.entryId!==e&&u.current?.hide(),u.current={entryId:e,hide:n},i?.(e)},[a,t,i]),x=(0,_.useCallback)((e,t=!1)=>{u.current?.hide();let r=++p.current;h(!1),Promise.resolve(n(e,t)).then(e=>{p.current===r&&e===!1&&h(!0)})},[n]);return(0,_.useLayoutEffect)(()=>{let e=t.current,n=e?.parentElement,i=JSON.parse(l);if(!e||!n){y();return}let o,s=r?n.querySelector(`.jump-to-latest`):null,u=()=>{o=void 0;let t=e.getBoundingClientRect(),r=n.getBoundingClientRect(),l=new Map;for(let t of e.querySelectorAll(`[data-history-entry]`)){let e=t.dataset.historyEntry;e&&!l.has(e)&&l.set(e,t)}let u=e.querySelector(`.conversation-turn`)??l.values().next().value,d=e.offsetWidth>0?t.width/e.offsetWidth:1,f=a&&t.height>0&&d>0&&!!u&&(t.right-u.getBoundingClientRect().right)/d>=48&&e.checkVisibility?.()!==!1&&getComputedStyle(e).display!==`none`&&(!c.current||getComputedStyle(c.current).display!==`none`);f||y();let p=s?.getBoundingClientRect(),m=Math.min(t.bottom-8,p&&p.height>0?p.top-12:1/0),h=Math.max(0,m-t.top-8),g=i.flatMap(e=>{let n=l.get(e);if(!n)return[];let r=(n.closest(`.conversation-turn`)??n).getBoundingClientRect();return r.bottom>t.top+16&&r.tope.top===_.top&&e.height===_.height&&e.visible===f&&e.current.join(`\0`)===g.join(`\0`)?e:_)},d=()=>{o===void 0&&(o=requestAnimationFrame(u))};u(),e.addEventListener(`scroll`,d),window.addEventListener(`resize`,d);let f=typeof ResizeObserver>`u`?void 0:new ResizeObserver(d);f?.observe(e),f?.observe(n),s&&f?.observe(s);for(let t of e.children)f?.observe(t);let p=new MutationObserver(d);return p.observe(e,{childList:!0,subtree:!0}),()=>{o!==void 0&&cancelAnimationFrame(o),e.removeEventListener(`scroll`,d),window.removeEventListener(`resize`,d),f?.disconnect(),p.disconnect()}},[l,t,r,a,y]),(0,_.useLayoutEffect)(()=>{if(g.height,!g.visible||d.current)return;let e=c.current,t=Array.from(e?.querySelectorAll(`[data-turn-entry]`)??[]),n=t.find(e=>e===document.activeElement)??t.find(e=>e.matches(`:hover`))??t.find(e=>g.current.includes(e.dataset.turnEntry??``));if(!e||!n)return;let r=e.getBoundingClientRect(),i=n.getBoundingClientRect();i.topr.bottom&&(e.scrollTop+=i.bottom-r.bottom)},[g.current,g.height,g.visible,l]),(0,_.useLayoutEffect)(()=>{let n=t.current;if(!n)return;let r=t=>{if(!a||t.defaultPrevented||t.isComposing||!t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||![`ArrowUp`,`ArrowDown`].includes(t.key)||!n.parentElement?.contains(document.activeElement)||n.checkVisibility?.()===!1||getComputedStyle(n).display===`none`||getComputedStyle(n).visibility===`hidden`||n.getBoundingClientRect().height<=0)return;let r=new Map;for(let e of n.querySelectorAll(`[data-history-entry]`)){let t=e.dataset.historyEntry;t&&!r.has(t)&&r.set(t,e)}let i=e.flatMap((e,t)=>{let n=r.get(e.entryId);return n?[{item:e,index:t,top:n.getBoundingClientRect().top}]:[]}),o=n.getBoundingClientRect().top,s;if(t.key===`ArrowDown`){let t=i.findIndex(e=>e.top>o+24);s=i.length===0?e[0]:t<0?e[i.at(-1).index+1]:e[(i[t-1]?.index??-1)+1]}else{for(let t=i.length-1;t>=0;t--){let n=i[t];if(Math.abs(n.top-o)<=24){s=e[n.index-1];break}if(n.tope.top>o+24)&&(s=i[0]?.item),i.length===0&&(s=e.at(-1))}s&&(t.preventDefault(),x(s.entryId))};return document.addEventListener(`keydown`,r),()=>document.removeEventListener(`keydown`,r)},[t,a,e,x]),(0,_.useLayoutEffect)(()=>()=>y(),[y]),e.length<4?null:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`nav`,{ref:c,className:`turn-rail`,"aria-label":s(`conversationTurns`),style:{top:g.top,maxHeight:g.height,visibility:g.visible?`visible`:`hidden`},onClickCapture:e=>{f.current&&=(e.preventDefault(),e.stopPropagation(),!1)},onPointerDown:e=>{if(!e.isPrimary||e.button!==0)return;let t=e.target instanceof Element?e.target.closest(`.turn-tick`):null;!t||!e.currentTarget.contains(t)||(f.current=!1,d.current={pointerId:e.pointerId,captureTarget:t,y:e.clientY,moved:!1},t.setPointerCapture?.(e.pointerId))},onPointerMove:e=>{let t=d.current;if(!t||t.pointerId!==e.pointerId||Math.abs(e.clientY-t.y)<3&&!t.moved)return;t.moved=!0,f.current=!0;let n=Array.from(e.currentTarget.querySelectorAll(`[data-turn-entry]`)).find(t=>{let n=t.getBoundingClientRect();return e.clientY>=n.top&&e.clientY{let t=d.current;d.current=null,t?.captureTarget.hasPointerCapture?.(e.pointerId)&&t.captureTarget.releasePointerCapture(e.pointerId)},onPointerCancel:e=>{let t=d.current;d.current=null,t?.captureTarget.hasPointerCapture?.(e.pointerId)&&t.captureTarget.releasePointerCapture(e.pointerId),f.current=!1},children:e.map((e,t)=>(0,K.jsx)(ZL,{item:e,position:t+1,current:g.current.includes(e.entryId),onNavigate:x,onPreview:b},e.entryId))}),m&&(0,K.jsx)(`span`,{className:`turn-navigation-error`,role:`status`,children:s(`turnPreviewUnavailable`)})]})}function $L({message:e,sessionId:t,path:n,entryId:r}){let{t:i}=cr(),[a,o]=(0,_.useState)(null),s=JSON.stringify([t,n,r]),c=e.parts?.filter(e=>e.type===`image`)??[];if(c.length===0)return null;let l=new Map,u=a?.scope===s?a:null,d=()=>o(e=>e?{...e,open:!1}:null);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`section`,{className:`message-attachments`,"aria-label":i(`imageAttachments`),children:c.map(e=>{let a=`${e.mimeType}:${e.name??``}:${e.previewUrl??``}`,c=l.get(a)??0;l.set(a,c+1);let u=`${a}:${c}`,d=t&&n&&r&&typeof e.sourcePartIndex==`number`&&Number.isSafeInteger(e.sourcePartIndex)&&e.sourcePartIndex>=0?{id:`${r}:${e.sourcePartIndex}`,entryId:r,partIndex:e.sourcePartIndex,kind:`image`,name:e.name??i(`attachedImage`)}:null,f=e.previewUrl?(0,K.jsx)(`img`,{src:e.previewUrl,alt:e.name??i(`attachedImage`)},`preview`):d&&t&&n?(0,K.jsx)(`span`,{className:`message-attachment-preview`,children:(0,K.jsx)(zI,{sessionId:t,path:n,source:d,thumbnail:!0})},`preview`):(0,K.jsx)(Ne,{"aria-hidden":`true`},`preview`),p=(0,K.jsx)(`span`,{children:e.name??i(`attachedImage`)},`name`);return d?(0,K.jsxs)(`button`,{className:`message-attachment`,type:`button`,title:d.name,"aria-label":d.name,onClick:()=>o({scope:s,source:d,open:!0}),children:[f,p]},u):(0,K.jsxs)(`div`,{className:`message-attachment`,children:[f,p]},u)})}),t&&n&&u&&(0,K.jsx)(VI,{sessionId:t,path:n,source:u.source,open:u.open,onSelect:d,onClose:d})]})}function eR(e,t,n){let r=(0,_.useMemo)(()=>new lf,[]),i=e?.history?.leafEntryId??e?.entries.at(-1)?.id,a=e?.id,o=e?.path,s=JSON.stringify([e?.id,e?.path,i]),c=(0,_.useRef)(s);c.current=s;let[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)({}),p=(0,_.useRef)(new Map),m=(0,_.useMemo)(()=>a&&o&&i?{sessionId:a,sessionPath:o,entryId:i}:null,[a,o,i]);(0,_.useEffect)(()=>{if(u(null),f({}),!n||!m)return;let e=new AbortController,t=async()=>{try{let t=null,n=[],i=new Set;for(let a=0;a<10;a++){let a=await r.sessionPromptHistory(m,t,e.signal);if(e.signal.aborted||c.current!==s||a.sessionId!==m.sessionId||a.sessionPath!==m.sessionPath||a.anchorEntryId!==m.entryId||a.requestedBeforeEntryId!==t||a.entryIds.length>100||a.entryIds.some(e=>!e||i.has(e))||new Set(a.entryIds).size!==a.entryIds.length||a.nextBeforeEntryId!==null&&(a.entryIds.length===0||a.nextBeforeEntryId!==a.entryIds[0]))return;for(let e of a.entryIds)i.add(e);if(n=[...a.entryIds,...n],a.nextBeforeEntryId===null){u({scope:s,ids:n});return}t=a.nextBeforeEntryId}}catch{}},i=typeof window.requestIdleCallback==`function`?window.requestIdleCallback(()=>void t(),{timeout:2e3}):void 0,a=i===void 0?window.setTimeout(()=>void t(),0):void 0;return()=>{e.abort(),i!==void 0&&window.cancelIdleCallback(i),a!==void 0&&window.clearTimeout(a);for(let e of p.current.values())e.abort();p.current.clear()}},[s,n,m,r]);let h=(0,_.useMemo)(()=>{let e=new Map(t.map(e=>[e.entryId,e]));if(l?.scope!==s)return t;let n=new Set(l.ids);return[...l.ids.map(t=>e.get(t)??d[t]??{entryId:t,title:``,previewState:`idle`}),...t.filter(e=>!n.has(e.entryId))]},[l,s,t,d]),g=(0,_.useRef)(h);return g.current=h,{items:h,requestPreview:(0,_.useCallback)(e=>{if(!n||!m||c.current!==s||p.current.has(e))return;let t=g.current.find(t=>t.entryId===e);if(!t||t.previewState===void 0||t.previewState===`ready`)return;let i=new AbortController;p.current.set(e,i),f(t=>({...t,[e]:{entryId:e,title:``,previewState:`loading`}})),r.sessionPromptPreview(m,e,i.signal).then(t=>{if(!(i.signal.aborted||c.current!==s)){if(t.sessionId!==m.sessionId||t.sessionPath!==m.sessionPath||t.anchorEntryId!==m.entryId||t.entryId!==e||typeof t.prompt!=`string`||typeof t.response!=`string`||Array.from(t.prompt).length>240||Array.from(t.response).length>240)throw Error(`Unverified preview`);f(n=>({...n,[e]:{entryId:e,title:t.prompt,reply:t.response,previewState:`ready`}}))}}).catch(()=>{!i.signal.aborted&&c.current===s&&f(t=>({...t,[e]:{entryId:e,title:``,previewState:`unavailable`}}))}).finally(()=>{p.current.get(e)===i&&p.current.delete(e)})},[n,m,s,r])}}var tR=1e3,nR=Yd*4;function rR(e,t){return t.history?.leafEntryId===e.validatedLeaf||t.history?.anchorEntryId===e.anchor&&t.history.anchorOnBranch===!0}function iR(e,t,n=t.entriesOmitted){let r=e.filter(e=>e.message?.truncation).length,i=e.reduce((e,t)=>e+(t.message?.truncation?.partsOmitted??0),0);return{...t,entriesOmitted:n,messagesTruncated:r,messagePartsOmitted:i,truncated:n>0||r>0||i>0}}function aR(e,t){let n=t.history?.leafEntryId??null;if(n===e.validatedLeaf)return e;let r=t.entries.findIndex(t=>t.id===e.anchor),i=r>=0?t.entries.slice(r+1):t.entries[0]?.parentId===e.anchor?t.entries:null,a=i?.reduce((e,t)=>e+Zd(t)+1,0)??0;return i&&e.session.entries.length+i.length<=tR&&e.session.bytes+a<=nR?{...e,anchor:n??e.anchor,validatedLeaf:n,session:{...e.session,entries:[...e.session.entries,...i],bytes:e.session.bytes+a,truncation:iR([...e.session.entries,...i],e.session.truncation)}}:{...e,validatedLeaf:n}}function oR(e,t,n,r){let i=(0,_.useMemo)(()=>new lf,[]),a=(0,_.useMemo)(()=>n??new Map,[n]),o=SL(e),s=(0,_.useRef)({scope:o,state:a.get(o)});s.current.scope!==o&&(s.current={scope:o,state:a.get(o)});let c=(0,_.useRef)({selected:e,callbacks:t});c.current={selected:e,callbacks:t};let l=(0,_.useRef)(s.current.state?.window??null),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=(0,_.useRef)(null),[p,m]=(0,_.useState)(l.current),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(null),[b,x]=(0,_.useState)(0),S=(0,_.useRef)(o),C=(0,_.useRef)(null),w=r?JSON.stringify([r.sessionId,r.sessionPath,r.entryId,r.revision]):null,T=r&&e&&w!==C.current&&r.sessionId===e.id&&r.sessionPath===e.path&&r.session.id===e.id&&r.session.path===e.path&&r.session.history?.anchorEntryId===r.entryId&&r.session.history.anchorOnBranch===!0&&r.session.entries.some(e=>e.id===r.entryId)?{session:r.session,anchor:r.session.entries.at(-1).id,validatedLeaf:r.session.history?.leafEntryId??null}:null,E=(0,_.useCallback)(e=>{l.current=e,CL(a,SL(e.session),{window:e}),m(e),c.current.callbacks.onAnchorChange?.({sessionId:e.session.id,sessionPath:e.session.path,entryId:e.anchor})},[a]),D=(0,_.useCallback)((e=!1)=>{u.current?.controller.abort(),u.current=null,d.current=null,a.delete(SL(l.current?.session??c.current.selected)),l.current=null,a.persist?.(),m(null),g(!1),y(e?`historyChanged`:null),f.current=null,c.current.callbacks.onAnchorChange?.(null),x(e=>e+1)},[a]),O=(0,_.useCallback)((e=!1)=>{let t=l.current,n=c.current.selected;if(!t||!n)return;let r=JSON.stringify([SL(n),t.anchor,n.history?.leafEntryId]);if(!e&&f.current===r)return;f.current=r,y(null);let i=()=>{f.current===r&&l.current===t&&(u.current?.controller.abort(),u.current=null,g(!1),y(`historyValidationUnavailable`))};c.current.callbacks.onAnchorChange?.({sessionId:t.session.id,sessionPath:t.session.path,entryId:t.anchor});let a=c.current.callbacks.onRefresh?.();if(!a){i();return}a.then(e=>{e||i()}).catch(i)},[]),k=(0,_.useCallback)(e=>{let t=l.current,n=c.current.selected;if(!e.page||!e.consuming||u.current!==e||e.controller.signal.aborted||!t||!n||e.scope!==SL(n)||t.session.history?.beforeEntryId!==e.before||!rR(t,n))return;let r=e.page,i=new Set(t.session.entries.map(e=>e.id)),a=[...r.entries.filter(e=>!i.has(e.id)),...t.session.entries],o=Zd(a);for(;a.length>tR||o>nR;){let e=a.pop();if(!e)break;o-=Zd(e)+ +!!a.length}c.current.callbacks.beforePrepend(),E({...t,anchor:a.at(-1)?.id??t.anchor,session:{...t.session,entries:a,bytes:o,truncation:iR(a,t.session.truncation,r.truncation.entriesOmitted),history:{...t.session.history,beforeEntryId:r.history?.beforeEntryId??null}}}),u.current=null,g(!1),y(null)},[E]);(0,_.useLayoutEffect)(()=>{if(T&&w!==C.current){S.current=o,u.current?.controller.abort(),u.current=null,d.current=null,f.current=null,g(!1),y(null),C.current=w,E(T);return}S.current!==o&&(S.current=o,u.current?.controller.abort(),u.current=null,d.current=null,l.current=s.current.state?.window??null,m(l.current),g(!1),y(null),f.current=null,x(e=>e+1),l.current||c.current.callbacks.onAnchorChange?.(null));let t=u.current;t&&!t.consuming&&e&&!rR(t.source,e)&&(t.controller.abort(),u.current=null);let n=l.current;if(!(!n||!e)){if(e.history?.anchorEntryId===n.anchor&&e.history.anchorOnBranch===!1){D(!0),c.current.callbacks.onRefresh?.();return}if(!rR(n,e)){O();return}y(e=>e===`historyValidationUnavailable`?null:e),(e.history?.leafEntryId??null)!==n.validatedLeaf&&(n=aR(n,e),E(n)),u.current?.page&&k(u.current)}},[o,e,D,O,E,k,T,w]),(0,_.useLayoutEffect)(()=>{let e=l.current;return e&&(CL(a,o,{...s.current.state,window:e}),c.current.callbacks.onAnchorChange?.({sessionId:e.session.id,sessionPath:e.session.path,entryId:e.anchor})),()=>{u.current?.controller.abort(),u.current=null,d.current=null,c.current.callbacks.onAnchorChange?.(null)}},[o,a]);let A=(0,_.useCallback)(()=>{let e=c.current.selected;return!l.current&&e?.history?.leafEntryId&&E({session:e,anchor:e.history.leafEntryId,validatedLeaf:e.history.leafEntryId}),l.current},[E]),j=(0,_.useCallback)((e,t)=>{let n=c.current.selected;if(!n||u.current)return;let r=e.session.history?.beforeEntryId;if(!r)return;let a={controller:new AbortController,scope:SL(n),before:r,source:e,consuming:t,anchor:{sessionId:n.id,sessionPath:n.path,entryId:e.anchor}};return u.current=a,t&&(g(!0),y(null)),a.done=(async()=>{try{let e=await i.sessionHistory(a.anchor,r,a.controller.signal);if(u.current!==a||a.controller.signal.aborted||a.scope!==SL(c.current.selected))return;if(e.id!==n.id||e.path!==n.path||e.anchorEntryId!==a.anchor.entryId||e.requestedBeforeEntryId!==r||e.history?.anchorEntryId!==a.anchor.entryId||e.history.anchorOnBranch!==!0)throw new sf(`Session history identity changed`,409,`SESSION_HISTORY_CHANGED`);a.page=e,a.consuming&&(k(a),u.current===a&&O())}catch(e){if(u.current!==a||a.controller.signal.aborted||(u.current=null,!a.consuming))return;g(!1),e instanceof sf&&e.code===`SESSION_HISTORY_CHANGED`?(D(!0),c.current.callbacks.onRefresh?.()):y(`historyUnavailable`)}})(),a.done},[k,D,i,O]),M=(0,_.useCallback)(async()=>{let e=c.current.selected;if(!e?.history?.leafEntryId)return;let t=l.current;if(t&&!rR(t,e)){O(!0);return}if(t||=A(),!t)return;let n=u.current;if(n){if(n.scope===SL(e)&&n.before===t.session.history?.beforeEntryId&&rR(n.source,e))return n.consuming=!0,g(!0),y(null),n.page&&k(n),n.done;n.controller.abort(),u.current=null}return j(t,!0)},[k,j,O,A]);(0,_.useEffect)(()=>{if(!t.preload){let e=u.current;e&&!e.consuming&&(e.controller.abort(),u.current=null,d.current=null);return}if(v||u.current||!e||p!==l.current)return;let n=p;if(n&&!rR(n,e))return;let r=n??(e.history?.leafEntryId?{session:e,anchor:e.history.leafEntryId,validatedLeaf:e.history.leafEntryId}:null);if(!r?.session.history?.beforeEntryId)return;let i=JSON.stringify([o,n?r.anchor:`initial`,n?r.session.history.beforeEntryId:null]);d.current!==i&&(d.current=i,j(r,!1))},[t.preload,v,o,e,p,j]);let N=p&&SL(p.session)===o?p:null,P=T??(N&&e&&rR(N,e)?aR(N,e):N),F=(0,_.useCallback)(()=>D(),[D]),I=!!(P&&e&&!rR(P,e));return{session:P?.session??e,engaged:!!P,hasMore:!!(P?.session??e)?.history?.beforeEntryId,hasNewer:!!(P&&P.anchor!==e?.history?.leafEntryId),verifying:I,loading:h,error:v,reset:b,retainReading:A,loadOlder:M,resetToLatest:F}}function sR(e){return e&&typeof e==`object`?e:{}}function cR(e){try{return sR(JSON.parse(e))}catch{return{}}}function lR(e){return e===`running`?`running`:e===`done`||e===`completed`?`done`:[`error`,`failed`,`aborted`,`killed`,`timed_out`].includes(String(e))?`error`:e===`uncertain`?`warn`:`unknown`}function uR(e,t){if(e?.forkSnapshotToolResult)return`unknown`;if(t===`running`)return`running`;if(t===`unknown`||!e)return`unknown`;if(e.isError)return`error`;let n=lR(sR(e.details).status);return n===`unknown`?e.isError===!1?`done`:`unknown`:n}function dR({status:e}){let{t}=cr();return e===`running`?(0,K.jsx)(`span`,{className:`status-mark running`,role:`img`,"aria-label":t(`toolState_running`),children:(0,K.jsx)(`i`,{})}):e===`done`?(0,K.jsx)(I,{className:`status-mark done`,"aria-label":t(`execution_done`)}):e===`error`?(0,K.jsx)(Lt,{className:`status-mark error`,"aria-label":t(`toolState_failed`)}):e===`warn`?(0,K.jsx)(`span`,{className:`status-mark warn`,role:`img`,"aria-label":t(`toolState_unknown`),children:`?`}):null}function fR({label:e,message:t,children:n}){return(0,K.jsxs)(`div`,{className:`execution-error`,role:`alert`,"aria-label":e,children:[(0,K.jsx)(V,{"aria-hidden":`true`}),(0,K.jsxs)(`div`,{className:`execution-error-content`,children:[(0,K.jsx)(`p`,{children:t}),n]})]})}function pR({failed:e,error:t,retryPrompt:n,retryEntryId:r,canRetry:i,onRetry:a}){let{t:o}=cr(),[s,c]=(0,_.useState)(!1);return e?(0,K.jsx)(fR,{label:o(`modelRequestFailed`),message:t||o(`modelFailureUnknown`),children:n!==void 0&&r&&(0,K.jsx)(`div`,{className:`provider-outcome-actions`,children:(0,K.jsxs)(`button`,{type:`button`,disabled:!i||s,onClick:()=>{c(!0),a(n,r).finally(()=>c(!1))},children:[(0,K.jsx)(ft,{"aria-hidden":`true`}),o(s?`retryingPrompt`:`retryPrompt`)]})})}):(0,K.jsx)(`div`,{className:`provider-outcome aborted`,role:`status`,children:o(`modelRequestStopped`)})}function mR({attempts:e,state:t,retry:n,observed:r=!0}){let{t:i}=cr(),a=t===`retrying`&&!r,o=n?.attempt,s=n?.maxAttempts,c=typeof o==`number`&&Number.isSafeInteger(o)&&o>0&&typeof s==`number`&&Number.isSafeInteger(s)&&s>=o,l=e.length>0||!!n?.errorMessage,u=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Pt,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{role:t===`retrying`?`status`:void 0,children:[i(a?`modelReconnectUnknown`:t===`recovered`?`modelRequestRecovered`:t===`retrying`?n?`modelReconnecting`:`modelEarlierAttempts`:t===`interrupted`?`modelRequestStopped`:`modelEarlierAttempts`),t===`retrying`&&c&&` ${o}/${s}`]}),t!==`retrying`&&(0,K.jsx)(`span`,{children:i(`modelFailedAttempts`,{count:e.length})}),l&&(0,K.jsx)(ee,{className:`reconnect-chevron`,"aria-hidden":`true`})]}),d=`provider-attempts ${t}${a?` unavailable`:``}`;return l?(0,K.jsxs)(`details`,{className:d,children:[(0,K.jsx)(`summary`,{children:u}),(0,K.jsxs)(`ol`,{children:[e.length===0&&(0,K.jsx)(`li`,{children:(0,K.jsx)(`p`,{children:n?.errorMessage})}),e.map(({entry:e,content:t})=>(0,K.jsxs)(`li`,{"data-history-entry":e.entryId??e.key,children:[(0,K.jsx)(`p`,{children:e.message.errorMessage||i(`modelFailureUnknown`)}),t?.map(e=>(0,K.jsx)(_.Fragment,{children:e.content},e.key))]},e.key))]})]}):(0,K.jsx)(`div`,{className:d,children:u})}function hR(e,t){let n=new Set,r=new Map,i=[],a=-1,o=(o,s=!1,c=!1)=>{if(i.length>0){let l=e[a]?.message.stopReason,u=o?.outcome===`cancelled`||l===`aborted`,d=l===`error`&&!u&&!(s&&t)&&!c;d&&n.add(a);let f=d?i.slice(0,-1):i,p=f.at(-1);p!==void 0&&r.set(p,{attempts:f.map(t=>e[t]),state:u?`interrupted`:l===`stop`||l===`length`||l===`toolUse`?`recovered`:s&&t?`retrying`:`earlier`})}i=[],a=-1};return e.forEach((e,t)=>{e.optimistic||(e.timing?o(e.timing):e.forkSnapshotBoundary?o(void 0,!1,!0):e.message.role===`user`||e.message.role===`custom`&&e.message.customType===`openpi-setup-request`?o():e.message.role===`assistant`&&(a=t,e.message.stopReason===`error`&&i.push(t)))}),o(void 0,!0),{finalErrors:n,groups:r}}function gR(e,t){return aj(sL(e,t).split(` +`).find(Boolean),120)}function _R(e){let t=e.split(` +`).map(e=>e.trim()).find(Boolean);return t?aj(t.replace(/^#{1,6}\s+/u,``).replace(/^>\s*/u,``).replace(/[*_~`]+/gu,``).replace(/\[([^\]]+)\]\([^)]*\)/gu,`$1`).trim(),600):``}function vR({body:e,icon:t,name:n,status:r,summary:i,output:a,evidenceState:o,note:s,rawDetails:c,snapshotMissingResult:l=!1,defaultOpen:u=!1}){let{t:d}=cr(),[f,p]=(0,_.useState)(u);(0,_.useEffect)(()=>p(u),[u]);let m=o??(r===`done`?`returned`:r===`error`?`failed`:r===`running`?`running`:`unknown`);return(0,K.jsxs)(`details`,{className:`message-details tool-line ${r}`,"data-tool":n,open:f,onToggle:e=>p(e.currentTarget.open),children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(`span`,{className:`tool-icon`,"aria-hidden":`true`,children:t}),(0,K.jsx)(`span`,{className:`tool-kind`,"aria-hidden":iL(n).action!==`call`,title:n,children:oL(n)}),(0,K.jsxs)(`span`,{className:`details-title`,children:[(0,K.jsx)(`span`,{className:`tool-action`,children:aL(d,n,m)}),i&&(0,K.jsx)(`span`,{className:`tool-summary`,children:i})]}),l&&(0,K.jsx)(`span`,{className:`evidence-status`,children:d(`toolSnapshotMissingResult`)}),(0,K.jsx)(ee,{className:`tool-disclosure`,"aria-hidden":`true`}),(0,K.jsx)(dR,{status:r})]}),s&&(0,K.jsx)(`p`,{className:`evidence-note`,children:s}),a===void 0?(0,K.jsx)(`pre`,{className:`details-body tool-evidence`,children:Bd(e).text}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`figure`,{"aria-label":d(`toolCallArguments`),style:{margin:0},children:(0,K.jsx)(`pre`,{className:`details-body tool-evidence`,children:Bd(e).text})}),(0,K.jsx)(`figure`,{"aria-label":d(`toolCallOutput`),style:{margin:0},children:(0,K.jsx)(`pre`,{className:`details-body tool-evidence`,children:Bd(a).text||d(`noOutput`)})})]}),c!==void 0&&(0,K.jsxs)(`details`,{className:`evidence-raw`,children:[(0,K.jsx)(`summary`,{children:d(`toolRawEvidence`)}),(0,K.jsx)(`pre`,{children:Bd(JSON.stringify(c,null,2)).text})]})]})}function yR({body:e,family:t,meta:n,status:r,title:i,defaultOpen:a=!1}){return(0,K.jsxs)(`details`,{className:`message-details activity-card ${t}`,open:a||void 0,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(`span`,{className:`activity-icon`,"aria-hidden":`true`,children:t===`subagent`?(0,K.jsx)(M,{}):(0,K.jsx)(Ft,{})}),(0,K.jsxs)(`span`,{className:`activity-main`,children:[(0,K.jsx)(`span`,{className:`activity-title`,children:i}),n&&(0,K.jsx)(`span`,{className:`activity-meta`,children:n})]}),(0,K.jsx)(dR,{status:r}),(0,K.jsx)(ee,{className:`tool-disclosure`,"aria-hidden":`true`})]}),(0,K.jsx)(`pre`,{className:`details-body tool-evidence`,children:e})]})}function bR(e,t,n={sessionId:``}){if(t?.forkSnapshotToolResult)return null;let{sessionId:r,subagents:i=[],records:a=[],workflows:o=[],onInspectSubagent:s,liveState:c,defaultOpen:l=!1,observed:u=!0}=n,d=e.name||``,f=cR(e.arguments),p=sR(t?.details),m=uR(t,c),h=!u&&m===`running`?`unknown`:m;if(d===`subagent_spawn`)return(0,K.jsx)(xR,{sessionId:r,id:typeof p.id==`string`?p.id:void 0,title:String(p.title||f.name||`subagent`),body:t?.content||String(f.prompt||e.arguments),activity:i.find(e=>e.id===p.id),saved:a.find(e=>e.id===p.id),spawnFailed:t?.isError===!0,observed:u,defaultOpen:l,onInspect:s});if(d.startsWith(`subagent`)){let n=d.replaceAll(`_`,` `).replace(/^subagent /u,``),r=i.find(e=>e.id===f.id)??a.find(e=>e.id===f.id);return(0,K.jsx)(yR,{family:`subagent`,defaultOpen:l,title:`${n[0]?.toUpperCase()||``}${n.slice(1)} · ${r?.title||f.id||`Subagent`}`,body:t?.content||e.arguments,status:h})}if(d===`workflow`){let n=typeof f.script==`string`?f.script:e.arguments,i=String(p.name||n.match(/\bname:\s*["'`]([^"'`]+)["'`]/u)?.[1]||`unnamed`),a=sR(p.agents),c=o.find(e=>e.runId===p.runId)?.children,l=[p.runId,p.status,a.total?`${Number(a.total)-Number(a.running||0)}/${a.total} agents`:``].filter(Boolean).join(` · `);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(yR,{family:`workflow`,title:`Workflow · ${i}`,meta:l,body:t?.content||n,status:h}),(0,K.jsx)(SR,{sessionId:r,tasks:c,observed:u,onInspect:s})]})}return d.startsWith(`workflow`)?(0,K.jsx)(yR,{family:`workflow`,title:d.replaceAll(`_`,` `),meta:String(f.runId||``),body:t?.content||e.arguments,status:h}):null}function xR({sessionId:e,id:t,title:n,body:r,activity:i,saved:a,spawnFailed:o,onInspect:s,defaultOpen:c=!1,observed:l=!0}){let{t:u}=cr(),d=i?.outcome===`interrupted`?`interrupted`:i?.status??(a?.state===`running`?void 0:a?.state),f=!l&&(d===`running`||!d&&!o)?`unknown`:d,p=u(f===`unknown`?`toolState_unknown`:f?`subagentState_${f}`:o?`subagentSpawnFailed`:t?`subagentStateUnavailable`:`subagentStarting`);return(0,K.jsxs)(`section`,{className:`activity-card subagent subagent-activity`,children:[(0,K.jsx)(AL,{identity:`${e}:${t??n}`,title:n,state:f,label:p,onInspect:t&&s?()=>s(t):void 0}),(c||o)&&(0,K.jsxs)(`details`,{className:`subagent-receipt`,open:c||void 0,children:[(0,K.jsx)(`summary`,{children:u(`subagentSpawnReceipt`)}),(0,K.jsx)(`p`,{children:u(`subagentSpawnReceiptHint`)}),(0,K.jsx)(`pre`,{className:`details-body tool-evidence`,children:r})]})]})}function SR({sessionId:e,tasks:t,observed:n,onInspect:r}){let{t:i}=cr();return(0,K.jsxs)(K.Fragment,{children:[t?.items.map(t=>{let a=t.outcome===`interrupted`?`interrupted`:!n&&t.status===`running`?`unknown`:t.status;return(0,K.jsx)(AL,{identity:`${e}:${t.id}`,title:t.title,state:a,label:i(a===`unknown`?`toolState_unknown`:`subagentState_${a}`),onInspect:r?()=>r(t.id,`workflows`):void 0},t.id)}),!!t?.omitted&&(0,K.jsx)(`p`,{className:`inspection-note`,children:i(`subagentListTruncated`,{count:t?.omitted})})]})}function CR({body:e,duration:t,status:n,level:r,defaultOpen:i,truncated:a,source:o}){let{t:s}=cr(),c=n===`running`,[l,u]=(0,_.useState)(i),[d,f]=(0,_.useState)();(0,_.useEffect)(()=>u(i),[i]);let p=t===void 0?``:sj(0,t),m=_R(e),h=[n===`unknown`?s(`toolState_unknown`):c?r?s(`thinkingActiveLevel`,{level:r}):s(`thinkingActive`):s(`thinkingDone`),p].filter(Boolean).join(` · `);return(0,K.jsxs)(`details`,{className:`message-details tool-line thinking-line ${n}`,open:l,onToggle:e=>u(e.currentTarget.open),children:[(0,K.jsxs)(`summary`,{"aria-label":[h,m].filter(Boolean).join(` · `),title:m,children:[(0,K.jsx)(`span`,{className:`tool-icon`,"aria-hidden":`true`,children:(0,K.jsx)(Le,{})}),(0,K.jsx)(`span`,{className:`details-title`,children:(0,K.jsx)(`span`,{className:`tool-summary`,children:m||h})}),(0,K.jsx)(ee,{className:`tool-disclosure`,"aria-hidden":`true`})]}),l&&(0,K.jsx)(`div`,{className:`details-body thinking-evidence`,children:a&&o&&!c?(0,K.jsx)(BL,{...o,preview:e,markdown:!0,purpose:`thinking`,fullText:d,onComplete:f}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Dk,{children:e}),a&&(0,K.jsx)(`p`,{className:`evidence-warning`,children:s(`thinkingPreviewOnly`)})]})})]})}function wR({content:e,editable:t,copyRequiresFull:n=!1,timestamp:r,onResend:i,onRegenerate:a,onFork:o,canFork:s=!1,forkPending:c=!1}){let{t:l}=cr(),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(0),v=(0,_.useRef)(void 0);(0,_.useEffect)(()=>()=>{g.current+=1,window.clearTimeout(v.current)},[]);let[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(e),[C,w]=(0,_.useState)(!1),T=(0,_.useRef)(null),E=(0,_.useId)();(0,_.useEffect)(()=>{y&&T.current?.focus()},[y]);let D=async()=>{if(!(C||!x.trim()||!t)){w(!0);try{await i(x.trim())&&b(!1)}finally{w(!1)}}};if(y)return(0,K.jsxs)(`div`,{className:`message-editor`,children:[(0,K.jsx)(`textarea`,{ref:T,value:x,"aria-label":l(`editMessage`),"aria-describedby":E,readOnly:C,onChange:e=>S(e.target.value),onKeyDown:e=>{e.nativeEvent.isComposing||C||(e.key===`Escape`&&b(!1),e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),D()))}}),(0,K.jsx)(`p`,{className:`message-edit-hint`,id:E,children:l(`editMessageHint`)}),(0,K.jsxs)(`div`,{className:`message-edit-actions`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:C,onClick:()=>b(!1),children:l(`cancel`)}),(0,K.jsx)(`button`,{type:`button`,className:`confirm`,disabled:C||!x.trim()||!t,onClick:()=>void D(),children:l(`confirmEdit`)})]})]});let O=oj(r);return(0,K.jsxs)(`div`,{className:`message-actions${f?` copy-failed`:``}`,children:[O&&(0,K.jsx)(`time`,{dateTime:r,children:O}),o&&(0,K.jsx)(`button`,{type:`button`,"aria-label":l(`forkMessage`),title:l(c?`forkSessionPending`:s?`forkMessageHint`:`forkSessionUnavailable`),disabled:!s||c,onClick:()=>void o(),children:(0,K.jsx)(Ae,{"aria-hidden":`true`})}),t&&(0,K.jsx)(`button`,{type:`button`,"aria-label":l(`editMessage`),title:l(`editMessage`),onClick:()=>{S(e),b(!0)},children:(0,K.jsx)(at,{})}),a&&(0,K.jsx)(`button`,{type:`button`,"aria-label":l(`regenerateMessage`),title:l(`regenerateMessageHint`),disabled:!s||c,onClick:()=>void a(),children:(0,K.jsx)(ft,{"aria-hidden":`true`})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":l(u?`copiedMessage`:`copyMessage`),title:l(n?`messageCopyRequiresFull`:u?`copiedMessage`:`copyMessage`),disabled:m||n,onClick:()=>{let t=++g.current;window.clearTimeout(v.current),h(!0),d(!1),p(!1),wd(e).then(e=>{t===g.current&&(h(!1),d(e),p(!e),e&&(v.current=window.setTimeout(()=>d(!1),1200)))})},children:u?(0,K.jsx)(I,{}):(0,K.jsx)(oe,{})}),f&&(0,K.jsx)(`span`,{className:`copy-error`,role:`status`,children:l(`copyFailed`)})]})}function TR({message:e,fullSubagent:t=!1,sessionId:n,onInspectSubagent:r}){let{t:i}=cr();if(e.customType===`openpi-web-command-feedback`)return(0,K.jsxs)(`div`,{className:`command-feedback`,role:`status`,children:[e.content,e.truncation?.truncated&&(0,K.jsx)(`p`,{children:i(`commandFeedbackTruncated`)})]});let a=sR(e.details);if(e.customType===`openpi-setup-request`||e.customType===`openpi-setup-closed`)return(0,K.jsx)(vR,{body:e.content,icon:(0,K.jsx)(It,{}),name:i(`configureOpenPi`),summary:e.customType===`openpi-setup-closed`?aj(e.content):void 0,status:`unknown`});if(e.customType===`subagent-result`){let o=Array.isArray(a.results)?a.results.map(sR):[a],s=new Set(uj([e]).map(e=>e.id));return(0,K.jsxs)(`section`,{className:`activity-card subagent subagent-activity`,children:[o.map(e=>{let t=typeof e.id==`string`?e.id:``,a=e.outcome===`interrupted`?`interrupted`:e.status===`done`||e.status===`error`||e.status===`running`?e.status:`unknown`;return(0,K.jsx)(AL,{identity:`${n}:${t}`,title:String(e.title||t||i(`subagentDetails`)),state:a,label:i(a===`unknown`?`unknownState`:`subagentState_${a}`),onInspect:r&&s.has(t)?()=>r(t):void 0},t||JSON.stringify(e))}),(0,K.jsxs)(`details`,{className:`subagent-result-evidence`,open:t||void 0,children:[(0,K.jsx)(`summary`,{children:i(`subagentBackgroundResult`,{count:o.length})}),(0,K.jsx)(`pre`,{className:`details-body tool-evidence`,children:!t&&typeof a.displayContent==`string`?a.displayContent:e.content})]})]})}if(e.customType===`workflow-result`){let t=Array.isArray(a.entries)?a.entries.map(sR):[],n=t.map(e=>lR(e.status)),r=n.includes(`error`)?`error`:n.includes(`warn`)?`warn`:n.length>0&&n.every(e=>e===`done`)?`done`:n.includes(`running`)?`running`:`unknown`,i=t.length?t.map(e=>`${e.status===`completed`?`✓`:`✗`} ${String(e.summary||e.runId||`run`)}${e.resultPreview?`\nResult: ${e.resultPreview}`:``}`).join(` +`):e.content;return(0,K.jsx)(yR,{family:`workflow`,title:t.length>1?`Workflow results · ${t.length} runs`:`Workflow ${String(t[0]?.runId||`result`)}`,body:i,status:r})}return null}function ER(e){return[``,`[]`,`{}`,`null`].includes(e.trim())}function DR(e){if(e.role===`toolResult`&&e.toolCallId)return`tool-result-${e.toolCallId}`;if(e.timestamp!==void 0)return`message-${e.role}-${e.timestamp}`}function OR(e){return[`assistant`,`toolResult`].includes(e.role??``)&&!e.truncation?.truncated?JSON.stringify(e):null}function kR(e){return JSON.stringify([e.role,e.content,(e.parts??[]).filter(t=>e.role!==`user`||t.type!==`text`).map(t=>t.type===`image`?[t.type,t.mimeType,e.role===`user`?void 0:t.name]:t.type),e.stopReason,e.errorMessage,e.toolCallId])}function AR(e){return e.role===`user`?kR(e):JSON.stringify({...e,timestamp:void 0})}var jR=new WeakMap;function MR(e,t){let n=jR.get(e),r=n?.get(t);if(r&&r.length===e.length&&r.head===e[0]&&r.tail===e[e.length-1])return r.projection;let i=new Map(e.map(e=>[e.id,e])),a=new Map;for(let t of e){let e=t.message&&OR(t.message);if(!e)continue;let n=a.get(e)??[];n.push(t),a.set(e,n)}let o=e.flatMap(e=>{if(e.forkSnapshotBoundary)return[{key:e.id,entryId:e.id,timestamp:e.timestamp,forkSnapshotBoundary:!0,message:{role:`custom`,content:``}}];if(e.type===`compaction`)return[{key:e.id,entryId:e.id,timestamp:e.timestamp,compaction:!0,message:{role:`custom`,content:``}}];if(`turnTiming`in e&&e.turnTiming&&e.turnTiming.sessionId===t)return[{key:e.id,timestamp:e.timestamp,timing:e.turnTiming,message:{role:`custom`,content:``}}];if(e.type!==`message`||!e.message)return[];let n=DL(e.message),r=OL(e,e=>i.get(e));return kL(e.message,r)?[]:[{key:e.id,entryId:e.id,timestamp:e.timestamp,message:n}]}),s=new Map,c=new Map;o.forEach((e,t)=>{if(e.entryId&&s.set(e.entryId,t),e.timing||e.compaction||e.forkSnapshotBoundary)return;let n=DR(e.message)??e.entryId??e.key,r=c.get(n)??[];r.push(t),c.set(n,r)});let l=new Map,u=0;for(let t of e){if(t.message?.role!==`custom`||t.message.truncation?.truncated)continue;let e=AR(t.message),n=l.get(e)??[];n.push(u),l.set(e,n),u++}let d=o.map(e=>({identity:DR(e.message),signature:AR(e.message)})),f=new Map,p=new Map;d.forEach((e,t)=>{let n=p.get(e.signature)??[];if(n.push(t),p.set(e.signature,n),e.identity===void 0)return;let r=f.get(e.identity)??[];r.push(t),f.set(e.identity,r)});let m=new Map(e.map((e,t)=>[e.id,t])),h=o.filter(e=>e.message.role===`user`).map(e=>({key:e.entryId??e.key,position:m.get(e.entryId??e.key),parentId:i.get(e.entryId??e.key)?.parentId,signature:kR(e.message)})),g=new Map;for(let e of h){let t=g.get(e.signature)??[];t.push(e),g.set(e.signature,t)}let _={nativeById:i,exactNative:a,baseEntries:o,indexById:s,lookupIndexes:c,customIndexes:l,nativeByIdentity:f,nativeByLegacySignature:p,nativeMessages:d,promptCandidates:h,promptsBySignature:g,commandInputs:new Map(o.flatMap(e=>e.message.role===`user`&&e.message.customType===`openpi-web-command-input`&&e.message.commandId?[[e.message.commandId,e.entryId??e.key]]:[])),persistedPositions:m};return n||(n=new Map,jR.set(e,n)),n.set(t,{projection:_,length:e.length,head:e[0],tail:e[e.length-1]}),_}function NR(e,t){if(!e)return-1;for(let n of e)if(!t.has(n))return n;return-1}function PR(e,t){let n=[e.timingKey,e.key,e.entryId,DR(e.message)];for(let e of n){if(!e)continue;let n=t[e];if(n!==void 0)return n}}function FR(e,t,n){let r=e.selectedSession,i=MR(r?.entries??[],r?.id);for(let e of n.keys())i.nativeById.has(e)||n.delete(e);let a=new Map;for(let e of t){if(e.optimistic)continue;let t=OR(e.message);if(!t)continue;let n=a.get(t)??[];n.push(e),a.set(t,n)}let o=new Set(n.values());for(let[e,t]of i.exactNative){let r=a.get(e);if(t.length!==1||r?.length!==1)continue;let s=t[0].id,c=r[0].key;n.has(s)||o.has(c)||i.nativeById.has(c)||(n.set(s,c),o.add(c))}let s=new Map;for(let e of t){let t=DR(e.message)??e.key,n=i.lookupIndexes.get(t);if(n)for(let t of n)s.set(t,e.key)}let c=new Set(t.flatMap(e=>e.optimistic?.projectedEntryId?[e.optimistic.projectedEntryId]:[])),l=[],u=[],d=e.selectedExecution?.sessionId===r?.id&&e.selectedExecution?.sessionPath===r?.path?e.selectedExecution:void 0,f=d?.pendingFollowUps??0,p=Math.max(0,t.filter(e=>e.optimistic?.admitted&&!e.optimistic.projectedEntryId&&!i.commandInputs.has(e.optimistic.commandId)).length-f),m=0,h=new Set,g=new Set,_=new Set,v=[];for(let e of t){if(e.optimistic?.projectedEntryId)continue;if(e.message.role===`custom`&&!e.message.truncation?.truncated){let t=AR(e.message),n=NR(i.customIndexes.get(t),g);if(n>=0){g.add(n);continue}}let n=e.optimistic?.commandId??(e.key.startsWith(`optimistic-`)?e.key.slice(11):void 0),a=n?i.commandInputs.get(n):void 0;if(a){e.optimistic&&l.push({key:e.key,entryId:a});continue}let o=DL(e.message);if(o.role===`user`&&e.optimistic){let t=e.optimistic.afterEntryId===null?-1:i.persistedPositions.get(e.optimistic.afterEntryId),n=!e.optimistic.admitted||m>=p?void 0:i.promptsBySignature.get(kR(o))?.find(n=>n.position!==void 0&&(t===void 0?n.parentId===e.optimistic?.afterEntryId:n.position>t)&&!c.has(n.key));if(n){c.add(n.key),l.push({key:e.key,entryId:n.key}),m++;continue}}else{let e=o.role===`user`?t.find(e=>e.optimistic?.admitted&&!e.optimistic.projectedEntryId&&!h.has(e.key)&&!l.some(t=>t.key===e.key)&&e.optimistic.sessionId===r?.id&&e.optimistic.sessionPath===r?.path&&kR(DL(e.message))===kR(o)):void 0;if(e){h.add(e.key);continue}let n=DR(o),a=AR(o),s=n===void 0?NR(i.nativeByLegacySignature.get(a),_):(i.nativeByIdentity.get(n)??[]).find(e=>!_.has(e)&&i.nativeMessages[e]?.signature===a)??-1;if(s>=0){_.add(s);continue}}let s={key:e.key,timingKey:e.key,timestamp:e.timestamp??new Date().toISOString(),message:o,optimistic:e.optimistic};o.role===`user`&&e.optimistic?u.push(s):v.push(s)}let y=new Map;for(let e of d?.queuedMessages??[])y.set(e,(y.get(e)??0)+1);let b=u.filter(e=>{if(!e.optimistic?.admitted||e.optimistic.commandId===d?.activeTurn?.commandId)return!0;let t=y.get(e.message.content)??0;return!t||(y.set(e.message.content,t-1),!1)}),x=new Map(t.flatMap(e=>e.optimistic?.projectedEntryId?[[e.optimistic.projectedEntryId,e.key]]:[]));for(let e of l)x.set(e.entryId,e.key);let S=i.baseEntries,C=(e,t)=>{S===i.baseEntries&&(S=i.baseEntries.slice()),S[e]=t};for(let[e,t]of s){let n=S[e];!n||n.timingKey===t||C(e,{...n,timingKey:t})}for(let[e,t]of n){let n=i.indexById.get(e);if(n===void 0)continue;let r=S[n];!r||r.key===t||C(n,{...r,key:t})}for(let[e,t]of x){let n=i.indexById.get(e);if(n===void 0)continue;let r=S[n];!r||r.key===t||C(n,{...r,key:t})}return{entries:S.concat(v,b),projectedPrompts:l}}function IR(e){let[t,n]=(0,_.useState)(()=>({row:e,since:Date.now()}));return(0,_.useEffect)(()=>{if(e?.key===t.row?.key)return;if(!e||!t.row){n({row:e,since:Date.now()});return}let r=window.setTimeout(()=>n({row:e,since:Date.now()}),Math.max(0,1e3-(Date.now()-t.since)));return()=>window.clearTimeout(r)},[e,t]),!e||e.key===t.row?.key?e:t.row??e}function LR({rows:e,active:t}){let{t:n}=cr(),r,[i,a]=(0,_.useState)(t),o=e.length===1,s=(0,_.useRef)(o),c=(0,_.useRef)(null),l=(0,_.useRef)(!0),u=(0,_.useRef)(0),d=(0,_.useRef)(void 0),[f,p]=(0,_.useState)({above:!1,below:!1}),m=(0,_.useCallback)(()=>{let e=c.current;if(!e)return;let t=e.scrollTop>1,n=e.scrollHeight-e.clientHeight-e.scrollTop>1;p(e=>e.above===t&&e.below===n?e:{above:t,below:n})},[]);(0,_.useEffect)(()=>a(t),[t]),(0,_.useLayoutEffect)(()=>{let n=c.current,r=s.current&&!o;s.current=o,!(!n||o||!i||e.length===0)&&(!r&&n.scrollTop!==u.current&&n.scrollHeight-n.clientHeight-n.scrollTop>24&&(l.current=!1),r&&!l.current&&(n.scrollTop=u.current),t&&l.current&&(n.scrollTop=n.scrollHeight,u.current=n.scrollTop),m())},[e,t,i,o,m]),(0,_.useEffect)(()=>{let e=c.current,n=e?.firstElementChild;if(!e||!n||o||typeof ResizeObserver>`u`)return;let r=new ResizeObserver(()=>{i&&t&&l.current&&(e.scrollTop=e.scrollHeight,u.current=e.scrollTop),m()});return r.observe(e),r.observe(n),()=>r.disconnect()},[t,i,o,m]);let h=e.filter(e=>e.processType===`thinking`).length,g=e.filter(e=>e.processType===`tool`).length,v=e.filter(e=>e.processType===`activity`).length,y=[h?n(`processThinkingCount`,{count:h}):``,g?n(`processToolCount`,{count:g}):``,v?n(`processActivityCount`,{count:v}):``].filter(Boolean),b=[...e].reverse().find(e=>e.processStatus===`running`),x=IR(b),S=x?.processPreview??(t?[...e].reverse():e).find(e=>e.processPreview)?.processPreview,C=x?.processToolName&&[`read`,`write`,`edit`].includes(x.processToolName)?S?.slice(Math.max(S.lastIndexOf(`/`),S.lastIndexOf(`\\`))+1):S,w=e.some(e=>e.error||e.processStatus===`error`),T=b?`running`:w?`error`:e.some(e=>e.processStatus===`warn`)?`warn`:e.every(e=>e.processStatus===`done`)?`done`:`unknown`,E=e.flatMap(e=>e.processToolName?[e.processToolName]:[]),D=[...new Set(E.map(e=>iL(e).action))],O=D.map(e=>n(`toolActionGroup_${e}`)),k=D.length?n(`toolGroup_${T===`done`?`done`:T===`running`?`running`:`unknown`}`,{actions:O.join(n(`toolGroupSeparator`))}):n(T===`running`?`processRunning`:`processDetails`),A=x?.processToolName?aL(n,x.processToolName,`running`):x?.processType===`thinking`?n(`thinkingActive`):k,j=x?.processToolName??E[0],M=x?.processType===`thinking`?Le:j?iL(j).Icon:It;return(0,K.jsxs)(`details`,{className:`process-sequence ${o?`single-process `:``}${T}`,open:o||i,"data-status":T,"data-running":T===`running`?`true`:void 0,"data-history-entry":e[0]?.key,onToggle:e=>{o||a(e.currentTarget.open)},children:[(0,K.jsxs)(`summary`,{hidden:o,"aria-label":[A,b?S:``,...y].filter(Boolean).join(` · `),children:[(0,K.jsx)(`span`,{className:`tool-icon`,"aria-hidden":`true`,children:(0,K.jsx)(M,{})}),(0,K.jsx)(`span`,{className:`process-sequence-title`,title:[O.join(n(`toolGroupSeparator`)),...y].filter(Boolean).join(` · `),children:(0,K.jsx)(`strong`,{children:A})}),S&&(b||!D.length)&&(0,K.jsx)(`span`,{className:`process-sequence-preview`,title:S,children:C}),(0,K.jsx)(`span`,{className:`process-sequence-counts`,children:y.join(` · `)}),(0,K.jsx)(ee,{className:`tool-disclosure`,"aria-hidden":`true`}),(0,K.jsx)(dR,{status:T})]}),(0,K.jsx)(`section`,{ref:c,className:`process-sequence-scroll`,"aria-label":o?void 0:[n(`processDetails`),...y].join(` · `),tabIndex:o?void 0:0,"data-scroll-above":f.above||void 0,"data-scroll-below":f.below||void 0,onScrollCapture:e=>{let t=e.target;if(o&&t instanceof HTMLElement&&t.classList.contains(`thinking-evidence`)){let n=t.getBoundingClientRect().top-e.currentTarget.getBoundingClientRect().top+t.scrollTop,r=n>u.current;u.current=n,l.current=(l.current||r)&&t.scrollHeight-t.clientHeight-t.scrollTop<=24}},onScroll:e=>{if(o)return;let t=e.currentTarget,n=t.scrollTop>u.current;u.current=t.scrollTop,l.current=(l.current||n)&&t.scrollHeight-t.clientHeight-t.scrollTop<=24,m()},onWheel:e=>{!e.defaultPrevented&&!e.ctrlKey&&!e.metaKey&&e.deltaY<0&&(o||KR(e.nativeEvent,e.currentTarget))&&(l.current=!1)},onKeyDown:e=>{let t=e.target;!e.defaultPrevented&&!e.altKey&&!e.metaKey&&(!e.ctrlKey||e.key===`Home`)&&([`ArrowUp`,`PageUp`,`Home`].includes(e.key)||e.key===` `&&e.shiftKey)&&t instanceof HTMLElement&&!t.isContentEditable&&!t.closest(`input, textarea, select`)&&!(e.key===` `&&t.closest(`button, summary`))&&(o||KR(e.nativeEvent,e.currentTarget))&&(l.current=!1)},onTouchStart:e=>{d.current=e.touches[0]?.clientY},onTouchMove:e=>{let t=e.touches[0]?.clientY;t!==void 0&&d.current!==void 0&&t>d.current&&(o||KR(e.nativeEvent,e.currentTarget))&&(l.current=!1),d.current=t},children:(0,K.jsx)(`div`,{className:`process-sequence-body`,children:e.map(e=>{e.processType===`thinking`?r=e.processMessageKey:e.processMessageKey!==r&&(r=void 0);let t=r!==void 0&&e.processType!==`thinking`;return(0,K.jsx)(`div`,{className:`process-step ${o?`single-tool-step `:``}${t?`thought-tool-step `:``}${e.processStatus??`unknown`}`,"data-status":e.processStatus??`unknown`,children:e.content},e.key)})})})]})}function RR(e,t){let n=[];for(let t of e){let e=n.at(-1),r=t.kind===`process`;r&&e?.process?e.rows.push(t):n.push({process:r,rows:[t]})}return n.flatMap((e,r)=>{let i=`${e.process?`process`:`rows`}-${e.rows[0]?.key}`;return e.process?(0,K.jsx)(LR,{rows:e.rows,active:t&&r===n.length-1},i):e.rows.map(e=>(0,K.jsx)(_.Fragment,{children:e.content},e.key))})}function zR({rows:e,timing:t,active:n,timedTurn:r}){let{t:i}=cr(),a=(0,_.useId)(),[o,s]=(0,_.useState)(t?.outcome!==`completed`),c=(0,_.useRef)(t?.outcome);(0,_.useEffect)(()=>{c.current!==t?.outcome&&t?.outcome===`completed`&&s(!1),c.current=t?.outcome},[t?.outcome]);let l=!!(t||r),u=[];for(let r of e){if(r.content===null)continue;let e=t?.resultEntryId?r.responseEntryId===t.resultEntryId&&r.final!==!1:!n&&r.final,i=r.kind!==`prompt`&&!e,a=u.at(-1);i&&a?.foldable?a.rows.push(r):u.push({foldable:i,rows:[r]})}let d=u.filter(e=>e.foldable),f=e=>e===0?a:`${a}-${e}`,p=d.length>0,m=t?(0,K.jsx)(NL,{timing:t}):r?(0,K.jsx)(ML,{elapsedMs:r.elapsedMs},JSON.stringify([r.sessionId,r.sessionPath,r.commandId,r.epoch,r.startedAt])):null;return(0,K.jsxs)(K.Fragment,{children:[l&&(0,K.jsxs)(`header`,{className:`turn-duration`,"data-outcome":t?.outcome,children:[p?(0,K.jsxs)(`button`,{type:`button`,className:`turn-duration-toggle`,"aria-expanded":o,"aria-controls":d.map((e,t)=>f(t)).join(` `),onClick:()=>s(e=>!e),children:[m,(0,K.jsx)(ee,{"aria-hidden":`true`})]}):m,t&&t.outcome!==`completed`&&(0,K.jsx)(`span`,{className:`turn-duration-outcome`,children:i(`turnElapsedOutcome_${t.outcome}`)})]}),l?u.map(e=>e.foldable?(0,K.jsx)(`div`,{className:`turn-response-body`,id:f(d.indexOf(e)),hidden:!o,children:RR(e.rows,n&&e===d.at(-1))},e.rows[0].key):(0,K.jsx)(_.Fragment,{children:RR(e.rows,!1)},e.rows[0].key)):RR(e,n)]})}function BR({id:e,rows:t,active:n,observed:r=!0,changes:i,session:a,timedTurn:o,onReviewTurn:s}){let{t:c}=cr(),l=[...t].reverse().find(e=>e.outcome||e.timing),u=l?.timing?.outcome??l?.outcome,d=t.some(e=>e.kind===`response`),f=t.find(e=>e.kind===`prompt`),p=!!(f?.promptEntryId&&t.some(e=>e.commandHandledInputId===f.promptEntryId&&e.commandHandledCommandId===f.promptCommandId)),m=t.some(e=>e.forkSnapshotBoundary),h=m?`forked`:n?r?`running`:`unknown`:u===`failed`?`failed`:u===`interrupted`||u===`cancelled`?`interrupted`:u===`completed`||d||p?`complete`:`waiting`,g=h===`failed`?`error`:h===`interrupted`?`warning`:h===`running`?`accent`:h===`complete`?`success`:`neutral`,v=c(h===`unknown`?`toolState_unknown`:`turnState_${h}`),y=t.some(e=>e.timing&&e.timing.commandId===o?.commandId&&e.timing.epoch===o?.epoch)?void 0:o,b=[],x=[],S=0,C=(e,t=!1)=>{b.push((0,K.jsx)(zR,{rows:x,timing:e,active:n&&t,timedTurn:t?y:void 0},`run-${S++}`)),x=[]};for(let e of t)e.kind===`prompt`?x.length?x.push(e):b.push((0,K.jsx)(_.Fragment,{children:e.content},e.key)):e.timing?C(e.timing):x.push(e);(x.length||y)&&C(void 0,!0);let w=!!(o||t.some(e=>e.timing));return(0,K.jsxs)(`section`,{className:`conversation-turn${e===0?` prelude`:``}`,"data-turn":e,children:[e>0&&h!==`complete`&&(!w||m)&&(0,K.jsxs)(`header`,{className:`turn-heading`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:c(`turnLabel`,{number:e})}),(0,K.jsxs)(`span`,{className:`turn-state ${h}`,children:[(0,K.jsx)(EL,{variant:g,label:v,isPulsing:h===`running`,icon:h===`failed`||h===`interrupted`?(0,K.jsx)(Lt,{"aria-hidden":`true`}):h===`forked`?(0,K.jsx)(Ae,{"aria-hidden":`true`}):void 0}),v]})]}),b,i&&a&&(0,K.jsx)(XL,{changes:i,onReview:s},`${a.id}:${a.path}:${i.promptEntryId}`)]})}function VR(e,t,n,r){let i=new Map;for(let t=0;t{if(!t)return;let r=i.get(t);if(!(r===void 0||r>=n)){for(let t=r+1;te.rows.some(e=>e.promptCommandId===n||r?.promptEntryId&&e.promptEntryId===r.promptEntryId)):void 0,l=s.length-1;for(;l>=0&&s[l].id!==0&&!s[l].rows.some(e=>e.kind===`prompt`&&!e.pendingPrompt);)l--;return{turns:s,activeTurn:c?.id??s[l]?.id}}function HR(e,t,n,r,i,a,o,s=!0){let{turns:c,activeTurn:l}=VR(e,t,n,a);return c.map(e=>(0,K.jsx)(BR,{id:e.id,rows:e.rows,active:t&&e.id===l&&!e.rows.some(e=>e.forkSnapshotBoundary),observed:s,changes:r?.get(e.rows.find(e=>e.kind===`prompt`&&!e.pendingPrompt)?.promptEntryId??``),session:i,timedTurn:t&&e.id===l&&!e.rows.some(e=>e.forkSnapshotBoundary)?a:void 0,onReviewTurn:o},`turn-group-${e.rows[0]?.key}`))}function UR(e,t,n){let r=e.getBoundingClientRect(),i=r.top,a=Array.from(e.querySelectorAll(`[data-history-entry], [data-history-message], [data-history-result]`)).filter(t=>{let n=t.getBoundingClientRect(),i=Math.max(n.top,r.top),a=Math.min(n.bottom,r.bottom);for(let n=t;n&&n!==e;n=n.parentElement){if(n.hidden||n instanceof HTMLDetailsElement&&!n.open&&n!==t&&!n.querySelector(`:scope > summary`)?.contains(t))return!1;if(n===t)continue;let e=getComputedStyle(n);if(!/^(auto|scroll|overlay|hidden|clip)$/.test(e.overflowY))continue;let r=n.getBoundingClientRect();i=Math.max(i,r.top),a=Math.min(a,r.bottom)}return a>i}),o=a.find(e=>!a.some(t=>t!==e&&e.contains(t))),s=o?.dataset.historyResult??o?.dataset.historyEntry??o?.dataset.historyMessage,c=o?.dataset.historyResult??o?.dataset.historyMessage,l=n?.entries.find(e=>e.id===c||e.id===s)?.id;if(!l&&s)for(let e of n?.entries??[])s.startsWith(`${e.id}-`)&&(!l||e.id.length>l.length)&&(l=e.id);return{key:l?s:void 0,entryId:l,offset:(o?.getBoundingClientRect().top??i)-i,scrollTop:e.scrollTop,pinned:t}}function WR(e,t){let n=!1;for(let r=e.parentElement;r&&r!==t;r=r.parentElement)if(r instanceof HTMLDetailsElement&&(r.open=!0),r.classList.contains(`turn-response-body`)&&r.hidden){let e=Array.from(t.querySelectorAll(`button[aria-controls]`)).find(e=>e.getAttribute(`aria-controls`)?.split(` `).includes(r.id));e&&(e.click(),n=!0)}return n}function GR(e,t,n){if(e.scrollIntoView?.({block:`nearest`,inline:`nearest`,behavior:`instant`}),n){t.scrollTop=n.scrollTop;for(let r=e.parentElement;r&&r!==t;r=r.parentElement)!/^(auto|scroll|overlay)$/.test(getComputedStyle(r).overflowY)||r.scrollHeight<=r.clientHeight||(r.scrollTop+=e.getBoundingClientRect().top-t.getBoundingClientRect().top-n.offset)}return Math.max(0,t.scrollTop+e.getBoundingClientRect().top-t.getBoundingClientRect().top-(n?.offset??24))}function KR(e,t){for(let n of e.composedPath()){if(n===t)return!0;if(!(n instanceof HTMLElement))continue;let e=getComputedStyle(n);if(/^(auto|scroll|overlay)$/.test(e.overflowY)&&(n.scrollTop>0||/^(contain|none)$/.test(e.overscrollBehaviorY)))return!1}return!1}function qR(e){let{t}=cr(),n=(0,_.useRef)(null),r=(0,_.useRef)(null),i=(0,_.useRef)(!0),a=(0,_.useRef)(0),o=(0,_.useRef)(void 0),s=(0,_.useRef)(0),c=(0,_.useRef)(e.readingRestorePending);c.current=e.readingRestorePending;let[l,u]=(0,_.useState)(!1),d=(0,_.useRef)(null),f=e.activityObserved!==!1&&e.resultExposureEnabled!==!1,p=(0,_.useCallback)(()=>{d.current?.abort(),d.current=null},[]),m=(0,_.useRef)(void 0),h=(0,_.useRef)(e.scrollToBottom),g=(0,_.useRef)(null),v=(0,_.useMemo)(()=>e.readingCache??new Map,[e.readingCache]),y=e.historyNavigation,b=y?JSON.stringify([y.sessionId,y.sessionPath,y.entryId,y.revision]):null,x=(0,_.useRef)(null),[S,C]=(0,_.useState)(null),T=oR(e.snapshot.selectedSession,{onAnchorChange:e.onHistoryAnchorChange,onRefresh:e.onRefreshHistory,preload:e.activityObserved!==!1&&e.resultExposureEnabled!==!1,beforePrepend:()=>{let e=n.current;e&&(g.current={...UR(e,!1,D.current),scrollHeight:e.scrollHeight},i.current=!1)}},v,y),E=T.session,D=(0,_.useRef)(E);D.current=E;let O=E?.id,k=E?.path,A=E?.cwd,j=S&&S.sessionId===O&&S.sessionPath===k?S.entryId:void 0,M=JSON.stringify([O,k]),N=JSON.stringify([e.snapshot.selectedSession?.id,e.snapshot.selectedSession?.path,e.snapshot.selectedSession?.history?.leafEntryId??e.snapshot.selectedSession?.entries.at(-1)?.id]);(0,_.useLayoutEffect)(()=>(f||p(),p),[N,b,f,p]),(0,_.useLayoutEffect)(()=>{let e=n.current;if(!e||!O||!k)return;let t=()=>{c.current||CL(v,M,{position:UR(e,i.current,D.current)})};window.addEventListener(`pagehide`,t);let r=()=>{document.visibilityState===`hidden`&&t()};return document.addEventListener(`visibilitychange`,r),()=>{window.clearTimeout(s.current),window.removeEventListener(`pagehide`,t),document.removeEventListener(`visibilitychange`,r),t()}},[M,v,O,k]);let P=(0,_.useRef)(M),[F,I]=(0,_.useState)({});(0,_.useLayoutEffect)(()=>{P.current!==M&&(P.current=M,I({}))},[M]);let L=(0,_.useMemo)(()=>new Map((E?.entries??[]).flatMap(e=>e.turnChanges&&e.turnChanges.sessionId===E?.id?[[e.turnChanges.promptEntryId,e.turnChanges]]:[])),[E?.entries,E?.id]),R=(0,_.useRef)(T.reset),ee=T.hasNewer||T.verifying,z=cj(e.snapshot,E),B=e.snapshot.selectedExecution?.sessionId===E?.id&&e.snapshot.selectedExecution?.sessionPath===E?.path?e.snapshot.selectedExecution:void 0,V=z&&e.liveActiveTurn!==void 0?e.liveRunning:z&&e.liveRunning||(B?B.status===`running`:z&&e.snapshot.runtime.status===`running`),H=!ee&&V?B?B.retry:z?e.liveRetry??void 0:void 0:void 0,te=(0,_.useRef)({scope:M,keys:new Map});te.current.scope!==M&&(te.current={scope:M,keys:new Map});let{entries:ne,projectedPrompts:re}=(0,_.useMemo)(()=>FR({...e.snapshot,selectedSession:E},ee?[]:e.liveMessages.filter(e=>e.optimistic?e.optimistic.sessionId===E?.id&&e.optimistic.sessionPath===E?.path:z),te.current.keys),[e.snapshot,E,z,ee,e.liveMessages]);(0,_.useEffect)(()=>{E&&re.length>0&&e.onPromptProjection?.(E.id,E.path,re)},[E,re,e.onPromptProjection]),(0,_.useEffect)(()=>{let e=n.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{i.current&&(typeof e.scrollTo==`function`?e.scrollTo({top:e.scrollHeight,behavior:`instant`}):e.scrollTop=e.scrollHeight,a.current=e.scrollTop)});return t.observe(e),r.current&&t.observe(r.current),()=>t.disconnect()},[]);let{rows:ie,turns:ae}=(0,_.useMemo)(()=>{let n=uj(ne.map(e=>e.message)),r=hR(ne,V&&!ee),i=[...r.finalErrors].at(-1),a=-1;for(let e=ne.length-1;e>=0;e--)if(ne[e].message.role===`assistant`){a=e;break}let o=new Map,s,c=new Map,l=new Set,u=z?e.snapshot.runtime.liveTools??[]:[],d=B?.liveTools??[],f=ee?[]:[...u,...d.filter(e=>!u.some(t=>t.call.id===e.call.id))];ne.forEach(e=>{let{message:t}=e;t.role===`toolResult`&&t.toolCallId&&c.set(t.toolCallId,e),t.parts?.forEach(e=>{e.type===`toolCall`&&e.id&&![`ask_user`,`human_handoff`].includes(e.name)&&l.add(e.id)})});let p=[],m=0,h,g=-1,_=-1;for(let e=ne.length-1;e>=0;e--){if(ne[e]?.message.role===`user`){_=e;break}if(ne[e]?.message.role===`custom`&&ne[e]?.message.customType===`openpi-setup-request`)break}let v=new Set,y=-1;ne.forEach(({message:e},t)=>{e.role===`user`||e.role===`custom`&&e.customType===`openpi-setup-request`?(y>=0&&v.add(y),y=-1):e.role===`assistant`&&e.content.trim()&&(y=t)}),y>=0&&v.add(y);let b=ne.flatMap((u,d)=>{let y=u.message;if(u.forkSnapshotBoundary)return[{key:u.key,turn:m,kind:`custom`,forkSnapshotBoundary:!0,content:null}];if(u.timing)return[{key:u.key,turn:m,kind:`custom`,timing:u.timing,content:null}];if(u.compaction)return[{key:u.key,turn:m,kind:`custom`,content:(0,K.jsx)(PL,{compaction:{state:`completed`}})}];if(y.role===`custom`){if(y.customType===`openpi-web-command-handled`){let e=y.details;return e&&typeof e==`object`&&`inputEntryId`in e&&typeof e.inputEntryId==`string`?[{key:u.key,turn:m,kind:`custom`,commandHandledInputId:e.inputEntryId,commandHandledCommandId:`commandId`in e&&typeof e.commandId==`string`?e.commandId:void 0,content:null}]:[]}return y.display===!1||![`openpi-web-command-feedback`,`openpi-setup-request`,`openpi-setup-closed`,`subagent-result`,`workflow-result`].includes(y.customType??``)?[]:(y.customType===`openpi-setup-request`&&(h=void 0,g=-1,m++),[{key:u.key,turn:m,kind:`custom`,content:(0,K.jsx)(`article`,{className:`message-row assistant detail-only`,"data-history-entry":u.entryId??u.key,tabIndex:-1,children:(0,K.jsx)(`div`,{className:`message-content`,children:(0,K.jsx)(TR,{message:y,sessionId:O??``,onInspectSubagent:e.onInspectSubagent,fullSubagent:e.snapshot.preferences.subagentResultDisplay===`full`})})})}])}if(y.role===`user`){h=y.content,g=d,m++,p.push({entryId:u.entryId??u.key,title:Array.from((y.content||t(`attachedImage`)).replace(/\s+/g,` `).trim()).slice(0,240).join(``)});let n=u.entryId?JSON.stringify([O,k,u.entryId]):``,r=F[n],i=!!(y.truncation?.visibleText&&r===void 0);return[{key:u.key,turn:m,kind:`prompt`,pendingPrompt:!!u.optimistic,promptCommandId:u.optimistic?.commandId??y.commandId,promptEntryId:u.entryId,content:(0,K.jsxs)(`article`,{className:`message-row user`,id:`turn-${m}`,"data-history-entry":u.entryId??u.key,"data-history-highlighted":j&&u.entryId===j||void 0,tabIndex:-1,children:[(0,K.jsxs)(`div`,{className:`message-content`,children:[(0,K.jsx)($L,{message:y,sessionId:O,path:k,entryId:u.entryId}),(y.content||y.truncation?.visibleText)&&(u.entryId&&O&&k&&y.truncation?.visibleText?(0,K.jsx)(BL,{preview:y.content,sessionId:O,sessionPath:k,entryId:u.entryId,markdown:!1,fullText:r,onComplete:e=>I(t=>({...t,[n]:e}))},`${O}:${k}:${u.entryId}`):(0,K.jsx)(zL,{content:y.content}))]}),(0,K.jsx)(wR,{content:r??y.content,editable:z&&!V&&!!(e.forkAvailable&&e.onEdit&&u.entryId&&O&&k&&!u.optimistic)&&!i,copyRequiresFull:i,timestamp:u.timestamp,onResend:t=>e.onEdit&&u.entryId&&O&&k?e.onEdit({sessionId:O,sessionPath:k,entryId:u.entryId},t):Promise.resolve(!1),onFork:u.entryId&&O&&k&&e.onFork&&!u.optimistic?()=>e.onFork({sessionId:O,sessionPath:k,entryId:u.entryId}):void 0,canFork:z&&!V&&e.forkAvailable,forkPending:e.forkPending})]})}]}if(y.role===`assistant`){let b=p.at(-1);b&&y.content.trim()&&(b.reply=Array.from(y.content.replace(/\s+/g,` `).trim()).slice(0,240).join(``));let x=[],S=y.parts??[],C=y.webSearch??[],w=e=>Math.min(S.length,e.beforePartIndex??0),T=e=>{for(let[t,n]of C.entries()){if(w(n)!==e)continue;let r=n.status===`completed`?`done`:n.status===`failed`?`error`:`warn`;x.push({key:`${u.key}-native-search-${t}`,turn:m,kind:`process`,processType:`tool`,processMessageKey:u.key,processToolName:`web_search`,processPreview:n.query,processStatus:r,error:n.status===`failed`,content:(0,K.jsx)(`article`,{className:`message-row assistant detail-only`,"data-history-entry":`${u.entryId??u.key}-native-search-${t}-body`,"data-history-message":u.entryId??u.key,tabIndex:-1,children:(0,K.jsx)(`div`,{className:`message-content`,children:(0,K.jsx)(vR,{body:n.query,icon:(0,K.jsx)(je,{}),name:`web_search`,summary:n.query,status:r})})})})}},E=S.reduce((e,t,n)=>(t.type===`thinking`||t.type===`text`)&&!t.text.trim()?e:n,-1),D=S.reduce((e,t,n)=>t.type===`text`?n:e,-1),M=!!(u.entryId&&O&&k&&y.truncation?.visibleText),N=y.content,P=u.entryId?JSON.stringify([O,k,u.entryId]):``,L=F[P],R=!!(y.truncation?.visibleText&&L===void 0),te=(t,n,r)=>{M&&!r||!M&&!t.trim()||x.push({key:n,turn:m,kind:`response`,responseEntryId:u.entryId,final:r&&(y.stopReason===`stop`||y.stopReason===`length`),content:(0,K.jsxs)(`article`,{className:`message-row assistant response${r&&v.has(d)?` final-response`:``}`,"data-history-message":u.entryId??u.key,"data-history-highlighted":j&&u.entryId===j||void 0,tabIndex:-1,"data-history-entry":u.entryId?`${u.entryId}-${n.slice(u.key.length+1)}`:n,children:[(0,K.jsx)(`div`,{className:`message-content`,children:M&&O&&k&&u.entryId?(0,K.jsx)(BL,{preview:N,sessionId:O,sessionPath:k,entryId:u.entryId,markdown:!0,fullText:L,onComplete:e=>I(t=>({...t,[P]:e}))},`${O}:${k}:${u.entryId}`):(0,K.jsx)(Dk,{children:t})}),r&&v.has(d)&&(0,K.jsx)(wR,{content:L??y.content,editable:!1,copyRequiresFull:R,timestamp:u.timestamp,onResend:e.onResend,onRegenerate:b?.entryId&&O&&k&&e.onRegenerate&&!u.optimistic&&!y.isError&&(y.stopReason===`stop`||y.stopReason===`length`)?()=>e.onRegenerate({sessionId:O,sessionPath:k,entryId:b.entryId}):void 0,onFork:u.entryId&&O&&k&&e.onFork?()=>e.onFork({sessionId:O,sessionPath:k,entryId:u.entryId}):void 0,canFork:z&&!V&&e.forkAvailable,forkPending:e.forkPending})]})})};y.parts?.forEach((r,i)=>{if(T(i),r.type===`text`&&(S[i-1]?.type!==`text`||C.some(e=>w(e)===i))){let e=r.text,t=i+1;for(;S[t]?.type===`text`&&!C.some(e=>w(e)===t);){let n=S[t];n?.type===`text`&&(e+=n.text),t++}te(e,`${u.key}-text-${i}`,t>D)}if(r.type===`thinking`&&r.text.trim()){let t=!ee&&!H&&!y.stopReason&&B?.compaction?.state!==`running`&&V&&d===ne.length-1&&i===E?e.activityObserved===!1?`unknown`:`running`:`done`;x.push({key:`${u.key}-thinking-${i}`,turn:m,kind:`process`,processType:`thinking`,processMessageKey:u.key,processPreview:_R(r.text),processStatus:t,content:(0,K.jsx)(`article`,{className:`message-row assistant detail-only`,"data-history-entry":`${u.entryId??u.key}-thinking-${i}-body`,"data-history-message":u.entryId??u.key,"data-history-highlighted":j&&u.entryId===j||void 0,tabIndex:-1,children:(0,K.jsx)(`div`,{className:`message-content`,children:(0,K.jsx)(CR,{body:r.text,truncated:r.textTruncated,source:u.entryId&&O&&k&&r.sourcePartIndex!==void 0?{sessionId:O,sessionPath:k,entryId:u.entryId,partIndex:r.sourcePartIndex}:void 0,status:t,level:t===`running`?e.snapshot.thinking?.level:void 0,duration:PR(u,e.thinkingDurations),defaultOpen:e.snapshot.preferences.expandThinking===!0},JSON.stringify([O,k,u.key,i]))})})})}if(r.type===`toolCall`){let a=r,o=f.find(e=>e.call.id===a.id),s=a.id?c.get(a.id):void 0,d=s?.message??o?.result,p=FL(a,d,f,s?void 0:o?.state),h=p?[...p.children.map(e=>({call:e.call,child:e})),...p.showWrapper?[{call:a}]:[]]:[{call:a}];for(let[r,{call:o,child:g}]of h.entries()){let _=o.name.startsWith(`subagent`)?e.snapshot.preferences.subagentResultDisplay===`full`:o.name===`bash`?e.snapshot.preferences.bashToolDisplay===`full`:o.name===`write`||o.name===`edit`?e.snapshot.preferences.fileMutationDisplay===`full`:!1,v=o.id?f.find(e=>e.call.id===o.id):void 0,y=g?s:o.id?c.get(o.id):void 0,b=g?void 0:y?.message,S=g?g.result:b??v?.result,C=g?g.state:b?void 0:v?.state,w=g?g.state===`returned`?`done`:g.state===`failed`?`error`:g.state===`cancelled`||g.state===`timed_out`?`warn`:g.state:uR(S,C),T=e.activityObserved===!1&&w===`running`?`unknown`:w,E=o.name===`plan_ready`&&S&&VL(S)?(0,K.jsx)(HL,{result:S,sessionId:O,sessionPath:k,entryId:y?.entryId},`${u.key}-${o.id||i}-plan`):Hd(o.name)&&!g?.outputMissing?(0,K.jsx)(YL,{call:o,result:S,liveState:C,observed:e.activityObserved,cwd:A,defaultOpen:_},`${u.key}-${o.id||i}-evidence`):g?.outputMissing?null:bR(o,S,{sessionId:O??``,subagents:z?e.snapshot.runtime.capabilities.subagents?.items:void 0,workflows:z?e.snapshot.runtime.capabilities.workflows?.items:void 0,records:n,onInspectSubagent:e.onInspectSubagent,liveState:C,defaultOpen:_,observed:e.activityObserved!==!1}),D=cR(o.arguments),{Icon:M,action:N}=iL(o.name),P=(0,K.jsx)(M,{},`${u.key}-${o.id||i}-icon`);x.push({key:`${u.key}-tool-${o.id||i}`,turn:m,kind:o.name===`plan_ready`&&S&&VL(S)?`response`:E&&(o.name===`subagent_spawn`||o.name===`workflow`)?`custom`:`process`,processType:/^(subagent|workflow)/u.test(o.name)?`activity`:`tool`,processMessageKey:u.key,processToolName:o.name,processPreview:sL(o.name,D).split(` +`).find(Boolean),processStatus:T,error:T===`error`,content:(0,K.jsx)(`article`,{className:`message-row assistant detail-only`,"data-history-message":u.entryId??u.key,"data-history-result":y?.entryId,"data-history-highlighted":j&&(u.entryId===j||y?.entryId===j)||void 0,tabIndex:-1,children:(0,K.jsxs)(`div`,{className:`message-content`,children:[E||(0,K.jsx)(vR,{body:o.name===`bash`&&typeof D.command==`string`?D.command:o.arguments,icon:P,name:o.name||`tool`,summary:N===`search`&&typeof D.path==`string`?t(`toolSearchTarget`,{path:D.path,pattern:gR(o.name,D)}):gR(o.name,D),output:g?g.error??S?.content:o.id&&l.has(o.id)?S?.content:void 0,status:T,evidenceState:e.activityObserved===!1&&g?.state===`running`?`unknown`:g?.state,rawDetails:p?.showWrapper&&o.id===a.id?d?.details:void 0,note:g?.outputMissing?t(g.argumentsOmitted?`toolNestedArgumentsMissing`:`toolNestedOutputMissing`):void 0,snapshotMissingResult:S?.forkSnapshotToolResult,defaultOpen:_}),p?.incomplete&&r===h.length-1&&(0,K.jsx)(`p`,{className:`evidence-note`,role:`status`,children:t(`toolNestedIncomplete`)}),p&&r===h.length-1&&!p.showWrapper&&(0,K.jsxs)(`details`,{className:`evidence-raw`,children:[(0,K.jsx)(`summary`,{children:t(`toolCodemodeDetails`)}),(0,K.jsx)(`pre`,{children:Bd(a.arguments).text}),(0,K.jsx)(`pre`,{children:Bd(d?.content??``).text})]})]})})})}}}),T(S.length),D<0&&te(y.content,`${u.key}-answer`,!0),y.stopReason===`error`&&!r.finalErrors.has(d)&&(o.set(u.key,[...x]),x.length=0);let re=r.groups.get(d);if(re&&(re.state===`retrying`&&H&&(s=`${re.attempts[0].key}-attempts`),x.push({key:`${re.attempts[0].key}-attempts`,turn:m,kind:`outcome`,outcome:re.state===`interrupted`?`interrupted`:void 0,content:(0,K.jsx)(`article`,{className:`message-row assistant outcome-row`,children:(0,K.jsx)(mR,{state:re.state,retry:re.state===`retrying`?H:void 0,observed:e.activityObserved!==!1&&B?.status!==`unknown`,attempts:re.attempts.map(e=>({entry:e,content:o.get(e.key)}))})})})),r.finalErrors.has(d)||y.stopReason===`aborted`){let t=y.stopReason===`error`,n=g===_&&d===i&&d===a?h:void 0;x.push({key:`${u.key}-outcome`,turn:m,kind:`outcome`,error:t,outcome:t?`failed`:`interrupted`,content:(0,K.jsx)(`article`,{className:`message-row assistant outcome-row`,children:(0,K.jsx)(pR,{failed:t,error:y.errorMessage,retryPrompt:n,retryEntryId:u.entryId,canRetry:z&&!ee&&!V,onRetry:e.onResend})})})}else(y.stopReason===`stop`||y.stopReason===`length`)&&x.push({key:`${u.key}-completed`,turn:m,kind:`outcome`,outcome:`completed`,content:null});return x}if(y.role===`toolResult`){if(y.toolCallId&&l.has(y.toolCallId))return[];if(VL(y))return[{key:u.key,turn:m,kind:`response`,content:(0,K.jsx)(`article`,{className:`message-row assistant detail-only`,"data-history-message":u.entryId??u.key,"data-history-highlighted":j&&u.entryId===j||void 0,tabIndex:-1,children:(0,K.jsx)(`div`,{className:`message-content`,children:(0,K.jsx)(HL,{result:y,sessionId:O,sessionPath:k,entryId:u.entryId})})})}];let n=y.toolName?.startsWith(`subagent`)?`subagent`:y.toolName?.startsWith(`workflow`)?`workflow`:null,r=uR(y),i=e.activityObserved===!1&&r===`running`?`unknown`:r,a=y.toolName||`tool`,o=n===`subagent`?e.snapshot.preferences.subagentResultDisplay===`full`:a===`bash`?e.snapshot.preferences.bashToolDisplay===`full`:a===`write`||a===`edit`?e.snapshot.preferences.fileMutationDisplay===`full`:!1,{Icon:s}=iL(a),c=(0,K.jsx)(s,{},`${u.key}-icon`),d=n&&!y.forkSnapshotToolResult?(0,K.jsx)(yR,{family:n,title:`${a.replaceAll(`_`,` `)} · ${aj(y.content)}`,body:y.content,status:i,defaultOpen:o},`${u.key}-card`):ER(y.content)&&!y.forkSnapshotToolResult?(0,K.jsxs)(`div`,{className:`tool-line-empty`,children:[(0,K.jsx)(`span`,{className:`tool-icon`,children:c}),(0,K.jsx)(`span`,{className:`tool-name`,children:a}),(0,K.jsx)(`span`,{className:`tool-summary`,children:t(`noOutput`)}),(0,K.jsx)(dR,{status:i})]},`${u.key}-empty`):(0,K.jsx)(vR,{body:y.content,icon:c,name:a,summary:aj(y.content),status:i,snapshotMissingResult:y.forkSnapshotToolResult,defaultOpen:o},`${u.key}-evidence`);return[{key:u.key,turn:m,kind:a===`ask_user`||a===`human_handoff`?`response`:`process`,processType:n?`activity`:`tool`,processToolName:a,processStatus:i,error:i===`error`,content:(0,K.jsx)(`article`,{className:`message-row assistant detail-only`,"data-history-entry":`${u.entryId??u.key}-body`,"data-history-message":u.entryId??u.key,"data-history-highlighted":j&&u.entryId===j||void 0,tabIndex:-1,children:(0,K.jsx)(`div`,{className:`message-content`,children:d})})}]}return[]}),x=b.length;for(;x>0&&b[x-1].pendingPrompt;)x--;let S=b.length-x,C=b[x-1]?.turn??0;H&&!s&&(s=`native-retry`,b.splice(x,0,{key:`native-retry`,turn:C,kind:`outcome`,content:(0,K.jsx)(`article`,{className:`message-row assistant outcome-row`,children:(0,K.jsx)(mR,{attempts:[],state:`retrying`,retry:H,observed:e.activityObserved!==!1&&B?.status!==`unknown`})})}));let w=!ee&&B?.compaction;if(w&&w.state!==`completed`){let n=b.findIndex(e=>e.key===s),r={key:`native-compaction-${w.startedAt??w.state}`,turn:b[n]?.turn??C,kind:`custom`,content:(0,K.jsx)(PL,{compaction:w,observed:e.activityObserved!==!1&&B?.status!==`unknown`})};b.splice(n<0?x:n,0,r),w.state===`failed`&&w.errorMessage&&b.splice(b.length-S,0,{key:`native-compaction-error`,turn:r.turn,kind:`custom`,content:(0,K.jsx)(`article`,{className:`message-row assistant outcome-row`,children:(0,K.jsx)(fR,{label:t(`compactionFailed`),message:w.errorMessage})})})}return{rows:b,turns:p}},[z,V,B,H,e.activityObserved,ee,ne,e.onResend,e.onEdit,e.onRegenerate,e.onFork,e.forkAvailable,e.forkPending,e.onInspectSubagent,e.snapshot.runtime.capabilities.subagents,e.snapshot.runtime.capabilities.workflows?.items,e.snapshot.preferences.expandThinking,e.snapshot.preferences.subagentResultDisplay,e.snapshot.preferences.bashToolDisplay,e.snapshot.preferences.fileMutationDisplay,e.snapshot.thinking?.level,e.thinkingDurations,e.snapshot.runtime.liveTools,O,k,A,F,j,t]),U=eR(e.snapshot.selectedSession,ae,f),oe=(0,_.useCallback)(async(t,r=!1)=>{if(p(),!f||!O||!k)return!1;let o=n.current,s=Array.from(o?.querySelectorAll(`[data-history-entry]`)??[]).find(e=>e.dataset.historyEntry===t);if(o&&s){i.current=!1,u(!0),C({sessionId:O,sessionPath:k,entryId:t});let e=Math.max(0,o.scrollTop+s.getBoundingClientRect().top-o.getBoundingClientRect().top-16),n=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;return o.scrollTo?.({top:e,behavior:r||n?`instant`:`smooth`}),typeof o.scrollTo!=`function`&&(o.scrollTop=e),a.current=o.scrollTop,s.focus({preventScroll:!0}),!0}if(r)return;if(!e.onNavigateToMessage)return!1;let c=new AbortController;d.current=c;let l=await e.onNavigateToMessage({sessionId:O,sessionPath:k,entryId:t},c.signal);if(!(c.signal.aborted||d.current!==c))return d.current=null,l},[p,f,O,k,e.onNavigateToMessage]);(0,_.useLayoutEffect)(()=>{let t=n.current;if(!t||!E)return;let r=SL(E),o=m.current!==r,s=R.current!==T.reset,l=o||s;R.current=T.reset;let d=h.current!==e.scrollToBottom;if(h.current=e.scrollToBottom,y&&b!==x.current&&y.sessionId===E.id&&y.sessionPath===E.path){i.current=!1,g.current=null,m.current=r;return}if(d&&T.engaged){g.current=null,T.resetToLatest();return}let f=o&&!s&&!d?v.get(r)?.position:void 0,p=f?.key&&Array.from(t.querySelectorAll(`[data-history-entry], [data-history-message], [data-history-result]`)).some(e=>e.dataset.historyEntry===f.key||e.dataset.historyMessage===f.key||e.dataset.historyResult===f.key),_=g.current??(f&&!f.pinned&&(!c.current||p)?{...f,scrollHeight:t.scrollHeight}:null);if(g.current=null,_&&(!l||f)&&!d){let e=Array.from(t.querySelectorAll(`[data-history-entry], [data-history-message], [data-history-result]`)),n=_.key===void 0?void 0:e.find(e=>e.dataset.historyEntry===_.key)??e.reverse().find(e=>e.dataset.historyMessage===_.key||e.dataset.historyResult===_.key);i.current=!1,u(!0),m.current=r;let o=()=>{if(n&&!t.contains(n))return;g.current===_&&(g.current=null);let e=n?GR(n,t,_):_.scrollTop+t.scrollHeight-_.scrollHeight;typeof t.scrollTo==`function`?t.scrollTo({top:e,behavior:`instant`}):t.scrollTop=e,a.current=t.scrollTop};if(n&&WR(n,t)){g.current=_;let e=requestAnimationFrame(o);return()=>cancelAnimationFrame(e)}o();return}(l||d||i.current)&&(i.current=!0,u(!1),typeof t.scrollTo==`function`?t.scrollTo({top:t.scrollHeight,behavior:`instant`}):t.scrollTop=t.scrollHeight,a.current=t.scrollTop),m.current=r},[E,ne,T.reset,T.engaged,T.resetToLatest,e.scrollToBottom,v,y,b]),(0,_.useLayoutEffect)(()=>{let e=n.current;if(!e||!E||!y||b===x.current||y.sessionId!==E.id||y.sessionPath!==E.path)return;let t=Array.from(e.querySelectorAll(`[data-history-entry], [data-history-message], [data-history-result]`)),r=t.filter(e=>e.dataset.historyEntry===y.entryId||e.dataset.historyMessage===y.entryId||e.dataset.historyResult===y.entryId),o=y.restorePosition?.key?t.find(e=>e.dataset.historyEntry===y.restorePosition.key)??[...t].reverse().find(e=>e.dataset.historyMessage===y.restorePosition.key||e.dataset.historyResult===y.restorePosition.key):void 0,s=o??r.find(e=>e.classList.contains(`response`))??r.find(e=>e.dataset.historyMessage===y.entryId||e.dataset.historyResult===y.entryId)??r[0];if(!s)return;WR(s,e);let c=()=>{if(!e.contains(s)||y.restorePosition&&x.current===b)return;let t=GR(s,e,o?y.restorePosition:void 0);e.scrollTo?.({top:t,behavior:`instant`}),typeof e.scrollTo!=`function`&&(e.scrollTop=t),a.current=e.scrollTop,y.restorePosition||s.focus({preventScroll:!0}),i.current=!1,u(!0),y.restorePosition||C(y),x.current=b,CL(v,SL(E),{position:UR(e,!1,E)})},l=document.querySelector(`dialog[open]`),d,f=()=>{d=requestAnimationFrame(c)};return l?l.addEventListener(`close`,f,{once:!0}):f(),()=>{l?.removeEventListener(`close`,f),d!==void 0&&cancelAnimationFrame(d)}},[E,y,b,v]);let se=z?e.liveRetry?`${t(`modelRetrying`)} (${e.liveRetry.attempt}/${e.liveRetry.maxAttempts})`:e.livePhase===`preparing`?t(`modelPreparing`):t(`modelRunning`):t(`backgroundSessionRunning`),ce=z?0:B?.liveTools.filter(e=>e.state===`running`).length??0,le=z&&e.liveActiveTurn!==void 0?e.liveActiveTurn:B?B.activeTurn:z?e.snapshot.runtime.activeTurn:void 0,ue=V&&le&&E&&le.sessionId===E.id&&le.sessionPath===E?.path&&typeof le.startedAt==`number`&&Number.isFinite(le.startedAt)&&typeof le.elapsedMs==`number`&&Number.isFinite(le.elapsedMs)&&le.elapsedMs>=0?le:void 0,de=!T.verifying&&ue&&(!ee||ue.promptEntryId&&ie.some(e=>e.promptEntryId===ue.promptEntryId))?ue:void 0,fe=t=>{T.hasMore&&!T.error&&!T.verifying&&e.activityObserved!==!1&&e.resultExposureEnabled!==!1&&t.scrollTop<=Math.max(t.clientHeight,160)&&T.loadOlder()},pe=()=>{i.current=!1,u(!0),T.retainReading()};return(0,K.jsxs)(`div`,{className:`transcript-surface`,children:[(0,K.jsx)(`div`,{ref:n,className:`conversation`,role:`log`,"aria-label":`Conversation`,tabIndex:0,onPointerDownCapture:()=>{y?.restorePosition&&(x.current=b)},onTouchStartCapture:e=>{o.current=e.touches[0]?.clientY,y?.restorePosition&&(x.current=b)},onTouchMove:e=>{let t=e.touches[0]?.clientY;t!==void 0&&o.current!==void 0&&t>o.current&&KR(e.nativeEvent,e.currentTarget)&&pe(),o.current=t},onScroll:e=>{let t=e.currentTarget,n=t.scrollTopa.current;a.current=t.scrollTop;let o=t.scrollTop+t.clientHeight>=t.scrollHeight-48;i.current=i.current?!n||o:r&&o,i.current||T.retainReading(),u(!i.current),window.clearTimeout(s.current),s.current=window.setTimeout(()=>{!c.current&&O&&k&&t.isConnected&&CL(v,M,{position:UR(t,i.current,D.current)})},200),n&&fe(t)},onWheel:e=>{y?.restorePosition&&(x.current=b),!e.defaultPrevented&&!e.ctrlKey&&!e.metaKey&&e.deltaY<0&&KR(e.nativeEvent,e.currentTarget)&&(pe(),fe(e.currentTarget))},onKeyDown:e=>{y?.restorePosition&&[`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(e.key)&&(x.current=b);let t=e.target;!e.defaultPrevented&&!e.altKey&&!e.metaKey&&(!e.ctrlKey||e.key===`Home`)&&([`ArrowUp`,`PageUp`,`Home`].includes(e.key)||e.key===` `&&e.shiftKey)&&t instanceof HTMLElement&&!t.isContentEditable&&!t.closest(`input, textarea, select`)&&!(e.key===` `&&t.closest(`button, summary`))&&KR(e.nativeEvent,e.currentTarget)&&(pe(),fe(e.currentTarget))},children:(0,K.jsxs)(`div`,{ref:r,className:`conversation-content`,children:[E?.rerun&&e.onOpenOriginal&&(0,K.jsxs)(`div`,{className:`message-branch-origin`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>void e.onOpenOriginal(E.rerun.source),children:[(0,K.jsx)(Ae,{"aria-hidden":`true`}),` `,t(`openOriginalConversation`)]}),(0,K.jsx)(`span`,{children:t(`messageRerunWorkspaceHint`)})]}),(T.hasMore||T.error||T.verifying)&&(0,K.jsxs)(`div`,{className:`conversation-history`,children:[T.error&&(0,K.jsx)(`p`,{role:`alert`,children:t(T.error)}),T.error&&T.error!==`historyChanged`&&(0,K.jsx)(`button`,{type:`button`,className:`secondary`,disabled:T.loading,onClick:()=>void T.loadOlder(),children:t(`retryAdmissionCheck`)}),T.loading&&(0,K.jsx)(`p`,{role:`status`,children:t(`historyLoading`)}),T.verifying&&!T.error&&!T.loading&&(0,K.jsx)(`p`,{role:`status`,children:t(`historyVerifying`)}),T.hasMore&&(0,K.jsx)(`span`,{children:t(`historyOmitted`,{count:E?.truncation.entriesOmitted??0})})]}),HR(ie,V&&(!ee||!!de)&&B?.compaction?.state!==`running`,le?.commandId,L,E,e.activityObserved===!1?void 0:de,e.onReviewTurn,e.activityObserved!==!1),V&&e.activityObserved!==!1&&B?.compaction?.state!==`running`&&(0,K.jsxs)(`div`,{className:`conversation-execution-status sr-only`,role:`status`,"aria-live":`polite`,children:[(0,K.jsx)(`span`,{children:se}),ce>0&&(0,K.jsx)(`span`,{children:t(`observedSessionTools`,{count:ce})}),(B?.pendingFollowUps??0)>0&&(0,K.jsx)(`span`,{children:t(`pendingFollowUpsHint`,{count:B.pendingFollowUps})})]})]})}),(l||T.hasNewer)&&ie.length>0&&(0,K.jsx)(`button`,{className:`jump-to-latest`,type:`button`,"aria-label":t(`jumpToLatest`),title:t(`jumpToLatest`),onClick:()=>{let e=n.current;e&&(i.current=!0,u(!1),C(null),T.resetToLatest(),e.scrollTo({top:e.scrollHeight,behavior:`smooth`}),queueMicrotask(()=>{n.current===e&&(Array.from(e.querySelectorAll(`.message-row[tabindex="-1"]`)).reverse().find(e=>!e.closest(`[hidden], details:not([open])`))??e).focus({preventScroll:!0})}))},children:V&&e.activityObserved!==!1?(0,K.jsxs)(`span`,{className:`latest-activity-dots`,"aria-hidden":`true`,children:[(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{}),(0,K.jsx)(`i`,{})]}):(0,K.jsx)(w,{"aria-hidden":`true`})}),(0,K.jsx)(QL,{items:U.items,viewport:n,enabled:f,onHidden:p,onRequestPreview:U.requestPreview,readingHistory:l||T.hasNewer,onNavigate:oe},N)]})}function JR(){(0,_.useEffect)(()=>{let e=new lf,t=new AbortController,n,r=async r=>{let i=r.data;if(!(r.source!==window||r.origin!==location.origin||i?.source!==`openpi-browser-extension`||i.type!==`connector-hello`||typeof i.bridgeId!=`string`||!/^[\da-f-]{36}$/.test(i.bridgeId)||!oF(i.browser)||n===i.bridgeId)){n=i.bridgeId;try{let r=await e.request(`/api/browser/connections`,{method:`POST`,signal:t.signal,body:JSON.stringify({browser:i.browser,profileId:i.profileId,extensionId:i.extensionId,extensionOrigin:i.extensionOrigin,version:i.version})});!t.signal.aborted&&n===i.bridgeId&&window.postMessage({source:`openpi-browser-ui`,type:`connector-authorize`,...r},location.origin)}catch{n===i.bridgeId&&(n=void 0)}}},i=()=>window.postMessage({source:`openpi-browser-ui`,type:`connector-probe`},location.origin);window.addEventListener(`message`,r),i();let a=setInterval(i,5e3);return()=>{t.abort(),clearInterval(a),window.removeEventListener(`message`,r)}},[])}function YR(e,t){let n=e.trim();if(!n||n.length>16384)return null;let r=/^[a-z][a-z\d+.-]*:\/\//iu.test(n);try{let e=new URL(r?n:`https://${n}`);return!r&&(e.hostname===`localhost`||e.hostname.endsWith(`.localhost`)||e.hostname===`[::1]`||/^127(?:\.\d{1,3}){3}$/u.test(e.hostname))&&(e=new URL(`http://${n}`)),![`http:`,`https:`].includes(e.protocol)||e.username||e.password||e.origin===t?null:e.href}catch{return null}}function XR(){return document.documentElement.dataset.openpiBrowserExtension===`ready`?[...document.querySelectorAll(`iframe[data-openpi-browser-document]`)].map(e=>({id:e.dataset.openpiBrowserPage,document:e.dataset.openpiBrowserDocument,url:e.dataset.openpiBrowserUrl,title:e.dataset.openpiBrowserTitle||``})):[]}function ZR(e,t,n){let r=(0,_.useRef)(n),i=(0,_.useRef)(0);r.current=n,(0,_.useEffect)(()=>{if(!e||!t)return;let n=new lf,a=new AbortController,o,s,c,l=e=>window.postMessage({source:`openpi-browser-ui`,...e},location.origin),u=()=>{c?.(),c=void 0,s&&l({type:`control-cancel`,requestId:s}),s=void 0},d=(r,i,o)=>{r===s&&(c?.(),c=void 0,s=void 0,n.request(`/api/browser/control`,{method:`POST`,signal:a.signal,body:JSON.stringify({sessionId:e,sessionPath:t,requestId:r,result:i,error:o,pages:XR()})}).catch(()=>{}))},f=e=>{let t=e.data;e.source===window&&e.origin===location.origin&&t?.source===`openpi-browser-extension`&&(t.type===`connector-hello`?i.current=Date.now():t.type===`control-result`&&d(t.requestId,t.result,t.error))},p=async(e,t)=>{let n=YR(t||``,location.origin);if(!n){d(e,void 0,`Invalid internal browser URL.`);return}let i=new AbortController;c=()=>i.abort();let o=await r.current(n,AbortSignal.any([a.signal,i.signal]));if(a.signal.aborted||s!==e)return;if(!o){d(e,void 0,`The internal browser has reached its page limit.`);return}let l=()=>{let t=document.getElementById(o)?.querySelector(`iframe[data-openpi-browser-document]`),n=t&&XR().find(e=>e.id===t.dataset.openpiBrowserPage);n&&d(e,{root:n.id})},u=new MutationObserver(l);u.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-openpi-browser-document`]});let f=setTimeout(()=>d(e,void 0,`The internal page did not bind. Inspect the browser's loading or embedding error.`),1e4);c=()=>{i.abort(),u.disconnect(),clearTimeout(f)},l()},m=async()=>{if(Date.now()-i.current>15e3&&document.documentElement.dataset.openpiBrowserExtension!==`ready`){u(),a.signal.aborted||(o=setTimeout(()=>void m(),1e3));return}try{let{pending:r}=await n.request(`/api/browser/control`,{method:`POST`,signal:a.signal,body:JSON.stringify({sessionId:e,sessionPath:t,pages:XR()})});s&&s!==r?.requestId&&u(),r&&!r.running&&r.request&&!s&&(s=r.requestId,r.request.operation===`open`?p(r.requestId,r.request.url).catch(()=>d(r.requestId,void 0,`The embedded browser could not open.`)):r.page?l({type:`control`,id:r.page.id,document:r.page.document,requestId:r.requestId,request:r.request}):d(r.requestId,void 0,`The embedded page is unavailable.`))}catch{u()}a.signal.aborted||(o=setTimeout(()=>void m(),250))};return window.addEventListener(`message`,f),m(),()=>{clearTimeout(o),a.abort(),u(),window.removeEventListener(`message`,f)}},[e,t])}function QR({usage:e,workspace:t,sessionId:n}){let{t:r,i18n:i}=cr(),[a,o]=(0,_.useState)(!1);if(!e)return null;let s=e.context,c=e=>new Intl.NumberFormat(i.resolvedLanguage).format(e),l=e=>new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:0}).format(e).toLowerCase(),u=s?.percent==null?r(`usageUnknown`):`${Math.round(s.percent)}%`,d=s?.percent==null?r(`usageUnknown`):`${new Intl.NumberFormat(i.resolvedLanguage,{maximumFractionDigits:1}).format(s.percent)}%`,f=s?l(s.contextWindow):r(`usageUnknown`);return(0,K.jsx)(`div`,{className:`session-usage`,children:(0,K.jsx)(gd,{isOpen:a,onOpenChange:o,placement:`below`,alignment:`end`,width:`min(360px, calc(100vw - 24px))`,label:r(`sessionUsage`),isModal:!1,hasCloseButton:!1,content:(0,K.jsxs)(`div`,{className:`session-usage-details`,children:[(0,K.jsxs)(`div`,{className:`usage-details-heading`,children:[(0,K.jsx)(`h2`,{children:r(`sessionOverview`)}),(0,K.jsx)(`button`,{className:`icon-button`,type:`button`,"aria-label":r(`close`),onClick:()=>o(!1),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]}),(0,K.jsxs)(`section`,{className:`usage-section`,children:[(0,K.jsxs)(`div`,{className:`usage-context-heading`,children:[(0,K.jsx)(`h3`,{children:r(`usageContextLabel`)}),(0,K.jsx)(`span`,{children:d})]}),(0,K.jsxs)(`p`,{className:`usage-context-value`,children:[(0,K.jsx)(`strong`,{children:s?.tokens==null?r(`usageUnknown`):c(s.tokens)}),s&&(0,K.jsxs)(`span`,{children:[` / `,c(s.contextWindow),` tokens`]})]}),s?.percent!=null&&(0,K.jsx)(`progress`,{value:Math.max(0,Math.min(100,s.percent)),max:100,"aria-label":r(`sessionContextUsage`)}),(0,K.jsx)(`p`,{className:`usage-help`,children:r(`usageContextHelp`)})]}),(0,K.jsxs)(`section`,{className:`usage-section`,children:[(0,K.jsx)(`h3`,{children:r(`usageSessionTotals`)}),(0,K.jsxs)(`dl`,{className:`usage-metrics`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:r(`usageInputLabel`)}),(0,K.jsx)(`dd`,{children:c(e.input)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:r(`usageOutputLabel`)}),(0,K.jsx)(`dd`,{children:c(e.output)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{children:r(`usageTotalLabel`)}),(0,K.jsx)(`dd`,{children:c(e.total)})]})]}),(0,K.jsx)(`p`,{className:`usage-help`,children:r(`usageTotalsHelp`)})]}),t&&(0,K.jsxs)(`dl`,{className:`usage-workspace`,children:[(0,K.jsx)(`dt`,{children:r(`usageWorkspaceLabel`)}),(0,K.jsx)(`dd`,{children:t})]}),n&&(0,K.jsxs)(`details`,{className:`usage-identity`,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(`span`,{children:r(`usageSessionId`)}),(0,K.jsx)(L,{"aria-hidden":`true`})]}),(0,K.jsx)(`code`,{children:n})]})]}),children:t=>(0,K.jsxs)(`button`,{...t,className:`session-usage-trigger`,type:`button`,"aria-label":r(`usageOpenDetails`,{input:l(e.input),output:l(e.output),percent:u,capacity:f}),children:[(0,K.jsxs)(`span`,{className:`usage-stat`,title:`${r(`sessionInputTokens`)}: ${c(e.input)}`,children:[(0,K.jsx)(k,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:l(e.input)})]}),(0,K.jsxs)(`span`,{className:`usage-stat`,title:`${r(`sessionOutputTokens`)}: ${c(e.output)}`,children:[(0,K.jsx)(w,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:l(e.output)})]}),(0,K.jsxs)(`span`,{className:`usage-stat`,title:`${r(`sessionContextUsage`)}: ${d}`,children:[(0,K.jsx)(ke,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[u,s&&(0,K.jsxs)(`span`,{className:`usage-capacity`,children:[` / `,f]})]})]})]})})})}function $R(e,t){return new Promise((n,r)=>{let i=new FileReader,a=e=>{t.removeEventListener(`abort`,o),e?r(e):typeof i.result==`string`?n(i.result.slice(i.result.indexOf(`,`)+1)):r(Error(`File read failed`))},o=()=>{i.abort(),a(new DOMException(`File read cancelled`,`AbortError`))};i.onload=()=>a(),i.onerror=()=>a(Error(`File read failed`)),t.addEventListener(`abort`,o,{once:!0}),t.aborted?o():i.readAsDataURL(e)})}function ez({name:e,kind:t=`file`,expanded:n=!1}){let r=t===`directory`?`folder`:t===`symlink`?`link`:/\.(?:md|markdown)$/iu.test(e)?`markdown`:/\.(?:csv|tsv|xlsx?)$/iu.test(e)?`sheet`:/\.(?:png|jpe?g|gif|webp|svg|bmp|ico)$/iu.test(e)?`image`:/\.(?:pdf|docx?|pptx?)$/iu.test(e)?`document`:/\.(?:[cm]?[jt]sx?|json|html?|css|py|rs|go|sh|ya?ml|toml|xml)$/iu.test(e)?`code`:`file`;return(0,K.jsx)(r===`folder`?n?G:De:r===`link`?Re:r===`sheet`?yt:r===`image`?be:r===`markdown`||r===`document`?Se:r===`code`?ve:Ce,{className:`file-icon file-icon-${r}`,"aria-hidden":`true`})}function tz({sessionId:e,sessionPath:t,cwd:n,canWrite:r,active:i,selected:a,onSelect:o,dropTarget:s,onShowTree:c,onRemoved:l}){let{t:u}=cr(),d=(0,_.useContext)(_k),f=kk(),p=(0,_.useMemo)(()=>new lf,[]),[m,h]=(0,_.useState)(f?.files?.query??``),[g,v]=(0,_.useState)(f?.files?.expanded??[`.`]),[y,b]=(0,_.useState)({}),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(!1),[D,O]=(0,_.useState)(0),[k,A]=(0,_.useState)(a.includes(`/`)?a.slice(0,a.lastIndexOf(`/`)):`.`),[j,M]=(0,_.useState)(null),[N,P]=(0,_.useState)(``),[F,I]=(0,_.useState)(null),[R,z]=(0,_.useState)(!1),[B,V]=(0,_.useState)(!1),[H,te]=(0,_.useState)([]),[ne,re]=(0,_.useState)(!1),[ie,ae]=(0,_.useState)([]),[U,oe]=(0,_.useState)(null),[se,ce]=(0,_.useState)(`.`),[le,ue]=(0,_.useState)(``),[de,fe]=(0,_.useState)([]),[pe,me]=(0,_.useState)(!1),[he,ge]=(0,_.useState)([]),[_e,ve]=(0,_.useState)(0),[ye,be]=(0,_.useState)(!1),[Se,Ce]=(0,_.useState)(),we=(0,_.useRef)(0),[G,De]=(0,_.useState)([]),[Oe,ke]=(0,_.useState)(!1),[Ae,je]=(0,_.useState)(``),Me=(0,_.useRef)(null),Ne=(0,_.useRef)(null),Pe=(0,_.useRef)(null),Fe=(0,_.useRef)(null),Ie=(0,_.useRef)(null),Le=(0,_.useRef)(!1),Re=(0,_.useRef)(0),Be=(0,_.useRef)(null),Ve=(0,_.useRef)(void 0),He=JSON.stringify([e,t,n]),Ue=(0,_.useRef)(He);Ue.current=He;let We=(0,_.useRef)(r);We.current=r;let Ge=(0,_.useRef)(null);(0,_.useEffect)(()=>(Ue.current=He,()=>{Ue.current=``,Ge.current?.abort(),clearTimeout(Ve.current)}),[He]),(0,_.useEffect)(()=>{Ne.current?.setAttribute(`webkitdirectory`,``)},[]),(0,_.useEffect)(()=>{if(!pe||!i)return;we.current++;let n=new AbortController;return be(!0),p.workspaceTrash(e,t,n.signal).then(r=>{!n.signal.aborted&&r.sessionId===e&&r.sessionPath===t&&(ge(r.entries),ve(r.unavailable??0),Ce(r.nextCursor))}).catch(e=>{n.signal.aborted||(z(!0),I(e instanceof Error?e.message:u(`filesReadFailed`)))}).finally(()=>{n.signal.aborted||be(!1)}),()=>n.abort()},[p,e,t,i,pe,D,u]),(0,_.useEffect)(()=>{U&&(Fe.current?.focus(),Fe.current?.select())},[U]),(0,_.useEffect)(()=>{j&&Pe.current?.focus()},[j]);let Ke=(0,_.useRef)(null),qe=(0,_.useRef)(f?.files?.treeScroll??0);(0,_.useLayoutEffect)(()=>{f?.files&&Object.assign(f.files,{query:m,expanded:g})},[f,m,g]),(0,_.useLayoutEffect)(()=>{!i||!(x||y[`.`])||qe.current!==null&&Ke.current&&(Ke.current.scrollTop=qe.current,qe.current=null)},[i,x,y]);let Je=(0,_.useRef)(y);Je.current=y;let Ye=(0,_.useRef)(x);Ye.current=x;let Xe=(0,_.useRef)(``),Ze=(0,_.useRef)(null),Qe=(0,_.useRef)(new Set),$e=(0,_.useRef)(!1),[et,tt]=(0,_.useState)(!1),nt=!!m.trim();(0,_.useLayoutEffect)(()=>{let e=Be.current;if(!e||!i)return;let t=[...Ke.current?.querySelectorAll(`[data-file-row]`)??[]].find(t=>t.dataset.fileRow===e);t&&(t.focus({preventScroll:!0}),Be.current=null)});let rt=e=>e instanceof sf&&e.code===`ARTIFACT_EXISTS`?u(`filesNameExists`):e instanceof Error?e.message:u(`filesMutationFailed`),it=e=>{h(``);let t=e.path.split(`/`),n=e.kind===`directory`?t.length:t.length-1;v(e=>[...new Set([...e,`.`,...t.slice(0,n).map((e,n)=>t.slice(0,n+1).join(`/`))])]),Be.current=e.path,O(e=>e+1),e.kind===`file`&&(e.bytes??0)<=20971520&&(o(e.path),d?.open(encodeURI(e.path)))},at=()=>{Le.current||(M(null),I(null),Ie.current?.focus({preventScroll:!0}))},ot=async n=>{if(n.preventDefault(),!j||!We.current||Le.current)return;if(!N||N===`.`||N===`..`||/[\\/\u0000-\u001f\u007f]/u.test(N)){z(!0),I(u(`filesNameInvalid`)),Pe.current?.focus();return}Le.current=!0,V(!0),I(null);let r=He;try{let n=await p.mutateWorkspaceFile(e,t,{kind:j,directory:k,name:N});if(Ue.current!==r||n.sessionId!==e||n.sessionPath!==t)return;M(null),P(``),z(!1),I(u(`filesCreated`,{path:n.path})),it(n)}catch(e){Ue.current===r&&(z(!0),I(rt(e)),Pe.current?.focus())}finally{Ue.current===r&&(Le.current=!1,V(!1))}},st=async n=>{if(!We.current||Le.current)return;let r=He;Le.current=!0,V(!0);let i=new AbortController;Ge.current=i;let a=(e,t)=>te(n=>n.map(n=>n.id===e.id?{...n,...t}:n));try{for(let o of n){if(Ue.current!==r)return;if(!We.current){a(o,{state:`error`,message:u(`filesWriteUnavailable`)});continue}if(!(!o.file&&o.kind!==`directory`)){a(o,{state:`running`,message:void 0});try{if(o.kind===`directory`){try{await p.mutateWorkspaceFile(e,t,{kind:`create-directory`,directory:o.directory,name:o.name})}catch(n){if(!(n instanceof sf)||n.code!==`ARTIFACT_EXISTS`)throw n;await p.workspaceFiles(e,t,[o.directory===`.`?``:o.directory,o.name].filter(Boolean).join(`/`),``,i.signal)}if(Ue.current!==r)return;a(o,{state:`done`,message:u(`filesImported`)}),O(e=>e+1);continue}if(!o.file)continue;if(o.file.size>52428800)throw Error(u(`filesImportTooLarge`));let n=await $R(o.file,i.signal);if(Ue.current!==r)return;if(!We.current){a(o,{state:`error`,message:u(`filesWriteUnavailable`)});continue}let s=await p.mutateWorkspaceFile(e,t,{kind:`import-file`,directory:o.directory,name:o.name,data:n,...o.createParents?{createParents:!0}:{}});if(Ue.current!==r||s.sessionId!==e||s.sessionPath!==t)return;a(o,{state:`done`,file:void 0,message:(s.bytes??0)>20971520?u(`filesImportedNoPreview`):u(`filesImported`)}),it(s)}catch(e){if(Ue.current!==r)return;a(o,{state:`error`,message:rt(e)})}}}}finally{Ge.current===i&&(Ge.current=null),Ue.current===r&&(Le.current=!1,V(!1))}},ct=(e,t=[],n=new Map,r=[])=>{if(!We.current||Le.current)return;if(e.length+r.length>2e3){z(!0),I(u(`filesImportFolderLimit`));return}c(!0);let i=[...[...new Set(r)].sort((e,t)=>e.split(`/`).length-t.split(`/`).length).map(e=>({id:++Re.current,name:e.split(`/`).at(-1),directory:[k===`.`?``:k,...e.split(`/`).slice(0,-1)].filter(Boolean).join(`/`)||`.`,kind:`directory`,state:`pending`})),...e.map(e=>{let t=n.get(e)??e.webkitRelativePath;return{id:++Re.current,name:e.name,directory:t?[k===`.`?``:k,...t.split(`/`).slice(0,-1)].filter(Boolean).join(`/`)||`.`:k,createParents:!!t,file:e,state:`pending`}})];te(e=>[...e,...t.map(e=>({id:++Re.current,name:e,directory:k,state:`error`,message:u(`filesImportDirectoryUnsupported`)})),...i]),st(i)},lt=async(n,r)=>{if(!We.current||Le.current)return;let i=He,s=r.filter(e=>!r.some(t=>t.kind===`directory`&&e.path.startsWith(`${t.path}/`)));Le.current=!0,V(!0),fe([]);let c=[],f=new Set;try{for(let r of s){if(Ue.current!==i||!We.current)return;try{if(!r.identity)throw Error(u(`filesRefreshBeforeOrganizing`));let s=await p.mutateWorkspaceFile(e,t,n===`trash`?{kind:n,path:r.path,identity:r.identity}:{kind:n,path:r.path,identity:r.identity,directory:se,name:U?.rename?le:r.name});if(Ue.current!==i||s.sessionId!==e||s.sessionPath!==t)return;if(f.add(r.path),s.trashed&&c.push(s.trashed),s.moved&&Hk(e,t,s.moved.from,s.moved.to),r.kind===`directory`){let e=e=>e===r.path||e.startsWith(`${r.path}/`);if(v(t=>n===`trash`?t.filter(t=>!e(t)):t.map(t=>e(t)?`${s.path}${t.slice(r.path.length)}`:t)),A(t=>e(t)?n===`move`?`${s.path}${t.slice(r.path.length)}`:r.path.split(`/`).slice(0,-1).join(`/`)||`.`:t),n===`move`&&e(a)){let e=`${s.path}${a.slice(r.path.length)}`;o(e),d?.open(encodeURI(e))}}n===`move`&&it(s),fe(e=>[...e,{path:r.path}])}catch(e){if(Ue.current!==i)return;fe(t=>[...t,{path:r.path,error:rt(e)}])}}De(c),n===`trash`&&l([...f]),ae(e=>e.filter(e=>![...f].some(t=>t===e.path||e.path.startsWith(`${t}/`)))),oe(null),O(e=>e+1)}finally{Ue.current===i&&(Le.current=!1,V(!1))}},ut=async n=>{if(!We.current||Le.current)return;let r=He;Le.current=!0,V(!0),fe([]);try{for(let i of n){if(Ue.current!==r||!We.current)return;try{let n=await p.mutateWorkspaceFile(e,t,{kind:`restore`,id:i.id,identity:i.identity});if(Ue.current!==r||n.sessionId!==e||n.sessionPath!==t)return;De(e=>e.filter(e=>e.id!==i.id)),ge(e=>e.filter(e=>e.id!==i.id)),fe(e=>[...e,{path:i.path}]),it(n)}catch(e){if(Ue.current!==r)return;fe(t=>[...t,{path:i.path,error:rt(e)}])}}O(e=>e+1)}finally{Ue.current===r&&(Le.current=!1,V(!1))}},ft=async()=>{if(!Se||ye)return;let n=we.current,r=He;be(!0);try{let i=await p.workspaceTrash(e,t,void 0,Se);if(n!==we.current||Ue.current!==r||i.sessionId!==e||i.sessionPath!==t)return;ge(e=>[...new Map([...e,...i.entries].map(e=>[e.id,e])).values()]),ve(e=>e+(i.unavailable??0)),Ce(i.nextCursor)}catch(e){n===we.current&&Ue.current===r&&(z(!0),I(rt(e)))}finally{n===we.current&&Ue.current===r&&be(!1)}},pt=e=>ae(t=>t.some(t=>t.path===e.path)?t.filter(t=>t.path!==e.path):[...t,e]),mt=(e,t=!1)=>{oe({entries:e,rename:t});let n=e[0]?.path??``;ce(t?n.split(`/`).slice(0,-1).join(`/`)||`.`:k),ue(e[0]?.name??``),I(null)},gt=(0,_.useRef)(ct);gt.current=ct,(0,_.useEffect)(()=>{let e=s.current;if(!e)return;let t=e=>{if(!e.dataTransfer?.types.includes(`Files`))return;e.preventDefault();let t=We.current&&!Le.current;e.dataTransfer.dropEffect=t?`copy`:`none`,ke(t)},n=t=>{(!(t.relatedTarget instanceof Node)||!e.contains(t.relatedTarget))&&ke(!1)},r=e=>{let t=e.dataTransfer;if(!t?.types.includes(`Files`)||(e.preventDefault(),ke(!1),!We.current||Le.current))return;let n=[],r=[],i=[];for(let e of t.items){if(e.kind!==`file`)continue;let t=e.webkitGetAsEntry?.();if(t?.isDirectory&&`createReader`in t)i.push(t);else if(t?.isDirectory)r.push(t.name);else{let t=e.getAsFile();t&&n.push(t)}}if(i.length){let e=Ue.current,t=new Map,a=[],o=0,s=async(r,i)=>{if(Ue.current!==e||!We.current)throw new DOMException(`Import cancelled`,`AbortError`);if(++o>2e3||i.split(`/`).length>64)throw Error(u(`filesImportFolderLimit`));let c=i?`${i}/${r.name}`:r.name;if(r.isDirectory){a.push(c);let e=r.createReader();for(;;){let t=await new Promise((t,n)=>e.readEntries(t,n));if(!t.length)break;for(let e of t)await s(e,c)}}else if(r.isFile){let e=await new Promise((e,t)=>r.file(e,t));t.set(e,c),n.push(e)}};Le.current=!0,V(!0),(async()=>{try{for(let e of i)await s(e,``);if(Ue.current!==e||!We.current)return;Le.current=!1,V(!1),gt.current(n,r,t,a)}catch(t){Ue.current===e&&(z(!0),I(t instanceof Error?t.message:u(`filesMutationFailed`)))}finally{Ue.current===e&&!Ge.current&&(Le.current=!1,V(!1))}})();return}gt.current(t.items.length?n:[...t.files],r)};return e.addEventListener(`dragover`,t),e.addEventListener(`dragleave`,n),e.addEventListener(`drop`,r),()=>{e.removeEventListener(`dragover`,t),e.removeEventListener(`dragleave`,n),e.removeEventListener(`drop`,r)}},[s,u]);let _t=async(e,t)=>{let r=He,i=n.includes(`\\`)?`\\`:`/`,a=await wd(t?`${n.replace(/[\\/]$/u,``)}${i}${e.split(`/`).join(i)}`:e);Ue.current===r&&(clearTimeout(Ve.current),je(u(a?`filesPathCopied`:`copyFailed`,{path:e})),Ve.current=setTimeout(()=>je(``),3e3))};(0,_.useEffect)(()=>{if(!i)return;let n=new AbortController;Ze.current=n;let r;Xe.current!==m.trim()&&(Xe.current=m.trim(),Ye.current=null,S(null)),r=setTimeout(async()=>{if(document.visibilityState!==`hidden`){E(!0);try{let r=async(r,i,a)=>{let o=await p.workspaceFiles(e,t,r,i,n.signal);for(o.nextCursor&&Qe.current.add(o.nextCursor);o.nextCursor&&o.entries.length{document.visibilityState!==`hidden`&&O(e=>e+1)};return window.addEventListener(`focus`,a),document.addEventListener(`visibilitychange`,a),()=>{n.abort(),clearTimeout(r),window.removeEventListener(`focus`,a),document.removeEventListener(`visibilitychange`,a);for(let e of Qe.current)p.releaseFileListing(e).catch(()=>void 0);Qe.current.clear(),$e.current=!1,tt(!1)}},[i,p,g,m,nt,e,t,D,u]);let vt=e=>v(t=>t.includes(e)?t.filter(t=>t!==e&&!t.startsWith(`${e}/`)):[...t,e]),yt=async n=>{let r=nt?Ye.current:Je.current[n],i=Ze.current;if(!(!r?.nextCursor||!i||i.signal.aborted||$e.current||T)){$e.current=!0,tt(!0),w(null);try{let a=await p.workspaceFiles(e,t,n,nt?m.trim():``,i.signal,r.nextCursor);if(Qe.current.delete(r.nextCursor),a.nextCursor&&Qe.current.add(a.nextCursor),i.signal.aborted)return;let o=[...new Map([...r.entries,...a.entries].map(e=>[e.path,e])).values()],s={...a,entries:o};nt?S(s):b(e=>({...e,[n]:s}))}catch(e){i.signal.aborted||w(e instanceof Error?e.message:u(`filesReadFailed`))}finally{i.signal.aborted||($e.current=!1,tt(!1))}}},bt=(e,t)=>t?.nextCursor?(0,K.jsxs)(`li`,{className:`file-tree-more`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:T||et,onClick:()=>void yt(e),children:u(et?`loading`:`filesLoadMore`)}),(0,K.jsx)(`small`,{children:u(`filesLoaded`,{count:t.entries.length})})]}):null,xt=e=>{let t=[...Ke.current?.querySelectorAll(`button[data-file-row]:not(:disabled)`)??[]],n=t.indexOf(document.activeElement),r=t[n];if(!r)return;let i;if(e.key===`ArrowDown`)i=t[Math.min(n+1,t.length-1)];else if(e.key===`ArrowUp`)i=t[Math.max(n-1,0)];else if(e.key===`Home`)i=t[0];else if(e.key===`End`)i=t.at(-1);else if(e.key===`ArrowRight`&&r.getAttribute(`aria-expanded`)===`false`)r.click();else if(e.key===`ArrowLeft`)r.getAttribute(`aria-expanded`)===`true`?r.click():i=t.find(e=>e.dataset.fileRow===r.dataset.fileRow?.split(`/`).slice(0,-1).join(`/`));else return;e.preventDefault(),i?.focus()},St=(e,t=0)=>e.map(e=>{let n=e.kind===`directory`,i=g.includes(e.path),s=r&&!!e.identity&&!e.path.split(`/`).some(e=>[`.git`,`.pi`,`.openpi-trash`].includes(e.toLowerCase()))&&(n||e.kind===`file`);return(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`div`,{className:`file-tree-item`,children:[ne&&(0,K.jsx)(`input`,{type:`checkbox`,className:`file-tree-check`,"aria-label":u(`filesSelectItem`,{name:e.name}),checked:ie.some(t=>t.path===e.path),disabled:!s||B,onChange:()=>pt(e)}),(0,K.jsxs)(`button`,{type:`button`,"data-file-row":e.path,className:`file-tree-row`,style:{paddingInlineStart:10+t*16},"aria-expanded":n?i:void 0,"aria-current":!n&&a===e.path?`true`:void 0,disabled:e.kind===`symlink`||e.kind===`other`,title:e.kind===`symlink`?u(`filesSymlink`):e.path,onClick:t=>{if(s&&(t.metaKey||t.ctrlKey)){re(!0),pt(e);return}n?(A(e.path),nt?(h(``),v([`.`,...e.path.split(`/`).map((e,t,n)=>n.slice(0,t+1).join(`/`))])):vt(e.path)):(A(e.path.includes(`/`)?e.path.slice(0,e.path.lastIndexOf(`/`)):`.`),o(e.path),d?.open(encodeURI(e.path),void 0,t.currentTarget))},children:[n?i?(0,K.jsx)(L,{className:`file-chevron`,"aria-hidden":`true`}):(0,K.jsx)(ee,{className:`file-chevron`,"aria-hidden":`true`}):(0,K.jsx)(`span`,{className:`file-chevron`}),(0,K.jsx)(ez,{name:e.name,kind:e.kind,expanded:i}),(0,K.jsxs)(`span`,{className:`file-tree-name`,children:[e.name,nt&&(0,K.jsx)(`small`,{children:e.path})]})]}),(0,K.jsx)(IA,{button:{label:u(`filesPathActions`,{name:e.name}),icon:(0,K.jsx)(W,{"aria-hidden":`true`}),isIconOnly:!0,size:`sm`,variant:`ghost`,className:`file-path-actions`},items:[{label:u(`filesCopyRelativePath`),onClick:()=>void _t(e.path,!1)},{label:u(`filesCopyAbsolutePath`),onClick:()=>void _t(e.path,!0)},{label:u(`filesRename`),isDisabled:!s||B,onClick:()=>mt([e],!0)},{label:u(`filesMove`),isDisabled:!s||B,onClick:()=>mt([e])},{label:u(`filesTrashAction`),isDisabled:!s||B,onClick:()=>void lt(`trash`,[e])}],menuWidth:200,alignment:`end`,hasChevron:!1})]}),!nt&&n&&i&&(0,K.jsxs)(`ul`,{children:[y[e.path]?St(y[e.path].entries,t+1):(0,K.jsx)(`li`,{className:`file-tree-note`,children:u(`loading`)}),bt(e.path,y[e.path])]})]},e.path)});return(0,K.jsxs)(`aside`,{className:`file-explorer`,"aria-label":u(`filesExplorer`),"data-drag-over":Oe||void 0,children:[(0,K.jsxs)(`div`,{className:`file-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`input`,{value:m,onChange:e=>h(e.currentTarget.value.slice(0,200)),placeholder:u(`filesSearch`),"aria-label":u(`filesSearch`)}),(0,K.jsx)(`span`,{className:`file-search-progress`,"aria-hidden":`true`,"data-loading":T||void 0}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":u(`refreshFiles`),title:u(`refreshFiles`),onClick:()=>O(e=>e+1),disabled:T,children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]}),(0,K.jsxs)(`div`,{className:`file-create-toolbar`,children:[(0,K.jsxs)(`fieldset`,{className:`file-write-actions`,"aria-label":u(`filesWorkspaceActions`),children:[(0,K.jsx)(IA,{button:{ref:Ie,label:u(`filesCreateMenu`),variant:`ghost`,className:`file-toolbar-button`,tooltip:r&&!B?u(`filesCreateMenu`):void 0,isDisabled:!r||B},items:[`create-file`,`create-directory`].map(e=>({label:u(e===`create-file`?`filesNewFile`:`filesNewDirectory`),icon:e===`create-file`?(0,K.jsx)(xe,{"aria-hidden":`true`}):(0,K.jsx)(Ee,{"aria-hidden":`true`}),isDisabled:!r||B,onClick:()=>{M(e),P(``),I(null)}})),menuWidth:190}),(0,K.jsx)(IA,{button:{label:u(`filesImportMenu`),variant:`ghost`,className:`file-toolbar-button`,tooltip:r&&!B?u(`filesImportMenu`):void 0,isDisabled:!r||B},items:[{label:u(`filesImport`),icon:(0,K.jsx)(Mt,{"aria-hidden":`true`}),isDisabled:!r||B,onClick:()=>Me.current?.click()},{label:u(`filesImportFolder`),icon:(0,K.jsx)(Te,{"aria-hidden":`true`}),isDisabled:!r||B,onClick:()=>Ne.current?.click()}],menuWidth:190}),(0,K.jsx)(`input`,{ref:Me,type:`file`,multiple:!0,hidden:!0,"aria-label":u(`filesImportChoose`),onChange:e=>{ct([...e.currentTarget.files??[]]),e.currentTarget.value=``}}),(0,K.jsx)(`input`,{ref:Ne,type:`file`,multiple:!0,hidden:!0,"aria-label":u(`filesImportFolderChoose`),onChange:e=>{ct([...e.currentTarget.files??[]]),e.currentTarget.value=``}}),(0,K.jsxs)(IA,{button:{label:u(`filesMoreMenu`),variant:`ghost`,className:`file-toolbar-button`,tooltip:u(`filesMoreMenu`)},menuWidth:210,children:[(0,K.jsx)(tj,{label:u(`filesSelectMultiple`),icon:(0,K.jsx)(ze,{"aria-hidden":`true`}),value:ne,isDisabled:!r||B,hasCloseOnSelect:!0,onChange:e=>{re(e),ae([])}}),(0,K.jsx)(tj,{label:u(`filesTrash`),icon:(0,K.jsx)(kt,{"aria-hidden":`true`}),value:pe,hasCloseOnSelect:!0,onChange:me})]})]}),(0,K.jsxs)(`p`,{className:`file-write-directory`,title:k,children:[(0,K.jsxs)(`span`,{children:[u(`filesTargetDirectory`),`:`,` `,k===`.`?u(`filesWorkspaceRoot`):k]}),k!==`.`&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>A(`.`),children:u(`filesWorkspaceRoot`)})]})]}),ne&&(0,K.jsxs)(`div`,{className:`file-organization-bar`,children:[(0,K.jsx)(`span`,{children:u(`filesSelectedCount`,{count:ie.length})}),(0,K.jsx)(`button`,{type:`button`,disabled:!ie.length||B||!r,onClick:()=>mt(ie),children:u(`filesMove`)}),(0,K.jsx)(`button`,{type:`button`,disabled:!ie.length||B||!r,onClick:()=>void lt(`trash`,ie),children:u(`filesTrashAction`)})]}),U&&(0,K.jsxs)(`form`,{className:`file-create-form`,onSubmit:e=>{e.preventDefault(),(!U.rename||le.trim())&<(`move`,U.entries)},children:[(0,K.jsxs)(`label`,{children:[u(U.rename?`filesRename`:`filesMoveDestination`),(0,K.jsx)(`input`,{ref:Fe,value:U.rename?le:se,"aria-label":u(U.rename?`filesNewName`:`filesMoveDestination`),disabled:B,onChange:e=>U.rename?ue(e.currentTarget.value):ce(e.currentTarget.value)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`button`,{type:`submit`,disabled:B||!r,children:u(U.rename?`filesRename`:`filesMove`)}),(0,K.jsx)(`button`,{type:`button`,disabled:B,onClick:()=>oe(null),children:u(`cancel`)})]})]}),de.length>0&&(0,K.jsxs)(`div`,{className:`file-import-results`,children:[(0,K.jsx)(`ol`,{"aria-label":u(`filesOrganizationResults`),"aria-live":`polite`,children:de.map(e=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{children:e.path}),(0,K.jsx)(`small`,{role:e.error?`alert`:void 0,children:e.error??u(`filesOperationDone`)})]},e.path))}),G.length>0&&(0,K.jsx)(`button`,{type:`button`,disabled:B||!r,onClick:()=>void ut(G),children:u(`filesUndoTrash`)})]}),pe&&(0,K.jsxs)(`section`,{className:`file-trash-list`,"aria-label":u(`filesTrash`),children:[(0,K.jsx)(`p`,{children:u(`filesTrashDetail`)}),_e>0&&(0,K.jsx)(`p`,{role:`alert`,children:u(`filesTrashUnavailable`,{count:_e})}),ye&&he.length===0?(0,K.jsx)(`p`,{children:u(`loading`)}):he.length===0?(0,K.jsx)(`p`,{children:u(`filesTrashEmpty`)}):(0,K.jsx)(`ul`,{children:he.map(e=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{title:e.path,children:e.path}),(0,K.jsx)(`button`,{type:`button`,disabled:!r||B,"aria-label":u(`filesRestoreItem`,{name:e.path}),onClick:()=>void ut([e]),children:u(`filesRestore`)})]},e.id))}),Se&&(0,K.jsx)(`button`,{type:`button`,disabled:ye,onClick:()=>void ft(),children:u(`filesLoadMore`)})]}),j&&(0,K.jsxs)(`form`,{className:`file-create-form`,onSubmit:e=>void ot(e),onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.stopPropagation(),at())},children:[(0,K.jsxs)(`label`,{children:[u(j===`create-file`?`filesFileName`:`filesDirectoryName`),(0,K.jsx)(`input`,{ref:Pe,value:N,maxLength:255,disabled:B,"aria-invalid":!!(F&&R),onChange:e=>P(e.currentTarget.value)})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`button`,{type:`submit`,disabled:!r||B,children:u(B?`filesCreating`:`filesCreate`)}),(0,K.jsx)(`button`,{type:`button`,disabled:B,onClick:at,children:u(`cancel`)})]})]}),F&&(0,K.jsx)(`p`,{className:`file-tree-note${R?` evidence-warning`:``}`,role:R?`alert`:`status`,children:F}),H.length>0&&(0,K.jsxs)(`div`,{className:`file-import-results`,children:[(0,K.jsx)(`p`,{children:u(`filesImportLimit`)}),(0,K.jsx)(`ol`,{"aria-label":u(`filesImportResults`),"aria-live":`polite`,children:H.map(e=>(0,K.jsxs)(`li`,{"data-import-state":e.state,children:[(0,K.jsx)(`span`,{title:`${e.directory}/${e.name}`,children:e.name}),(0,K.jsx)(`small`,{children:e.message??u(e.state===`running`?`filesImporting`:`filesImportPending`)}),e.state===`error`&&(e.file||e.kind===`directory`)&&(0,K.jsx)(`button`,{type:`button`,disabled:!r||B,onClick:()=>void st([e]),children:u(`filesRetryImport`)})]},e.id))}),(0,K.jsx)(`button`,{type:`button`,disabled:B,onClick:()=>te(e=>e.filter(e=>e.state!==`done`)),children:u(`filesClearImported`)})]}),(0,K.jsx)(`span`,{className:`sr-only`,role:`status`,children:Ae}),C&&(0,K.jsx)(`p`,{className:`file-tree-note evidence-warning`,role:`alert`,children:C}),(0,K.jsxs)(`section`,{className:`file-tree`,"aria-label":u(`filesExplorer`),ref:Ke,onKeyDown:xt,onScroll:e=>{f?.files&&(f.files.treeScroll=e.currentTarget.scrollTop)},"aria-busy":T,children:[(0,K.jsxs)(`ul`,{children:[St(nt?x?.entries??[]:y[`.`]?.entries??[]),bt(`.`,nt?x:y[`.`])]}),(nt?x?.truncated:y[`.`]?.truncated)&&(0,K.jsx)(`p`,{className:`file-tree-note`,children:u(`filesTruncated`)}),!T&&!C&&(nt?x?.entries.length===0:y[`.`]?.entries.length===0)&&(0,K.jsx)(`p`,{className:`file-tree-note`,children:u(nt?`filesNoMatches`:`filesEmpty`)})]})]})}function nz({sessionId:e,sessionPath:t,cwd:n,active:r,canWrite:i=!0}){let{t:a}=cr(),o=kk(),[s,c]=(0,_.useState)(o?.files?.selected??``),[l,u]=(0,_.useState)(o?.files?.treeVisible??!0),d=(0,_.useRef)(null),f=(0,_.useRef)(null);return(0,_.useLayoutEffect)(()=>{o&&(o.files={query:``,expanded:[`.`],treeScroll:0,...o.files,selected:s,treeVisible:l})},[o,s,l]),(0,K.jsx)(`div`,{ref:d,className:`files-workspace`,"data-tree-visible":l,"data-preview-open":!!s,children:(0,K.jsxs)(Gk,{ref:f,sessionId:e,sessionPath:t,embedded:!0,active:r,onClose:()=>{c(``),u(!0)},children:[(0,K.jsx)(Cd,{content:a(l?`filesHideTree`:`filesShowTree`),placement:`below`,children:(0,K.jsx)(`button`,{type:`button`,className:`files-tree-toggle icon-button`,"aria-label":a(l?`filesHideTree`:`filesShowTree`),"aria-pressed":l,onClick:()=>u(e=>!e),children:l?(0,K.jsx)(G,{"aria-hidden":`true`}):(0,K.jsx)(De,{"aria-hidden":`true`})})}),!s&&(0,K.jsxs)(`div`,{className:`files-empty-header`,title:n,children:[(0,K.jsx)(G,{"aria-hidden":`true`}),n.split(/[\\/]/u).filter(Boolean).at(-1)||n]}),!s&&(0,K.jsxs)(`div`,{className:`files-preview-empty`,children:[(0,K.jsx)(Se,{"aria-hidden":`true`}),(0,K.jsx)(`h3`,{children:a(`filesChoose`)}),(0,K.jsx)(`p`,{children:a(`filesChooseDetail`)})]}),(0,K.jsx)(`div`,{className:`files-tree-container`,hidden:!l,children:(0,K.jsx)(tz,{sessionId:e,sessionPath:t,cwd:n,canWrite:i,active:r&&l,selected:s,onSelect:c,dropTarget:d,onShowTree:u,onRemoved:e=>{e.some(e=>e===s||s.startsWith(`${e}/`))&&f.current?.close({restoreFocus:!1})}},JSON.stringify([e,t,n]))})]})})}var rz=(0,_.createContext)(null);rz.displayName=`CollapsibleGroupContext`;var iz=(0,_.createContext)(null);iz.displayName=`CollapsibleGroupPresentationContext`;function az(e){let{isCollapsible:t,value:n}=e,r=(0,_.use)(rz),i=r!=null&&n!=null,a=t===!0?{}:t||null,o=a!=null,[s,c]=(0,_.useState)(()=>i?!0:a?.isOpen===void 0?a?.defaultIsOpen??!0:a.isOpen),l;return l=i&&n!=null?r.isOpen(n):a?.isOpen===void 0?s:a.isOpen,{isEnabled:o,isOpen:l,toggle:()=>{if(i&&n!=null){r.toggle(n);return}let e=!l;a?.isOpen===void 0&&c(e),a?.onOpenChange?.(e)}}}var oz={info:`info`,warning:`warning`,error:`error`,success:`success`},sz={info:`status`,warning:`alert`,error:`alert`,success:`status`},cz=`status`,lz={info:`accent`,warning:`warning`,error:`error`,success:`success`},uz={root:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kMv6JI:`xjb2p0i`,$$css:!0},rootElevatedCard:{kaIpWk:`x1vf2byn`,$$css:!0},header:{k1xSpc:`x78zum5`,kGNEyG:`x1cy8zhl`,kwnvtZ:`x1a02dak`,k1C7PZ:`xak3so`,khm7nJ:`x4olc9o`,k8WAf4:`x8o8v82`,kg3NbH:`x1pzlopt`,$$css:!0},headerCardStandalone:{kaIpWk:`x1vf2byn`,$$css:!0},headerCardWithContent:{krdFHd:`xwxb7qi`,kfmiAY:`x13nour3`,kVL7Gh:`xbiv7yw`,kT0f0o:`x16uus16`,$$css:!0},headerCentered:{kGNEyG:`x6s0dn4`,$$css:!0},endArea:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kwnvtZ:`x1a02dak`,kjj79g:`x13a6bvl`,kOIVth:`x1txdalj`,kmuXW:`x2lah0s`,ks0D6T:`x193iq5w`,keTefX:`xvc5jky`,kqGvvJ:`x81ka23`,$$css:!0},chevron:{k1ekBW:`x11xpdln`,kIyJzY:`xuedmi6 x12w9bfk`,kAMwcw:`xlr8y92`,$$css:!0},chevronExpanded:{k3aq6I:`x19jd1h0`,$$css:!0}},dz={info:{kWkggS:`xgcxg3y`,$$css:!0},warning:{kWkggS:`x24i8r5`,$$css:!0},error:{kWkggS:`x1pritpl`,$$css:!0},success:{kWkggS:`xu13z74`,$$css:!0}};function fz(e){return Object.prototype.hasOwnProperty.call(dz,e)}var pz={none:{kGVxlE:`x1gnnqk1`,$$css:!0},low:{kGVxlE:`x1i5ehqx`,$$css:!0},med:{kGVxlE:`x14hfi27`,$$css:!0},high:{kGVxlE:`x1kcpxr7`,$$css:!0}};function mz({status:e,title:t,description:n,icon:r,isDismissable:i=!1,onDismiss:a,dismissLabel:o,endContent:s,container:c=`card`,elevation:l=`none`,collapsible:u=!0,children:d,xstyle:f,className:p,style:m,ref:h,onFocusCapture:g,onPointerDownCapture:v,...y}){let b=Rc(),[x,S]=(0,_.useState)(!1),C=typeof u==`object`&&u?u:{},{isEnabled:w,isOpen:T,toggle:E}=az({isCollapsible:u!==!1&&{...C,defaultIsOpen:C.defaultIsOpen??!1}}),D=(0,_.useRef)(null),O=(0,_.useId)(),k=oz[e],A=sz[e]??cz,j=lz[e],M=Ea(d),N=b(`@astryx.banner.dismiss`),P=o??N,F=o??(typeof t==`string`?b(`@astryx.banner.dismissTitled`,{dismiss:N,title:t}):N);if(x)return null;let I=(e,t)=>{e instanceof HTMLElement&&e!==document.body&&!t.contains(e)&&(D.current=e)},L=e=>{I(e.relatedTarget,e.currentTarget)},R=e=>{I(document.activeElement,e.currentTarget)},ee=()=>{let e=D.current;S(!0),a?.(),e?.isConnected&&e.focus()},z=w&&M,B=Ea(s)||i||z,V=Ea(s)||i,H=!Ea(n)&&V,te=M&&(!w||T),ne=c===`card`;return(0,K.jsxs)(`div`,{ref:h,role:A,onFocusCapture:ca(g,L),onPointerDownCapture:ca(v,R),...oa(Sr(uz.root,pz[l],ne&&l!==`none`&&uz.rootElevatedCard,f),p,m),...y,children:[(0,K.jsxs)(`div`,{...oa(ba(`banner`,{container:c,status:e}),Sr(uz.header,H&&uz.headerCentered,fz(e)&&dz[e],ne&&(te?uz.headerCardWithContent:uz.headerCardStandalone))),children:[(0,K.jsx)(`div`,{...Ea(r)?oa(ba(`banner-icon`,{status:e}),{className:`x78zum5 x6s0dn4 x2lah0s`}):{className:`x78zum5 x6s0dn4 x2lah0s`},"aria-hidden":`true`,children:Ea(r)?r:k==null?null:(0,K.jsx)(xu,{icon:k,size:`md`,color:j,...ba(`banner-icon`,{status:e})})}),(0,K.jsxs)(`div`,{...{0:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli`},1:{className:`x78zum5 xdt5ytf xxhr3t x98rzlu xeuugli xgualba`}}[!!Ea(s)<<0],children:[(0,K.jsx)(`div`,{className:`x1ghz6dp xjb2p0i xcr08ib x2mo6ok x1kq96og x1tgivj0 xj0a0fe`,children:t}),Ea(n)&&(0,K.jsx)(`div`,{className:`x1ghz6dp xjb2p0i x141an7d x1sodnla x1ltkj2j xv1l7n4 xj0a0fe`,children:n})]}),B&&(0,K.jsxs)(`div`,{...Sr(uz.endArea,rs.inset(Br[`--spacing-2`])),children:[s,z&&(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,label:b(T?`@astryx.banner.collapse`:`@astryx.banner.expand`),tooltip:b(T?`@astryx.banner.collapse`:`@astryx.banner.expand`),icon:(0,K.jsx)(xu,{icon:`chevronDown`,size:`sm`,color:`inherit`,xstyle:[uz.chevron,T&&uz.chevronExpanded]}),onClick:E,"aria-expanded":T,"aria-controls":te?O:void 0,isIconOnly:!0}),i&&(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,label:F,tooltip:P,icon:(0,K.jsx)(xu,{icon:`close`,size:`sm`,color:`inherit`}),onClick:ee,isIconOnly:!0})]})]}),te&&(0,K.jsx)(`div`,{id:z?O:void 0,...oa(ba(`banner-content`,{container:c,status:e}),{0:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh`},1:{className:`x1de1mus x8o8v82 x1pzlopt xgbv0en xw8tdv1 x92x3c3 x1t7ytsu x18b5jzi x1q0q8m5 x1j92z86 x1gejf6u xw8gpjh x1k5g1gk x1eprgri`}}[!!ne<<0]),children:d})]})}mz.displayName=`Banner`;var hz={container:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,k9WMMc:`x2b8uid`,kOIVth:`x18g69wz`,k8WAf4:`xmfvnks`,kg3NbH:`xm7rs69`,$$css:!0},containerCompact:{kOIVth:`x1txdalj`,k8WAf4:`x1na6nto`,kg3NbH:`x1pzlopt`,$$css:!0}};function gz({title:e,description:t,icon:n,actions:r,headingLevel:i=3,isCompact:a=!1,xstyle:o,className:s,style:c,ref:l,...u}){let d=`h${i}`;return(0,K.jsxs)(`div`,{ref:l,...u,role:`status`,...oa(ba(`empty-state`,{variant:a?`compact`:null}),Sr(hz.container,a&&hz.containerCompact,o),s,c),children:[n!=null&&(0,K.jsx)(`div`,{"aria-hidden":`true`,children:n}),(0,K.jsxs)(`div`,{className:`x78zum5 xdt5ytf x6s0dn4 xxc7z9f`,children:[(0,_.createElement)(d,oa(ba(`empty-state-title`,{variant:a?`compact`:null}),{0:{className:`x1ghz6dp xjb2p0i x18juvz8 x2mo6ok xf74fhv x1tgivj0`},1:{className:`x1ghz6dp xjb2p0i x2mo6ok xf74fhv x1tgivj0 xcr08ib`}}[!!a<<0]),e),t!=null&&(0,K.jsx)(`div`,{...oa(ba(`empty-state-description`,{variant:a?`compact`:null}),{0:{className:`x1ghz6dp xjb2p0i xjm74w1 x1sodnla xw6l6zx xv1l7n4`},1:{className:`x1ghz6dp xjb2p0i x1sodnla xw6l6zx xv1l7n4 x141an7d`}}[!!a<<0]),children:t})]}),r!=null&&(0,K.jsx)(`div`,{...{0:{className:`x78zum5 x1q0g3np x6s0dn4 x1txdalj xcsaf9d`},1:{className:`x78zum5 x6s0dn4 x1txdalj xcsaf9d xdt5ytf`}}[!!a<<0],children:r})]})}gz.displayName=`EmptyState`;var _z=1e3,vz=100,yz={root:{kWkggS:`xprdx6m x1j0df82 x1o55y2u`,kSiTet:`xvpkmg4 x1tbh5bv`,$$css:!0},animate:{kILWW9:`xpz12be`,k44tkh:`xqgcaz`,ko0y90:`xa4qsjk`,kKVMdj:`xeuoslp x1aquc0h`,kyAemX:`x193epu2`,$$css:!0}},bz={0:{kaIpWk:`xwksslw`,$$css:!0},1:{kaIpWk:`xx3sua9`,$$css:!0},2:{kaIpWk:`xh6dtrn`,$$css:!0},3:{kaIpWk:`x1hviunn`,$$css:!0},4:{kaIpWk:`x1hviunn`,$$css:!0},none:{kaIpWk:`x2u8bby`,$$css:!0},rounded:{kaIpWk:`xjspbzw`,$$css:!0}},xz={kKxzle:`xvo38ju`,$$css:!0},Sz={animationDelay:e=>[xz,{"--x-animationDelay":(e=>typeof e==`number`?e+`ms`:e??void 0)(`${_z+vz*e}ms`)}],dimensions:(e,t)=>[{kzqmXN:(typeof e==`number`?`${e}px`:e)==null?typeof e==`number`?`${e}px`:e:`x5lhr3w`,kZKoxP:(typeof t==`number`?`${t}px`:t)==null?typeof t==`number`?`${t}px`:t:`x16ye13r`,$$css:!0},{"--x-width":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof e==`number`?`${e}px`:e),"--x-height":(e=>typeof e==`number`?e+`px`:e??void 0)(typeof t==`number`?`${t}px`:t)}]};function Cz({width:e=`100%`,height:t=`100%`,radius:n=3,index:r=0,"data-testid":i,xstyle:a,className:o,style:s,ref:c,...l}){return(0,K.jsx)(`div`,{ref:c,"aria-hidden":`true`,"data-testid":i,...oa(ba(`skeleton`),Sr(yz.root,yz.animate,bz[n],Sz.dimensions(e,t),Sz.animationDelay(r),a),o,s),...l})}Cz.displayName=`Skeleton`;function wz({branches:e,value:t,loading:n,onChange:r}){let{t:i}=cr(),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),u=(0,_.useRef)([]),d=(0,_.useRef)(null),f=(0,_.useId)(),p=e.options.filter(e=>`${e.label} ${e.ref}`.toLocaleLowerCase().includes(a.toLocaleLowerCase()));(0,_.useEffect)(()=>{if(!s)return;let e=requestAnimationFrame(()=>l.current?.focus());return()=>cancelAnimationFrame(e)},[s]),(0,_.useEffect)(()=>{if(!s)return;let e=e=>{let t=e.target;d.current=t instanceof Element&&!t.closest(`.review-base-picker, .review-base-popup`)?t.closest(`button:not(:disabled), input:not(:disabled), textarea:not(:disabled), select:not(:disabled), a[href], [tabindex], [contenteditable='true']`):null};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[s]);let m=e.options.find(e=>e.ref===t)?.label??t;return(0,K.jsx)(iN,{className:`review-base-picker`,label:i(`gitReviewBaseBranch`),isLabelHidden:!0,value:t??``,triggerLabel:(0,K.jsx)(`span`,{className:`review-base-label`,title:t,children:m||i(`gitReviewChooseBase`)}),variant:`ghost`,size:`sm`,isDisabled:e.options.length===0,isLoading:n,onOpenChange:e=>{c(e),e||(o(``),d.current?.isConnected&&d.current.focus({preventScroll:!0}),d.current=null)},children:(s,c,d)=>(0,K.jsxs)(`div`,{className:`review-base-popup`,children:[(0,K.jsxs)(`label`,{className:`review-base-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`sr-only`,children:i(`gitReviewSearchBranches`)}),(0,K.jsx)(`input`,{ref:l,type:`search`,value:a,"aria-controls":f,placeholder:i(`gitReviewSearchBranches`),onChange:e=>o(e.currentTarget.value),onKeyDown:e=>{e.nativeEvent.isComposing||e.keyCode===229||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),d()):e.key===`ArrowDown`&&p.length&&!n&&(e.preventDefault(),u.current[0]?.focus()))}})]}),e.truncated&&(0,K.jsx)(`p`,{role:`status`,children:i(`gitReviewBranchesTruncated`)}),(0,K.jsxs)(`div`,{id:f,role:`listbox`,"aria-label":i(`gitReviewBaseBranch`),className:`review-base-options`,children:[p.map((e,a)=>(0,K.jsxs)(`button`,{type:`button`,disabled:n,role:`option`,"aria-selected":t===e.ref,title:e.ref,ref:e=>{u.current[a]=e},onClick:()=>{r(e.ref),d()},onKeyDown:e=>{if(!(e.nativeEvent.isComposing||e.keyCode===229)){if(e.key===`Escape`)e.preventDefault(),e.stopPropagation(),d();else if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`){e.preventDefault();let t=e.key===`Home`?0:e.key===`End`?p.length-1:(a+(e.key===`ArrowDown`?1:p.length-1))%p.length;u.current[t]?.focus()}}},children:[(0,K.jsxs)(`span`,{children:[e.label,(0,K.jsx)(`small`,{children:e.ref.startsWith(`refs/heads/`)?i(`gitReviewLocalBranch`):i(`gitReviewRemoteBranch`)})]}),t===e.ref&&(0,K.jsx)(I,{"aria-hidden":`true`})]},e.ref)),!p.length&&(0,K.jsx)(`p`,{role:`status`,children:i(`gitReviewNoMatchingBranches`)})]})]})})}function Tz(e,t){return{path:e,name:t,directories:new Map,files:[]}}function Ez({files:e,selectedPath:t,collapsed:n,searching:r,onToggle:i,onSelect:a,viewed:o,onViewedChange:s,viewedLimitReached:c=!1}){let{t:l}=cr(),u=(0,_.useMemo)(()=>{let t=Tz(``,``);for(let n of e){let e=t;for(let t of n.path.split(`/`).slice(0,-1)){let n=e.path?`${e.path}/${t}`:t,r=e.directories.get(t);r||(r=Tz(n,t),e.directories.set(t,r)),e=r}e.files.push(n)}return t},[e]),d=(e,u)=>(0,K.jsxs)(`ul`,{children:[[...e.directories.values()].map(e=>{let t=e,a=t.name;for(;t.files.length===0&&t.directories.size===1;){let e=t.directories.values().next().value;if(!e)break;t=e,a+=`/${t.name}`}let o=t.path,s=r||!n.has(o);return(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`review-tree-directory`,style:{paddingLeft:8+u*16},title:o,"aria-expanded":s,disabled:r,onClick:()=>i(o),children:[(0,K.jsx)(ee,{"aria-hidden":`true`,"data-open":s}),(0,K.jsx)(`span`,{children:a})]}),s&&d(t,u+1)]},e.path)}),e.files.map(e=>{let n=e.path.split(`/`).at(-1)??e.path,r=/\.(png|jpe?g|gif|webp|svg)$/iu.test(n)?Ne:/\.(md|txt|log)$/iu.test(n)?Se:ve;return(0,K.jsxs)(`li`,{className:`review-tree-file-row`,children:[(0,K.jsxs)(`button`,{className:`session-review-file review-tree-file`,type:`button`,style:{paddingLeft:8+u*16},"data-review-file":e.path,title:e.path,"aria-label":e.path,"aria-description":l(`gitFileStatus_${e.status}`),"aria-current":t===e.path?`true`:void 0,onClick:()=>a(e.path),children:[(0,K.jsx)(r,{"aria-hidden":`true`,className:`review-tree-icon`}),(0,K.jsx)(`span`,{className:`review-tree-name`,children:n}),(0,K.jsx)(`span`,{className:`review-tree-status`,"aria-hidden":`true`,children:l(`gitFileStatus_${e.status}`)}),(0,K.jsx)(`span`,{className:`session-review-stats`,"aria-hidden":`true`,children:e.binary?(0,K.jsx)(`span`,{children:l(`gitReviewBinaryShort`)}):e.statsUnavailable?(0,K.jsx)(`span`,{title:l(`turnEditStatsUnknown`),children:`—`}):(0,K.jsxs)(K.Fragment,{children:[e.additions>0&&(0,K.jsxs)(`span`,{className:`review-additions`,children:[`+`,e.additions]}),e.deletions>0&&(0,K.jsxs)(`span`,{className:`review-deletions`,children:[`-`,e.deletions]})]})})]}),s&&(0,K.jsx)(`label`,{className:`review-viewed-control`,title:l(`gitReviewMarkViewed`,{path:e.path}),children:(0,K.jsx)(`input`,{type:`checkbox`,"aria-label":l(`gitReviewMarkViewed`,{path:e.path}),checked:o?.has(e.path)??!1,disabled:c&&!o?.has(e.path),onChange:t=>s(e.path,t.currentTarget.checked)})})]},e.path)})]});return(0,K.jsx)(`div`,{className:`session-review-list review-file-tree`,children:d(u,0)})}var Dz=20,Oz=200,kz=[0,1,2,3];function Az(e){return e.split(/[\\/]/u).at(-1)||e}function jz(e,t){return e?e.reason===`not_git_repository`?t(`gitReviewNotRepository`):e.reason===`unborn_repository`?t(`gitReviewUnborn`):e.reason===`baseline_unavailable`?t(`gitReviewBaselineUnavailable`):e.reason===`base_branch_unavailable`?t(`gitReviewBaseUnavailable`):e.reason===`invalid_base_branch`?t(`gitReviewBaseInvalid`):t(`gitReviewFailed`):null}function Mz({review:e,initialFilePath:t,onClose:n,onOpenTools:r,embedded:i=!1,active:a=!0,onOpenFiles:o,readingScope:s,onReferenceLine:c}){let{t:l}=cr(),u=kk(),d=(0,_.useRef)(void 0);e.result?.branches?d.current=e.result.branches:e.result&&!e.loading&&(d.current=void 0);let f=e.result?.branches??(e.loading?d.current:void 0),p=`${s??e.source??`unstaged`}:${e.baseRef??``}`,m=u?.review?.scope===p?u.review:void 0,h=(0,_.useRef)(JSON.stringify([p,t])),g=(0,_.useRef)(null),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(new Set(m?.collapsedDirectories));(0,_.useEffect)(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(([e])=>{e&&y(e.contentRect.width>=720)});return t.observe(e),()=>t.disconnect()},[]);let S=(0,_.useRef)(null),C=(0,_.useRef)(null),w=(0,_.useRef)(null),E=(0,_.useRef)(!0),D=(0,_.useRef)(!1),O=(0,_.useRef)(m?.listScroll??null),k=(0,_.useRef)(null),[A,j]=(0,_.useState)(m?.visibleFiles??Dz),[M,N]=(0,_.useState)(m?.query??``),[P,F]=(0,_.useState)(null),[I,L]=(0,_.useState)(m?m.selected:t??null),[R,ee]=(0,_.useState)(()=>m?.viewed?{scope:p,revision:m.viewed.revision,paths:new Set(m.viewed.paths.slice(0,Oz))}:null),z=(0,_.useRef)(m?{list:m.listScroll,preview:m.previewScroll}:null);(0,_.useLayoutEffect)(()=>{u&&(u.review={source:e.source??`unstaged`,baseRef:e.baseRef,scope:p,selected:I,query:M,collapsedDirectories:[...b],visibleFiles:A,listScroll:u.review?.scope===p?u.review.listScroll:0,previewScroll:u.review?.scope===p?u.review.previewScroll:0,viewed:R?.scope===p?{revision:R.revision,paths:[...R.paths].slice(0,Oz)}:void 0})},[u,e.source,e.baseRef,p,I,M,b,A,R]);let[B,V]=(0,_.useState)(null),[H,te]=(0,_.useState)(null),[ne,re]=(0,_.useState)(0),[ie,ae]=(0,_.useState)(()=>window.matchMedia?.(`(max-width: 1100px)`).matches??!1);(0,_.useEffect)(()=>{let e=window.matchMedia?.(`(max-width: 1100px)`);if(!e)return;let t=()=>ae(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,_.useEffect)(()=>{let e=JSON.stringify([p,t]);h.current!==e&&(h.current=e,E.current=!!t||!(document.activeElement instanceof Element&&document.activeElement.closest(`.review-base-picker, .review-base-popup`)),O.current=null,L(t??null),N(``),x(new Set),F(null),ee(null))},[t,p]);let U=i?`section`:ie?`main`:`aside`,oe=e.result?.ok?e.result.snapshot:null,se=!e.historical&&I&&P&&P.comparison===(e.source??oe?.comparison)?oe?.revision===P.revision?oe:P:oe,ce=!!(I&&se&&oe&&se.revision!==oe.revision);(0,_.useEffect)(()=>{I&&!P&&oe&&F(oe)},[I,P,oe]);let le=e.source??se?.comparison??`unstaged`,ue=jz(e.result&&!e.result.ok?e.result:null,l),de=se?.files.find(e=>e.path===I),fe=B?.source===le&&B?.revision===se?.revision&&B?.file.path===I?B.file:de,pe=se?.revision,me=R?.scope===p&&R.revision===pe?R.paths:new Set;(0,_.useEffect)(()=>{pe&&R&&(R.scope!==p||R.revision!==pe)&&ee(null)},[pe,p,R]);let W=(e,t)=>{!pe||!se?.files.some(t=>t.path===e)||ee(n=>{let r=new Set(n?.scope===p&&n.revision===pe?n.paths:[]);if(t){if(r.size>=Oz)return n;r.add(e)}else r.delete(e);return{scope:p,revision:pe,paths:r}})};(0,_.useLayoutEffect)(()=>{!a||!se||!z.current||I&&fe?.diffLoaded===!1||(C.current&&(C.current.scrollTop=z.current.list),w.current&&(w.current.scrollTop=z.current.preview),z.current=null)},[a,se,I,fe?.diffLoaded]);let he=H?.source===le&&H?.path===I&&H?.revision===pe&&de?.diffLoaded===!1?H.message:null;(0,_.useEffect)(()=>{let t=de?.path;if(!a||!t||de?.diffLoaded!==!1||!e.readFile||!pe)return;let n=new AbortController;return te(null),e.readFile(t,n.signal,pe).then(e=>{n.signal.aborted||(e?V({source:le,revision:pe,file:e}):te({source:le,path:t,revision:pe,message:l(`gitReviewFileMissing`)}))},e=>{n.signal.aborted||te({source:le,path:t,revision:pe,message:e instanceof Error?e.message:l(`gitReviewFailed`)})}),()=>n.abort()},[de?.path,a,de?.diffLoaded,pe,le,e.readFile,ne,l]);let ge=(0,_.useMemo)(()=>(se?.files??[]).filter(e=>e.path.toLocaleLowerCase().includes(M.toLocaleLowerCase())).sort((e,t)=>e.path.localeCompare(t.path,`en`,{numeric:!0})),[se?.files,M]),_e=v?ge:ge.slice(0,A);(0,_.useEffect)(()=>{!v||I||!se?.files.length||(E.current=!1,L(se.files[0].path))},[v,I,se]);let be=Math.max(0,ge.length-_e.length),xe=se?.listComplete===!1||se?.listComplete===void 0&&se?.truncated,Se=xe||se?.nextOffset!==void 0,Ce=e.historical?l(se?.evidenceSource===`file-tools`?`turnEditsScope`:`turnChangesScope`):se?se.comparison===`session`?l(`gitReviewSessionSnapshot`):se.comparison===`unstaged`?l(`gitReviewUnstaged`):se.comparison===`staged`?l(`gitReviewStaged`):se.baseBranch?l(`gitReviewComparison`,{current:se.currentBranch??l(`gitReviewDetached`),base:se.baseBranch.replace(/^refs\/(?:heads|remotes)\//u,``)}):l(`gitReviewWorkingTree`):null;(0,_.useEffect)(()=>{let e=a&&!D.current;D.current=a,a&&(!e&&!E.current||(E.current=!1,I?w.current?.focus():i?C.current?.focus():S.current?.focus()))},[a,i,I]);let we=e=>{O.current=C.current?.scrollTop??null,e!==I&&(z.current={list:O.current??0,preview:0},w.current&&(w.current.scrollTop=0),u?.review?.scope===p&&(u.review.previewScroll=0)),E.current=!v,F(se),L(e)};(0,_.useLayoutEffect)(()=>{let e=k.current;if(I||!e||!a)return;k.current=null;let t=C.current;if(!t?.isConnected||t.closest(`[hidden], [inert]`))return;let n=[...t.querySelectorAll(`[data-review-file]`)].find(t=>t.dataset.reviewFile===e);O.current!==null&&(t.scrollTop=O.current),n?n.focus({preventScroll:O.current!==null}):i?t.focus():S.current?.focus()},[a,i,I]);let Te=()=>{let e=I,t=ge.findIndex(t=>t.path===e);t>=A&&j(Math.ceil((t+1)/Dz)*Dz),E.current=!1,k.current=e,L(null),F(null)};return(0,K.jsxs)(U,{ref:g,className:`review-panel${i?` embedded`:``}${v?` review-wide`:``}`,"aria-label":l(`changeEvidence`),"aria-busy":e.loading||void 0,onKeyDown:e=>{e.key!==`Escape`||e.nativeEvent.isComposing||e.keyCode===229||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||e.defaultPrevented||(!I||v)&&i||(e.preventDefault(),e.stopPropagation(),I&&!v?Te():i||n())},children:[(0,K.jsxs)(`div`,{className:`review-source-picker`,children:[e.setSource&&(0,K.jsxs)(`label`,{children:[l(`gitReviewSource`),` `,(0,K.jsxs)(`select`,{value:e.historical?`turn`:e.source??`unstaged`,onChange:t=>e.setSource?.(t.currentTarget.value),children:[e.historical&&(0,K.jsx)(`option`,{value:`turn`,children:l(`turnChangesReview`)}),(0,K.jsx)(`option`,{value:`unstaged`,children:l(`gitReviewUnstaged`)}),(0,K.jsx)(`option`,{value:`staged`,children:l(`gitReviewStaged`)}),(0,K.jsx)(`option`,{value:`branch`,children:l(`gitReviewBranch`)}),(0,K.jsx)(`option`,{value:`session`,children:l(`gitReviewSessionSnapshot`)})]})]}),e.source===`branch`&&e.setBaseRef&&f&&(0,K.jsx)(wz,{branches:f,value:e.baseRef??(e.result?.ok?e.result.snapshot.baseBranch??void 0:void 0),loading:e.loading,onChange:e.setBaseRef}),Ce&&(!e.setSource||e.historical||se?.comparison===`branch`)&&(0,K.jsx)(`span`,{className:`review-source-summary`,title:Ce,children:Ce}),(0,K.jsxs)(`div`,{className:`review-source-actions`,children:[o&&(0,K.jsx)(`button`,{type:`button`,onClick:o,children:l(`sessionFileRecords`)}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":l(`gitReviewRefresh`),title:l(`gitReviewRefresh`),disabled:e.loading,"aria-busy":e.loading||void 0,onClick:()=>{e.loading||e.refresh()},children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]})]}),ce&&(0,K.jsxs)(`div`,{className:`review-update`,role:`status`,children:[(0,K.jsx)(`span`,{children:l(`gitReviewNewVersion`)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{w.current?.focus(),F(oe),V(null)},children:l(`gitReviewShowLatest`)})]}),(e.error||ue)&&(0,K.jsx)(mz,{status:`error`,container:`section`,title:e.error||ue,description:se?l(`gitReviewOlderResult`):void 0,className:`review-banner`,endContent:(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,label:l(`gitReviewRetry`),isDisabled:e.loading,isLoading:e.loading,onClick:()=>{e.loading||e.refresh()}})}),(0,K.jsxs)(`div`,{className:`review-workspace`,children:[I&&(0,K.jsxs)(`div`,{className:`review-file-screen`,children:[(0,K.jsxs)(`header`,{className:`review-file-header`,children:[!v&&(0,K.jsx)(qc,{label:l(`gitReviewBackToFiles`),variant:`ghost`,size:`sm`,isIconOnly:!0,icon:(0,K.jsx)(T,{"aria-hidden":`true`}),onClick:Te}),(0,K.jsxs)(`div`,{className:`review-file-heading`,children:[(0,K.jsx)(`strong`,{title:I,children:Az(I)}),(0,K.jsx)(`span`,{title:I,children:I})]}),fe&&pe&&(0,K.jsxs)(`label`,{className:`review-file-viewed`,children:[(0,K.jsx)(`input`,{type:`checkbox`,"aria-label":l(`gitReviewMarkCurrentViewed`,{path:I}),checked:me.has(I),disabled:me.size>=Oz&&!me.has(I),onChange:e=>W(I,e.currentTarget.checked)}),(0,K.jsx)(`span`,{children:l(`gitReviewViewedLabel`)})]}),!i&&(0,K.jsxs)(`div`,{className:`review-file-actions`,children:[r&&(0,K.jsx)(qc,{label:l(`openTools`),variant:`ghost`,size:`sm`,isIconOnly:!0,icon:(0,K.jsx)(lt,{"aria-hidden":`true`}),onClick:r}),(0,K.jsx)(qc,{label:l(`close`),variant:`ghost`,size:`sm`,isIconOnly:!0,icon:(0,K.jsx)(Lt,{"aria-hidden":`true`}),onClick:n})]})]}),(0,K.jsxs)(`div`,{className:`review-file-toolbar`,children:[(0,K.jsx)(`div`,{className:`review-file-context`,children:fe&&(0,K.jsx)(`span`,{children:l(`gitFileStatus_${fe.status}`)})}),(0,K.jsxs)(UP,{gap:2,align:`center`,className:`session-review-stats`,children:[fe&&!fe.binary&&!fe.statsUnavailable&&fe.additions>0&&(0,K.jsxs)(zo,{type:`supporting`,hasTabularNumbers:!0,className:`review-additions`,children:[`+`,fe.additions]}),fe&&!fe.binary&&!fe.statsUnavailable&&fe.deletions>0&&(0,K.jsxs)(zo,{type:`supporting`,hasTabularNumbers:!0,className:`review-deletions`,children:[`-`,fe.deletions]})]})]}),(0,K.jsx)(`section`,{ref:w,className:`review-file-preview`,"aria-label":l(`gitReviewFilePreview`,{file:I}),tabIndex:-1,onScroll:e=>{u?.review&&(u.review.previewScroll=e.currentTarget.scrollTop)},children:fe?he?(0,K.jsxs)(`div`,{role:`alert`,children:[(0,K.jsx)(`p`,{children:he}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>re(e=>e+1),children:l(`retryAdmissionCheck`)})]}):fe.diffLoaded===!1&&e.readFile?(0,K.jsx)(`p`,{role:`status`,children:l(`gitReviewLoading`)}):fe.binary?(0,K.jsx)(gz,{icon:(0,K.jsx)(ve,{"aria-hidden":`true`}),title:l(`gitReviewBinary`),isCompact:!0}):fe.statsUnavailable?(0,K.jsx)(gz,{icon:(0,K.jsx)(ve,{"aria-hidden":`true`}),title:l(`turnEditStatsUnknown`),description:l(`turnEditReason_${fe.statsUnavailable}`),isCompact:!0}):fe.diff?(0,K.jsxs)(K.Fragment,{children:[fe.diffTruncated&&(0,K.jsx)(`p`,{className:`review-hidden-lines`,children:l(`gitReviewDiffTruncated`)}),(0,K.jsx)(KL,{file:fe,onReferenceLine:c})]}):(0,K.jsx)(gz,{icon:(0,K.jsx)(ve,{"aria-hidden":`true`}),title:l(fe.diffTruncated?`gitReviewDiffTruncated`:`gitReviewNoDiff`),description:fe.diffTruncated?l(`gitReviewDiffTruncated`):void 0,isCompact:!0}):(0,K.jsx)(`p`,{role:`status`,children:l(e.loading?`gitReviewLoading`:`gitReviewFileMissing`)})})]}),(!I||v)&&(0,K.jsxs)(`div`,{className:`review-navigation`,children:[!i&&!v&&(0,K.jsxs)(`header`,{className:`review-heading`,children:[(0,K.jsx)(`div`,{children:(0,K.jsxs)(`h2`,{children:[(0,K.jsx)(ye,{"aria-hidden":`true`}),` `,l(`changeEvidence`)]})}),(0,K.jsxs)(`div`,{className:`review-heading-actions`,children:[r&&(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":l(`openTools`),title:l(`openTools`),onClick:r,children:(0,K.jsx)(lt,{"aria-hidden":`true`})}),(0,K.jsx)(`button`,{ref:S,type:`button`,className:`icon-button review-close`,"aria-label":l(`close`),title:l(`close`),onClick:n,children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{ref:C,onScroll:e=>{u?.review&&(u.review.listScroll=e.currentTarget.scrollTop)},className:`review-body`,tabIndex:i?-1:void 0,children:[se&&(0,K.jsxs)(WP,{gap:1,align:`stretch`,className:`review-summary`,children:[(0,K.jsxs)(UP,{gap:3,align:`center`,justify:`between`,children:[(0,K.jsx)(zo,{type:`label`,children:l(xe?`gitReviewLoadedCount`:`filesChanged`,{count:xe?se.files.length:se.totalFiles??se.files.length})}),se.nextOffset!==void 0&&!xe&&(0,K.jsx)(zo,{type:`supporting`,color:`secondary`,children:l(`gitReviewLoadedCount`,{count:se.files.length})}),!xe&&!se.truncated&&se.nextOffset===void 0&&(se.additions>0||se.deletions>0)&&!se.files.some(e=>e.binary||e.statsUnavailable||e.status===`untracked`&&e.diffLoaded===!1)&&(0,K.jsxs)(UP,{gap:2,align:`center`,className:`review-summary-counts`,"aria-hidden":`true`,children:[se.additions>0&&(0,K.jsxs)(zo,{type:`supporting`,hasTabularNumbers:!0,className:`review-additions`,children:[`+`,se.additions]}),se.deletions>0&&(0,K.jsxs)(zo,{type:`supporting`,hasTabularNumbers:!0,className:`review-deletions`,children:[`-`,se.deletions]})]})]}),me.size>=Oz&&(0,K.jsx)(zo,{type:`supporting`,color:`secondary`,children:l(`gitReviewViewedLimit`,{count:Oz})})]}),e.loading&&!se&&(0,K.jsxs)(`div`,{className:`review-loading`,role:`status`,children:[(0,K.jsx)(`span`,{className:`sr-only`,children:l(`gitReviewLoading`)}),(0,K.jsxs)(WP,{gap:2,align:`stretch`,"aria-hidden":`true`,children:[(0,K.jsx)(Cz,{width:`42%`,height:16,radius:`rounded`,index:0}),(0,K.jsx)(`div`,{className:`review-loading-list`,children:kz.map(e=>(0,K.jsx)(Cz,{width:`100%`,height:36,radius:0,index:e+1},e))})]})]}),se?.truncated&&(0,K.jsx)(mz,{status:`info`,title:l(`gitReviewTruncated`),className:`review-banner`}),se&&se.files.length>0&&(0,K.jsxs)(`label`,{className:`review-search`,children:[(0,K.jsx)(ht,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`sr-only`,children:l(Se?`gitReviewSearchLoaded`:`gitReviewSearch`)}),(0,K.jsx)(`input`,{type:`search`,value:M,placeholder:l(Se?`gitReviewSearchLoaded`:`gitReviewSearch`),onChange:e=>{N(e.target.value),j(Dz)}})]}),M&&ge.length===0&&(0,K.jsx)(`p`,{className:`review-search-empty`,role:`status`,children:l(Se?`gitReviewNoLoadedMatch`:`gitReviewNoMatch`)}),se&&se.files.length===0&&(0,K.jsx)(gz,{icon:(0,K.jsx)(Ae,{"aria-hidden":`true`}),title:l(`gitReviewEmpty`),isCompact:!0,className:`review-empty`}),_e.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ez,{files:_e,selectedPath:I,collapsed:b,searching:!!M,onToggle:e=>x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),onSelect:we,viewed:me,onViewedChange:W,viewedLimitReached:me.size>=Oz}),be>0&&(0,K.jsx)(`div`,{className:`session-review-more`,children:(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,width:`100%`,label:l(`gitReviewShowMore`,{count:Math.min(Dz,be)}),onClick:()=>j(e=>Math.min(e+Dz,ge.length))})})]}),se?.nextOffset!==void 0&&e.loadMore&&(0,K.jsx)(`div`,{className:`session-review-more`,children:(0,K.jsx)(qc,{variant:`ghost`,size:`sm`,width:`100%`,label:l(`gitReviewLoadNext`),isLoading:e.loading,isDisabled:e.loading,onClick:()=>{e.loadMore?.()}})})]})]})]})]})}function Nz(e,t,n,r){let{t:i}=cr(),a=(0,_.useMemo)(()=>new lf,[]),[o,s]=(0,_.useState)(0),[c,l]=(0,_.useState)({identity:``,result:null,error:null}),u=JSON.stringify([e,t,r,o]);(0,_.useEffect)(()=>{if(!r)return;let o=new AbortController;return a.turnChanges(e,t,r,o.signal).then(t=>{if(o.signal.aborted)return;if(!t.ok||t.changes.sessionId!==e||t.changes.promptEntryId!==r||t.changes.state===`unavailable`){l({identity:u,result:null,error:i(`turnChangesUnavailable`)});return}let a=t.changes;l({identity:u,error:null,result:{ok:!0,snapshot:{...a.source?{evidenceSource:a.source}:{},...a.fileCount===null?{}:{totalFiles:a.fileCount,listComplete:!0},repositoryRoot:n,currentBranch:null,baseBranch:null,comparison:`session`,revision:u,files:a.files,additions:a.additions,deletions:a.deletions,truncated:a.state===`partial`}}})},()=>{o.signal.aborted||l({identity:u,result:null,error:i(`turnChangesUnavailable`)})}),()=>o.abort()},[a,e,t,r,u,n,i]);let d=(0,_.useCallback)(async()=>s(e=>e+1),[]);return{result:c.identity===u?c.result:null,error:c.identity===u?c.error:null,loading:!!r&&c.identity!==u,refresh:d,historical:!0}}function Pz(e,t,n){let r=(0,_.useRef)({onState:t,onOpen:n});r.current={onState:t,onOpen:n};let[i,a]=(0,_.useState)(),[o,s]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{let t=()=>{let e=document.documentElement.dataset.openpiBrowserExtension===`ready`;s(e),e||a(void 0)};t();let n=new MutationObserver(t);n.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-openpi-browser-extension`]});let i=t=>{if(t.source!==window||t.origin!==location.origin)return;let n=t.data;if(!n||n.source!==`openpi-browser-extension`||n.id!==e)return;if(n.type===`lost`){a(void 0);return}if(typeof n.url!=`string`)return;let i=YR(n.url,location.origin);if(i&&(n.type===`open`&&r.current.onOpen(i),n.type===`state`&&typeof n.title==`string`)){let t={id:e,document:typeof n.document==`string`?n.document:void 0,url:i,title:n.title.slice(0,256),canGoBack:n.canGoBack===!0,canGoForward:n.canGoForward===!0};a(t),r.current.onState(t)}};return window.addEventListener(`message`,i),()=>{n.disconnect(),window.removeEventListener(`message`,i)}},[e]),{ready:o,page:o&&i?.id===e?i:void 0,command:t=>window.postMessage({source:`openpi-browser-ui`,type:`command`,id:e,action:t},location.origin)}}var Fz=8;function Iz({onTitle:e,onOpen:t,initialUrl:n=``,readingId:r}){let{t:i}=cr(),a=(0,_.useId)(),o=(0,_.useRef)(null),s=kk(),c=s?.browser?.pages[r],[l,u]=(0,_.useState)(c?.draft??n),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)({history:c?.history??(n?[n]:[]),index:c?.index??(n?0:-1),revision:0,loaded:!1,unknown:!1}),h=p.history[p.index],g=(0,_.useRef)(h);(0,_.useLayoutEffect)(()=>{s?.browser&&(s.browser.pages[r]={draft:l,history:p.history.map((e,t)=>t===p.index?g.current??e:e),index:p.index})},[s,r,l,p]);let v=`${a}-${p.revision}`,y=Pz(v,t=>{g.current=t.url;let n=s?.browser?.pages[r];n&&(n.history=n.history.map((e,r)=>r===n.index?t.url:e)),document.activeElement!==o.current&&u(t.url),e(t.title||new URL(t.url).host)},t),b=y.page?.url??h,x=(t,n)=>{let r=t[n];r&&(g.current=r,m(e=>({history:t,index:n,revision:e.revision+1,loaded:!1,unknown:!1})),u(r),f(null),e(new URL(r).host))};return(0,K.jsxs)(`div`,{className:`browser-tool browser-direct-tool`,children:[(0,K.jsxs)(`form`,{className:`browser-toolbar`,onSubmit:e=>{e.preventDefault();let t=YR(l,window.location.origin);if(!t){f(i(`browserAddressNotAllowed`));return}if(t===h)x(p.history,p.index);else{let e=[...p.history.slice(0,p.index+1),t].slice(-64);x(e,e.length-1)}},children:[(0,K.jsxs)(`div`,{className:`browser-navigation`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`browserBack`),title:i(`browserBack`),disabled:y.page?!y.page.canGoBack:p.unknown||p.index<=0,onClick:()=>y.page?y.command(`back`):x(p.history,p.index-1),children:(0,K.jsx)(T,{"aria-hidden":`true`})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`browserForward`),title:i(`browserForward`),disabled:y.page?!y.page.canGoForward:p.unknown||p.index>=p.history.length-1,onClick:()=>y.page?y.command(`forward`):x(p.history,p.index+1),children:(0,K.jsx)(E,{"aria-hidden":`true`})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`browserReload`),title:i(`browserReload`),disabled:!h,onClick:()=>y.page?y.command(`reload`):x(p.history,p.index),children:(0,K.jsx)(dt,{"aria-hidden":`true`})})]}),(0,K.jsx)(`input`,{ref:o,"aria-label":i(`browserAddress`),title:i(y.page?`browserAddress`:`browserEnteredAddress`),value:l,placeholder:`https://`,spellCheck:!1,onChange:e=>{u(e.currentTarget.value),f(null)}}),(0,K.jsx)(`button`,{type:`submit`,"aria-label":i(`browserGo`),title:i(`browserGo`),disabled:!l.trim(),children:(0,K.jsx)(E,{"aria-hidden":`true`})}),(0,K.jsx)(`button`,{type:`button`,"aria-label":i(`openExternalBrowser`),title:i(`openExternalBrowser`),disabled:!b||!y.page&&p.unknown,onClick:()=>b&&window.open(b,`_blank`,`noopener,noreferrer`),children:(0,K.jsx)(he,{"aria-hidden":`true`})})]}),(0,K.jsxs)(`div`,{className:`browser-feedback`,children:[d&&(0,K.jsx)(`p`,{className:`workbar-error`,role:`alert`,children:d}),p.unknown&&!y.page&&(0,K.jsx)(`p`,{className:`browser-notice`,role:`status`,children:i(`browserLocationUnknown`)})]}),(0,K.jsx)(`div`,{className:`browser-direct-viewport`,children:h?(0,K.jsx)(`iframe`,{"data-openpi-browser-page":v,"data-openpi-browser-document":y.page?.document,"data-openpi-browser-url":y.page?.url,"data-openpi-browser-title":y.page?.title,src:h,title:i(`browserPageTitle`,{address:new URL(h).host}),referrerPolicy:`no-referrer`,sandbox:`allow-scripts allow-forms allow-same-origin allow-popups allow-popups-to-escape-sandbox`,onLoad:()=>m(e=>e.revision===p.revision?{...e,loaded:!0,unknown:e.loaded}:e)},p.revision):(0,K.jsxs)(`div`,{className:`workbar-empty`,children:[(0,K.jsx)(me,{"aria-hidden":`true`}),(0,K.jsx)(`strong`,{children:i(`browserReady`)}),(0,K.jsx)(`p`,{children:i(`browserDirectDescription`)})]})}),(0,K.jsx)(`p`,{className:`browser-notice`,children:i(y.ready?`browserEnhancedHint`:`browserDirectHint`)})]})}function Lz({onReady:e}={}){let{t}=cr(),n=(0,_.useId)(),r=kk(),[i,a]=(0,_.useState)(r?.browser?.tabs??[{id:0,title:``}]),o=(0,_.useRef)(Math.max(...i.map(e=>e.id))+1),s=(0,_.useRef)(i);s.current=i;let[c,l]=(0,_.useState)(),[u,d]=(0,_.useState)(r?.browser?.selected??0);(0,_.useLayoutEffect)(()=>{r&&(r.browser={tabs:i,selected:u,pages:r.browser?.pages??{}})},[r,i,u]);let f=e=>{requestAnimationFrame(()=>document.getElementById(`${n}-tab-${e}`)?.focus())},p=(e=``)=>{if(s.current.length>=Fz){e&&l(e);return}let t={id:o.current++,title:e?new URL(e).host:``,initialUrl:e},r=[...s.current,t];return s.current=r,a(r),d(t.id),l(void 0),f(t.id),`${n}-page-${t.id}`},m=(0,_.useRef)(p);m.current=p,(0,_.useEffect)(()=>(e?.(e=>m.current(e)),()=>e?.(void 0)),[e]);let h=e=>{r?.browser&&delete r.browser.pages[e],l(void 0);let t=i.filter(t=>t.id!==e);if(!t.length){let e={id:o.current++,title:``};a([e]),d(e.id),f(e.id)}else if(a(t),u===e){let n=i.findIndex(t=>t.id===e),r=t[Math.min(n,t.length-1)];d(r.id),f(r.id)}};return(0,K.jsxs)(`div`,{className:`browser-workspace`,children:[(0,K.jsxs)(`div`,{className:`browser-tabs-header`,children:[(0,K.jsx)(`div`,{role:`tablist`,"aria-label":t(`browserTabs`),className:`browser-tabs`,onKeyDown:e=>{if(!(e.target instanceof HTMLElement)||e.target.getAttribute(`role`)!==`tab`)return;let t=e.target.id,r=i.findIndex(e=>`${n}-tab-${e.id}`===t),a=r;if(e.key===`ArrowRight`)a=(r+1)%i.length;else if(e.key===`ArrowLeft`)a=(r+i.length-1)%i.length;else if(e.key===`Home`)a=0;else if(e.key===`End`)a=i.length-1;else if(e.key===`Delete`){e.preventDefault(),e.stopPropagation(),h(i[r].id);return}else return;e.preventDefault(),e.stopPropagation(),d(i[a].id),f(i[a].id)},children:i.map(e=>(0,K.jsxs)(`div`,{className:`browser-tab`,"data-active":e.id===u,children:[(0,K.jsxs)(`button`,{type:`button`,role:`tab`,id:`${n}-tab-${e.id}`,"aria-selected":e.id===u,"aria-controls":`${n}-page-${e.id}`,tabIndex:e.id===u?0:-1,onClick:()=>d(e.id),children:[(0,K.jsx)(me,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:e.title||t(`browserNewTab`)})]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":t(`browserCloseTab`,{title:e.title||t(`browserNewTab`)}),title:t(`close`),onClick:()=>h(e.id),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]},e.id))}),(0,K.jsx)(`button`,{type:`button`,className:`browser-add-tab`,"aria-label":t(`browserAddTab`),title:i.length>=Fz?t(`browserTabLimit`,{count:Fz}):t(`browserAddTab`),disabled:i.length>=Fz,onClick:()=>p(),children:(0,K.jsx)(lt,{"aria-hidden":`true`})})]}),c&&(0,K.jsxs)(`p`,{className:`browser-notice`,role:`status`,children:[t(`browserTabLimit`,{count:Fz}),` ·`,` `,(0,K.jsx)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,children:t(`openExternalBrowser`)})]}),(0,K.jsx)(`div`,{className:`browser-pages`,children:i.map(e=>(0,K.jsx)(`div`,{role:`tabpanel`,id:`${n}-page-${e.id}`,"aria-labelledby":`${n}-tab-${e.id}`,className:`browser-page`,hidden:u!==e.id,children:(0,K.jsx)(Iz,{readingId:e.id,initialUrl:e.initialUrl,onOpen:p,onTitle:t=>a(n=>n.map(n=>n.id===e.id?{...n,title:t}:n))})},e.id))})]})}var Rz=2,zz=1,Bz=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(Rz,Math.floor(u/e.css.cell.width)),rows:Math.max(zz,Math.floor(l/e.css.cell.height))}}},Vz=Object.defineProperty,Hz=Object.getOwnPropertyDescriptor,Uz=(e,t)=>{for(var n in t)Vz(e,n,{get:t[n],enumerable:!0})},Wz=(e,t,n,r)=>{for(var i=r>1?void 0:r?Hz(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Vz(t,n,i),i},Gz=(e,t)=>(n,r)=>t(n,r,e),Kz=`Terminal input`,qz={get:()=>Kz,set:e=>Kz=e},Jz=`Too much output to announce, navigate to rows manually to read`,Yz={get:()=>Jz,set:e=>Jz=e};function Xz(e){return e.replace(/\r?\n/g,`\r`)}function Zz(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function Qz(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function $z(e,t,n,r){e.stopPropagation(),e.clipboardData&&eB(e.clipboardData.getData(`text/plain`),t,n,r)}function eB(e,t,n,r){e=Xz(e),e=Zz(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function tB(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function nB(e,t,n,r,i){tB(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function rB(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function iB(e,t=0,n=e.length){let r=``;for(let i=t;i65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var aB=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},oB=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},sB=``,cB=` `,lB=class e{constructor(){this.fg=0,this.bg=0,this.extended=new uB}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},uB=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},dB=class e extends lB{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new uB,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?rB(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},fB=`di$target`,pB=`di$dependencies`,mB=new Map;function hB(e){return e[pB]||[]}function gB(e){if(mB.has(e))return mB.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);_B(t,e,r)};return t._id=e,mB.set(e,t),t}function _B(e,t,n){t[fB]===t?t[pB].push({id:e,index:n}):(t[pB]=[{id:e,index:n}],t[fB]=t)}var vB=gB(`BufferService`),yB=gB(`CoreMouseService`),bB=gB(`CoreService`),xB=gB(`CharsetService`),SB=gB(`InstantiationService`),CB=gB(`LogService`),wB=gB(`OptionsService`),TB=gB(`OscLinkService`),EB=gB(`UnicodeService`),DB=gB(`DecorationService`),OB=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new dB,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;ti?i.activate(e,t,a):kB(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};OB=Wz([Gz(0,vB),Gz(1,wB),Gz(2,TB)],OB);function kB(e,t){if(confirm(`Do you want to navigate to ${t}? -WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var TB=dB(`CharSizeService`),EB=dB(`CoreBrowserService`),DB=dB(`MouseService`),OB=dB(`RenderService`),kB=dB(`SelectionService`),AB=dB(`CharacterJoinerService`),jB=dB(`ThemeService`),MB=dB(`LinkProviderService`),NB=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?zB.isErrorNoTelemetry(e)?new zB(e.message+` +WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var AB=gB(`CharSizeService`),jB=gB(`CoreBrowserService`),MB=gB(`MouseService`),NB=gB(`RenderService`),PB=gB(`SelectionService`),FB=gB(`CharacterJoinerService`),IB=gB(`ThemeService`),LB=gB(`LinkProviderService`),RB=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?WB.isErrorNoTelemetry(e)?new WB(e.message+` `+e.stack):Error(e.message+` -`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function PB(e){IB(e)||NB.onUnexpectedError(e)}var FB=`Canceled`;function IB(e){return e instanceof LB||e instanceof Error&&e.name===FB&&e.message===FB}var LB=class extends Error{constructor(){super(FB),this.name=this.message}};function RB(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var zB=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},BB=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function VB(e,t=0){return e[e.length-(1+t)]}var HB;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(HB||={});var UB=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||HB.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};UB.empty=new UB(e=>{});function WB(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var GB;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function QB(...e){return $B(()=>ZB(e))}function $B(e){let t=qB({dispose:WB(()=>{JB(t),e()})});return t}var eV=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,qB(this)}dispose(){this._isDisposed||(JB(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ZB(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return YB(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),YB(e,null))}};eV.DISABLE_DISPOSED_WARNING=!1;var tV=eV,nV=class{constructor(){this._store=new tV,qB(this),YB(this._store,this)}dispose(){JB(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};nV.None=Object.freeze({dispose(){}});var rV=class{constructor(){this._isDisposed=!1,qB(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&YB(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,JB(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&YB(e,null),e}},iV=typeof window==`object`?window:globalThis,aV=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};aV.Undefined=new aV(void 0);var oV=aV,sV=class{constructor(){this._first=oV.Undefined,this._last=oV.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===oV.Undefined}clear(){let e=this._first;for(;e!==oV.Undefined;){let t=e.next;e.prev=oV.Undefined,e.next=oV.Undefined,e=t}this._first=oV.Undefined,this._last=oV.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new oV(e);if(this._first===oV.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==oV.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==oV.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==oV.Undefined&&e.next!==oV.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===oV.Undefined&&e.next===oV.Undefined?(this._first=oV.Undefined,this._last=oV.Undefined):e.next===oV.Undefined?(this._last=this._last.prev,this._last.next=oV.Undefined):e.prev===oV.Undefined&&(this._first=this._first.next,this._first.prev=oV.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==oV.Undefined;)yield e.element,e=e.next}},cV=globalThis.performance&&typeof globalThis.performance.now==`function`,lV=class e{static create(t){return new e(t)}constructor(e){this._now=cV&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},uV;(e=>{e.None=()=>nV.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(QB(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new CV({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new CV({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new CV({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new CV({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new CV({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new CV;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new CV(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof tV?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(uV||={});var dV=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new lV,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};dV.all=new Set,dV._idPool=0;var fV=dV,pV=-1,mV=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function zB(e){VB(e)||RB.onUnexpectedError(e)}var BB=`Canceled`;function VB(e){return e instanceof HB||e instanceof Error&&e.name===BB&&e.message===BB}var HB=class extends Error{constructor(){super(BB),this.name=this.message}};function UB(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var WB=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},GB=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function KB(e,t=0){return e[e.length-(1+t)]}var qB;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(qB||={});var JB=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||qB.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};JB.empty=new JB(e=>{});function YB(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var XB;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function rV(...e){return iV(()=>nV(e))}function iV(e){let t=QB({dispose:YB(()=>{$B(t),e()})});return t}var aV=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,QB(this)}dispose(){this._isDisposed||($B(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{nV(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return eV(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),eV(e,null))}};aV.DISABLE_DISPOSED_WARNING=!1;var oV=aV,sV=class{constructor(){this._store=new oV,QB(this),eV(this._store,this)}dispose(){$B(this),this._store.dispose()}_register(e){if(e===this)throw Error(`Cannot register a disposable on itself!`);return this._store.add(e)}};sV.None=Object.freeze({dispose(){}});var cV=class{constructor(){this._isDisposed=!1,QB(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&eV(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,$B(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&eV(e,null),e}},lV=typeof window==`object`?window:globalThis,uV=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};uV.Undefined=new uV(void 0);var dV=uV,fV=class{constructor(){this._first=dV.Undefined,this._last=dV.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===dV.Undefined}clear(){let e=this._first;for(;e!==dV.Undefined;){let t=e.next;e.prev=dV.Undefined,e.next=dV.Undefined,e=t}this._first=dV.Undefined,this._last=dV.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new dV(e);if(this._first===dV.Undefined)this._first=n,this._last=n;else if(t){let e=this._last;this._last=n,n.prev=e,e.next=n}else{let e=this._first;this._first=n,n.next=e,e.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==dV.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==dV.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==dV.Undefined&&e.next!==dV.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===dV.Undefined&&e.next===dV.Undefined?(this._first=dV.Undefined,this._last=dV.Undefined):e.next===dV.Undefined?(this._last=this._last.prev,this._last.next=dV.Undefined):e.prev===dV.Undefined&&(this._first=this._first.next,this._first.prev=dV.Undefined);--this._size}*[Symbol.iterator](){let e=this._first;for(;e!==dV.Undefined;)yield e.element,e=e.next}},pV=globalThis.performance&&typeof globalThis.performance.now==`function`,mV=class e{static create(t){return new e(t)}constructor(e){this._now=pV&&e===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime===-1?this._now()-this._startTime:this._stopTime-this._startTime}},hV;(e=>{e.None=()=>sV.None;function t(e,t){return d(e,()=>{},0,void 0,!0,void 0,t)}e.defer=t;function n(e){return(t,n=null,r)=>{let i=!1,a;return a=e(e=>{if(!i)return a?a.dispose():i=!0,t.call(n,e)},null,r),i&&a.dispose(),a}}e.once=n;function r(e,t,n){return l((n,r=null,i)=>e(e=>n.call(r,t(e)),null,i),n)}e.map=r;function i(e,t,n){return l((n,r=null,i)=>e(e=>{t(e),n.call(r,e)},null,i),n)}e.forEach=i;function a(e,t,n){return l((n,r=null,i)=>e(e=>t(e)&&n.call(r,e),null,i),n)}e.filter=a;function o(e){return e}e.signal=o;function s(...e){return(t,n=null,r)=>u(rV(...e.map(e=>e(e=>t.call(n,e)))),r)}e.any=s;function c(e,t,n,i){let a=n;return r(e,e=>(a=t(a,e),a),i)}e.reduce=c;function l(e,t){let n,r=new OV({onWillAddFirstListener(){n=e(r.fire,r)},onDidRemoveLastListener(){n?.dispose()}});return t?.add(r),r.event}function u(e,t){return t instanceof Array?t.push(e):t&&t.add(e),e}function d(e,t,n=100,r=!1,i=!1,a,o){let s,c,l,u=0,d,f=new OV({leakWarningThreshold:a,onWillAddFirstListener(){s=e(e=>{u++,c=t(c,e),r&&!l&&(f.fire(c),c=void 0),d=()=>{let e=c;c=void 0,l=void 0,(!r||u>1)&&f.fire(e),u=0},typeof n==`number`?(clearTimeout(l),l=setTimeout(d,n)):l===void 0&&(l=0,queueMicrotask(d))})},onWillRemoveListener(){i&&u>0&&d?.()},onDidRemoveLastListener(){d=void 0,s.dispose()}});return o?.add(f),f.event}e.debounce=d;function f(t,n=0,r){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],n,void 0,!0,void 0,r)}e.accumulate=f;function p(e,t=(e,t)=>e===t,n){let r=!0,i;return a(e,e=>{let n=r||!t(e,i);return r=!1,i=e,n},n)}e.latch=p;function m(t,n,r){return[e.filter(t,n,r),e.filter(t,e=>!n(e),r)]}e.split=m;function h(e,t=!1,n=[],r){let i=n.slice(),a=e(e=>{i?i.push(e):s.fire(e)});r&&r.add(a);let o=()=>{i?.forEach(e=>s.fire(e)),i=null},s=new OV({onWillAddFirstListener(){a||(a=e(e=>s.fire(e)),r&&r.add(a))},onDidAddFirstListener(){i&&(t?setTimeout(o):o())},onDidRemoveLastListener(){a&&a.dispose(),a=null}});return r&&r.add(s),s.event}e.buffer=h;function g(e,t){return(n,r,i)=>{let a=t(new v);return e(function(e){let t=a.evaluate(e);t!==_&&n.call(r,t)},void 0,i)}}e.chain=g;let _=Symbol(`HaltChainable`);class v{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:_),this}reduce(e,t){let n=t;return this.steps.push(t=>(n=e(n,t),n)),this}latch(e=(e,t)=>e===t){let t=!0,n;return this.steps.push(r=>{let i=t||!e(r,n);return t=!1,n=r,i?r:_}),this}evaluate(e){for(let t of this.steps)if(e=t(e),e===_)break;return e}}function y(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new OV({onWillAddFirstListener:()=>e.on(t,r),onDidRemoveLastListener:()=>e.removeListener(t,r)});return i.event}e.fromNodeEventEmitter=y;function b(e,t,n=e=>e){let r=(...e)=>i.fire(n(...e)),i=new OV({onWillAddFirstListener:()=>e.addEventListener(t,r),onDidRemoveLastListener:()=>e.removeEventListener(t,r)});return i.event}e.fromDOMEventEmitter=b;function x(e){return new Promise(t=>n(e)(t))}e.toPromise=x;function S(e){let t=new OV;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event}e.fromPromise=S;function C(e,t){return e(e=>t.fire(e))}e.forward=C;function w(e,t,n){return t(n),e(e=>t(e))}e.runAndSubscribe=w;class T{constructor(e,t){this._observable=e,this._counter=0,this._hasChanged=!1;let n={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};this.emitter=new OV(n),t&&t.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function E(e,t){return new T(e,t).emitter.event}e.fromObservable=E;function D(e){return(t,n,r)=>{let i=0,a=!1,o={beginUpdate(){i++},endUpdate(){i--,i===0&&(e.reportChanges(),a&&(a=!1,t.call(n)))},handlePossibleChange(){},handleChange(){a=!0}};e.addObserver(o),e.reportChanges();let s={dispose(){e.removeObserver(o)}};return r instanceof oV?r.add(s):Array.isArray(r)&&r.push(s),s}}e.fromObservableLight=D})(hV||={});var gV=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new mV,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};gV.all=new Set,gV._idPool=0;var _V=gV,vV=-1,yV=class e{constructor(t,n,r=(e._idPool++).toString(16).padStart(3,`0`)){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let n=this.threshold;if(n<=0||t{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[n,r]of this._stacks)(!e||t0||this._options?.leakWarningThreshold?new hV(e?.onListenerError??PB,this._options?.leakWarningThreshold??pV):void 0,this._perfMon=this._options?._profName?new fV(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new vV(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||PB)(n),nV.None}if(this._disposed)return nV.None;t&&(e=e.bind(t));let r=new bV(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=gV.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof bV?(this._deliveryQueue??=new wV,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=$B(()=>{SV?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof tV?n.add(a):Array.isArray(n)&&n.push(a),SV){let e=Error().stack.split(` +`))}},SV=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},CV=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},wV=0,TV=class{constructor(e){this.value=e,this.id=wV++}},EV=2,DV,OV=class{constructor(e){this._size=0,this._options=e,this._leakageMon=vV>0||this._options?.leakWarningThreshold?new bV(e?.onListenerError??zB,this._options?.leakWarningThreshold??vV):void 0,this._perfMon=this._options?._profName?new _V(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new CV(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||zB)(n),sV.None}if(this._disposed)return sV.None;t&&(e=e.bind(t));let r=new TV(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=xV.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof TV?(this._deliveryQueue??=new kV,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=iV(()=>{DV?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof oV?n.add(a):Array.isArray(n)&&n.push(a),DV){let e=Error().stack.split(` `).slice(2,3).join(` -`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);SV.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*xV<=t.length){let e=0;for(let n=0;n0}},wV=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},TV=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new CV,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new CV,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};TV.INSTANCE=new TV;var EV=TV;function DV(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}EV.INSTANCE.onDidChangeZoomLevel;function OV(e){return EV.INSTANCE.getZoomFactor(e)}EV.INSTANCE.onDidChangeFullscreen;var kV=typeof navigator==`object`?navigator.userAgent:``,AV=kV.indexOf(`Firefox`)>=0,jV=kV.indexOf(`AppleWebKit`)>=0,MV=kV.indexOf(`Chrome`)>=0,NV=!MV&&kV.indexOf(`Safari`)>=0;kV.indexOf(`Electron/`),kV.indexOf(`Android`);var PV=!1;if(typeof iV.matchMedia==`function`){let e=iV.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=iV.matchMedia(`(display-mode: fullscreen)`);PV=e.matches,DV(iV,e,({matches:e})=>{PV&&t.matches||(PV=e)})}function FV(){return PV}var IV=`en`,LV=!1,RV=!1,zV=!1,BV=!1,VV=!1,HV=IV,UV,WV=globalThis,GV;typeof WV.vscode<`u`&&typeof WV.vscode.process<`u`?GV=WV.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(GV=process);var KV=typeof GV?.versions?.electron==`string`&&GV?.type===`renderer`;if(typeof GV==`object`){LV=GV.platform===`win32`,RV=GV.platform===`darwin`,zV=GV.platform===`linux`,zV&&GV.env.SNAP&&GV.env.SNAP_REVISION,GV.env.CI||GV.env.BUILD_ARTIFACTSTAGINGDIRECTORY,HV=IV;let e=GV.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,HV=t.resolvedLanguage||IV,t.languagePack?.translationsConfigFile}catch{}BV=!0}else typeof navigator==`object`&&!KV?(UV=navigator.userAgent,LV=UV.indexOf(`Windows`)>=0,RV=UV.indexOf(`Macintosh`)>=0,(UV.indexOf(`Macintosh`)>=0||UV.indexOf(`iPad`)>=0||UV.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,zV=UV.indexOf(`Linux`)>=0,UV?.indexOf(`Mobi`),VV=!0,HV=globalThis._VSCODE_NLS_LANGUAGE||IV,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var qV=LV,JV=RV,YV=zV,XV=BV;VV&&typeof WV.importScripts==`function`&&WV.origin;var ZV=UV,QV=HV,$V;(e=>{function t(){return QV}e.value=t;function n(){return QV.length===2?QV===`en`:QV.length>=3&&QV[0]===`e`&&QV[1]===`n`&&QV[2]===`-`}e.isDefaultVariant=n;function r(){return QV===`en`}e.isDefault=r})($V||={});var eH=typeof WV.postMessage==`function`&&!WV.importScripts;(()=>{if(eH){let e=[];WV.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let r=++t;e.push({id:r,callback:n}),WV.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var tH=!!(ZV&&ZV.indexOf(`Chrome`)>=0);ZV&&ZV.indexOf(`Firefox`),!tH&&ZV&&ZV.indexOf(`Safari`),ZV&&ZV.indexOf(`Edg/`),ZV&&ZV.indexOf(`Android`);var nH=typeof navigator==`object`?navigator:{};XV||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||nH&&nH.clipboard&&nH.clipboard.writeText,XV||nH&&nH.clipboard&&nH.clipboard.readText,XV||FV()||nH.keyboard,`ontouchstart`in iV||nH.maxTouchPoints,iV.PointerEvent&&(`ontouchstart`in iV||navigator.maxTouchPoints);var rH=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},iH=new rH,aH=new rH,oH=new rH,sH=Array(230),cH;(e=>{function t(e){return iH.keyCodeToStr(e)}e.toString=t;function n(e){return iH.strToKeyCode(e)}e.fromString=n;function r(e){return aH.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return oH.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return aH.strToKeyCode(e)||oH.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return iH.keyCodeToStr(e)}e.toElectronAccelerator=o})(cH||={});var lH=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new uH([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},uH=class{constructor(e){if(e.length===0)throw RB(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t{function t(t){return t===e.None||t===e.Cancelled||t instanceof wH?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:uV.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:SH})})(CH||={});var wH=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?SH:(this._emitter||=new CV,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},TH=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new BB(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new BB(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},EH=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new BB(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=$B(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var DH;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(DH||={});var OH=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new CV,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};OH.EMPTY=OH.fromArray([]);function kH(e){return AH(e,0)}function AH(e,t){switch(typeof e){case`object`:return e===null?jH(349,t):Array.isArray(e)?PH(e,t):FH(e,t);case`string`:return NH(e,t);case`boolean`:return MH(e,t);case`number`:return jH(e,t);case`undefined`:return jH(937,t);default:return jH(617,t)}}function jH(e,t){return(t<<5)-t+e|0}function MH(e,t){return jH(e?433:863,t)}function NH(e,t){t=jH(149417,t);for(let n=0,r=e.length;nAH(t,e),t)}function FH(e,t){return t=jH(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=NH(n,t),AH(e[n],t)),t)}var{registerWindow:IH,getWindow:LH,getDocument:RH,getWindows:zH,getWindowsCount:BH,getWindowId:VH,getWindowById:HH,hasWindow:UH,onDidRegisterWindow:WH,onWillUnregisterWindow:GH,onDidUnregisterWindow:KH}=function(){let e=new Map,t={window:iV,disposables:new tV};e.set(iV.vscodeWindowId,t);let n=new CV,r=new CV,i=new CV;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return nV.None;let a=new tV,o={window:t,disposables:a.add(new tV)};return e.set(t.vscodeWindowId,o),a.add($B(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(JH(t,rU.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:iV},getDocument(e){return LH(e).document}}}(),qH=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function JH(e,t,n,r){return new qH(e,t,n,r)}function YH(e,t){return function(n){return t(new bH(e,n))}}function XH(e){return function(t){return e(new gH(t))}}var ZH=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=YH(LH(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=XH(n)),JH(e,t,i,r)},QH,$H=class extends EH{constructor(e){super(),this.defaultTarget=e&&LH(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},eU=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){PB(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(eU.sort),a.shift().execute();r.set(i,!1)};QH=(t,r,a=0)=>{let o=VH(t),s=new eU(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var tU=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};tU.None=new tU(0,0);function nU(e){let t=e.getBoundingClientRect(),n=LH(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=kH(n),a=r.get(i);if(a)a.users+=1;else{let o=new CV,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add($B(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var rU={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:jV?`webkitAnimationStart`:`animationstart`,ANIMATION_END:jV?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:jV?`webkitAnimationIteration`:`animationiteration`},iU=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=aU(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=aU(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=aU(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=aU(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=aU(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=aU(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=aU(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=aU(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=aU(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=aU(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=aU(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=aU(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=aU(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=aU(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function aU(e){return typeof e==`number`?`${e}px`:e}function oU(e){return new iU(e)}var sU=class{constructor(){this._hooks=new tV,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add($B(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=LH(e)}this._hooks.add(JH(a,rU.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(JH(a,rU.POINTER_UP,e=>this.stopMonitoring(!0)))}};function cU(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var lU;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(lU||={});var uU=class e extends nV{constructor(){super(),this.dispatched=!1,this.targets=new sV,this.ignoreTargets=new sV,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(uV.runAndSubscribe(WH,({window:e,disposables:t})=>{t.add(JH(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(JH(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(JH(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:iV,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=XB(new e),$B(e.INSTANCE.targets.push(t))):nV.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=XB(new e),$B(e.INSTANCE.ignoreTargets.push(t))):nV.None}static isTouchDevice(){return`ontouchstart`in iV||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n=e.HOLD_DELAY&&Math.abs(s.initialPageX-VB(s.rollingPageX))<30&&Math.abs(s.initialPageY-VB(s.rollingPageY))<30){let e=this.newGestureEvent(lU.Contextmenu,s.initialTarget);e.pageX=VB(s.rollingPageX),e.pageY=VB(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=VB(s.rollingPageX),n=VB(s.rollingPageY),i=VB(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(lU.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===lU.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===lU.Change||t.type===lU.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=QH(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(lU.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};uU.SCROLL_FRICTION=-.005,uU.HOLD_DELAY=700,uU.CLEAR_TAP_COUNT_TIME=400,zz([cU],uU,`isTouchDevice`,1);var dU=uU,fU=class extends nV{onclick(e,t){this._register(JH(e,rU.CLICK,n=>t(new bH(LH(e),n))))}onmousedown(e,t){this._register(JH(e,rU.MOUSE_DOWN,n=>t(new bH(LH(e),n))))}onmouseover(e,t){this._register(JH(e,rU.MOUSE_OVER,n=>t(new bH(LH(e),n))))}onmouseleave(e,t){this._register(JH(e,rU.MOUSE_LEAVE,n=>t(new bH(LH(e),n))))}onkeydown(e,t){this._register(JH(e,rU.KEY_DOWN,e=>t(new gH(e))))}onkeyup(e,t){this._register(JH(e,rU.KEY_UP,e=>t(new gH(e))))}oninput(e,t){this._register(JH(e,rU.INPUT,t))}onblur(e,t){this._register(JH(e,rU.BLUR,t))}onfocus(e,t){this._register(JH(e,rU.FOCUS,t))}onchange(e,t){this._register(JH(e,rU.CHANGE,t))}ignoreGesture(e){return dU.ignoreTarget(e)}},pU=11,mU=class extends fU{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=pU+`px`,this.domNode.style.height=pU+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new sU),this._register(ZH(this.bgDomNode,rU.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(ZH(this.domNode,rU.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new $H),this._pointerdownScheduleRepeatTimer=this._register(new TH)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,LH(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},hU=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},gU=class extends nV{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new CV),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new hU(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new bU(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=bU.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},_U=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function vU(e,t){let n=t-e;return function(t){return e+n*SU(t)}}function yU(e,t,n){return function(r){return r2.5*n){let r,i;return e{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},wU=140,TU=class extends fU{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new CU(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new sU),this._shouldRender=!0,this.domNode=oU(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(JH(this.domNode.domNode,rU.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new mU(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=oU(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(JH(this.slider.domNode,rU.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=nU(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(qV&&a>wU){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},EU=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};NU.INSTANCE=new NU;var PU=NU,FU=class extends fU{constructor(e,t,n){super(),this._onScroll=this._register(new CV),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new CV),this.onWillScroll=this._onWillScroll.event,this._options=LU(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new OU(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new DU(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=oU(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=oU(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=oU(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new TH),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=ZB(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,JV&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new xH(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=ZB(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(JH(this._listenOnDomNode,rU.MOUSE_WHEEL,e=>{this._onMouseWheel(new xH(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=PU.INSTANCE;jU&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!JV&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=AU*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=AU*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(jU&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),kU)}},IU=class extends FU{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function LU(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,JV&&(t.className+=` mac`),t}var RU=class extends nV{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new CV),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new gU({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>QH(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new IU(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(uV.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register($B(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register($B(()=>this._styleElement.remove())),this._register(uV.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(` -`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};RU=zz([Bz(2,pB),Bz(3,EB),Bz(4,mB),Bz(5,jB),Bz(6,yB),Bz(7,OB)],RU);var zU=class extends nV{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register($B(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};zU=zz([Bz(1,pB),Bz(2,EB),Bz(3,SB),Bz(4,OB)],zU);var BU=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},VU={full:0,left:0,center:0,right:0},HU={full:0,left:0,center:0,right:0},UU={full:0,left:0,center:0,right:0},WU=class extends nV{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new BU,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register($B(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);HU.full=this._canvas.width,HU.left=e,HU.center=t,HU.right=e,this._refreshDrawHeightConstants(),UU.full=1,UU.left=1,UU.center=1+HU.left,UU.right=1+HU.left+HU.center}_refreshDrawHeightConstants(){VU.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);VU.left=t,VU.center=t,VU.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*VU.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*VU.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*VU.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*VU.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(UU[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-VU[e.position||`full`]/2),HU[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+VU[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};WU=zz([Bz(2,pB),Bz(3,SB),Bz(4,OB),Bz(5,yB),Bz(6,jB),Bz(7,EB)],WU);var $;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=` -`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var GU;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(GU||={});var KU;(e=>e.ST=`${$.ESC}\\`)(KU||={});var qU=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.lengththis.updateCompositionElements(!0),0)}}};qU=zz([Bz(2,pB),Bz(3,yB),Bz(4,hB),Bz(5,OB)],qU);var JU=0,YU=0,XU=0,ZU=0,QU={css:`#00000000`,rgba:0},$U;(e=>{function t(e,t,n,r){return r===void 0?`#${iW(e)}${iW(t)}${iW(n)}`:`#${iW(e)}${iW(t)}${iW(n)}${iW(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})($U||={});var eW;(e=>{function t(e,t){if(ZU=(t.rgba&255)/255,ZU===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return JU=a+Math.round((n-a)*ZU),YU=o+Math.round((r-o)*ZU),XU=s+Math.round((i-s)*ZU),{css:$U.toCss(JU,YU,XU),rgba:$U.toRgba(JU,YU,XU)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=rW.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return $U.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[JU,YU,XU]=rW.toChannels(t),{css:$U.toCss(JU,YU,XU),rgba:t}}e.opaque=i;function a(e,t){return ZU=Math.round(t*255),[JU,YU,XU]=rW.toChannels(e.rgba),{css:$U.toCss(JU,YU,XU,ZU),rgba:$U.toRgba(JU,YU,XU,ZU)}}e.opacity=a;function o(e,t){return ZU=e.rgba&255,a(e,ZU*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(eW||={});var tW;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return JU=parseInt(e.slice(1,2).repeat(2),16),YU=parseInt(e.slice(2,3).repeat(2),16),XU=parseInt(e.slice(3,4).repeat(2),16),$U.toColor(JU,YU,XU);case 5:return JU=parseInt(e.slice(1,2).repeat(2),16),YU=parseInt(e.slice(2,3).repeat(2),16),XU=parseInt(e.slice(3,4).repeat(2),16),ZU=parseInt(e.slice(4,5).repeat(2),16),$U.toColor(JU,YU,XU,ZU);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return JU=parseInt(r[1]),YU=parseInt(r[2]),XU=parseInt(r[3]),ZU=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),$U.toColor(JU,YU,XU,ZU);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[JU,YU,XU,ZU]=t.getImageData(0,0,1,1).data,ZU!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:$U.toRgba(JU,YU,XU,ZU),css:e}}e.toColor=r})(tW||={});var nW;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(nW||={});var rW;(e=>{function t(e,t){if(ZU=(t&255)/255,ZU===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return JU=a+Math.round((n-a)*ZU),YU=o+Math.round((r-o)*ZU),XU=s+Math.round((i-s)*ZU),$U.toRgba(JU,YU,XU)}e.blend=t;function n(e,t,n){let a=nW.relativeLuminance(e>>8),o=nW.relativeLuminance(t>>8);if(aW(a,o)>8));if(saW(a,nW.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=aW(a,nW.relativeLuminance(s>>8));if(caW(a,nW.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=aW(nW.relativeLuminance2(o,s,c),nW.relativeLuminance2(r,i,a));for(;l0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=aW(nW.relativeLuminance2(o,s,c),nW.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=aW(nW.relativeLuminance2(o,s,c),nW.relativeLuminance2(r,i,a));for(;l>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(rW||={});function iW(e){let t=e.toString(16);return t.length<2?`0`+t:t}function aW(e,t){return e1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t=E,M=k,N=this._workCell;if(f.length>0&&k===f[0][0]&&j){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v=r[1],j?(A=!0,N=new oW(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),M=r[1]-1,m=N.getWidth()):E=r[1]}let P=this._isCellInSelection(k,t),F=n&&k===a,I=O&&k>=l&&k<=u,L=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{L=!0});let R=N.getChars()||rB;if(R===` `&&(N.isUnderline()||N.isOverline())&&(R=`\xA0`),T=m*s-c.get(R,N.isBold(),N.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(P&&w||!P&&!w&&N.bg===y)&&(P&&w&&p.selectionForeground||N.fg===b)&&N.extended.ext===x&&I===S&&T===C&&!F&&!A&&!L&&j){N.isInvisible()?_+=rB:_+=R,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=N.bg,b=N.fg,x=N.extended.ext,S=I,C=T,w=P,A&&a>=k&&a<=M&&(a=k),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`);break;default:break}}if(N.isBold()&&D.push(`xterm-bold`),N.isItalic()&&D.push(`xterm-italic`),N.isDim()&&D.push(`xterm-dim`),_=N.isInvisible()?rB:N.getChars()||rB,N.isUnderline()&&(D.push(`xterm-underline-${N.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!N.isUnderlineColorDefault()))if(N.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${iB.toColorRGB(N.getUnderlineColor()).join(`,`)})`;else{let e=N.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&N.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}N.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),N.isStrikethrough()&&D.push(`xterm-strikethrough`),I&&(h.style.textDecoration=`underline`);let ee=N.getFgColor(),z=N.getFgColorMode(),B=N.getBgColor(),V=N.getBgColorMode(),H=!!N.isInverse();if(H){let e=ee;ee=B,B=e;let t=z;z=V,V=t}let te,ne,re=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&re||(e.backgroundColorRGB&&(V=50331648,B=e.backgroundColorRGB.rgba>>8&16777215,te=e.backgroundColorRGB),e.foregroundColorRGB&&(z=50331648,ee=e.foregroundColorRGB.rgba>>8&16777215,ne=e.foregroundColorRGB),re=e.options.layer===`top`)}),!re&&P&&(te=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,B=te.rgba>>8&16777215,V=50331648,re=!0,p.selectionForeground&&(z=50331648,ee=p.selectionForeground.rgba>>8&16777215,ne=p.selectionForeground)),re&&D.push(`xterm-decoration-top`);let ie;switch(V){case 16777216:case 33554432:ie=p.ansi[B],D.push(`xterm-bg-${B}`);break;case 50331648:ie=$U.toColor(B>>16,B>>8&255,B&255),this._addStyle(h,`background-color:#${mW((B>>>0).toString(16),`0`,6)}`);break;default:H?(ie=p.foreground,D.push(`xterm-bg-257`)):ie=p.background}switch(te||N.isDim()&&(te=eW.multiplyOpacity(ie,.5)),z){case 16777216:case 33554432:N.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(h,ie,p.ansi[ee],N,te,void 0)||D.push(`xterm-fg-${ee}`);break;case 50331648:let e=$U.toColor(ee>>16&255,ee>>8&255,ee&255);this._applyMinimumContrast(h,ie,e,N,te,ne)||this._addStyle(h,`color:#${mW(ee.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,ie,p.foreground,N,te,ne)||H&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!F&&!A&&!L&&j?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=M}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||uW(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=eW.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t=n[0]&&e=n[0]}};pW=zz([Bz(1,AB),Bz(2,yB),Bz(3,EB),Bz(4,hB),Bz(5,SB),Bz(6,jB)],pW);function mW(e,t,n){for(;e.length0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},gW=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n=this.startCol&&t=this.startCol):!1}};function _W(){return new gW}var vW=`xterm-dom-renderer-owner-`,yW=`xterm-rows`,bW=`xterm-fg-`,xW=`xterm-bg-`,SW=`xterm-focus`,CW=`xterm-selection`,wW=1,TW=class extends nV{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=wW++,this._rowElements=[],this._selectionRenderModel=_W(),this.onRequestRedraw=this._register(new CV).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(yW),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(CW),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=dW(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(pW,document),this._element.classList.add(vW+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register($B(()=>{this._element.classList.remove(vW+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new hW(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${yW} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${yW} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${yW} .xterm-dim { color: ${eW.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${yW}.${SW} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${yW}.${SW} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${yW}.${SW} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${yW} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${yW} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${yW} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${yW} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${yW} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${CW} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${CW} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${CW} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${bW}${n} { color: ${r.css}; }${this._terminalSelector} .${bW}${n}.xterm-dim { color: ${eW.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${xW}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${bW}257 { color: ${eW.opaque(e.background).css}; }${this._terminalSelector} .${bW}257.xterm-dim { color: ${eW.multiplyOpacity(eW.opaque(e.background),.5).css}; }${this._terminalSelector} .${xW}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(SW),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(SW),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${vW}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};TW=zz([Bz(7,_B),Bz(8,TB),Bz(9,yB),Bz(10,pB),Bz(11,hB),Bz(12,EB),Bz(13,jB)],TW);var EW=class extends nV{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new CV),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new kW(this._optionsService))}catch{this._measureStrategy=this._register(new OW(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};EW=zz([Bz(2,yB)],EW);var DW=class extends nV{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},OW=class extends DW{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},kW=class extends DW{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},AW=class extends nV{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new jW(this._window)),this._onDprChange=this._register(new CV),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new CV),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(uV.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(JH(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(JH(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},jW=class extends nV{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new rV),this._onDprChange=this._register(new CV),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register($B(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=JH(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},MW=class extends nV{constructor(){super(),this.linkProviders=[],this._register($B(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function NW(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function PW(e,t,n,r,i,a,o,s,c){if(!a)return;let l=NW(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var FW=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return PW(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=NW(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};FW=zz([Bz(0,OB),Bz(1,TB)],FW);var IW=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},LW={};Rz(LW,{getSafariVersion:()=>WW,isChromeOS:()=>XW,isFirefox:()=>VW,isIpad:()=>KW,isIphone:()=>qW,isLegacyEdge:()=>HW,isLinux:()=>YW,isMac:()=>GW,isNode:()=>RW,isSafari:()=>UW,isWindows:()=>JW});var RW=typeof process<`u`&&`title`in process,zW=RW?`node`:navigator.userAgent,BW=RW?`node`:navigator.platform,VW=zW.includes(`Firefox`),HW=zW.includes(`Edge`),UW=/^((?!chrome|android).)*safari/i.test(zW);function WW(){if(!UW)return 0;let e=zW.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var GW=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(BW),KW=BW===`iPad`,qW=BW===`iPhone`,JW=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(BW),YW=BW.indexOf(`Linux`)>=0,XW=/\bCrOS\b/.test(zW),ZW=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ii){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},QW=class extends ZW{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},$W=class extends ZW{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},eG=!RW&&`requestIdleCallback`in window?$W:QW,tG=class{constructor(){this._queue=new eG}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},nG=class extends nV{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new rV),this._pausedResizeTask=new tG,this._observerDisposable=this._register(new rV),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new CV),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new CV),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new CV),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new CV),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new IW((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new rG(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register($B(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=$B(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};nG=zz([Bz(2,yB),Bz(3,TB),Bz(4,hB),Bz(5,SB),Bz(6,pB),Bz(7,EB),Bz(8,jB)],nG);var rG=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function iG(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return sG(i,a,e,t,n,r)+cG(a,t,n,r)+lG(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,gG(Math.abs(i-e),hG(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return gG(oG(a>t?e:i,n)+(s-1)*n.cols+1+aG(a>t?i:e,n),hG(o,r))}function aG(e,t){return e-1}function oG(e,t){return t.cols-e}function sG(e,t,n,r,i,a){return cG(t,r,i,a).length===0?``:gG(mG(e,t,e,t-dG(t,i),!1,i).length,hG(`D`,a))}function cG(e,t,n,r){let i=e-dG(e,n),a=t-dG(t,n);return gG(Math.abs(i-a)-uG(e,t,n),hG(pG(e,t),r))}function lG(e,t,n,r,i,a){let o;o=cG(t,r,i,a).length>0?r-dG(r,i):t;let s=r,c=fG(e,t,n,r,i,a);return gG(mG(e,o,n,s,c===`C`,i).length,hG(c,a))}function uG(e,t,n){let r=0,i=e-dG(e,n),a=t-dG(t,n);for(let o=0;o=0&&e0?r-dG(r,i):t,e=n&&ot?`A`:`B`}function mG(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&sa.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function hG(e,t){let n=t?`O`:`[`;return $.ESC+n+e}function gG(e,t){e=Math.floor(e);let n=``;for(let r=0;rthis._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function vG(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var yG=50,bG=15,xG=50,SG=500,CG=RegExp(`\xA0`,`g`),wG=class extends nV{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new oB,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new CV),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new CV),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new CV),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new CV),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new _G(this._bufferService),this._activeSelectionMode=0,this._register($B(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]e.replace(CG,` `)).join(JW?`\r +`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);DV.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*EV<=t.length){let e=0;for(let n=0;n0}},kV=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},AV=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new OV,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new OV,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};AV.INSTANCE=new AV;var jV=AV;function MV(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}jV.INSTANCE.onDidChangeZoomLevel;function NV(e){return jV.INSTANCE.getZoomFactor(e)}jV.INSTANCE.onDidChangeFullscreen;var PV=typeof navigator==`object`?navigator.userAgent:``,FV=PV.indexOf(`Firefox`)>=0,IV=PV.indexOf(`AppleWebKit`)>=0,LV=PV.indexOf(`Chrome`)>=0,RV=!LV&&PV.indexOf(`Safari`)>=0;PV.indexOf(`Electron/`),PV.indexOf(`Android`);var zV=!1;if(typeof lV.matchMedia==`function`){let e=lV.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=lV.matchMedia(`(display-mode: fullscreen)`);zV=e.matches,MV(lV,e,({matches:e})=>{zV&&t.matches||(zV=e)})}function BV(){return zV}var VV=`en`,HV=!1,UV=!1,WV=!1,GV=!1,KV=!1,qV=VV,JV,YV=globalThis,XV;typeof YV.vscode<`u`&&typeof YV.vscode.process<`u`?XV=YV.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(XV=process);var ZV=typeof XV?.versions?.electron==`string`&&XV?.type===`renderer`;if(typeof XV==`object`){HV=XV.platform===`win32`,UV=XV.platform===`darwin`,WV=XV.platform===`linux`,WV&&XV.env.SNAP&&XV.env.SNAP_REVISION,XV.env.CI||XV.env.BUILD_ARTIFACTSTAGINGDIRECTORY,qV=VV;let e=XV.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,qV=t.resolvedLanguage||VV,t.languagePack?.translationsConfigFile}catch{}GV=!0}else typeof navigator==`object`&&!ZV?(JV=navigator.userAgent,HV=JV.indexOf(`Windows`)>=0,UV=JV.indexOf(`Macintosh`)>=0,(JV.indexOf(`Macintosh`)>=0||JV.indexOf(`iPad`)>=0||JV.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,WV=JV.indexOf(`Linux`)>=0,JV?.indexOf(`Mobi`),KV=!0,qV=globalThis._VSCODE_NLS_LANGUAGE||VV,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var QV=HV,$V=UV,eH=WV,tH=GV;KV&&typeof YV.importScripts==`function`&&YV.origin;var nH=JV,rH=qV,iH;(e=>{function t(){return rH}e.value=t;function n(){return rH.length===2?rH===`en`:rH.length>=3&&rH[0]===`e`&&rH[1]===`n`&&rH[2]===`-`}e.isDefaultVariant=n;function r(){return rH===`en`}e.isDefault=r})(iH||={});var aH=typeof YV.postMessage==`function`&&!YV.importScripts;(()=>{if(aH){let e=[];YV.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n{let r=++t;e.push({id:r,callback:n}),YV.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var oH=!!(nH&&nH.indexOf(`Chrome`)>=0);nH&&nH.indexOf(`Firefox`),!oH&&nH&&nH.indexOf(`Safari`),nH&&nH.indexOf(`Edg/`),nH&&nH.indexOf(`Android`);var sH=typeof navigator==`object`?navigator:{};tH||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||sH&&sH.clipboard&&sH.clipboard.writeText,tH||sH&&sH.clipboard&&sH.clipboard.readText,tH||BV()||sH.keyboard,`ontouchstart`in lV||sH.maxTouchPoints,lV.PointerEvent&&(`ontouchstart`in lV||navigator.maxTouchPoints);var cH=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},lH=new cH,uH=new cH,dH=new cH,fH=Array(230),pH;(e=>{function t(e){return lH.keyCodeToStr(e)}e.toString=t;function n(e){return lH.strToKeyCode(e)}e.fromString=n;function r(e){return uH.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return dH.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return uH.strToKeyCode(e)||dH.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return lH.keyCodeToStr(e)}e.toElectronAccelerator=o})(pH||={});var mH=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new hH([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},hH=class{constructor(e){if(e.length===0)throw UB(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t{function t(t){return t===e.None||t===e.Cancelled||t instanceof kH?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:hV.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:DH})})(OH||={});var kH=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?DH:(this._emitter||=new OV,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},AH=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new GB(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new GB(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},jH=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new GB(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=iV(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var MH;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(MH||={});var NH=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new OV,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};NH.EMPTY=NH.fromArray([]);function PH(e){return FH(e,0)}function FH(e,t){switch(typeof e){case`object`:return e===null?IH(349,t):Array.isArray(e)?zH(e,t):BH(e,t);case`string`:return RH(e,t);case`boolean`:return LH(e,t);case`number`:return IH(e,t);case`undefined`:return IH(937,t);default:return IH(617,t)}}function IH(e,t){return(t<<5)-t+e|0}function LH(e,t){return IH(e?433:863,t)}function RH(e,t){t=IH(149417,t);for(let n=0,r=e.length;nFH(t,e),t)}function BH(e,t){return t=IH(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=RH(n,t),FH(e[n],t)),t)}var{registerWindow:VH,getWindow:HH,getDocument:UH,getWindows:WH,getWindowsCount:GH,getWindowId:KH,getWindowById:qH,hasWindow:JH,onDidRegisterWindow:YH,onWillUnregisterWindow:XH,onDidUnregisterWindow:ZH}=function(){let e=new Map,t={window:lV,disposables:new oV};e.set(lV.vscodeWindowId,t);let n=new OV,r=new OV,i=new OV;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return sV.None;let a=new oV,o={window:t,disposables:a.add(new oV)};return e.set(t.vscodeWindowId,o),a.add(iV(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add($H(t,cU.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:lV},getDocument(e){return HH(e).document}}}(),QH=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function $H(e,t,n,r){return new QH(e,t,n,r)}function eU(e,t){return function(n){return t(new TH(e,n))}}function tU(e){return function(t){return e(new xH(t))}}var nU=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=eU(HH(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=tU(n)),$H(e,t,i,r)},rU,iU=class extends jH{constructor(e){super(),this.defaultTarget=e&&HH(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},aU=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){zB(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(aU.sort),a.shift().execute();r.set(i,!1)};rU=(t,r,a=0)=>{let o=KH(t),s=new aU(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var oU=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};oU.None=new oU(0,0);function sU(e){let t=e.getBoundingClientRect(),n=HH(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=PH(n),a=r.get(i);if(a)a.users+=1;else{let o=new OV,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(iV(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var cU={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:IV?`webkitAnimationStart`:`animationstart`,ANIMATION_END:IV?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:IV?`webkitAnimationIteration`:`animationiteration`},lU=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=uU(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=uU(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=uU(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=uU(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=uU(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=uU(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=uU(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=uU(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=uU(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=uU(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=uU(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=uU(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=uU(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=uU(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function uU(e){return typeof e==`number`?`${e}px`:e}function dU(e){return new lU(e)}var fU=class{constructor(){this._hooks=new oV,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(iV(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=HH(e)}this._hooks.add($H(a,cU.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add($H(a,cU.POINTER_UP,e=>this.stopMonitoring(!0)))}};function pU(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var mU;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(mU||={});var hU=class e extends sV{constructor(){super(),this.dispatched=!1,this.targets=new fV,this.ignoreTargets=new fV,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(hV.runAndSubscribe(YH,({window:e,disposables:t})=>{t.add($H(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add($H(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add($H(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:lV,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=tV(new e),iV(e.INSTANCE.targets.push(t))):sV.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=tV(new e),iV(e.INSTANCE.ignoreTargets.push(t))):sV.None}static isTouchDevice(){return`ontouchstart`in lV||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n=e.HOLD_DELAY&&Math.abs(s.initialPageX-KB(s.rollingPageX))<30&&Math.abs(s.initialPageY-KB(s.rollingPageY))<30){let e=this.newGestureEvent(mU.Contextmenu,s.initialTarget);e.pageX=KB(s.rollingPageX),e.pageY=KB(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=KB(s.rollingPageX),n=KB(s.rollingPageY),i=KB(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(mU.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===mU.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===mU.Change||t.type===mU.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=rU(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(mU.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};hU.SCROLL_FRICTION=-.005,hU.HOLD_DELAY=700,hU.CLEAR_TAP_COUNT_TIME=400,Wz([pU],hU,`isTouchDevice`,1);var gU=hU,_U=class extends sV{onclick(e,t){this._register($H(e,cU.CLICK,n=>t(new TH(HH(e),n))))}onmousedown(e,t){this._register($H(e,cU.MOUSE_DOWN,n=>t(new TH(HH(e),n))))}onmouseover(e,t){this._register($H(e,cU.MOUSE_OVER,n=>t(new TH(HH(e),n))))}onmouseleave(e,t){this._register($H(e,cU.MOUSE_LEAVE,n=>t(new TH(HH(e),n))))}onkeydown(e,t){this._register($H(e,cU.KEY_DOWN,e=>t(new xH(e))))}onkeyup(e,t){this._register($H(e,cU.KEY_UP,e=>t(new xH(e))))}oninput(e,t){this._register($H(e,cU.INPUT,t))}onblur(e,t){this._register($H(e,cU.BLUR,t))}onfocus(e,t){this._register($H(e,cU.FOCUS,t))}onchange(e,t){this._register($H(e,cU.CHANGE,t))}ignoreGesture(e){return gU.ignoreTarget(e)}},vU=11,yU=class extends _U{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=vU+`px`,this.domNode.style.height=vU+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new fU),this._register(nU(this.bgDomNode,cU.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(nU(this.domNode,cU.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new iU),this._pointerdownScheduleRepeatTimer=this._register(new AH)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,HH(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},bU=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},xU=class extends sV{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new OV),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new bU(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new TU(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=TU.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},SU=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function CU(e,t){let n=t-e;return function(t){return e+n*DU(t)}}function wU(e,t,n){return function(r){return r2.5*n){let r,i;return e{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},kU=140,AU=class extends _U{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new OU(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new fU),this._shouldRender=!0,this.domNode=dU(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register($H(this.domNode.domNode,cU.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new yU(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=dU(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register($H(this.slider.domNode,cU.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=sU(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(QV&&a>kU){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},jU=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};RU.INSTANCE=new RU;var zU=RU,BU=class extends _U{constructor(e,t,n){super(),this._onScroll=this._register(new OV),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new OV),this.onWillScroll=this._onWillScroll.event,this._options=HU(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new NU(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new MU(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=dU(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=dU(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=dU(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new AH),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=nV(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,$V&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new EH(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=nV(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push($H(this._listenOnDomNode,cU.MOUSE_WHEEL,e=>{this._onMouseWheel(new EH(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=zU.INSTANCE;IU&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!$V&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=FU*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=FU*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(IU&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),PU)}},VU=class extends BU{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function HU(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,$V&&(t.className+=` mac`),t}var UU=class extends sV{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new OV),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new xU({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>rU(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new VU(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(hV.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(iV(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(iV(()=>this._styleElement.remove())),this._register(hV.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(` +`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};UU=Wz([Gz(2,vB),Gz(3,jB),Gz(4,yB),Gz(5,IB),Gz(6,wB),Gz(7,NB)],UU);var WU=class extends sV{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(iV(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};WU=Wz([Gz(1,vB),Gz(2,jB),Gz(3,DB),Gz(4,NB)],WU);var GU=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},KU={full:0,left:0,center:0,right:0},qU={full:0,left:0,center:0,right:0},JU={full:0,left:0,center:0,right:0},YU=class extends sV{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new GU,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(iV(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);qU.full=this._canvas.width,qU.left=e,qU.center=t,qU.right=e,this._refreshDrawHeightConstants(),JU.full=1,JU.left=1,JU.center=1+qU.left,JU.right=1+qU.left+qU.center}_refreshDrawHeightConstants(){KU.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);KU.left=t,KU.center=t,KU.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*KU.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*KU.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*KU.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*KU.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(JU[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-KU[e.position||`full`]/2),qU[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+KU[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};YU=Wz([Gz(2,vB),Gz(3,DB),Gz(4,NB),Gz(5,wB),Gz(6,IB),Gz(7,jB)],YU);var $;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=` +`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var XU;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(XU||={});var ZU;(e=>e.ST=`${$.ESC}\\`)(ZU||={});var QU=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.lengththis.updateCompositionElements(!0),0)}}};QU=Wz([Gz(2,vB),Gz(3,wB),Gz(4,bB),Gz(5,NB)],QU);var $U=0,eW=0,tW=0,nW=0,rW={css:`#00000000`,rgba:0},iW;(e=>{function t(e,t,n,r){return r===void 0?`#${lW(e)}${lW(t)}${lW(n)}`:`#${lW(e)}${lW(t)}${lW(n)}${lW(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(iW||={});var aW;(e=>{function t(e,t){if(nW=(t.rgba&255)/255,nW===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return $U=a+Math.round((n-a)*nW),eW=o+Math.round((r-o)*nW),tW=s+Math.round((i-s)*nW),{css:iW.toCss($U,eW,tW),rgba:iW.toRgba($U,eW,tW)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=cW.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return iW.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[$U,eW,tW]=cW.toChannels(t),{css:iW.toCss($U,eW,tW),rgba:t}}e.opaque=i;function a(e,t){return nW=Math.round(t*255),[$U,eW,tW]=cW.toChannels(e.rgba),{css:iW.toCss($U,eW,tW,nW),rgba:iW.toRgba($U,eW,tW,nW)}}e.opacity=a;function o(e,t){return nW=e.rgba&255,a(e,nW*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(aW||={});var oW;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return $U=parseInt(e.slice(1,2).repeat(2),16),eW=parseInt(e.slice(2,3).repeat(2),16),tW=parseInt(e.slice(3,4).repeat(2),16),iW.toColor($U,eW,tW);case 5:return $U=parseInt(e.slice(1,2).repeat(2),16),eW=parseInt(e.slice(2,3).repeat(2),16),tW=parseInt(e.slice(3,4).repeat(2),16),nW=parseInt(e.slice(4,5).repeat(2),16),iW.toColor($U,eW,tW,nW);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return $U=parseInt(r[1]),eW=parseInt(r[2]),tW=parseInt(r[3]),nW=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),iW.toColor($U,eW,tW,nW);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[$U,eW,tW,nW]=t.getImageData(0,0,1,1).data,nW!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:iW.toRgba($U,eW,tW,nW),css:e}}e.toColor=r})(oW||={});var sW;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(sW||={});var cW;(e=>{function t(e,t){if(nW=(t&255)/255,nW===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return $U=a+Math.round((n-a)*nW),eW=o+Math.round((r-o)*nW),tW=s+Math.round((i-s)*nW),iW.toRgba($U,eW,tW)}e.blend=t;function n(e,t,n){let a=sW.relativeLuminance(e>>8),o=sW.relativeLuminance(t>>8);if(uW(a,o)>8));if(suW(a,sW.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=uW(a,sW.relativeLuminance(s>>8));if(cuW(a,sW.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=uW(sW.relativeLuminance2(o,s,c),sW.relativeLuminance2(r,i,a));for(;l0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=uW(sW.relativeLuminance2(o,s,c),sW.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=uW(sW.relativeLuminance2(o,s,c),sW.relativeLuminance2(r,i,a));for(;l>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(cW||={});function lW(e){let t=e.toString(16);return t.length<2?`0`+t:t}function uW(e,t){return e1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t=E,M=k,N=this._workCell;if(f.length>0&&k===f[0][0]&&j){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v=r[1],j?(A=!0,N=new dW(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),M=r[1]-1,m=N.getWidth()):E=r[1]}let P=this._isCellInSelection(k,t),F=n&&k===a,I=O&&k>=l&&k<=u,L=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{L=!0});let R=N.getChars()||cB;if(R===` `&&(N.isUnderline()||N.isOverline())&&(R=`\xA0`),T=m*s-c.get(R,N.isBold(),N.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(P&&w||!P&&!w&&N.bg===y)&&(P&&w&&p.selectionForeground||N.fg===b)&&N.extended.ext===x&&I===S&&T===C&&!F&&!A&&!L&&j){N.isInvisible()?_+=cB:_+=R,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=N.bg,b=N.fg,x=N.extended.ext,S=I,C=T,w=P,A&&a>=k&&a<=M&&(a=k),!this._coreService.isCursorHidden&&F&&this._coreService.isCursorInitialized){if(D.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&D.push(`xterm-cursor-blink`),D.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:D.push(`xterm-cursor-outline`);break;case`block`:D.push(`xterm-cursor-block`);break;case`bar`:D.push(`xterm-cursor-bar`);break;case`underline`:D.push(`xterm-cursor-underline`);break;default:break}}if(N.isBold()&&D.push(`xterm-bold`),N.isItalic()&&D.push(`xterm-italic`),N.isDim()&&D.push(`xterm-dim`),_=N.isInvisible()?cB:N.getChars()||cB,N.isUnderline()&&(D.push(`xterm-underline-${N.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!N.isUnderlineColorDefault()))if(N.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${lB.toColorRGB(N.getUnderlineColor()).join(`,`)})`;else{let e=N.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&N.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}N.isOverline()&&(D.push(`xterm-overline`),_===` `&&(_=`\xA0`)),N.isStrikethrough()&&D.push(`xterm-strikethrough`),I&&(h.style.textDecoration=`underline`);let ee=N.getFgColor(),z=N.getFgColorMode(),B=N.getBgColor(),V=N.getBgColorMode(),H=!!N.isInverse();if(H){let e=ee;ee=B,B=e;let t=z;z=V,V=t}let te,ne,re=!1;this._decorationService.forEachDecorationAtCell(k,t,void 0,e=>{e.options.layer!==`top`&&re||(e.backgroundColorRGB&&(V=50331648,B=e.backgroundColorRGB.rgba>>8&16777215,te=e.backgroundColorRGB),e.foregroundColorRGB&&(z=50331648,ee=e.foregroundColorRGB.rgba>>8&16777215,ne=e.foregroundColorRGB),re=e.options.layer===`top`)}),!re&&P&&(te=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,B=te.rgba>>8&16777215,V=50331648,re=!0,p.selectionForeground&&(z=50331648,ee=p.selectionForeground.rgba>>8&16777215,ne=p.selectionForeground)),re&&D.push(`xterm-decoration-top`);let ie;switch(V){case 16777216:case 33554432:ie=p.ansi[B],D.push(`xterm-bg-${B}`);break;case 50331648:ie=iW.toColor(B>>16,B>>8&255,B&255),this._addStyle(h,`background-color:#${yW((B>>>0).toString(16),`0`,6)}`);break;default:H?(ie=p.foreground,D.push(`xterm-bg-257`)):ie=p.background}switch(te||N.isDim()&&(te=aW.multiplyOpacity(ie,.5)),z){case 16777216:case 33554432:N.isBold()&&ee<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ee+=8),this._applyMinimumContrast(h,ie,p.ansi[ee],N,te,void 0)||D.push(`xterm-fg-${ee}`);break;case 50331648:let e=iW.toColor(ee>>16&255,ee>>8&255,ee&255);this._applyMinimumContrast(h,ie,e,N,te,ne)||this._addStyle(h,`color:#${yW(ee.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,ie,p.foreground,N,te,ne)||H&&D.push(`xterm-fg-257`)}D.length&&=(h.className=D.join(` `),0),!F&&!A&&!L&&j?g++:h.textContent=_,T!==this.defaultSpacing&&(h.style.letterSpacing=`${T}px`),d.push(h),k=M}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||hW(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=aW.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t=n[0]&&e=n[0]}};vW=Wz([Gz(1,FB),Gz(2,wB),Gz(3,jB),Gz(4,bB),Gz(5,DB),Gz(6,IB)],vW);function yW(e,t,n){for(;e.length0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},xW=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n=this.startCol&&t=this.startCol):!1}};function SW(){return new xW}var CW=`xterm-dom-renderer-owner-`,wW=`xterm-rows`,TW=`xterm-fg-`,EW=`xterm-bg-`,DW=`xterm-focus`,OW=`xterm-selection`,kW=1,AW=class extends sV{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=kW++,this._rowElements=[],this._selectionRenderModel=SW(),this.onRequestRedraw=this._register(new OV).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(wW),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(OW),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=gW(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(vW,document),this._element.classList.add(CW+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(iV(()=>{this._element.classList.remove(CW+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new bW(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${wW} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${wW} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${wW} .xterm-dim { color: ${aW.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${wW}.${DW} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${wW}.${DW} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${wW}.${DW} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${wW} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${wW} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${wW} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${wW} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${wW} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${OW} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${OW} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${OW} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${TW}${n} { color: ${r.css}; }${this._terminalSelector} .${TW}${n}.xterm-dim { color: ${aW.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${EW}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${TW}257 { color: ${aW.opaque(e.background).css}; }${this._terminalSelector} .${TW}257.xterm-dim { color: ${aW.multiplyOpacity(aW.opaque(e.background),.5).css}; }${this._terminalSelector} .${EW}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(DW),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(DW),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${CW}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};AW=Wz([Gz(7,SB),Gz(8,AB),Gz(9,wB),Gz(10,vB),Gz(11,bB),Gz(12,jB),Gz(13,IB)],AW);var jW=class extends sV{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new OV),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new PW(this._optionsService))}catch{this._measureStrategy=this._register(new NW(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};jW=Wz([Gz(2,wB)],jW);var MW=class extends sV{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},NW=class extends MW{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},PW=class extends MW{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},FW=class extends sV{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new IW(this._window)),this._onDprChange=this._register(new OV),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new OV),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(hV.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register($H(this._textarea,`focus`,()=>this._isFocused=!0)),this._register($H(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},IW=class extends sV{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new cV),this._onDprChange=this._register(new OV),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(iV(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=$H(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},LW=class extends sV{constructor(){super(),this.linkProviders=[],this._register(iV(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function RW(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function zW(e,t,n,r,i,a,o,s,c){if(!a)return;let l=RW(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var BW=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return zW(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=RW(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};BW=Wz([Gz(0,NB),Gz(1,AB)],BW);var VW=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},HW={};Uz(HW,{getSafariVersion:()=>YW,isChromeOS:()=>tG,isFirefox:()=>KW,isIpad:()=>ZW,isIphone:()=>QW,isLegacyEdge:()=>qW,isLinux:()=>eG,isMac:()=>XW,isNode:()=>UW,isSafari:()=>JW,isWindows:()=>$W});var UW=typeof process<`u`&&`title`in process,WW=UW?`node`:navigator.userAgent,GW=UW?`node`:navigator.platform,KW=WW.includes(`Firefox`),qW=WW.includes(`Edge`),JW=/^((?!chrome|android).)*safari/i.test(WW);function YW(){if(!JW)return 0;let e=WW.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var XW=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(GW),ZW=GW===`iPad`,QW=GW===`iPhone`,$W=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(GW),eG=GW.indexOf(`Linux`)>=0,tG=/\bCrOS\b/.test(WW),nG=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._ii){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},rG=class extends nG{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},iG=class extends nG{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},aG=!UW&&`requestIdleCallback`in window?iG:rG,oG=class{constructor(){this._queue=new aG}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},sG=class extends sV{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new cV),this._pausedResizeTask=new oG,this._observerDisposable=this._register(new cV),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new OV),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new OV),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new OV),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new OV),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new VW((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new cG(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(iV(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=iV(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};sG=Wz([Gz(2,wB),Gz(3,AB),Gz(4,bB),Gz(5,DB),Gz(6,vB),Gz(7,jB),Gz(8,IB)],sG);var cG=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function lG(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return fG(i,a,e,t,n,r)+pG(a,t,n,r)+mG(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,xG(Math.abs(i-e),bG(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return xG(dG(a>t?e:i,n)+(s-1)*n.cols+1+uG(a>t?i:e,n),bG(o,r))}function uG(e,t){return e-1}function dG(e,t){return t.cols-e}function fG(e,t,n,r,i,a){return pG(t,r,i,a).length===0?``:xG(yG(e,t,e,t-gG(t,i),!1,i).length,bG(`D`,a))}function pG(e,t,n,r){let i=e-gG(e,n),a=t-gG(t,n);return xG(Math.abs(i-a)-hG(e,t,n),bG(vG(e,t),r))}function mG(e,t,n,r,i,a){let o;o=pG(t,r,i,a).length>0?r-gG(r,i):t;let s=r,c=_G(e,t,n,r,i,a);return xG(yG(e,o,n,s,c===`C`,i).length,bG(c,a))}function hG(e,t,n){let r=0,i=e-gG(e,n),a=t-gG(t,n);for(let o=0;o=0&&e0?r-gG(r,i):t,e=n&&ot?`A`:`B`}function yG(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&sa.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function bG(e,t){let n=t?`O`:`[`;return $.ESC+n+e}function xG(e,t){e=Math.floor(e);let n=``;for(let r=0;rthis._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function CG(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var wG=50,TG=15,EG=50,DG=500,OG=RegExp(`\xA0`,`g`),kG=class extends sV{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new dB,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new OV),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new OV),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new OV),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new OV),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new SG(this._bufferService),this._activeSelectionMode=0,this._register(iV(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]e.replace(OG,` `)).join($W?`\r `:` -`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),YW&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=vG(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=NW(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-yG),yG),t/=yG,t/Math.abs(t)+Math.round(t*(bG-1)))}shouldForceSelection(e){return GW?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),xG)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(GW&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&tthis._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=vG(n,this._bufferService.cols)}};wG=zz([Bz(3,pB),Bz(4,hB),Bz(5,DB),Bz(6,yB),Bz(7,OB),Bz(8,EB)],wG);var TG=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},EG=class{constructor(){this._color=new TG,this._css=new TG}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},DG=Object.freeze((()=>{let e=[tW.toColor(`#2e3436`),tW.toColor(`#cc0000`),tW.toColor(`#4e9a06`),tW.toColor(`#c4a000`),tW.toColor(`#3465a4`),tW.toColor(`#75507b`),tW.toColor(`#06989a`),tW.toColor(`#d3d7cf`),tW.toColor(`#555753`),tW.toColor(`#ef2929`),tW.toColor(`#8ae234`),tW.toColor(`#fce94f`),tW.toColor(`#729fcf`),tW.toColor(`#ad7fa8`),tW.toColor(`#34e2e2`),tW.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:$U.toCss(r,i,a),rgba:$U.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:$U.toCss(n,n,n),rgba:$U.toRgba(n,n,n)})}return e})()),OG=tW.toColor(`#ffffff`),kG=tW.toColor(`#000000`),AG=tW.toColor(`#ffffff`),jG=kG,MG={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},NG=OG,PG=class extends nV{constructor(e){super(),this._optionsService=e,this._contrastCache=new EG,this._halfContrastCache=new EG,this._onChangeColors=this._register(new CV),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:OG,background:kG,cursor:AG,cursorAccent:jG,selectionForeground:void 0,selectionBackgroundTransparent:MG,selectionBackgroundOpaque:eW.blend(kG,MG),selectionInactiveBackgroundTransparent:MG,selectionInactiveBackgroundOpaque:eW.blend(kG,MG),scrollbarSliderBackground:eW.opacity(OG,.2),scrollbarSliderHoverBackground:eW.opacity(OG,.4),scrollbarSliderActiveBackground:eW.opacity(OG,.5),overviewRulerBorder:OG,ansi:DG.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=FG(e.foreground,OG),t.background=FG(e.background,kG),t.cursor=eW.blend(t.background,FG(e.cursor,AG)),t.cursorAccent=eW.blend(t.background,FG(e.cursorAccent,jG)),t.selectionBackgroundTransparent=FG(e.selectionBackground,MG),t.selectionBackgroundOpaque=eW.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=FG(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=eW.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?FG(e.selectionForeground,QU):void 0,t.selectionForeground===QU&&(t.selectionForeground=void 0),eW.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=eW.opacity(t.selectionBackgroundTransparent,.3)),eW.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=eW.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=FG(e.scrollbarSliderBackground,eW.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=FG(e.scrollbarSliderHoverBackground,eW.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=FG(e.scrollbarSliderActiveBackground,eW.opacity(t.foreground,.5)),t.overviewRulerBorder=FG(e.overviewRulerBorder,NG),t.ansi=DG.slice(),t.ansi[0]=FG(e.black,DG[0]),t.ansi[1]=FG(e.red,DG[1]),t.ansi[2]=FG(e.green,DG[2]),t.ansi[3]=FG(e.yellow,DG[3]),t.ansi[4]=FG(e.blue,DG[4]),t.ansi[5]=FG(e.magenta,DG[5]),t.ansi[6]=FG(e.cyan,DG[6]),t.ansi[7]=FG(e.white,DG[7]),t.ansi[8]=FG(e.brightBlack,DG[8]),t.ansi[9]=FG(e.brightRed,DG[9]),t.ansi[10]=FG(e.brightGreen,DG[10]),t.ansi[11]=FG(e.brightYellow,DG[11]),t.ansi[12]=FG(e.brightBlue,DG[12]),t.ansi[13]=FG(e.brightMagenta,DG[13]),t.ansi[14]=FG(e.brightCyan,DG[14]),t.ansi[15]=FG(e.brightWhite,DG[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;re.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},RG={trace:0,debug:1,info:2,warn:3,error:4,off:5},zG=`xterm.js: `,BG=class extends nV{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),VG=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=RG[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis._length)for(let t=this._length;t=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;tthis._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*UG+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*UG+0]=e|2097152|t[2]<<22):this._data[e*UG+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*UG+0]>>22}hasWidth(e){return this._data[e*UG+0]&12582912}getFg(e){return this._data[e*UG+1]}getBg(e){return this._data[e*UG+2]}hasContent(e){return this._data[e*UG+0]&4194303}getCodePoint(e){let t=this._data[e*UG+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*UG+0]&2097152}getString(e){let t=this._data[e*UG+0];return t&2097152?this._combined[e]:t&2097151?Qz(t&2097151):``}isProtected(e){return this._data[e*UG+2]&536870912}loadCell(e,t){return GG=e*UG,t.content=this._data[GG+0],t.fg=this._data[GG+1],t.bg=this._data[GG+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*UG+0]=t.content,this._data[e*UG+1]=t.fg,this._data[e*UG+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*UG+0]=t|n<<22,this._data[e*UG+1]=r.fg,this._data[e*UG+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*UG+0];r&2097152?this._combined[e]+=Qz(t):r&2097151?(this._combined[e]=Qz(r&2097151)+Qz(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*UG+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;rthis.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*KG=0;--e)if(this._data[e*UG+0]&4194303)return e+(this._data[e*UG+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*UG+0]&4194303||this._data[e*UG+2]&50331648)return e+(this._data[e*UG+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t>22||1}return r&&r.push(t),i}};function JG(e,t,n,r,i,a){let o=[];for(let s=0;s=s&&r0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function YG(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;oQG(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;sc&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function QG(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var $G=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new CV),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),ZB(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};$G._nextId=1;var eK=$G,tK={},nK=tK.B;tK[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},tK.A={"#":`£`},tK.B=void 0,tK[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},tK.C=tK[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},tK.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},tK.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},tK.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},tK.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},tK.E=tK[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},tK.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},tK.H=tK[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},tK[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var rK=4294967295,iK=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=WG.clone(),this.savedCharset=nK,this.markers=[],this._nullCell=oB.fromCharData([0,nB,1,0]),this._whitespaceCell=oB.fromCharData([0,rB,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new eG,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new HG(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new aB),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new aB),this._whitespaceCell}getBlankLine(e,t){return new qG(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&erK?rK:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=WG);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new HG(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(WG),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new qG(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=JG(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(WG),n);if(r.length>0){let n=YG(this.lines,r);XG(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(WG),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=QG(c,Math.max(g,0),this._cols))}for(let t=0;t0;)this.ybase===0?this.y0){let e=[],t=[];for(let e=0;e=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.linee.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},aK=class extends nV{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new CV),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new iK(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new iK(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},oK=2,sK=1,cK=class extends nV{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new CV),this.onResize=this._onResize.event,this._onScroll=this._register(new CV),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,oK),this.rows=Math.max(e.rawOptions.rows||0,sK),this.buffers=this._register(new aK(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};cK=zz([Bz(0,yB)],cK);var lK={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:GW,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},uK=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],dK=class extends nV{constructor(e){super(),this._onOptionChange=this._register(new CV),this.onOptionChange=this._onOptionChange.event;let t={...lK};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register($B(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in lK))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in lK))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=lK[e],!fK(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=lK[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=uK.includes(t)?t:lK[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function fK(e){return e===`block`||e===`underline`||e===`bar`}function pK(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&pK(e[r],t-1);return n}var mK=Object.freeze({insertMode:!1}),hK=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),gK=class extends nV{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new CV),this.onData=this._onData.event,this._onUserInput=this._register(new CV),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new CV),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new CV),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=pK(mK),this.decPrivateModes=pK(hK)}reset(){this.modes=pK(mK),this.decPrivateModes=pK(hK)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};gK=zz([Bz(0,pB),Bz(1,vB),Bz(2,yB)],gK);var _K={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function vK(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var yK=String.fromCharCode,bK={DEFAULT:e=>{let t=[vK(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${yK(t[0])}${yK(t[1])}${yK(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${vK(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${vK(e,!0)};${e.x};${e.y}${t}`}},xK=class extends nV{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new CV),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(_K))this.addProtocol(e,_K[e]);for(let e of Object.keys(bK))this.addEncoding(e,bK[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};xK=zz([Bz(0,pB),Bz(1,hB),Bz(2,yB)],xK);var SK=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],CK=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],wK;function TK(e,t){let n=0,r=t.length-1,i;if(et[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=DK.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return DK.createPropertyValue(0,n,r)}},DK=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new CV,this.onChange=this._onChange.event;let e=new EK;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},OK=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function kK(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var AK=2147483647,jK=256,MK=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>jK)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>AK?AK:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>AK?AK:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,AK):e}},NK=[],PK=class{constructor(){this._state=0,this._active=NK,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=NK}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=NK,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||NK,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,$z(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=NK,this._id=-1,this._state=0}}},FK=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=$z(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},IK=[],LK=class{constructor(){this._handlers=Object.create(null),this._active=IK,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=IK}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=IK,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||IK,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,$z(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=IK,this._ident=0}},RK=new MK;RK.addParam(0);var zK=class{constructor(e){this._handler=e,this._data=``,this._params=RK,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():RK,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=$z(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=RK,this._data=``,this._hitLimit=!1,e));return this._params=RK,this._data=``,this._hitLimit=!1,t}},BK=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;it),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(VK,0,2,0),e.add(VK,8,5,8),e.add(VK,6,0,6),e.add(VK,11,0,11),e.add(VK,13,13,13),e}(),UK=class extends nV{constructor(e=HK){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new MK,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register($B(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new PK),this._dcsParser=this._register(new LK),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;tr||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let n=a;n>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r=t||(r=e[i])<32||r>127&&r>4:i>>8}return n}}function qK(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function JK(e,t=16){let[n,r,i]=e;return`rgb:${qK(n,t)}/${qK(r,t)}/${qK(i,t)}`}var YK={"(":0,")":1,"*":2,"+":3,"-":1,".":2},XK=131072,ZK=10;function QK(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var $K=5e3,eq=0,tq=class extends nV{constructor(e,t,n,r,i,a,o,s,c=new UK){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new eB,this._utf8Decoder=new tB,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=WG.clone(),this._eraseAttrDataInternal=WG.clone(),this._onRequestBell=this._register(new CV),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new CV),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new CV),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new CV),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new CV),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new CV),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new CV),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new CV),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new CV),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new CV),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new CV),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new CV),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new CV),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new nq(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(GU.IND,()=>this.index()),this._parser.setExecuteHandler(GU.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(GU.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new FK(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new FK(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new FK(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new FK(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new FK(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new FK(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new FK(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new FK(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new FK(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new FK(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new FK(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new FK(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in tK)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new zK((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),$K))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${$K} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>XK&&(a=this._parseStack.position+XK)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.lengthXK)for(let t=a;t0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;ps){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof qG&&d.copyCellsFrom(e,t,0,m,!1);t=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!QK(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new zK(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new FK(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let c=s;for(let e=1;e0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent($.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent($.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent($.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent($.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent($.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${$.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=iB.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=WG.fg,e.bg=WG.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=WG.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=WG.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=WG.fg&16777215,r.bg&=-67108864,r.bg|=WG.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=WG.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!QK(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>ZK&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>ZK&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(rq(n))if(r===`?`)t.push({type:0,index:n});else{let e=KK(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=KK(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=WG.clone(),this._eraseAttrDataInternal=WG.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new oB;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${$.ESC}${e}${$.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},nq=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){ethis.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(eq=e,e=t,t=eq),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};nq=zz([Bz(0,pB)],nq);function rq(e){return 0<=e&&e<256}var iq=5e7,aq=12,oq=50,sq=class extends nV{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new CV),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>iq)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=aq?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=aq)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>oq&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},cq=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};cq=zz([Bz(0,pB)],cq);var lq=!1,uq=class extends nV{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new rV),this._onBinary=this._register(new CV),this.onBinary=this._onBinary.event,this._onData=this._register(new CV),this.onData=this._onData.event,this._onLineFeed=this._register(new CV),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new CV),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new CV),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new CV),this._instantiationService=new LG,this.optionsService=this._register(new dK(e)),this._instantiationService.setService(yB,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(cK)),this._instantiationService.setService(pB,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(BG)),this._instantiationService.setService(vB,this._logService),this.coreService=this._register(this._instantiationService.createInstance(gK)),this._instantiationService.setService(hB,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(xK)),this._instantiationService.setService(mB,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(DK)),this._instantiationService.setService(xB,this.unicodeService),this._charsetService=this._instantiationService.createInstance(OK),this._instantiationService.setService(gB,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(cq),this._instantiationService.setService(bB,this._oscLinkService),this._inputHandler=this._register(new tq(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(uV.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(uV.forward(this._bufferService.onResize,this._onResize)),this._register(uV.forward(this.coreService.onData,this._onData)),this._register(uV.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new sq((e,t)=>this._inputHandler.parse(e,t))),this._register(uV.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new CV),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!lq&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),lq=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,oK),t=Math.max(t,sK),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(kK.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(kK(this._bufferService),!1))),this._windowsWrappingHeuristics.value=$B(()=>{for(let t of e)t.dispose()})}}},dq={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function fq(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?$.ESC+`OA`:$.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?$.ESC+`OD`:$.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?$.ESC+`OC`:$.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?$.ESC+`OB`:$.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:$.DEL,e.altKey&&(i.key=$.ESC+i.key);break;case 9:if(e.shiftKey){i.key=$.ESC+`[Z`;break}i.key=$.HT,i.cancel=!0;break;case 13:i.key=e.altKey?$.ESC+$.CR:$.CR,i.cancel=!0;break;case 27:i.key=$.ESC,e.altKey&&(i.key=$.ESC+$.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`D`:t?$.ESC+`OD`:$.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`C`:t?$.ESC+`OC`:$.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`A`:t?$.ESC+`OA`:$.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`B`:t?$.ESC+`OB`:$.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=$.ESC+`[2~`);break;case 46:i.key=a?$.ESC+`[3;`+(a+1)+`~`:$.ESC+`[3~`;break;case 36:i.key=a?$.ESC+`[1;`+(a+1)+`H`:t?$.ESC+`OH`:$.ESC+`[H`;break;case 35:i.key=a?$.ESC+`[1;`+(a+1)+`F`:t?$.ESC+`OF`:$.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?$.ESC+`[5;`+(a+1)+`~`:$.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?$.ESC+`[6;`+(a+1)+`~`:$.ESC+`[6~`;break;case 112:i.key=a?$.ESC+`[1;`+(a+1)+`P`:$.ESC+`OP`;break;case 113:i.key=a?$.ESC+`[1;`+(a+1)+`Q`:$.ESC+`OQ`;break;case 114:i.key=a?$.ESC+`[1;`+(a+1)+`R`:$.ESC+`OR`;break;case 115:i.key=a?$.ESC+`[1;`+(a+1)+`S`:$.ESC+`OS`;break;case 116:i.key=a?$.ESC+`[15;`+(a+1)+`~`:$.ESC+`[15~`;break;case 117:i.key=a?$.ESC+`[17;`+(a+1)+`~`:$.ESC+`[17~`;break;case 118:i.key=a?$.ESC+`[18;`+(a+1)+`~`:$.ESC+`[18~`;break;case 119:i.key=a?$.ESC+`[19;`+(a+1)+`~`:$.ESC+`[19~`;break;case 120:i.key=a?$.ESC+`[20;`+(a+1)+`~`:$.ESC+`[20~`;break;case 121:i.key=a?$.ESC+`[21;`+(a+1)+`~`:$.ESC+`[21~`;break;case 122:i.key=a?$.ESC+`[23;`+(a+1)+`~`:$.ESC+`[23~`;break;case 123:i.key=a?$.ESC+`[24;`+(a+1)+`~`:$.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=$.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=$.DEL:e.keyCode===219?i.key=$.ESC:e.keyCode===220?i.key=$.FS:e.keyCode===221&&(i.key=$.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=dq[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=$.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=$.ESC+n}else if(e.keyCode===32)i.key=$.ESC+(e.ctrlKey?$.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=$.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=$.US),e.key===`@`&&(i.key=$.NUL))}return i}var pq=0,mq=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new eG,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new eG,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(pq=this._search(t),pq===-1)||this._getKey(this._array[pq])!==t)return!1;do if(this._array[pq]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(pq),!0;while(++pqe-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(pq=this._search(e),!(pq<0||pq>=this._array.length)&&this._getKey(this._array[pq])===e))do yield this._array[pq];while(++pq=this._array.length)&&this._getKey(this._array[pq])===e))do t(this._array[pq]);while(++pq=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},hq=0,gq=0,_q=class extends nV{constructor(){super(),this._decorations=new mq(e=>e?.marker.line),this._onDecorationRegistered=this._register(new CV),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new CV),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register($B(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new vq(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e{hq=t.options.x??0,gq=hq+(t.options.width??1),e>=hq&&e=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},xq=20,Sq=class extends nV{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;ethis._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new bq(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(` -`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(JH(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register($B(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` -`&&(this._liveRegionLineCount++,this._liveRegionLineCount===xq+1&&(this._liveRegion.textContent+=Wz.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;ee;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e{ZB(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(JH(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(JH(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register(JH(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register(JH(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;re?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;tthis._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;ethis._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&wq(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,ZB(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};Cq=zz([Bz(1,DB),Bz(2,OB),Bz(3,pB),Bz(4,MB)],Cq);function wq(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Tq=class extends uq{constructor(e={}){super(e),this._linkifier=this._register(new rV),this.browser=LW,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new rV),this._onCursorMove=this._register(new CV),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new CV),this.onKey=this._onKey.event,this._onRender=this._register(new CV),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new CV),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new CV),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new CV),this.onBell=this._onBell.event,this._onFocus=this._register(new CV),this._onBlur=this._register(new CV),this._onA11yCharEmitter=this._register(new CV),this._onA11yTabEmitter=this._register(new CV),this._onWillOpen=this._register(new CV),this._setup(),this._decorationService=this._instantiationService.createInstance(_q),this._instantiationService.setService(SB,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(MW),this._instantiationService.setService(MB,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(CB)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(uV.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(uV.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(uV.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(uV.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register($B(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=eW.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${JK(r)}${KU.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=$U.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=$U.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Sq,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register(JH(this.element,`copy`,e=>{this.hasSelection()&&qz(e,this._selectionService)}));let e=e=>Jz(e,this.textarea,this.coreService,this.optionsService);this._register(JH(this.textarea,`paste`,e)),this._register(JH(this.element,`paste`,e)),VW?this._register(JH(this.element,`mousedown`,e=>{e.button===2&&Zz(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(JH(this.element,`contextmenu`,e=>{Zz(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),YW&&this._register(JH(this.element,`auxclick`,e=>{e.button===1&&Xz(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register(JH(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register(JH(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register(JH(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register(JH(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register(JH(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register(JH(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register(JH(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register(JH(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,Hz.get()),XW||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(AW,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(EB,this._coreBrowserService),this._register(JH(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register(JH(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(EW,this._document,this._helperContainer),this._instantiationService.setService(TB,this._charSizeService),this._themeService=this._instantiationService.createInstance(PG),this._instantiationService.setService(jB,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(sW),this._instantiationService.setService(AB,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(nG,this.rows,this.screenElement)),this._instantiationService.setService(OB,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(qU,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(FW),this._instantiationService.setService(DB,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Cq,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(RU,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(wG,this.element,this.screenElement,r)),this._instantiationService.setService(kB,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(uV.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(zU,this.screenElement)),this._register(JH(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Sq,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(WU,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(WU,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(TW,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(JH(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register(JH(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){Yz(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=fq(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===$.ETX||n.key===$.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Eq(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new oB)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},kq=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new Oq(t)}getNullCell(){return new oB}},Aq=class extends nV{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new CV),this.onBufferChange=this._onBufferChange.event,this._normal=new kq(this._core.buffers.normal,`normal`),this._alternate=new kq(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},jq=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},Mq=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Nq=[`cols`,`rows`],Pq=0,Fq=class extends nV{constructor(e){super(),this._core=this._register(new Tq(e)),this._addonManager=this._register(new Dq),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(Nq.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new jq(this._core),this._parser}get unicode(){return this._checkProposedApi(),new Mq(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new Aq(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r -`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Hz.get()},set promptLabel(e){Hz.set(e)},get tooMuchOutput(){return Wz.get()},set tooMuchOutput(e){Wz.set(e)}}}_verifyIntegers(...e){for(Pq of e)if(Pq===1/0||isNaN(Pq)||Pq%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Pq of e)if(Pq&&(Pq===1/0||isNaN(Pq)||Pq%1!=0||Pq<0))throw Error(`This API only accepts positive integers`)}};function Iq(){return{background:`#101316`,foreground:`#d7dde3`,cursor:`#7db8ff`,selectionBackground:`#365b8a`,black:`#1d2227`,red:`#ff7b72`,green:`#56d364`,yellow:`#e3b341`,blue:`#79c0ff`,magenta:`#d2a8ff`,cyan:`#39c5cf`,white:`#e6edf3`,brightBlack:`#6e7681`,brightRed:`#ffa198`,brightGreen:`#7ee787`,brightYellow:`#f2cc60`,brightBlue:`#a5d6ff`,brightMagenta:`#d2a8ff`,brightCyan:`#56d4dd`,brightWhite:`#ffffff`}}function Lq({sessionId:e,cwd:t,tabId:n,active:r=!0,onConnectionChange:i}){let{t:a}=cr(),o=(0,_.useMemo)(()=>new rf,[]),s=wk(),c=n?s?.terminals?.[n]:s?.terminal,l=t.replace(/[\\/]+$/u,``).split(/[\\/]/u).pop()||t,u=(0,_.useRef)(r);u.current=r;let d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(c?.id??null),[m,h]=(0,_.useState)(`connecting`),[g,v]=(0,_.useState)(null),[y,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(!1),[C,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(0),O=(0,_.useRef)(null),k=(0,_.useRef)(null),[A,j]=(0,_.useState)(!1),[M,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(null),I=(0,_.useRef)(i);I.current=i,(0,_.useEffect)(()=>{I.current?.({id:p.current,pending:[`connecting`,`reconnecting`,`restarting`].includes(m)})},[m]),(0,_.useEffect)(()=>{let r=d.current;if(!r)return;let i=n?s?.terminals?.[n]:s?.terminal;p.current??=i?.id??null;let c=!1,l=!1,m=!1,g=!1,_,y=!1,x=Promise.resolve(void 0),C=null,w=new AbortController;h(`connecting`),v(null),b(null),S(!1),T(!1),j(!1),N(!1),F(null);let D=new Fq({cursorBlink:!0,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace`,fontSize:13,lineHeight:1.25,scrollback:8e3,screenReaderMode:!0,disableStdin:!0,theme:Iq()}),A=i?{...i}:void 0,M=new Fz;D.loadAddon(M),D.open(r);let P=f.current;f.current=null,!r.closest(`[hidden], [inert]`)&&(E===0||r.closest(`.interactive-terminal`)?.contains(document.activeElement)||P?.sessionId===e&&P.cwd===t&&P.generation===E&&document.activeElement===document.body)&&D.focus(),D.attachCustomKeyEventHandler(e=>{if(e.type!==`keydown`)return!0;let t=e.key.toLowerCase();return t===`escape`&&e.stopPropagation(),!((e.ctrlKey||e.metaKey)&&t===`v`||(e.ctrlKey||e.metaKey)&&t===`c`&&D.hasSelection())});let I=e=>!c&&w===e&&!e.signal.aborted,L=()=>{m=!1,y=!0,C=null,D.options.disableStdin=!0,w.abort()},R=e=>{c||(L(),v(e instanceof Error?e.message:a(`terminalError`)),h(`error`))},ee=e=>{if(y||c)return;let t=w;x=x.then(()=>{if(I(t)&&!y&&m&&!l)return e()}).catch(e=>{I(t)&&R(e)})},z=t=>{let n=p.current;if(!(!n||!u.current||!m||l||y))for(let r of t.match(/[\s\S]{1,32768}/gu)??[]){if(C&&C.data.length+r.length<=65536){C.data+=r;continue}let t={data:r};C=t,ee(async()=>{C===t&&(C=null),await o.writeInteractiveTerminal(e,n,t.data)})}},B=(t,n)=>{let r=p.current;!r||!m||l||y||(C=null,ee(()=>o.resizeInteractiveTerminal(e,r,t,n)))},V=()=>{if(!(!r.offsetWidth||!r.offsetHeight))try{M.fit()}catch{}},H=(e=D.buffer.active.viewportY)=>{let t=e>=D.buffer.active.baseY;S(!t);let r=p.current;if(s&&r&&!A){let i={...n?s.terminals?.[n]:s.terminal,id:r,viewport:e,atBottom:t};n?(s.terminals??={})[n]=i:s.terminal=i}},te=e=>{if(!c){if(e.type===`output`){if(e.reset)D.reset(),_!==void 0&&T(!0);else if(_!==void 0&&e.offset<=_)return;D.write(e.data,()=>{c||(A&&=(A.atBottom?D.scrollToBottom():D.scrollToLine(A.viewport),void 0),H())}),_=e.offset;return}l=!0,m=!1,D.options.disableStdin=!0,w.abort(),b(e.type===`exit`?e.exitCode:null),h(`exited`)}},ne=D.onData(z),re=D.onScroll(H),ie=D.onResize(({cols:e,rows:t})=>B(e,t)),ae=typeof ResizeObserver>`u`?void 0:new ResizeObserver(V);ae?.observe(r);let U=async()=>{if(c||g||m)return;g=!0,L();let r=new AbortController;w=r,x=Promise.resolve();let i=p.current;h(i?`reconnecting`:`connecting`),v(null),V();try{let c=i?await o.interactiveTerminal(e,i,r.signal):await o.createInteractiveTerminal(e,D.cols,D.rows,r.signal,n?`${n}:${E}`:void 0);if(!I(r))return;if(!c.id||c.sessionId!==e||c.cwd!==t||i&&c.id!==i)throw Error(a(`inspectionChanged`));if(g=!1,p.current=c.id,s){let e={viewport:0,atBottom:!0,...n?s.terminals?.[n]:s.terminal,id:c.id};n?(s.terminals??={})[n]=e:s.terminal=e}l=c.exited,m=!c.exited,y=c.exited,D.options.disableStdin=c.exited,h(c.exited?`exited`:`ready`),b(c.exitCode),V(),c.exited||B(D.cols,D.rows),await o.streamInteractiveTerminal(e,c.id,_,r.signal,e=>{I(r)&&te(e)}),I(r)&&!l&&R(Error(a(`terminalDisconnected`)))}catch(e){I(r)&&R(e)}finally{w===r&&(g=!1)}},oe={reconnect:()=>{U()},suspend:L,scrollToBottom:()=>{c||(D.scrollToBottom(),D.focus())}};return O.current=oe,U(),()=>{c=!0,L(),O.current===oe&&(O.current=null),k.current===oe&&(k.current=null),ae?.disconnect(),ne.dispose(),re.dispose(),ie.dispose(),x.catch(()=>void 0),D.dispose(),p.current=null}},[o,t,E,e,a,s,n]);let L=async r=>{let i=O.current;if(!i||k.current)return;k.current=i,N(!0),F(null),h(`restarting`),v(null),i.suspend();let c=p.current;try{if(c&&await o.closeInteractiveTerminal(e,c),O.current!==i)return;if(p.current=null,s)if(n){let e=s.terminals?.[n]?.title;(s.terminals??={})[n]={viewport:0,atBottom:!0,title:e}}else s.terminal=void 0;r&&(f.current={sessionId:e,cwd:t,generation:E+1}),j(!1),D(e=>e+1)}catch(e){if(O.current===i){let t=e instanceof Error?e.message:a(`terminalError`);v(t),F(t),h(`error`),k.current=null,N(!1)}}};return(0,K.jsxs)(`section`,{className:`interactive-terminal`,"aria-label":a(`terminal`),children:[(0,K.jsxs)(`header`,{className:`interactive-terminal-status`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`terminal-status-dot ${m}`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`terminal-cwd`,title:t,children:l}),m===`ready`&&(0,K.jsx)(`span`,{className:`terminal-connection-state`,children:a(`connected`)})]}),(0,K.jsxs)(`div`,{className:`interactive-terminal-actions`,children:[m===`error`&&(0,K.jsxs)(`button`,{type:`button`,"aria-label":a(`reconnectTerminal`),title:a(`reconnectTerminal`),className:`terminal-reconnect-action`,disabled:M,onClick:()=>O.current?.reconnect(),children:[(0,K.jsx)(dt,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:a(`reconnectTerminal`)})]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":a(`restartTerminal`),title:a(`restartTerminal`),disabled:M||m===`connecting`||m===`reconnecting`,onClick:()=>{F(null),j(!0)},children:(0,K.jsx)(ft,{"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{className:`interactive-terminal-notice`,"aria-live":`polite`,children:[g?(0,K.jsx)(`span`,{className:`error`,children:g}):m===`exited`?(0,K.jsx)(`span`,{children:y===null?a(`terminalExited`):a(`terminalExitCode`,{code:y})}):m===`connecting`?(0,K.jsx)(`span`,{children:a(`terminalConnecting`)}):m===`reconnecting`?(0,K.jsx)(`span`,{children:a(`terminalReconnecting`)}):m===`restarting`?(0,K.jsx)(`span`,{children:a(`terminalRestarting`)}):null,C&&(0,K.jsx)(`span`,{className:`terminal-output-resynced`,children:a(`terminalOutputResynced`)})]}),(0,K.jsxs)(`div`,{className:`interactive-terminal-viewport`,children:[(0,K.jsx)(`div`,{ref:d,className:`interactive-terminal-host`}),x&&(0,K.jsxs)(`button`,{type:`button`,className:`terminal-scroll-bottom`,onClick:()=>O.current?.scrollToBottom(),children:[(0,K.jsx)(w,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:a(`terminalScrollToBottom`)})]})]}),(0,K.jsx)($j,{isOpen:A,purpose:`form`,width:430,"aria-label":a(`restartTerminalTitle`),onOpenChange:e=>{!e&&!k.current&&j(!1)},children:(0,K.jsxs)(`form`,{className:`openpi-dialog`,"aria-busy":M,onSubmit:e=>{e.preventDefault(),L(e.currentTarget.contains(document.activeElement))},children:[(0,K.jsx)(`strong`,{children:a(`restartTerminalTitle`)}),(0,K.jsx)(`p`,{children:a(`restartTerminalDetail`)}),P&&(0,K.jsx)(`p`,{className:`terminal-restart-error`,role:`alert`,children:P}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>{k.current||j(!1)},children:a(`cancel`)}),(0,K.jsx)(`button`,{type:`submit`,className:`danger`,disabled:M,children:a(M?`terminalRestarting`:`restartTerminal`)})]})]})},`${e}:${t}`)]})}function Rq(e){return e.startsWith(`terminal:`)?`terminal`:e}function zq(e){return e===`launcher`?{tabs:[],active:null,launcherOpen:!0,activationHistory:[]}:{tabs:[e],active:e,launcherOpen:!1,activationHistory:[e]}}function Bq(e,t){return t===`launcher`?{...e,launcherOpen:!0}:{tabs:e.tabs.includes(t)?e.tabs:[...e.tabs,t],active:t,launcherOpen:!1,activationHistory:[...e.activationHistory.filter(e=>e!==t),t]}}function Vq(e,t){return e.tabs.includes(t)?Bq(e,t):e}function Hq(e,t){if(!e.tabs.includes(t))return e;let n=e.tabs.filter(e=>e!==t),r=e.activationHistory.filter(e=>e!==t);if(e.active!==t)return{...e,tabs:n,activationHistory:r};let i=r.at(-1),a=e.tabs.indexOf(t),o=n[Math.min(a,n.length-1)],s=i??o??null;return{tabs:n,active:s,launcherOpen:e.launcherOpen||s===null,activationHistory:r}}function Uq(e){return{...e,launcherOpen:e.active===null}}var Wq=[{kind:`side-conversation`,icon:qe,title:`sideConversation`,description:`sideConversationDescription`},{kind:`review`,icon:ye,title:`changeEvidence`,description:`workbarChangesDescription`},{kind:`terminal`,icon:Tt,title:`terminal`,description:`workbarTerminalDescription`},{kind:`browser`,icon:me,title:`browser`,description:`workbarBrowserDescription`},{kind:`files`,icon:G,title:`files`,description:`workbarFilesDescription`}];function Gq({onSelect:e}){let{t}=cr();return(0,K.jsx)(`section`,{className:`workbar-launcher`,"aria-label":t(`openTools`),children:(0,K.jsx)(`div`,{className:`workbar-launcher-list`,children:Wq.map(n=>{let r=n.icon;return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>e(n.kind),children:[(0,K.jsx)(r,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:t(n.title)}),(0,K.jsx)(`small`,{children:t(n.description)})]}),(0,K.jsx)(ee,{"aria-hidden":`true`})]},n.kind)})})})}function Kq({sessionId:e,cwd:t,snapshot:n,activity:r}){let{t:i}=cr(),a=(0,_.useMemo)(()=>new rf,[]),o=wk(),[s,c]=(0,_.useState)(o?.sideConversation?.selectedId??null),[l,u]=(0,_.useState)(o?.sideConversation?.drafts??{});(0,_.useLayoutEffect)(()=>{o&&(o.sideConversation={selectedId:s,drafts:l})},[o,s,l]);let d=l[s??``]??``,f=(0,_.useRef)(0),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1),b=(0,_.useRef)(!1),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(0),[E,D]=(0,_.useState)(null),O=(0,_.useRef)(null);(0,_.useEffect)(()=>()=>O.current?.abort(),[]);let A=(r?.items??[]).filter(e=>e.origin===`btw`),j=A.find(e=>e.id===s),M=j?.status??E,N=p?.id===s?p:null,P=n?.models.find(e=>s?`${e.provider}/${e.id}`===N?.model:e.current),F=s?N?.model:P&&`${P.provider}/${P.id}`,I=P?.name||P?.id||F||i(`usageUnknown`),L=!s&&n?.thinking?.supported?n.thinking.level:void 0,R=N?.cwd??t,z=n?.workspaces.find(e=>e.path===R)?.name??QA(R),B=i(s?`continueSideConversation`:`startSideConversation`),V=i(v?`sideConversationPending`:s?`send`:`start`),H=e=>{f.current++,c(e),D(null),S(null),g(null)},te=async t=>{t.preventDefault();let n=d.trim();if(!n||b.current)return;b.current=!0,O.current?.abort();let r=new AbortController,o=f.current,l=s??``;O.current=r,y(!0),S(null);try{let t=await a.subagentAction(e,s?{kind:`subagents`,action:`send-btw`,id:s,text:n}:{kind:`subagents`,action:`spawn-btw`,prompt:n},r.signal);if(r.signal.aborted)return;if(t.sessionId!==e||s&&t.detail.id!==s)throw Error(i(`inspectionChanged`));if(u(e=>e[l]===d?{...e,[l]:``}:e),o!==f.current)return;c(t.detail.id),D(t.detail.status),w(e=>e+1)}catch(e){!r.signal.aborted&&o===f.current&&S(e instanceof Error?e.message:i(`inspectionUnavailable`))}finally{r.signal.aborted||(b.current=!1,y(!1))}},ne=async()=>{if(!s||b.current)return;b.current=!0,O.current?.abort();let t=new AbortController,n=f.current;O.current=t,y(!0),S(null);try{let r=await a.subagentAction(e,{kind:`subagents`,action:`cancel-btw`,id:s},t.signal);if(t.signal.aborted||n!==f.current)return;if(r.sessionId!==e||r.detail.id!==s)throw Error(i(`inspectionChanged`));D(r.detail.status),w(e=>e+1)}catch(e){!t.signal.aborted&&n===f.current&&S(e instanceof Error?e.message:i(`inspectionUnavailable`))}finally{t.signal.aborted||(b.current=!1,y(!1))}};return(0,K.jsxs)(`div`,{className:`side-conversation-body`,children:[s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`workbar-back`,onClick:()=>H(null),children:[(0,K.jsx)(T,{"aria-hidden":`true`}),` `,i(`backToSideConversations`)]}),(0,K.jsx)(JI,{sessionId:e,id:s,activity:j,client:a,liveAvailable:!0,refreshRevision:C,fullView:!1,readOnlyNote:!1,onDetail:e=>m({id:e.id,cwd:e.cwd,model:e.model})},`${e}:${s}`)]}):(0,K.jsxs)(`div`,{className:`side-conversation-list`,"data-empty":A.length===0,children:[(0,K.jsxs)(`div`,{className:`side-conversation-intro`,children:[(0,K.jsx)(qe,{"aria-hidden":`true`}),(0,K.jsx)(`h3`,{children:i(`sideConversation`)}),(0,K.jsx)(`p`,{children:i(`sideConversationDescription`)})]}),A.length>0&&(0,K.jsx)(`ul`,{children:A.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>H(e.id),children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:e.title||e.id}),(0,K.jsx)(`small`,{children:i(`subagentState_${e.status}`)})]}),(0,K.jsx)(ee,{"aria-hidden":`true`})]})},e.id))})]}),x&&(0,K.jsx)(`p`,{className:`workbar-error`,role:`alert`,children:x}),(0,K.jsx)(`div`,{className:`composer-dock`,children:(0,K.jsxs)(`form`,{className:`composer composer-m02 side-conversation-composer`,onSubmit:te,"aria-busy":v,children:[(0,K.jsx)(`textarea`,{rows:1,value:d,disabled:v,"aria-label":B,placeholder:B,onChange:e=>{let t=e.currentTarget.value;u(e=>({...e,[s??``]:t}))},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.defaultPrevented&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,K.jsxs)(`div`,{className:`composer-toolbar`,children:[(0,K.jsxs)(`div`,{className:`composer-toolbar-context`,children:[(0,K.jsx)(`button`,{type:`button`,className:`composer-context-trigger icon-button`,"aria-label":i(`addContext`),title:i(`fileReference`),disabled:v,onClick:()=>g({key:s??``,generation:f.current}),children:(0,K.jsx)(lt,{"aria-hidden":`true`})}),(0,K.jsxs)(`span`,{className:`composer-workspace-label`,title:R,children:[(0,K.jsx)(De,{"aria-hidden":`true`}),` `,z]})]}),(0,K.jsxs)(`div`,{className:`composer-toolbar-controls`,children:[(0,K.jsx)(`div`,{className:`model-picker-wrap`,children:(0,K.jsx)($M,{className:`model-selector model-picker`,label:`${i(`model`)}: ${I}`,isLabelHidden:!0,value:F??``,triggerLabel:(0,K.jsxs)(`span`,{className:`model-thinking-label`,title:F||I,children:[(0,K.jsx)(`span`,{className:`model-picker-label`,children:I}),L&&(0,K.jsx)(`span`,{className:`model-picker-thinking`,children:L[0].toUpperCase()+L.slice(1)})]}),variant:`ghost`,size:`sm`,placement:`above`,alignment:`end`,isDisabled:!F,children:()=>(0,K.jsxs)(`div`,{className:`side-conversation-model-details`,children:[(0,K.jsx)(`strong`,{children:I}),(0,K.jsx)(`code`,{children:F}),(0,K.jsx)(`p`,{children:i(s?`sideConversationModelFixed`:`sideConversationModelInherited`)})]})},s??`new`)}),s&&M===`running`&&(0,K.jsx)(`button`,{type:`button`,className:`send-button`,"aria-label":i(`stop`),title:i(`stop`),disabled:v,onClick:()=>void ne(),children:(0,K.jsx)(Et,{"aria-hidden":`true`})}),(!s||M!==`running`||!!d.trim())&&(0,K.jsx)(`button`,{type:`submit`,className:`send-button`,disabled:v||!d.trim(),"aria-label":V,title:V,children:(0,K.jsx)(k,{"aria-hidden":`true`})})]})]})]})}),(0,K.jsx)(JM,{open:h!==null,sessionId:e,onClose:()=>g(null),onInsert:e=>{if(!h||h.generation!==f.current||h.key!==(s??``)||b.current)return i(`fileReferenceDraftChanged`);let t=h.key;u(n=>({...n,[t]:`${n[t]??``}${n[t]?` -`:``}${YM(e)}`}))}})]})}function qq({sessionId:e,cwd:t,activity:n,tabId:r,active:i,onConnectionChange:a}){let{t:o}=cr(),s=n?.items??[];return(0,K.jsxs)(`div`,{className:`terminal-workspace`,children:[(0,K.jsx)(Lq,{sessionId:e,cwd:t,tabId:r,active:i,onConnectionChange:a}),s.length>0&&(0,K.jsxs)(`details`,{className:`terminal-agent-activity`,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(Tt,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:o(`backgroundTerminalActivity`)}),(0,K.jsx)(`small`,{children:s.length}),(0,K.jsx)(ee,{"aria-hidden":`true`})]}),(0,K.jsx)(`ul`,{children:s.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:e.title||e.id}),(0,K.jsx)(`small`,{children:o(`execution_${e.status}`,{defaultValue:e.status})})]})},e.id))})]})]})}function Jq({visible:e,requestedTool:t,requestRevision:n,sessionId:r,sessionPath:i,cwd:a,snapshot:o,capabilities:s,review:c,reviewInitialFilePath:l,reviewTurn:u,onWorkspaceReview:d,conversationCollapsed:f,onRestoreConversation:p,onExpandReview:m,onClose:h,onActiveToolChange:g,canControl:v=!0,onActivateSession:y,readingState:b,onReferenceLine:x,onBrowserReady:S}){let{t:C}=cr(),w=(0,_.useRef)({}),E=b??w.current;E.terminal&&!E.terminals?.terminal&&((E.terminals??={}).terminal=E.terminal,E.terminal=void 0);let[D,O]=(0,_.useState)(()=>E?.tabs?E.requestRevision===n?E.tabs:Bq(E.tabs,t):zq(t)),k=JSON.stringify([r,i]),A=(0,_.useRef)(new Map),j=(0,_.useRef)(null),M=(0,_.useRef)(null),N=(0,_.useRef)(null),P=(0,_.useMemo)(()=>new rf,[]),[F,I]=(0,_.useState)({}),[L,R]=(0,_.useState)([]),ee=(0,_.useRef)(new Set),z=(0,_.useRef)(0);(0,_.useEffect)(()=>()=>{z.current++},[]);let[B,V]=(0,_.useState)(null),[H,te]=(0,_.useState)(null),[ne,re]=(0,_.useState)(``),[ie,ae]=(0,_.useState)(()=>Object.fromEntries(Object.entries(E.terminals??{}).flatMap(([e,t])=>t.title?[[e,t.title]]:[]))),U=e=>ie[e]??(e===`terminal`?C(`terminal`):`${C(`terminal`)} ${D.tabs.filter(e=>Rq(e)===`terminal`).indexOf(e)+1}`);(0,_.useLayoutEffect)(()=>{let t=N.current;if(N.current=null,!t||t.scope!==k||!e||(t.tool?D.launcherOpen||D.active!==t.tool:!D.launcherOpen))return;let n=requestAnimationFrame(()=>{let e=t.tool?A.current.get(t.tool):j.current;!e?.isConnected||e.closest(`[hidden], [inert]`)||document.activeElement!==document.body&&!e.closest(`.workbar-panel`)?.contains(document.activeElement)&&!document.getElementById(j.current?.getAttribute(`aria-controls`)??``)?.contains(document.activeElement)||e.focus({preventScroll:!0})});return()=>cancelAnimationFrame(n)},[D,k,e]);let oe=e&&!D.launcherOpen&&D.active===`browser`&&v,[se,ce]=(0,_.useState)(null);(0,_.useLayoutEffect)(()=>{oe?ce(k):(!e||!v||!D.tabs.includes(`browser`)||se!==k)&&ce(null)},[oe,k,e,v,D,se]),(0,_.useLayoutEffect)(()=>{E&&(E.tabs=D,E.requestRevision=n)},[E,D,n]);let le=Oz(r,i,a,u?.promptEntryId),ue=(0,_.useRef)(n);(0,_.useEffect)(()=>(g?.(e?D.launcherOpen?`launcher`:D.active?Rq(D.active):null:null),()=>g?.(null)),[e,D.launcherOpen,D.active,g]),(0,_.useEffect)(()=>{ue.current!==n&&(ue.current=n,O(e=>Bq(e,t)))},[n,t]);let de=e=>{let t=e===`terminal`&&D.tabs.some(e=>Rq(e)===`terminal`)?`terminal:${crypto.randomUUID()}`:e;if(t!==`launcher`&&(N.current={tool:t,scope:k}),t.startsWith(`terminal:`)){let e=Math.max(1,...Object.values(ie).map(e=>Number(e.match(/\s(\d+)$/u)?.[1])||0))+1,n=`${C(`terminal`)} ${e}`;ae(e=>({...e,[t]:n})),(E.terminals??={})[t]={viewport:0,atBottom:!0,title:n}}O(e=>Bq(e,t))},fe=async(e,t)=>{let n=z.current,i=t.contains(document.activeElement);if(Rq(e)===`terminal`&&v){if(ee.current.has(e)||F[e]?.pending)return;let t=F[e]?.id??E.terminals?.[e]?.id;if(t){ee.current.add(e),R(t=>[...t,e]),V(null);try{await P.closeInteractiveTerminal(r,t)}catch(e){n===z.current&&V(e instanceof Error?e.message:C(`terminalError`));return}finally{n===z.current&&(ee.current.delete(e),R(t=>t.filter(t=>t!==e)))}if(n!==z.current)return}}Rq(e)===`terminal`&&E.terminals&&delete E.terminals[e],O(n=>{let r=Hq(n,e);return(t.contains(document.activeElement)||i&&document.activeElement===document.body)&&(N.current={tool:r.launcherOpen?null:r.active,scope:k}),r})},pe=D.active?Rq(D.active):null,me=D.launcherOpen?`openTools`:Wq.find(e=>e.kind===pe)?.title??`openTools`;return Ki({isActive:e,onDismiss:()=>{D.launcherOpen&&D.active?(N.current={tool:D.active,scope:k},O(Uq)):h()},getContainer:()=>M.current,isPresent:()=>M.current?.contains(document.activeElement)??!1}),(0,K.jsx)(Ck.Provider,{value:E,children:(0,K.jsx)(Ti,{children:(0,K.jsxs)(`aside`,{ref:M,className:`workbar-panel`,hidden:!e,"aria-label":C(me??`openTools`),children:[(0,K.jsxs)(`header`,{className:`workbar-tabbar`,children:[(0,K.jsxs)(`div`,{className:`workbar-tabs`,role:`toolbar`,"aria-label":C(`openTools`),children:[D.tabs.length===0&&(0,K.jsxs)(`span`,{className:`workbar-tab-placeholder`,children:[(0,K.jsx)(lt,{"aria-hidden":`true`}),` `,C(`openTools`)]}),D.tabs.map(e=>{let t=Rq(e),n=Wq.find(e=>e.kind===t),r=n.icon,i=!D.launcherOpen&&D.active===e,a=t===`terminal`?U(e):C(n.title),o=()=>{t===`terminal`&&(re(a),te(e))};return(0,K.jsxs)(`div`,{className:`workbar-tab`,"data-active":i||void 0,children:[(0,K.jsxs)(`button`,{type:`button`,ref:t=>{t?A.current.set(e,t):A.current.delete(e)},"aria-pressed":i,title:t===`terminal`?`${a} · ${C(`renameTerminal`)}`:a,onDoubleClick:o,onContextMenu:e=>{t===`terminal`&&(e.preventDefault(),o())},onKeyDown:e=>{t===`terminal`&&e.key===`F2`&&(e.preventDefault(),o())},onClick:()=>O(t=>Vq(t,e)),children:[(0,K.jsx)(r,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:a})]}),(0,K.jsx)(`button`,{type:`button`,className:`workbar-tab-close`,"aria-label":t===`terminal`&&v?C(`workbarEndTerminal`,{name:a}):`${C(`close`)} ${a}`,title:t===`terminal`&&v?C(`workbarEndTerminal`,{name:a}):`${C(`close`)} ${a}`,disabled:t===`terminal`&&v&&(L.includes(e)||F[e]?.pending!==!1),onClick:t=>void fe(e,t.currentTarget),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]},e)})]}),(0,K.jsxs)(`div`,{className:`workbar-tabbar-actions`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`workbar-back-to-chat`,onClick:()=>{f?p():h(),requestAnimationFrame(()=>document.querySelector(`.composer textarea`)?.focus({preventScroll:!0}))},children:[(0,K.jsx)(T,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:C(`workbarBackToChat`)})]}),!f&&D.active===`review`&&m&&(0,K.jsx)(`button`,{type:`button`,className:`icon-button review-expand`,"aria-label":C(`gitReviewExpand`),title:C(`gitReviewExpand`),onClick:m,children:(0,K.jsx)(nt,{"aria-hidden":`true`,style:{transform:`rotate(180deg)`}})}),D.active?(0,K.jsx)(jA,{className:`workbar-tool-picker`,button:{ref:j,className:`icon-button workbar-add-tab`,icon:(0,K.jsx)(lt,{"aria-hidden":`true`}),label:C(`openTools`),isIconOnly:!0,variant:`ghost`,"aria-label":C(`openTools`),tooltip:C(`openTools`)},onOpenChange:e=>{e||(N.current??={tool:D.active,scope:k},O(Uq))},items:Wq.map(e=>({id:e.kind,icon:(0,K.jsx)(e.icon,{"aria-hidden":`true`}),label:C(e.kind===`terminal`?`workbarNewTerminal`:e.title),description:C(e.description),onClick:()=>de(e.kind)})),menuWidth:`min(300px, calc(100vw - 24px))`,alignment:`end`,hasChevron:!1}):(0,K.jsx)(`button`,{type:`button`,ref:j,className:`icon-button workbar-add-tab`,"aria-label":C(`openTools`),title:C(`openTools`),"aria-pressed":D.launcherOpen,onClick:()=>O(e=>Bq(e,`launcher`)),children:(0,K.jsx)(lt,{"aria-hidden":`true`})}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":C(`workbarCollapseTools`),title:C(`workbarCollapseTools`),onClick:h,children:(0,K.jsx)(rt,{"aria-hidden":`true`})})]})]}),B&&(0,K.jsx)(`p`,{className:`error`,role:`alert`,children:B}),(0,K.jsxs)(`div`,{className:`workbar-panels`,children:[(0,K.jsx)(`div`,{className:`workbar-tool-panel`,hidden:!D.launcherOpen,children:(0,K.jsx)(Gq,{onSelect:de})}),D.tabs.map(t=>{let n=Rq(t);return(0,K.jsx)(`div`,{className:`workbar-tool-panel`,"data-tool":n,"data-tab":t,hidden:D.launcherOpen||D.active!==t,inert:D.launcherOpen||D.active!==t||!e,children:n===`terminal`&&e&&v?(0,K.jsx)(qq,{sessionId:r,cwd:a,tabId:t,active:!D.launcherOpen&&D.active===t,onConnectionChange:e=>I(n=>({...n,[t]:e})),activity:s[`background-terminals`]}):n===`browser`&&e&&v&&(oe||se===k)?(0,K.jsx)(Mz,{onReady:S},k):e&&!D.launcherOpen&&D.active===t?!v&&[`side-conversation`,`terminal`,`browser`].includes(n)?(0,K.jsxs)(`div`,{className:`workbar-empty`,children:[(0,K.jsx)(`p`,{children:C(`toolsRequireCurrentSession`)}),y&&(0,K.jsx)(`button`,{type:`button`,className:`secondary`,onClick:y,children:C(`activateViewedSession`)})]}):n===`side-conversation`?(0,K.jsx)(Kq,{sessionId:r,cwd:a,snapshot:o,activity:s.subagents}):n===`review`?(0,K.jsx)(Dz,{review:u?{...le,setSource:e=>{c.setSource?.(e),d?.()}}:c,initialFilePath:u?.filePath??l,readingScope:u?`turn:${u.promptEntryId}:${u.revision}`:`workspace:${c.source??`unstaged`}`,onOpenFiles:()=>de(`files`),onReferenceLine:v?x:void 0,onClose:()=>O(e=>Hq(e,`review`)),embedded:!0},u?`${u.promptEntryId}:${u.revision}`:c.source??`workspace`):(0,K.jsx)(ZR,{sessionId:r,sessionPath:i,cwd:a,active:!0,canWrite:v},JSON.stringify([r,i,a])):null},t)})]}),(0,K.jsx)($j,{isOpen:H!==null,purpose:`form`,"aria-label":C(`renameTerminal`),onOpenChange:e=>{e||te(null)},children:(0,K.jsxs)(`form`,{className:`openpi-dialog`,onSubmit:e=>{e.preventDefault();let t=ne.trim();if(!H||!t)return;ae(e=>({...e,[H]:t}));let n=(E.terminals??={})[H];E.terminals[H]={...n??{viewport:0,atBottom:!0},title:t},te(null)},children:[(0,K.jsx)(`strong`,{children:C(`renameTerminal`)}),(0,K.jsx)(`input`,{"aria-label":C(`terminalName`),value:ne,maxLength:80,onChange:e=>re(e.target.value)}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>te(null),children:C(`cancel`)}),(0,K.jsx)(`button`,{type:`submit`,disabled:!ne.trim(),children:C(`save`)})]})]})})]})})})}var Yq=`openpi:workbar-positions:v1`;function Xq(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Zq(e,t=4096){return typeof e==`string`&&e.length<=t?e:``}function Qq(e,t=0,n=0,r=5e7){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function $q(e,t=100){return Array.isArray(e)?e.slice(0,t).filter(e=>typeof e==`string`&&e.length<=4096):[]}function eJ(e){return WR(Zq(e),window.location.origin)}function tJ(e){return typeof e==`string`&&([`files`,`review`,`browser`,`terminal`,`side-conversation`].includes(e)||/^terminal:[a-zA-Z0-9-]{1,128}$/u.test(e))}function nJ(e){return typeof e==`string`&&[`launcher`,`files`,`review`,`browser`,`terminal`,`side-conversation`].includes(e)}function rJ(e){let t={};if(!Xq(e))return t;if(Xq(e.tabs)){let n=Array.isArray(e.tabs.tabs)?[...new Set(e.tabs.tabs.filter(tJ))].slice(0,16):[],r=tJ(e.tabs.active)&&n.includes(e.tabs.active)?e.tabs.active:null;t.tabs={tabs:n,active:r,launcherOpen:e.tabs.launcherOpen===!0||r===null,activationHistory:Array.isArray(e.tabs.activationHistory)?[...new Set(e.tabs.activationHistory.filter(tJ).filter(e=>n.includes(e)))].slice(-16):[]},t.requestRevision=Qq(e.requestRevision)}if(Xq(e.files)&&(t.files={selected:Zq(e.files.selected),treeVisible:e.files.treeVisible!==!1,query:Zq(e.files.query,200),expanded:$q(e.files.expanded),treeScroll:Qq(e.files.treeScroll)}),Xq(e.artifact)){t.artifact={reference:Zq(e.artifact.reference),source:e.artifact.source===!0,editing:!1,scroll:Qq(e.artifact.scroll)};let n=e.artifact.document;Xq(n)&&typeof n.revision==`string`&&/^[a-f0-9]{64}$/u.test(n.revision)&&(t.artifact.document={path:Zq(n.path),revision:n.revision,page:Math.floor(Qq(n.page,1,1,1e5)),...typeof n.scale==`number`?{scale:Qq(n.scale,1,.1,8)}:{}})}let n=e.review;Xq(n)&&(n.source===`unstaged`||n.source===`staged`||n.source===`branch`||n.source===`session`)&&(t.review={scope:Zq(n.scope),source:n.source,...typeof n.baseRef==`string`?{baseRef:Zq(n.baseRef,1024)}:{},selected:typeof n.selected==`string`?Zq(n.selected):null,query:Zq(n.query,200),collapsedDirectories:$q(n.collapsedDirectories),visibleFiles:Qq(n.visibleFiles,50,0,200),listScroll:Qq(n.listScroll),previewScroll:Qq(n.previewScroll)},Xq(n.viewed)&&typeof n.viewed.revision==`string`&&(t.review.viewed={revision:Zq(n.viewed.revision,128),paths:$q(n.viewed.paths,200)}));let r=e.browser;if(Xq(r)&&Array.isArray(r.tabs)){let e=new Set,n=r.tabs.flatMap(t=>{if(!Xq(t)||!Number.isSafeInteger(t.id)||typeof t.id!=`number`||t.id<0||t.id>5e7||e.has(t.id))return[];e.add(t.id);let n=eJ(t.initialUrl);return[{id:t.id,title:Zq(t.title,200),...n?{initialUrl:n}:{}}]}).slice(0,8),i={};for(let e of n){let t=Xq(r.pages)?r.pages[e.id]:void 0;if(!Xq(t))continue;let n=$q(t.history,32).flatMap(e=>eJ(e)??[]);i[e.id]={draft:eJ(t.draft)??``,history:n,index:n.length?Math.min(Math.floor(Qq(t.index)),n.length-1):-1}}t.browser={tabs:n,selected:n.some(e=>e.id===r.selected)?Number(r.selected):n[0]?.id??0,pages:i}}if(Xq(e.terminals)){t.terminals={};for(let[n,r]of Object.entries(e.terminals).slice(0,16))!tJ(n)||n!==`terminal`&&!n.startsWith(`terminal:`)||!t.tabs?.tabs.includes(n)||!Xq(r)||(t.terminals[n]={...typeof r.id==`string`?{id:Zq(r.id,128)}:{},...typeof r.title==`string`?{title:Zq(r.title,80)}:{},viewport:Qq(r.viewport),atBottom:r.atBottom!==!1})}return Xq(e.terminal)&&typeof e.terminal.id==`string`&&(t.terminal={id:Zq(e.terminal.id,128),viewport:Qq(e.terminal.viewport),atBottom:e.terminal.atBottom!==!1}),Xq(e.sideConversation)&&(t.sideConversation={selectedId:typeof e.sideConversation.selectedId==`string`?Zq(e.sideConversation.selectedId,128):null,drafts:{}}),t}function iJ(e){if(!Xq(e)||!Zq(e.sessionId,128)||!Zq(e.sessionPath)||!nJ(e.tool))return null;let t={sessionId:Zq(e.sessionId,128),sessionPath:Zq(e.sessionPath),tool:e.tool,open:e.open===!0,requestRevision:Qq(e.requestRevision),reading:rJ(e.reading)};return Xq(e.reviewTurn)&&Zq(e.reviewTurn.promptEntryId,512)&&(t.reviewTurn={promptEntryId:Zq(e.reviewTurn.promptEntryId,512),revision:Qq(e.reviewTurn.revision),...typeof e.reviewTurn.filePath==`string`?{filePath:Zq(e.reviewTurn.filePath)}:{}}),t}function aJ(){try{let e=localStorage.getItem(Yq);if(!e||e.length>256e3)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];let n=new Map;for(let e of t.slice(-32)){let t=iJ(e);t&&n.set(JSON.stringify([t.sessionId,t.sessionPath]),t)}return[...n.values()]}catch{return[]}}function oJ(e){try{let t=e.slice(-32).flatMap(e=>iJ(e)??[]),n=JSON.stringify(t);for(;n.length>256e3&&t.length;)t.shift(),n=JSON.stringify(t);localStorage.setItem(Yq,n)}catch{}}function sJ(e,t,n){if([`session_start`,`session_switched`,`session_created`].includes(t))return e.length===0?e:[];if([`agent_settled`,`turn_settled`].includes(t))return e.some(e=>e.state===`running`)?e.map(e=>e.state===`running`?{...e,state:`unknown`}:e):e;if(!t.startsWith(`tool_execution_`))return e;let r=n.toolCallId;if(typeof r!=`string`||r.length>500)return e;let i=e.find(e=>e.call.id===r);if(i&&i.state!==`running`&&(i.state!==`unknown`||t!==`tool_execution_end`))return e;let a=Pd(n.call),o=a.type===`toolCall`&&typeof a.name==`string`&&typeof a.arguments==`string`?a:i?.call;if(!o||o.evidenceTruncated&&o.id?.includes(`[truncated]`))return e;let s=Pd(n.result),c=typeof s.content==`string`?s:i?.result,l=typeof n.parentToolCallId==`string`&&n.parentToolCallId.length<=500?n.parentToolCallId:i?.parentToolCallId,u={call:o,result:c,...l?{parentToolCallId:l}:{},state:t===`tool_execution_end`?n.isError===!0?`failed`:`returned`:`running`},d=(i?e.map(e=>e.call.id===r?u:e):[...e,u]).slice(-32);for(;d.length>0&&new TextEncoder().encode(JSON.stringify(d)).byteLength>524288;)d.shift();return d}var cJ={en:{translation:{promptPending:`Processing your request…`,commandFeedbackTruncated:`This is a limited command preview. Narrow the query or run it in the TUI for the full output.`,planMode_inactive:`Normal mode`,planMode_planning:`Planning · writes blocked`,planMode_ready:`Plan ready · awaiting review`,planMode_invalid:`Plan state invalid · writes blocked`,planModeEnter:`Plan`,promptPlanMessage:`This conversation uses Plan mode · discuss the plan; no implementation yet`,planModeUnconfirmed:`Could not confirm Plan mode. Refresh before continuing.`,planModeExit:`Exit planning`,planModeImplement:`Prepare implementation prompt`,planImplementationReplaceDraft:`Preparing this plan will replace the current draft and turn off Plan mode. The prompt will not be sent. Continue?`,commandSupport_plan:`Planning and same-session implementation prompts are available. Starting a fresh implementation session still requires the TUI.`,commandSupport_setup:`Configuration uses the active model; questions are answered in Web.`,handoffWaiting:`Manual action`,handoffDone:`Done`,handoffUnable:`Unable to complete`,handoffDoneHelp:`I performed the action. The agent still needs to verify it.`,handoffUnableHelp:`I could not finish. I can add a note about the blocker.`,handoffReview:`Review status`,handoffSubmit:`Submit status`,handoffSignal:`Expected result:`,handoffVerify:`Reporting Done lets the agent continue and verify; it is not proof of success.`,planCardLabel:`Development plan`,planCardReady:`Plan ready`,planCardResult:`Plan result`,planCardNotApproval:`This step produced a plan. It did not approve or start implementation.`,planCardCollapse:`Collapse`,planCardExpand:`Expand`,planCardCopy:`Copy plan`,planCardCopyPreview:`Copy visible preview`,planCardTruncated:`Only a bounded preview is displayed.`,planCardLoadFull:`Load full plan`,planCardLoadingFull:`Loading plan...`,planCardLoadFailed:`Could not load the full plan. Retry`,planCardEvidence:`Tool result · plan_ready`,questionWaiting:`Question`,questionPreview:`View preview`,questionSkip:`Skip`,questionProgress:`{{current}} of {{total}}`,questionReview:`Review answers`,questionReviewTitle:`Ready to send?`,questionReviewHelp:`Review your choices. Nothing is sent until you submit.`,questionEdit:`Edit answer: {{question}}`,questionDismiss:`Dismiss questions without answering`,questionCustom:`Or write your own reply`,questionCustomHelp:`Or leave it blank to ask for a clearer question.`,questionYourAnswer:`Your answer`,questionCustomPlaceholder:`Describe what you have in mind…`,questionNotes:`Additional context (optional)`,questionNotesPlaceholder:`Add a constraint or clarify your choice…`,questionRephrase:`Ask for a clearer or smaller question`,questionBack:`Back`,questionNext:`Next question`,questionSubmit:`Submit answers`,questionSubmitting:`Sending…`,questionRetry:`Check submission`,questionUncertain:`We could not confirm delivery. Your submitted answers are kept here. Check submission to recover the result without sending them twice.`,questionDisconnected:`Reconnecting… Your choices stay here; submitting is paused.`,questionLimit:`Keep each answer or note within {{count}} UTF-8 bytes.`,questionLoadFailed:`Could not check for questions awaiting your answer.`,questionDraftLimit:`Question drafts are full. Shorten or clear an existing answer before adding more text.`,questionRetryLoad:`Try again`,questionCloseReceipt:`Close question status`,questionState_dismissed:`Questions dismissed. No answers were submitted.`,questionState_cancelled:`Questions cancelled. No answers were submitted.`,questionState_expired:`Questions expired. No answers were submitted.`,questionState_stale:`This request is no longer active. Check the conversation for its result.`,conversationView:`Conversation view`,jumpToLatest:`Jump to latest`,historyLoading:`Loading history…`,historyOmitted:`{{count}} earlier entries · Scroll up to load automatically`,historyChanged:`The Session branch changed. History has been reset to the current branch.`,historyUnavailable:`Could not load history. Please retry.`,historyValidationUnavailable:`Could not verify the conversation history. Please retry.`,historyVerifying:`Checking conversation history…`,messageLoadFull:`Load full message`,messageLoadMore:`Load more`,messageLoadingFull:`Loading message…`,messageLoadFailed:`Could not load this message. Retry`,filePreview:`File preview`,changeEvidence:`Changes`,changeEvidenceScope:`Read-only Git snapshot of changes since this session started.`,turnLabel:`Turn {{number}}`,turnState_running:`Running`,turnState_complete:`Completed`,turnState_failed:`Failed`,turnState_interrupted:`Interrupted`,turnState_waiting:`Waiting for response`,turnState_forked:`Forked · Ready to continue`,turnChanges_one:`{{count}} file changed during this turn`,turnChanges_other:`{{count}} files changed during this turn`,turnChangesPartial:`At least {{count}} files changed during this turn`,turnChangesIncomplete:`This turn's change record is incomplete.`,turnChangesMore:`Show {{count}} more files`,turnChangesLess:`Show fewer files`,turnChangesReview:`Review turn changes`,turnChangesReviewButton:`Review`,turnChangesBack:`Back to turn changes`,turnChangesLoading:`Loading this turn's changes…`,turnChangesUnavailable:`This turn's saved diff is unavailable.`,messageCopyRequiresFull:`Load the full message before copying.`,filesChanged_one:`{{count}} file changed`,filesChanged_other:`{{count}} files changed`,reviewChanges:`Review changes`,workspaceChanges:`Workspace changes`,overviewChanges:`Changes`,overviewLineTotals:`Text lines added and removed across the current Git comparison`,overviewPartialTotals:`Known line counts only; some files could not be counted. Open Changes for details.`,overviewCounting:`Counting…`,overviewCountsUnknown:`Counts unavailable`,overviewReviewUnavailable:`Unavailable`,sessionSources:`Sources`,sourcesAdd:`Add source`,sourcesEmpty:`No sources yet`,sourcesFailed:`Could not load sources.`,sourcesViewAll:`View all`,sourcesLoadMore:`Load more sources`,sourcesBack:`Back to sources`,sourcesPartial:`This list has reached its display limit. Earlier sources remain in the conversation.`,turnChangesScope:`Saved workspace changes during this turn`,turnEdits_one:`Edited {{count}} file`,turnEdits_other:`Edited {{count}} files`,turnEditsPartial:`Recorded edits to {{count}} files`,turnEditsScope:`This turn's recorded file-tool writes · saved; shell and external edits are not included`,turnEditStatsUnknown:`Line counts unavailable`,turnEditReason_before_unavailable:`The write completed, but previous contents were not authorized for reading. A before/after diff is unavailable.`,turnEditReason_content_limit:`The write completed. Content exceeds the saved comparison limit, so exact line counts are unavailable.`,turnEditReason_concurrent_change:`The file changed between recorded operations. A reliable net diff for this turn is unavailable.`,gitReviewLoadedCount:`{{count}} files loaded`,gitReviewPartialLabel:`Partial`,gitReviewSearch:`Search file paths`,gitReviewExpand:`Expand review`,gitReviewSearchLoaded:`Search loaded files`,gitReviewMarkViewed:`Mark {{path}} as viewed`,gitReviewMarkCurrentViewed:`Mark current file {{path}} as viewed`,gitReviewViewedLabel:`Viewed`,gitReviewViewedProgress:`Viewed {{viewed}} / {{loaded}} loaded files`,gitReviewViewedLimit:`Up to {{count}} viewed marks are remembered for this comparison.`,gitReviewNoMatch:`No matching files.`,gitReviewNoLoadedMatch:`No matches in the loaded files.`,gitReviewLoadNext:`Load the next files`,gitReviewChanged:`The workspace changed. Refresh the list before loading more.`,gitReviewNewVersion:`New changes are available. You are reading the previous version.`,gitReviewShowLatest:`Show latest diff`,gitReviewBinary:`No text diff is available for this binary file.`,gitReviewBinaryShort:`Binary`,gitReviewPendingStats:`Not loaded`,gitReviewComparison:`{{current}} compared with {{base}}`,gitReviewWorkingTree:`Working tree compared with HEAD`,gitReviewSessionSnapshot:`Changes since this session started`,gitReviewDetached:`Detached HEAD`,gitReviewLoading:`Reading Git changes…`,gitReviewRetry:`Retry`,gitReviewRefresh:`Refresh changes`,gitReviewOlderResult:`Showing the previous result.`,gitReviewNotRepository:`This workspace is not a Git repository.`,gitReviewUnborn:`This repository has no readable HEAD yet.`,gitReviewFailed:`Git changes could not be read.`,gitReviewTruncated:`The change snapshot reached its file or diff size limit.`,gitReviewEmpty:`No changes in this comparison.`,gitReviewHiddenLines:`{{count}} more diff lines hidden.`,gitReviewDiffTruncated:`This file's diff was not loaded because the snapshot reached its size limit.`,gitReviewShowMore:`Show {{count}} more files`,gitReviewBackToFiles:`Back to changed files`,gitReviewFilePreview:`Diff for {{file}}`,gitReviewNoDiff:`No text diff is available for this file.`,changeDiff:`Change diff`,diffView:`Diff`,gitFileStatus_added:`Added`,gitFileStatus_modified:`Modified`,gitFileStatus_deleted:`Deleted`,gitFileStatus_renamed:`Renamed`,gitFileStatus_copied:`Copied`,gitFileStatus_untracked:`Untracked`,gitFileStatus_unknown:`Changed`,closePreview:`Close preview`,artifactReadOnly:`Read-only`,artifactReferenceUnavailable:`File preview is unavailable in this view: {{path}}`,artifactSession:`Session {{sessionId}}`,copyFilePath:`Copy file path`,filePathCopied:`File path copied`,refreshFile:`Refresh file`,downloadFile:`Download file`,downloadingFile:`Downloading…`,artifactOlderPreview:`Showing an older preview. `,readingFile:`Reading file…`,artifactVersion:`Version`,artifactBytes:`{{count}} bytes`,artifactPreviewTruncated:`Preview truncated. Download the file for the complete content.`,artifactUnsupported:`This file type cannot be previewed. Use Download.`,chatView:`Chat`,trajectory:`Trajectory`,trajectoryScope:`Recorded Session messages in order, not execution durations or the complete model request.`,trajectoryRunning:`Work is active. This view updates as saved records arrive; in-flight text is available in Chat.`,trajectoryTruncated:`Loaded history is partial: {{entries}} entries omitted, {{parts}} parts omitted, {{messages}} messages truncated.`,trajectoryEmpty:`No saved records yet.`,trajectoryOrder:`Record order`,trajectoryRecordCount:`{{count}} records`,trajectoryMatches:`{{count}} matches`,trajectorySearch:`Search loaded records`,trajectoryNoMatches:`No matching records.`,trajectoryEarlierGroup:`Earlier context`,trajectoryEventCount:`{{count}} Session changes`,trajectorySummary:`Overview`,trajectoryInputTab:`Input`,trajectoryResultTab:`Result`,trajectoryConversationGroup:`Conversation`,trajectoryReasoningTitle:`Thinking`,trajectoryRecordNumber:`Record {{number}}`,trajectoryRecordInfo:`Record information`,trajectoryRecordId:`Record ID`,trajectoryCallId:`Tool call ID`,trajectoryEventType:`Event type`,trajectoryEvent_model_change:`Model changed`,trajectoryEvent_thinking_level_change:`Thinking level changed`,trajectoryEvent_compaction:`Context compacted`,trajectoryEvent_session_info:`Session information updated`,trajectoryEvent_custom:`Session record`,trajectoryEarlier:`Show earlier records ({{count}} remaining in loaded history)`,trajectoryDetails:`Record details`,trajectoryRecordedAt:`Record timestamp`,trajectoryEvidenceTruncated:`This evidence was truncated in the Session projection.`,trajectoryArguments:`Tool arguments`,trajectoryRecordedContent:`Recorded content`,trajectoryThinking:`Recorded model reasoning`,trajectoryOutput:`Tool result`,trajectoryMissingResult:`No unambiguous result is included in the loaded records. This does not imply the tool is still running.`,trajectoryStructured:`Structured result`,trajectoryEventOnly:`Only this event’s type and timestamp are available.`,trajectory_user:`User message`,trajectory_assistant:`Assistant`,trajectory_call:`Tool call`,trajectory_result:`Unpaired result`,trajectory_event:`Session event`,trajectory_returned:`Tool returned a result.`,trajectory_error:`Tool returned an error`,trajectory_unknown:`Outcome not established`,runtimeStatus:`Runtime status`,refreshStatus:`Refresh status`,terminalDetails:`Terminal details`,openTools:`Open tools`,sideConversation:`Side conversation`,sideConversationDescription:`Ask a focused question in a separate Pi session without interrupting the main task.`,workbarChangesDescription:`Inspect the current Git branch and working tree.`,terminal:`Terminal`,renameTerminal:`Rename terminal`,terminalName:`Terminal name`,workbarTerminalDescription:`Open an interactive shell for the current workspace.`,backgroundTerminalActivity:`Agent command activity`,restartTerminal:`Restart terminal`,reconnectTerminal:`Reconnect terminal`,restartTerminalTitle:`Restart this terminal?`,restartTerminalDetail:`The current terminal will be closed. Running processes may be interrupted.`,terminalReconnecting:`Reconnecting terminal...`,terminalScrollToBottom:`Scroll to bottom`,terminalOutputResynced:`Terminal output resynchronized.`,terminalRestarting:`Restarting terminal...`,terminalConnecting:`Starting terminal…`,terminalExited:`Terminal exited.`,terminalExitCode:`Terminal exited with code {{code}}.`,terminalDisconnected:`Terminal connection ended unexpectedly.`,terminalError:`Terminal unavailable.`,browser:`Browser`,sessionFileRecords:`Session file records`,gitReviewSource:`Changes`,gitReviewBaseBranch:`Compare against branch`,gitReviewChooseBase:`Choose comparison branch`,gitReviewSearchBranches:`Search branches`,gitReviewLocalBranch:`Local branch`,gitReviewRemoteBranch:`Remote branch`,gitReviewBranchesTruncated:`Showing a bounded list of branches. Some branches are omitted.`,gitReviewNoMatchingBranches:`No matching branches.`,gitReviewBaseUnavailable:`No default comparison branch is available. Choose a branch to review committed changes.`,gitReviewBaseInvalid:`The selected comparison branch is unavailable. Choose another branch.`,gitReviewUnstaged:`Unstaged changes`,gitReviewStaged:`Staged changes`,gitReviewBranch:`Branch changes`,gitReviewFileMissing:`This file no longer has changes in this view. Refresh the file list.`,artifactExternalAccess:`This file is in another working directory. You can authorize read-only access to this file for this session; other files remain inaccessible.`,artifactAuthorizeFile:`Open this file read-only`,sideConversationPending:`Preparing side conversation…`,resizeSidebar:`Resize sidebar`,resizePanes:`Resize panes`,resizeWorkbar:`Resize workbar`,browserPasteTooLarge:`Paste at most {{count}} characters at a time.`,browserInputTooLarge:`Enter at most {{count}} characters at a time.`,browserInputTargetChanged:`The input target changed or could not be confirmed. An input operation was not executed.`,workbarBrowserDescription:`Open and interact with a page inside the OpenPI workbar.`,browserReady:`Enter an address to start browsing`,browserStarting:`Starting the embedded browser…`,browserOpened:`Opened in the embedded browser`,browserOpenAgain:`Open again`,browserOpenFailed:`The embedded browser is unavailable.`,browserBack:`Back`,browserForward:`Forward`,browserReload:`Reload`,browserTabs:`Browser tabs`,browserNewTab:`New tab`,browserAddTab:`New browser tab`,browserCloseTab:`Close {{title}}`,browserTabLimit:`Up to {{count}} browser tabs`,browserPageTitle:`Web page: {{address}}`,browserEnteredAddress:`Last address opened from this toolbar`,browserAddressNotAllowed:`Enter an HTTP(S) address without embedded credentials, outside this application's origin.`,browserLocationUnknown:`This page navigated. Its new address is unavailable. Reload returns to the address you entered.`,browserDirectDescription:`Browse pages directly. Sites that refuse embedding can be opened in your external browser.`,browserDirectHint:`The address records toolbar navigation only. Page popups open in your external browser. Blank page? Use Open in external browser.`,browserEnhancedHint:`Browser enhancement is on: addresses sync and ordinary popup links open in these tabs. Some site policies, login popups and cross-site history still require an external browser.`,files:`Files`,filesExplorer:`Workspace files`,filesSearch:`Filter files…`,refreshFiles:`Refresh files`,filesWorkspaceActions:`Workspace file actions`,filesCreateMenu:`New`,filesImportMenu:`Import`,filesMoreMenu:`More`,filesNewFile:`New file`,filesNewDirectory:`New folder`,filesImport:`Import files`,filesImportFolder:`Import folder`,filesImportFolderChoose:`Choose a folder to import`,filesImportFolderLimit:`Import up to 2,000 files and folders at a time, with at most 64 nested levels.`,filesSelectMultiple:`Select multiple files`,filesSelectItem:`Select {{name}}`,filesSelectedCount:`{{count}} selected`,filesRename:`Rename`,filesNewName:`New name`,filesMove:`Move`,filesMoveDestination:`Destination folder (workspace relative path)`,filesTrashAction:`Move to trash`,filesTrash:`Workspace trash`,filesTrashDetail:`Removed files stay in this workspace and can be restored. Existing names are preserved.`,filesTrashEmpty:`No removed files`,filesTrashUnavailable:`{{count}} entries could not be verified. Their contents remain in .openpi-trash; automatic restore is unavailable.`,filesRestore:`Restore`,filesRestoreItem:`Restore {{name}}`,filesUndoTrash:`Undo removal`,filesOrganizationResults:`File operation results`,filesOperationDone:`Done`,filesRefreshBeforeOrganizing:`Refresh the file tree before organizing this item.`,filesImportChoose:`Choose files to import`,filesTargetDirectory:`Destination`,filesWorkspaceRoot:`Workspace root`,filesFileName:`File name`,filesDirectoryName:`Folder name`,filesCreate:`Create`,filesCreating:`Creating…`,filesCreated:`Created: {{path}}`,filesNameInvalid:`Enter one file or folder name without path separators.`,filesNameExists:`This name already exists. Choose a different name; the existing file was preserved.`,filesMutationFailed:`Could not write this file. Your input is preserved.`,filesWriteUnavailable:`Switch to this session to write workspace files.`,filesImportLimit:`Each file can be up to 50 MiB. Existing names are never overwritten.`,filesImportTooLarge:`This file exceeds the 50 MiB import limit.`,filesImportDirectoryUnsupported:`Folders cannot be imported. Choose the files inside the folder.`,filesImportResults:`File import results`,filesImportPending:`Waiting to import`,filesImporting:`Importing…`,filesImported:`Saved to the workspace`,filesImportedNoPreview:`Saved. Preview supports up to 20 MiB; copy the path to use this file in chat.`,filesClearImported:`Clear completed imports`,filesRetryImport:`Retry import`,filesPathActions:`Path actions for {{name}}`,filesCopyRelativePath:`Copy relative path`,filesCopyAbsolutePath:`Copy absolute path`,filesPathCopied:`Copied path: {{path}}`,filesReadFailed:`Unable to read files.`,filesSymlink:`Symbolic link — not followed by the file browser`,filesTruncated:`The result is incomplete. Refine your search.`,filesNoMatches:`No matching files`,filesEmpty:`This folder is empty`,filesChoose:`Choose a file to preview`,filesChooseDetail:`Browse your workspace on the right. Files open here, keeping the explorer in place.`,filesHideTree:`Hide file tree`,filesShowTree:`Show file tree`,filesPreview:`Preview`,filesSource:`View source`,filesEdit:`Edit`,filesMode:`File view`,filesEditor:`File editor`,filesSave:`Save file`,filesSaving:`Saving…`,filesSaved:`Saved`,filesUnsaved:`Unsaved changes · draft kept in this window`,filesDiscard:`Discard draft`,filesDiscardConfirm:`Discard your unsaved changes to this file?`,filesSaveConflict:`The file changed on disk. Your draft is preserved. Refresh to inspect the current version, then reconcile your changes before saving.`,filesSaveFailed:`Could not save. Your draft is preserved; check the file and retry.`,filesEditLoadFirst:`Continue reading the complete file before editing.`,filesEditUnavailable:`Editing supports workspace UTF-8 text files up to 1 MiB. At most 16 unsaved drafts can be kept.`,filesOutline:`Document outline`,filesDiskVersion:`Inspect current disk version`,filesReconcile:`Reviewed · continue editing my draft against this version`,filesTable:`Table preview`,filesRow:`Row`,filesSheets:`Worksheets`,filesTableTruncated:`Showing a bounded table preview. Download the file for all rows and columns.`,filesOfficeLayout:`Document content preview; pagination and typography may differ from Office.`,filesSlidesLayout:`Slide text and images; themes, charts and animations may differ from PowerPoint.`,filesPreviousPage:`Previous page`,filesNextPage:`Next page`,filesZoomOut:`Zoom out`,filesZoomIn:`Zoom in`,filesZoomReset:`Reset zoom`,filesPdfPage:`Page {{page}}`,filesDocumentLimit:`This document exceeds the preview limit. Download it to open locally.`,filesPreviewFailed:`Unable to preview this file. You can still download it.`,filesDiagram:`Mermaid diagram`,filesExpandDiagram:`Expand diagram`,filesFitImage:`Fit`,filesOriginalImage:`Original size`,filesLoadMore:`Load more`,filesLoaded:`{{count}} items loaded`,filesReadMore:`Continue reading`,filesContentChanged:`The file changed. Refresh when ready; your current reading position is preserved.`,workbarFilesDescription:`Browse workspace files with an inline preview and file tree.`,backToSideConversations:`Back to side conversations`,continueSideConversation:`Send a follow-up…`,startSideConversation:`Ask a side question…`,sideConversationModelInherited:`New side conversations use the main conversation’s model and thinking level.`,sideConversationModelFixed:`This is the model used by this side conversation.`,stop:`Stop`,start:`Start`,browserAddress:`Browser address`,browserGo:`Open address`,openExternalBrowser:`Open in external browser`,invalidBrowserAddress:`Enter a valid HTTP or HTTPS address.`,addImages:`Add images`,addFiles:`Add files`,fileAttachments:`File attachments`,previewFileAttachment:`Preview file`,fileAttachmentDescription:`Documents, spreadsheets, PDFs, text, code, and other files`,fileAttachmentCount:`Attach up to {{count}} items.`,fileAttachmentTooLarge:`Files must total 50 MB or less.`,fileAttachmentReadFailed:`Could not read this file. Check the format or whether it is password protected.`,fileAttachmentTextReady:`Text ready`,fileAttachmentTextTruncated:`Partial text · original retained`,fileAttachmentOriginalReady:`Original file ready`,fileAttachmentExtractionFailed:`Text unavailable · original retained`,fileAttachmentEncodingUnavailable:`The text encoding could not be read. The original bytes are preserved.`,fileAttachmentDocumentUnavailable:`Text could not be extracted. The document may be password protected or have an unsupported format. The original bytes are preserved.`,fileAttachmentNoText:`The original file will be attached for the agent to read with its tools. No text was extracted.`,fileAttachmentPreviewTruncated:`Preview shows the first 20,000 characters. The complete extracted text will be attached.`,fileAttachmentExtractedContent:`Extracted text`,fileAttachmentPromptLabel:`User-provided files:`,fileAttachmentPromptTooLong:`The message and file references exceed the input limit. Shorten the message or attach fewer files.`,imageAttachmentDescription:`PNG, JPEG, GIF, or WebP`,imageAttachments:`Image attachments`,imageAttachmentsLoading:`Preparing attachments…`,commandOpensPanel:`Open panel`,commandPanelArguments:`This command opens a panel and cannot include arguments or images. Remove them, or use the panel directly.`,commandPanelUnavailable:`The panel could not be opened. Your command is preserved.`,commandUnavailable_terminal_only:`Requires Pi's terminal interface.`,commandUnavailable_not_integrated:`This extension command is not connected to Web yet. Use it in Pi's terminal.`,artifactImagePreviewFailed:`Unable to preview this image. Refresh the file to retry, or download it.`,artifactFileDetails:`File details`,turnElapsedRunning:`Working for {{duration}}`,compactionElapsed:`Waiting {{duration}}`,compactionRunning:`Compacting context`,compactionCompleted:`Context automatically compacted`,compactionFailed:`Context compaction failed`,compactionInterrupted:`Compaction interrupted`,compactionUnchanged:`Compaction finished without a new summary`,compactionUnavailable:`Context compaction status unavailable`,compactionReconnectHelp:`Connection interrupted. The current status will be checked after reconnecting.`,compactionDraftHelp:`Compacting history. Messages you send will be queued.`,turnElapsedFinished:`Worked for {{duration}}`,composerAdd:`Add`,composerCommands:`Commands`,composerFile:`File`,composerGoal:`Goal`,composerPlan:`Plan`,composerCompact:`Compact`,composerModel:`Model`,composerBack:`Back`,composerGoalDescription:`Set or view a long-running goal`,composerPlanDescription:`Enter or leave Plan mode`,composerCompactDescription:`Summarize earlier conversation history`,composerModelDescription:`Select this Session's model`,compactionQueueWaiting:`Waiting for compaction to finish`,compactionQueueBlocked:`Messages retained. Retry when ready or clear the queue.`,clearPromptQueue:`Clear queue`,turnElapsedOutcome_cancelled:`Stopped`,turnElapsedOutcome_failed:`Failed`,turnElapsedOutcome_uncertain:`Outcome unconfirmed`,settingsSetupBusyHint:`Agent configuration is available after this turn. Display settings can be changed now.`,resetChatContentWidth:`Reset chat content width`,resetChatFontSize:`Reset chat font size`,setupResolveAdmission:`Return to the conversation to resolve the pending message before applying settings.`,removeAttachment:`Remove attachment`,dropImagesHere:`Drop files or images here`,imageAttachmentCount:`Attach up to {{count}} images.`,imageAttachmentTooLarge:`Each image must be 10 MB or smaller.`,imageAttachmentTotalTooLarge:`The attached images must total 32 MB or less.`,imageAttachmentUnsupported:`Only valid PNG, JPEG, GIF, and WebP images are supported.`,imageAttachmentReadFailed:`Could not read this image. Add it again to retry; your message is preserved.`,attachedImage:`Attached image`,previewAttachment:`Preview image`,closeImagePreview:`Close image preview`,imagePreviewFailed:`Unable to display this image.`,fitImage:`Fit image`,originalImageSize:`Original size`,imageViewMode:`Image view`,sessionUsage:`Session token usage`,sessionInputTokens:`Input tokens`,sessionOutputTokens:`Output tokens`,sessionCacheTokens:`Cached tokens`,sessionContextUsage:`Context usage and context window`,usageContextLabel:`Context`,usageUnknown:`Unknown`,usageOpenDetails:`Input {{input}} · Output {{output}} · Context {{percent}} / {{capacity}} · View token usage`,usageContextHelp:`Estimated tokens in the current branch / model context limit.`,usageSessionTotals:`Session totals`,usageInputLabel:`Input`,usageOutputLabel:`Output`,usageTotalLabel:`Total`,usageWorkspaceLabel:`Workspace`,usageSessionId:`Session ID`,usageTotalsHelp:`Session token totals include cache usage.`,subagentDetails:`Subagents`,sessionOverview:`Session overview`,sessionOverviewChanges:`Changes in the current review scope`,subagentSummaryRunning:`{{count}} running`,subagentSummaryDone:`{{count}} completed`,subagentSummaryOther:`{{count}} other`,subagentNoneYet:`No subagents yet`,subagentOtherGroup:`Failed / interrupted`,subagentShowMore:`Show {{count}} more`,backToSubagents:`Back to subagents`,subagentActiveGroup:`Active`,subagentFinishedGroup:`Completed`,subagentNoneRunning:`No subagents running.`,subagentNoneFinished:`Completed tasks will appear here.`,subagentProgress:`Subagents: {{running}} running · {{completed}} completed`,subagentSummaryUnknown:`{{count}} without confirmed status`,subagentTasks:`Subagent tasks`,inspectSubagent:`Open subagent: {{name}}`,subagentState_running:`Running`,subagentState_done:`Completed`,subagentState_error:`Failed`,subagentState_interrupted:`Interrupted`,subagentStarting:`Starting…`,subagentSpawnFailed:`Failed to start`,subagentStateUnavailable:`Started · state unavailable`,subagentSpawnReceipt:`Start receipt`,subagentSpawnReceiptHint:`This confirms the start request, not the subagent's final result.`,subagentTask:`Assigned task`,subagentTranscript:`Subagent conversation`,subagentResult:`Result`,subagentSaved:`Saved record`,subagentRecordedState:`Last recorded state`,subagentSavedHint:`From this parent session's saved receipts. A result may include other tasks from the same batch; this is not the child's full live conversation.`,subagentLive:`Working · updates automatically`,subagentReadOnly:`Read-only view · closing this panel does not stop the task`,subagentUnavailable:`Live details are no longer available for this subagent in the current session. The start receipt is not evidence of completion.`,subagentStale:`Could not refresh. The details below are the last received snapshot.`,subagentNoMessages:`No messages received yet.`,subagentTranscriptUnavailable:`This view retains a task summary and cannot show the full child conversation.`,subagentWorkflowsTruncated:`{{count}} workflows are outside the loaded list; their task counts are unknown.`,subagentState_unknown:`Unconfirmed`,subagentUnconfirmedGroup:`Unconfirmed`,subagentTruncated:`Showing a bounded excerpt; {{count}} earlier messages omitted. Some text may be shortened.`,subagentListTruncated:`{{count}} additional tasks are outside the loaded list.`,subagentThinkingRedacted:`Reasoning was redacted by the provider.`,subagentTool_running:`Running`,subagentTool_done:`Returned`,subagentTool_error:`Failed`,subagentTool_unknown:`Result not retained`,inspectionChanged:`The active session changed. Reopen this panel.`,inspectionUnavailable:`Details are unavailable.`,inspectionLoading:`Loading status…`,thinkingUnavailable:`Thinking state is unavailable.`,trustUnavailable:`Project trust status is unavailable.`,executionState:`State`,terminalCommand:`Command`,copyTerminalCommand:`Copy command`,copyVisibleOutput:`Copy visible {{stream}}`,copySetupCommand:`Copy setup command`,savedTrustDecision:`Saved decision`,activeSessionTrust:`Active Session trust`,trustDecision_trusted:`Trusted`,trustDecision_denied:`Denied`,trustDecision_undecided:`Undecided`,trustDecision_unknown:`Unknown`,trustActiveYes:`Trusted in this Session`,trustActiveNo:`Not trusted in this Session`,terminalDirectory:`Directory`,startedAt:`Started`,exitCode:`Exit code`,detailTruncated:`Some details are shortened to keep this view bounded.`,standardOutput:`Standard output`,standardError:`Standard error`,outputTruncated:`{{count}} bytes omitted from this output view.`,outputRecovery:`The runtime reports a retained log. This view shows only a bounded excerpt.`,modelAndThinking:`Model and reasoning`,selectedModel:`Current model`,thinkingLevel:`Thinking level`,availableThinking:`Available levels`,unknownState:`Unknown`,projectTrust:`Project trust`,trust_trusted:`This session trusts the workspace.`,trust_untrusted:`Trust for this workspace has been denied.`,trust_restricted:`Project resources are restricted pending a trust decision.`,trust_unknown:`Trust state is not available.`,trustRefreshNeeded:`The saved decision and active session differ. Refresh the session through Pi to apply it.`,providerAvailability:`Provider credentials`,settings:`Settings`,settingsNavigation:`Settings navigation`,generalSettings:`General`,configurationSettings:`Configuration`,configurationIntro:`Permissions, web access and model responses.`,configurationReadFailure:`Configuration could not be read safely. Fix the settings file, then refresh.`,configurationUserScope:`User configuration`,configurationSetupHint:`Response and search changes use OpenPI setup`,configurationApproval:`Approval policy`,configurationApprovalDetail:`Tool approvals follow the installed Pi extensions.`,configurationPiPermissions:`Pi extensions`,configurationSandbox:`Sandbox`,configurationSandboxDetail:`Tools run with the host process permissions.`,configurationSandboxUnavailable:`No OS sandbox`,configurationSearchDetail:`Let the current Session model search the web when supported.`,configurationSearchOff:`Do not offer native search to the current model.`,configurationSearchOn:`Offer native search when the current connection supports it.`,configurationVerbosity:`Output verbosity`,configurationVerbosityDetail:`Choose how much detail the model includes in its response.`,configurationResponsesUnavailable:`The current connection does not use a supported Responses API.`,configurationVerbosity_default:`Model default`,configurationVerbosity_low:`Low`,configurationVerbosity_medium:`Medium`,configurationVerbosity_high:`High`,configurationVerbosityHelp_low:`Prefer short answers with fewer details.`,configurationVerbosityHelp_medium:`Include useful explanation and a moderate amount of detail.`,configurationVerbosityHelp_high:`Include more complete explanation and detail.`,configurationVerbosityRequest:`Set only response_verbosity to {{value}}; preserve the other OpenPI settings.`,configurationSummary:`Reasoning summary`,configurationSummaryDetail:`Choose the summary requested from a supported reasoning model.`,configurationSummaryUnavailable:`The current connection does not support reasoning summaries.`,configurationSummary_default:`Model default`,configurationSummary_auto:`Auto`,configurationSummary_concise:`Concise`,configurationSummary_detailed:`Detailed`,configurationSummary_none:`Off`,configurationSummaryHelp_auto:`Let the model choose the summary length.`,configurationSummaryHelp_concise:`Request a brief reasoning summary.`,configurationSummaryHelp_detailed:`Request a more detailed reasoning summary.`,configurationSummaryHelp_none:`Do not request a summary. Keep the current reasoning effort.`,configurationSummaryRequest:`Set only response_reasoning_summary to {{value}}; preserve the other OpenPI settings.`,configurationModelFeatures:`Model features`,configurationReasoningLevels:`Available reasoning efforts`,configurationReasoningDetail:`Choose which supported levels appear in model controls. The current level stays visible; its value is unchanged.`,configurationReasoningCount:`{{count}} selected`,configurationDependencies:`Workspace dependencies`,configurationEnvironment:`Local environment`,configurationEnvironmentDetail:`Node.js, Python and other tools come from your environment. OpenPI does not install a bundled workspace runtime.`,configurationRuntimeStatus:`Runtime status`,browserSettings:`Browser`,webSearchSettings:`Web search`,webSearchCurrentModel:`Current Session model`,webSearchNativeDetail:`Use your current model provider's native search with the existing connection and credentials.`,webSearchSupported:`This connection supports native search. When enabled, the model decides when to search.`,webSearchUnsupported:`Native search is unsupported or unconfirmed for this connection. No search tool is provided and no other provider is used.`,webSearchNativeRequest:`Enable native web search using the current Session model and existing Pi credentials. Do not switch model, connection protocol, or search provider. Unsupported or unknown connections must receive no search tool.`,webSearchIntro:`Let your model search current sources and read the original pages.`,webSearchPackageDetail:`Optional search, page reading, and PDF extraction through a Pi package.`,webSearchDefaultOff:`Off by default. This optional extension follows the current Session model; it needs no separate search key or plugin installation.`,webSearchLoaded:`Package loaded in this Session`,webSearchNotLoaded:`Package not loaded in this Session`,webSearchSource:`Review plugin source`,webSearchProfile:`Search setup`,webSearchExa:`Exa — no API key required`,webSearchExisting:`Keep my existing search preferences`,webSearchProfileHint:`Exa uses search queries with direct page reading. Existing preferences stay untouched. Other search services can be configured after installation.`,webSearchEnable:`Enable web search…`,webSearchDisable:`Disable web search…`,webSearchConfigure:`Change search service…`,webSearchExaRequest:`Enable optional web search with Pi Web Access and Exa, which needs no API key. Let me review the installation confirmation, preserve other preferences, and do not reload automatically.`,webSearchExistingRequest:`Enable optional web search with Pi Web Access and keep my existing search preferences unchanged. Let me review the installation confirmation, preserve other preferences, and do not reload automatically.`,webSearchDisableRequest:`Disable native web search. Preserve other settings and Session history.`,webSearchProviderRequest:`Help me change the search service for my installed Pi Web Access plugin. Explain available services and permissions, preserve unrelated preferences, keep credentials with the search plugin, and do not reload automatically.`,browserSettingsIntro:`Let OpenPI read pages, click, type and take screenshots.`,browserControl:`Browser control`,browserControlHint:`Requests a setup change. Access changes after the configuration is saved.`,browserDefault:`Default browser`,browserDefaultHint:`Requests a setup change for the browser used when none is named.`,browserEmbedded:`OpenPI browser`,browserAllowedTitle:`Allowed browsers`,browserOffHint:`Your choices take effect when browser control is on.`,browserConnected:`Connected`,browserNeedsSetup:`Extension setup needed`,browserNotFound:`Browser not detected`,browserUpdateNeeded:`Extension update needed`,browserBlocked:`Not allowed`,browserDefaultBlocked:`Your default browser is not allowed. Allow it or choose another default.`,browserSetUp:`Set up`,browserManage:`Manage`,browserSetupNamed:`Set up {{browser}}`,browserManageNamed:`Manage {{browser}}`,browserAllowNamed:`Allow {{browser}}`,browserMore:`More browsers`,browserSpeakHint:`Say “Use Chrome to…” to choose a different browser for a request.`,browserGuideTitle:`Connect {{browser}}`,browserGuideEyebrow:`One step at a time`,browserConnectionTitle:`Connection`,browserCloseGuide:`Close browser setup`,browserConnectionReady:`Connected. Choose whether OpenPI may use this browser.`,browserEmbeddedDetail:`Pages open inside OpenPI. Some websites require a regular browser to sign in or display correctly.`,browserExternalDetail:`OpenPI can use existing tabs and signed-in pages in your connected {{browser}} profile. Keep an OpenPI tab open in that profile.`,browserManageExtension:`Manage extension`,browserAllowUse:`Allow OpenPI to use it`,browserMakeDefault:`Use as default`,browserInstallIn:`Install in`,browserInstallTitle:`Install OpenPI Browser Bridge`,browserSetupSteps:`Setup steps`,browserGuidePopout:`Keep this guide in a separate window`,browserGuideDetached:`Your guide is open in a separate window. Follow it alongside the browser settings.`,browserShowGuide:`Show guide`,browserGuideInline:`Return guide here`,browserGuideBlocked:`The guide window could not open. Allow pop-ups and try again, or follow the steps here.`,browserSafariSettings:`Safari → Settings`,browserSafariDeveloper:`Developer settings`,browserSafariTemporary:`Add Temporary Extension…`,browserSafariOpenHint:`Open Safari, then choose Safari → Settings. Keep this guide alongside it. Requires Safari 26 or later on macOS.`,browserSafariDeveloperTitle:`Show Safari’s developer settings`,browserSafariDeveloperHint:`In Settings → Advanced, turn on Show features for web developers. Then select the Developer tab.`,browserSafariLoadHint:`In Developer, click Add Temporary Extension and select the folder below. Enable OpenPI Browser Bridge and allow the websites you want to control, including the local OpenPI page. Temporary extensions need reloading after Safari quits.`,browserFirefoxThis:`This Firefox`,browserFirefoxTemporary:`Load Temporary Add-on…`,browserFirefoxDeveloperTitle:`Select This Firefox`,browserFirefoxDeveloperHint:`On about:debugging, choose This Firefox in the left sidebar. Firefox does not need a Developer mode switch.`,browserFirefoxLoadHint:`Click Load Temporary Add-on and select manifest.json in the folder below. This development installation lasts until Firefox restarts; a permanent installation requires a Mozilla-signed package.`,browserFirefoxDone:`Selected. Next`,browserStepCount:`Step {{step}} of {{total}}`,browserStepLabel:`Step {{step}}: {{label}}`,browserStepOpen:`Open page`,browserStepAdd:`Add extension`,browserStepConnect:`Connect`,browserOpenManagerTitle:`Open {{browser}} extensions`,browserOpenManagerHint:`Start here. We’ll open the right page for you.`,browserOpenManager:`Open {{browser}} extensions`,browserReopenManager:`Open extensions page again`,browserAlreadyInstalled:`Already installed? Connect`,browserDeveloperMode:`Developer mode`,browserDeveloperTitle:`Turn on Developer mode`,browserDeveloperHint:`In the extensions page you just opened, turn on the Developer mode switch.`,browserDeveloperDone:`It’s on. Next`,browserIllustration:`Illustration · In {{browser}}`,browserExtensions:`Extensions`,browserLoadUnpacked:`Load unpacked`,browserLoadHint:`Click Load unpacked in your browser, then select the folder below.`,browserFolderBundled:`Included with OpenPI`,browserOpenFolder:`Open folder`,browserFolderOpened:`Extension folder opened.`,browserPathCopied:`Path copied`,browserCopyFailed:`Couldn’t copy. Select the path above and copy it manually.`,browserChooseFolderMac:`In the folder picker, press ⌘ ⇧ G, paste this path and press Return, then click Select.`,browserChooseFolderOther:`In the folder picker, paste this path into the address bar and select the folder.`,browserInstalledConnect:`Added. Connect to OpenPI`,browserPreviousStep:`Back`,browserWaiting:`Waiting for OpenPI Browser Bridge… We’ll detect it automatically.`,browserInstallBrowserFirst:`Install {{browser}} first, or open this OpenPI address in your installed browser.`,browserConnectTitle:`Connect to OpenPI`,browserConnectHint:`Open OpenPI in {{browser}}. Use the profile where you installed the extension.`,browserOpenIn:`Open in {{browser}}`,browserAllowHint:`Once connected, you can allow OpenPI to use this browser. Installing the extension does not change your browser permissions.`,browserCheck:`Check connection`,browserNotConnectedYet:`No connection yet. Finish installation, refresh OpenPI in that browser and check again.`,browserHelp:`Setup help`,browserReloadHint:`Already installed? Reload OpenPI Browser Bridge in the extension manager and refresh OpenPI. Accept the browser’s permission prompt if shown.`,browserSupportedHint:`Chrome, Edge, Brave and Chromium 145+ support embedded and native pages. Safari 26+ on macOS and Firefox 128+ use the portable extension for native tabs; nested frames must be opened separately. Temporary Safari/Firefox installations need reloading after browser restart.`,browserCopyPath:`Copy extension folder path`,browserLoading:`Checking browser connections…`,browserSaved:`Saved. Browser permissions take effect immediately.`,browserSaving:`Saving…`,modelSettings:`Models`,skillsSettings:`Skills`,subagentsSettings:`Sub-agents`,pluginsSettings:`Plugins`,configureOpenPi:`Configure OpenPI`,setupRequestReviewAll:`review every OpenPI configuration area with me`,setupRequestSetTheme:`set only the OpenPI Web theme to {{value}} and preserve every other setting`,setupRequestSetChatWidth:`set only the OpenPI Web chat content width to {{value}}px and preserve every other setting`,setupRequestSetChatFontSize:`set only the OpenPI Web chat font size to {{value}}px and preserve every other setting`,setupRequestEnableExpandedThinking:`expand thinking blocks by default in OpenPI Web and preserve every other setting`,setupRequestDisableExpandedThinking:`collapse thinking blocks by default in OpenPI Web and preserve every other setting`,setupRequestSubagents:`review and configure Agent role models and workflow limits`,setupRequestFailed:`The OpenPI setup request was not accepted.`,setupRequestRunning:`Applying OpenPI settings…`,setupRequestAccepted:`Configuration request accepted.`,setupPlanBlocked:`Exit Plan mode before changing agent configuration. Display settings can be changed directly; exiting does not start implementation.`,setupPlanBusy:`Agent configuration requires an idle turn and leaving Plan mode. Display settings can be changed now.`,setupOutcome_pending:`Configuration request is awaiting a save receipt.`,toolCallArguments:`Tool arguments`,toolCallOutput:`Tool result`,setupOutcome_saved:`OpenPI configuration was saved and applied.`,setupOutcome_unchanged:`Configuration was saved; effective settings are unchanged.`,setupOutcome_failed:`The setup request failed. Review the error and current settings before retrying.`,setupOutcome_cancelled:`Setup was cancelled without a confirmed save.`,setupOutcome_unconfirmed:`No successful save was confirmed. Review current settings before retrying /openpi-setup.`,settingsUpdateFailed:`The Web preference could not be saved.`,settingsPreferencesSaved:`Display settings saved.`,settingsPreferencesSaveFailed:`Could not save display settings. Check configuration diagnostics and retry.`,settingsCatalogLoading:`Loading Pi resources…`,settingsCatalogFailed:`Could not load Pi settings resources.`,appearance:`Appearance`,settingsPersonal:`Personal`,settingsAgent:`Agent`,settingsIntegrations:`Integrations`,settingsArchivedChats:`Archived chats`,settingsSearch:`Search settings`,settingsClearSearch:`Clear search`,settingsNoResults:`No matching settings`,appearanceVisualStyle:`Visual style`,appearanceMode:`Mode`,appearanceTheme:`Theme`,appearanceAccent:`Accent color`,appearanceBackground:`Background`,appearanceForeground:`Foreground`,appearanceFont:`Font`,appearanceFont_codex:`Codex default`,appearanceFont_sans:`Sans serif`,appearanceFont_serif:`Serif`,appearanceFont_mono:`Monospace`,appearanceAccent0:`Default`,appearanceAccent1:`Blue`,appearanceAccent2:`Purple`,appearanceAccent3:`Pink`,appearanceAccent4:`Orange`,appearanceAccent5:`Green`,appearanceCustomAccent:`Custom accent color`,appearanceAdvanced:`Advanced`,appearanceReset:`Restore defaults`,appearanceResetAction:`Reset appearance`,appearanceImport:`Import theme`,appearanceCopy:`Copy theme`,appearanceCopied:`Theme copied`,appearanceCopyFailed:`Could not copy theme. Try again.`,appearanceThemeValue:`Theme data`,appearanceImportPlaceholder:`Paste an OpenPI theme…`,appearanceImportInvalid:`Enter valid OpenPI theme data.`,appearanceImportAction:`Import`,searchArchivedChats:`Search archived chats`,archiveProjectFilter:`Filter by project`,archiveAllProjects:`All projects`,archiveProjectGroup:`{{project}} · {{count}} archived chats`,archiveSort:`Sort archived chats`,archiveSortUpdated:`Last updated`,archiveSortCreated:`Date created`,restoreArchivedChat:`Restore {{title}}`,themeLight:`Light`,themeDark:`Dark`,themeMist:`Mist`,themeRose:`Rose`,themePine:`Pine`,themeSystem:`System`,conversationSettings:`Conversation`,expandThinkingByDefault:`Expand thinking by default`,chatContentWidth:`Chat content width`,chatFontSize:`Chat font size`,agentBehavior:`Agent behavior`,capabilityDiscovery:`Capability discovery`,capabilityDiscovery_explicit:`Explicit`,capabilityDiscovery_adaptive:`Adaptive`,workflowLimits:`Workflow limits`,workflowConcurrency:`Workflow concurrency`,workflowCalls:`Total calls`,agentSettingsSetupHint:`Agent changes are applied through /openpi-setup in the current session.`,setupRequestDiscovery:`Set capability discovery to {{mode}}. Preserve other settings.`,setupRequestLimits:`Set workflow concurrency to {{concurrency}} and total agent calls to {{calls}}. Preserve other settings.`,setupRequestEnableSuggestions:`Enable next-action suggestions. Help me choose a model if required; preserve other settings.`,setupRequestDisableSuggestions:`Disable next-action suggestions. Preserve other settings.`,setupRequestPostEdit:`Help me configure or disable the post-edit command. Show the current configuration and ask which command to use.`,configurePostEdit:`Configure post-edit command`,workflowLimitsValue:`{{concurrency}} concurrent · {{calls}} total calls`,nextActionSuggestions:`Next-action suggestions`,enabled:`Enabled`,disabled:`Disabled`,configured:`Configured`,postEditCommand:`Post-edit command`,resultDisplay:`Default result display`,subagentResults:`Subagent results`,bashOperations:`Bash operations`,fileMutations:`Write / Edit operations`,footer:`Footer`,terminalFooter:`Pi terminal footer`,terminalFooterStyle:`Terminal footer style`,terminalFooterHint:`Applies to Pi's command-line interface. An already open Pi interface updates when restarted or when setup is applied.`,detailDisplay_full:`Full`,detailDisplay_compact:`Compact`,sessionSettings:`Session`,currentModel:`Current`,useThisModel:`Use model`,model:`Model`,modelConnection:`Model connection`,provider:`Provider`,modelId:`Model ID`,providerStatusUnavailable:`This provider is not present in the bounded authentication snapshot.`,providerSettings:`Provider credentials`,providerSettingsIntro:`Inspect which Pi providers can authenticate the current Web session.`,openRuntimeDetails:`Open runtime details`,currentWorkspace:`Current workspace`,providerAuth_api_key:`API key`,providerAuth_oauth:`OAuth`,providerAuthUnknown:`Authentication method not reported`,authentication:`Authentication`,accessType:`Access`,providerAccessSubscription:`Subscription account`,providerAccessStandard:`Provider credentials`,configurationOwner:`Configuration owner`,providerLoading:`Loading provider status…`,providerLoadFailed:`Could not load provider status.`,providerReadOnly:`Managed by Pi`,selectProvider:`Select a provider`,gitReviewBaselineUnavailable:`No usable session baseline was retained (it may exceed the capture limit). Choose Unstaged, Staged or Branch to inspect Git changes, or open the session file records.`,modelsIntro:`Sign in with an account or add an API key. Your existing Pi connections are available here.`,accountLoginMethod:`Connection method`,accountLoginTab:`Account`,accountLoginChatGPT:`ChatGPT account`,accountLoginClaude:`Claude account`,accountLoginKeyTab:`API key`,accountLoginConfigured:`Account signed in`,accountLoginIntro:`Continue in your browser. No API key needed.`,accountLoginExisting:`Your account credential is saved in Pi.`,accountLoginStart:`Sign in`,accountLoginAgain:`Sign in again`,accountLoginUnsaved:`Save or discard your other changes before signing in.`,accountLoginStarting:`Preparing sign-in…`,accountLoginWaiting:`Waiting for authorization`,accountLoginChoose:`Choose how to sign in`,accountLoginCancelling:`Cancelling sign-in…`,accountLoginBrowser:`Continue in browser`,accountLoginDevice:`Use a device code`,accountLoginBrowserOption:`Sign in on this computer. Returns here automatically.`,accountLoginDeviceOption:`For remote servers or when browser sign-in is unavailable.`,accountLoginBrowserHelp:`Open the sign-in page and approve access. This page updates automatically.`,accountLoginDeviceHelp:`Open the authorization page and enter this code. Keep this page open.`,accountLoginOpen:`Open sign-in page`,accountLoginCopyCode:`Copy device code`,accountLoginPaste:`Authorization code or callback URL`,accountLoginContinue:`Continue`,accountLoginFallback:`Signed in but still waiting?`,accountLoginRemoteHelp:`If automatic return does not work, copy the final callback URL from your browser and paste it here.`,accountLoginCancel:`Cancel sign-in`,accountLogin_failed:`Sign-in failed. Try again or choose another method.`,accountLogin_expired:`Sign-in expired. Start again to get a new authorization link.`,accountLogin_cancelled:`Sign-in cancelled.`,accountLoginRequestFailed:`The request did not complete. Refresh status before retrying.`,accountLoginStatusUnknown:`Cannot check sign-in status. Your authorization may still be in progress.`,accountLoginRefreshRequired:`The credential was saved, but Pi could not update its model list. Reload Pi before using this connection.`,accountLogout:`Sign out`,accountLogoutRefreshRequired:`The saved credential was removed, but Pi could not update its model list. Reload Pi to refresh the status.`,accountLogoutTitle:`Sign out of {{provider}}?`,accountLogoutDetail:`Removes this provider’s saved credential from Pi on this machine. Other Pi sessions using it will also need to sign in again. Environment credentials are unchanged.`,providerInputTypes:`Input types`,providerInputText:`Text`,providerInputImage:`Images`,providerCustomTag:`Custom`,providerEdit:`Edit`,providerRemove:`Delete`,providerSave:`Save`,editProvider:`Edit {{provider}}`,removeProvider:`Delete {{provider}}`,providerAdd:`Add model provider`,providerAddMode:`How to add`,providerAddCatalog:`Third-party providers`,providerAddCustom:`Custom model API`,providerAccountHint:`Use an existing account to connect. Choose a provider and continue in your browser.`,providerCatalogHint:`Choose a provider from the built-in catalog and enter its API key.`,providerCustomHint:`Connect a gateway or self-hosted service using an OpenAI or Anthropic compatible API.`,providerKeyKeep:`Leave blank to keep the existing key`,providerKeyOptional:`Enter an API key, or leave blank to use environment authentication`,providerDisplayName:`Provider name`,providerCustomSettings:`Custom settings`,providerSaved:`Saved {{provider}}.`,modelDefaultTitle:`Default for new chats`,modelDefaultChoose:`Choose model`,modelDefaultBadge:`Default`,modelCurrentBadge:`In use`,modelDefaultNotSet:`Not set · Pi chooses when a new chat starts`,modelDefaultHint:`Choose the model for future chats. Existing chats keep their own model. This also updates Pi's default.`,modelDefaultReadFailed:`Could not read the default model.`,modelDefaultProjectOverride:`This workspace has a Pi override: {{model}}.`,modelDefaultSave:`Save default`,modelMakeDefault:`Also make this the default for new chats`,modelDefaultSaveFailed:`The default was not confirmed. Refresh status and try again.`,modelDefaultPartial:`The chat model changed, but saving the default was not confirmed. Refresh status before retrying.`,modelConnectionNextHint:`Choose a model from this connection to use in the current chat.`,modelConnectionSearch:`Search models…`,modelConnectionChooseProvider:`Choose a model from {{provider}}`,modelConnectionUse:`Use in this chat`,modelConnectionUseFailed:`The model change was not confirmed. Refresh the model list and try again.`,modelConnectionLoadFailed:`Could not load models.`,modelConnectionNoModels:`No selectable models yet. Check the connection or add a model definition.`,modelConnectionNoMatch:`No matching models.`,modelConnectionMore:`{{count}} more models. Search to narrow the list.`,providerModelsEmpty:`No models yet. Fetch available models or add one manually.`,providerModelsInherited:`Uses the provider’s built-in model catalog.`,providerModelsReadOnly:`This provider contains model settings that must be edited in Pi’s configuration file.`,providerModelId:`Model {{number}} ID`,providerModelName:`Model {{number}} name`,providerModelDetails:`Model details: {{model}}`,providerRemoveModel:`Remove model: {{model}}`,providerIdInvalid:`Use a unique provider ID with letters, numbers, hyphens, dots or underscores.`,providerNativeAuth:`This provider uses Pi’s native sign-in.`,providerConfigurationFailed:`Could not save. Check the fields and retry when the session is idle.`,providerProfileSavedKeyFailed:`The provider was saved, but its API key was not. Retry saving the key.`,providerReload:`Discard draft and reload`,providerCurrentRemoval:`Select another model before removing the model currently in use.`,providerRemoveDetail:`Remove this provider’s configuration and custom models? Credentials managed by Pi are kept.`,providerPickerIntro:`Select the models you want to add from this provider.`,providerPickerSelected:`{{count}} selected`,providerApiKey:`API key`,providerKeyPlaceholder:`Paste a key to add or replace it`,saveProviderKey:`Save API key`,savingSettings:`Saving…`,keepEditing:`Keep editing`,discardAndContinue:`Discard and continue`,unsavedSettingsTitle:`Discard unsaved changes?`,unsavedSettingsDetail:`Unsaved model and credential changes will be lost.`,unsavedCredentialTitle:`Discard the unsaved credential?`,unsavedCredentialDetail:`The new key has not been saved and will be cleared.`,modelSelectionBusy:`This session is busy. Model changes are unavailable.`,providerKeySaved:`Saved to Pi credentials. Existing keys are never displayed.`,providerSaveFailed:`Credential save did not complete. Wait until the session is idle, refresh status and retry. Some providers need additional authentication settings.`,providerWriteDetail:`Save API keys here directly to Pi. Keys never enter a model conversation. For OAuth or additional provider fields, use Pi's native login.`,editModelConfiguration:`Add or edit a custom model`,modelConfigurationDetail:`Set up a provider connection, then choose available models or add one manually. Saving does not send a model request.`,configuredModels:`Custom model configuration`,addModel:`Add a model`,modelConfig_provider:`Provider ID`,modelConfig_id:`Model ID`,modelConfig_name:`Display name`,modelConfig_baseUrl:`API base URL`,modelConfig_api:`API format`,modelConfig_contextWindow:`Context window`,modelConfig_maxTokens:`Max output tokens`,providerCapacityLabel:`{{field}} {{number}}`,providerModelOptions:`Model options`,providerModelInvalid:`Model {{number}}: use a unique model ID and positive token counts, such as 128K or 1M. Leave capacities blank to use defaults.`,modelConfig_reasoning:`Supports reasoning`,saveModelConfiguration:`Save model`,reloadModelConfiguration:`Discard draft and load latest`,retryModelConfiguration:`Retry loading`,discardModelDraftTitle:`Discard this model draft?`,discardModelDraftDetail:`The latest configuration will replace this unsaved draft.`,discardAndReload:`Discard and reload`,modelConfigurationUnsaved:`Unsaved changes`,modelConfigurationConflict:`Model configuration changed elsewhere. Your draft is unchanged.`,modelConfigurationLoadFailed:`Could not load model configuration. Your draft is unchanged.`,modelConfigurationSaved:`Saved to Pi models.json. Configure the provider API key to make this model available.`,modelConfigurationFailed:`Model save did not complete. Your draft is unchanged.`,setupConfigurationRequest:`Configuration request`,configureViaSetup:`Apply via OpenPI setup`,setupFormDetail:`Uses /openpi-setup. Follow progress and any required confirmation in the conversation; submission does not mean the configuration is saved.`,setupSkillsPlaceholder:`Describe the skill to add or configure, including its source or local path`,setupPluginsPlaceholder:`Describe the Pi package to configure, including its exact package name or local path`,enableSkillInvocation:`Allow model invocation`,disableSkillInvocation:`Require explicit invocation`,setupSkillInvocationRequest:`Configure this Pi skill: {{path}}. Set its native disable-model-invocation field to {{disabled}}. Preserve other content and explain when the change takes effect.`,setupRoleFormRequest:`Configure the OpenPI {{role}} role to use {{model}} and set workflow concurrency to {{concurrency}}. Inherit parent thinking, validate the selection and preserve unrelated configuration.`,providerReadOnlyDetail:`This page is read-only and never receives credential values. Configure provider authentication through Pi, then refresh this status.`,openProviderSettings:`Open provider settings`,credentialConfigured:`Configured`,credentialMissing:`Not configured`,authNotVerified:`Configured credentials do not guarantee a successful model request.`,configurationViaPi:`Read-only status. Manage model credentials and trust through Pi; manage OpenPI options with /openpi-setup.`,noSkillsFound:`No skills are loaded for this Session.`,addSkill:`Add skill`,addPlugin:`Add plugin`,searchResources:`Search by name or source`,filterResourceScope:`Resource scope`,allResourceScopes:`All scopes`,noMatchingResources:`No matching resources`,resourceBulkTooLarge:`Filter the list further before submitting a bulk request.`,resourceManagement:`Pi resources`,resourceSourceAuto:`Pi automatic discovery`,resourceSourceLocal:`Local resource`,resourcePackageSource:`Package, repository or local path`,resourcePackageSourcePlaceholder:`npm:package@version · git:owner/repo · /path/to/skill`,resourceInstallIntro:`Choose a source and scope. OpenPI setup will review and apply the request in the conversation.`,resourceInstallReview:`Review the exact source and permissions in the conversation. Submitting this request does not mean it is installed or loaded.`,resourceRequestSubmitted:`Request submitted. Follow progress and confirmations in the conversation, then refresh this catalog.`,browseSkills:`Browse skills.sh`,resourceSessionState:`Apply to this Session`,resourcesReloadNote:`Refresh reads the catalog. Reload applies saved resources to this idle Session; changes are never reloaded automatically.`,reloadResources:`Reload resources`,resourceReloadReview:`Apply saved Pi skill and plugin configuration and restart extensions in the current Session? Wait for running work to finish first.`,resourceReloaded:`Resources reloaded. Review the refreshed catalog and diagnostics.`,resourceReloadFailed:`Could not reload resources. Wait for this Session to become idle and refresh before retrying.`,advancedResourceConfiguration:`Advanced configuration`,resourceDiagnostics:`Pi reports {{extensionErrors}} extension diagnostics and {{skillErrors}} skill diagnostics.`,resourceConfigurationDiagnostics:`{{count}} settings files could not be read. Review Pi configuration diagnostics.`,resourceCatalogTruncated:`This catalog is bounded; some resources are omitted.`,resourceTargetTruncated:`This source or path is truncated. Confirm the full target through Advanced configuration before making changes.`,updateResource:`Review update`,removeResource:`Review removal`,skillsEmptyTitle:`Add your first skill`,skillsEmptyIntro:`Skills give Pi reusable instructions. Add a package, repository or local skill; project skills follow Pi project trust.`,pluginsEmptyTitle:`Extend Pi with a plugin`,pluginsEmptyIntro:`Packages can include extensions, skills, prompts and themes. Add a source to review its installation through OpenPI setup.`,pluginCount:`{{count}} plugin sources`,installedVersion:`Installed version`,configuredVersion:`Configured version`,resourceVersionUnpinned:`Not pinned / local source`,pluginState_loaded:`Session resources loaded`,pluginState_installed:`Installed · not loaded`,pluginState_disabled:`Disabled in configuration`,pluginState_missing:`Package missing`,pluginState_error:`Load diagnostics`,pluginState_notLoaded:`Not loaded`,pluginLoadedResources:`{{count}} resources in this Session's catalog. Configuration changes require an explicit reload.`,pluginAction_enable:`Review enable`,pluginAction_disable:`Review disable`,pluginAction_update:`Review update`,pluginAction_remove:`Review removal`,enableVisibleSkills:`Allow model use ({{count}} shown)`,disableVisibleSkills:`Explicit use only ({{count}} shown)`,enableVisiblePlugins:`Enable {{count}} shown packages`,disableVisiblePlugins:`Disable {{count}} shown packages`,setupResourceInstallRequest:`Add these Pi {{kind}} from source {{source}} in scope {{scope}}. Inspect the source and resolve a fixed package identity, review required installation permissions with me using ask_user, then use Pi's native package/skill configuration. For a skill request, preserve unrelated extensions and other resources. Preserve existing preferences and project trust; do not reload this Session automatically. Report saved configuration and any remaining action separately. Do not change unrelated OpenPI settings.`,setupPluginOperationRequest:`Review Pi package action {{action}} for exactly configured source {{source}}, native root {{path}}, scope {{scope}}. Resolve relative sources against the native scope's settings directory. Use Pi's native package management. For updates, inspect available versions and review a fixed target identity and required permissions with me using ask_user before installing. Preserve resource filters and all unrelated preferences; if a toggle would destroy filters, stop and explain. Removal must not delete a local source directory. Do not reload automatically. Report persisted and active states separately; do not change unrelated OpenPI settings.`,setupSkillManageRequest:`Review Pi skill action {{action}} for exactly file {{path}}, source {{source}}, scope {{scope}}. Inspect native ownership first. Review the update/removal and required permissions with me using ask_user. Preserve unrelated skills and package resources; do not remove an entire shared package to remove one skill. Preserve project trust and do not reload automatically. Do not change unrelated OpenPI settings.`,setupSkillsBulkRequest:`For exactly these currently displayed Pi skill files {{paths}}, set native disable-model-invocation to {{disabled}}. Inspect ownership, preserve all other content and preferences, review necessary changes with me, and report any files that cannot be changed safely. Explicit /skill invocation remains available. Do not reload automatically or change unrelated OpenPI settings.`,setupPluginsBulkRequest:`For exactly these currently displayed Pi packages {{packages}}, set disabled to {{disabled}} through native Pi configuration. Preserve all other preferences and resource filters; skip and report entries whose filters cannot be preserved. Respect scope and project trust, review necessary changes with me, and do not reload automatically or change unrelated OpenPI settings.`,resourceRequestFinished:`The setup turn has ended. Refresh and inspect Pi's configuration and Session resources to confirm what changed.`,skillCount_one:`{{count}} skill`,skillCount_other:`{{count}} skills`,skill:`Skill`,copySkillInvocation:`Copy invocation`,source:`Source`,scope:`Scope`,invocation:`Invocation`,modelInvocation:`Model invocation`,resourceScope_user:`Global`,resourceScope_project:`Project`,resourceScope_temporary:`Temporary`,explicitOnly:`Explicit invocation only`,availableToModel:`Available to the model`,skillFile:`Skill file`,selectSkill:`Select a skill`,subagentConfiguration:`Pi-native subagent roles`,subagentConfigurationIntro:`Role models inherit from the parent unless OpenPI setup assigns an available model.`,subagentActiveCount_one:`{{count}} active`,subagentActiveCount_other:`{{count}} active`,subagentCompletedCount_one:`{{count}} recorded`,subagentCompletedCount_other:`{{count}} recorded`,subagentConcurrency:`Limit {{count}}`,builtInRoles:`Built-in roles`,subagentRole_explorer:`Explorer`,subagentRole_implementer:`Implementer`,subagentRole_reviewer:`Reviewer`,subagentRole_advisor:`Advisor`,subagentRoleShort_explorer:`Read-only investigation`,subagentRoleShort_implementer:`Focused implementation`,subagentRoleShort_reviewer:`Correctness review`,subagentRoleShort_advisor:`Technical analysis`,subagentRoleDescription_explorer:`Explores the codebase and reports evidence without modifying files.`,subagentRoleDescription_implementer:`Implements a bounded change and runs the relevant repository checks.`,subagentRoleDescription_reviewer:`Reviews correctness, safety, regressions, and missing validation.`,subagentRoleDescription_advisor:`Analyzes difficult technical questions and recommends a concrete next step.`,configureRoles:`Configure roles`,builtInRole:`Built-in role`,builtIn:`Built-in`,modelAssignment:`Model assignment`,inheritParentModel:`Inherit parent model`,effectiveModel:`Effective model`,workflowConcurrencyLabel:`Concurrent agents`,workflowCallLimit:`Total agent calls`,runtimeBoundaries:`Runtime boundaries`,subagentAuthorityNote:`Child authority is the fail-closed intersection of the parent Session and role capabilities.`,subagentModelNote:`No hardcoded provider is introduced; an unassigned role follows the parent model and thinking level.`,resourceCount_one:`{{count}} resource`,resourceCount_other:`{{count}} resources`,noPluginsFound:`No loaded plugin sources were reported.`,pluginCatalogTotals:`{{extensions}} ext · {{skills}} skills · {{prompts}} prompts · {{themes}} themes`,loaded:`Loaded`,resourceOrigin:`Origin`,resourceOrigin_package:`Package`,resourceOrigin_topLevel:`Top-level resource`,resources:`Resources`,baseDirectory:`Base directory`,notReported:`Not reported`,extensions:`Extensions`,extensionSurfaceCount:`{{tools}} tools · {{commands}} commands`,prompts:`Prompts`,themes:`Themes`,pluginResourceSummary:`{{extensions}} ext · {{skills}} skills · {{prompts}} prompts · {{themes}} themes`,pluginsManagedByPi:`These resources are loaded by Pi. Submit changes using the setup form above. Package changes follow native confirmation and take effect through Pi's reload lifecycle.`,selectPlugin:`Select a plugin source`,statusCaptured:`Snapshot at {{time}} · refresh for the latest state`,conversationViews:`Conversation views`,currentConversations:`Current`,archivedConversations:`Archived`,refreshArchives:`Refresh archived conversations`,loadingArchives:`Loading archived conversations...`,moreArchives:`Load more archived conversations`,retryArchives:`Retry archived conversations`,archiveLoadFailed:`Could not load archived conversations.`,archiveCursorStale:`Archived conversations changed. Refresh to continue.`,archiveScanBounded:`{{count}} older records have not been scanned.`,noArchivedSessions:`No archived conversations.`,noScannedArchives:`No archived conversations in the scanned history.`,noMatchingScannedArchives:`No matching archived conversations in the scanned history.`,draftLimit:`Draft storage is full. Send or clear an existing draft before adding more content.`,restoreConversation:`Restore conversation`,restoringConversation:`Restoring…`,loadedArchives:`Archived conversations in the loaded history`,loadedHistoryBounded:`{{sessions}} more sessions and {{workspaces}} workspace summaries are not loaded. Search covers the loaded list only.`,noLoadedArchives:`No archived conversations in this loaded list.`,restoreFailed:`Could not confirm restoration. Refresh and try again.`,execution_running:`Running`,execution_done:`Completed`,execution_killed:`Stopped`,execution_timed_out:`Timed out`,execution_failed:`Failed`,execution_uncertain:`Uncertain`,activeOnlyHint:`Only the active Web session accepts messages.`,acceptedHint:`Message accepted by OpenPI Web.`,promptAdmissionUnknown:`It is unclear whether the last message was received.`,promptAdmissionUnknownDetail:`Review the refreshed Session history and runtime status before deciding. Sending as a new message may create a duplicate message.`,promptAdmissionCheckingDetail:`Checking the latest Session history and runtime status before resend options are enabled.`,promptAdmissionVerificationFailedDetail:`Could not refresh the latest Session history and runtime status. Check again before sending as a new message.`,abandonAdmission:`Don't resend for now`,retryAdmissionCheck:`Check again`,retryOriginalAdmission:`Retry original message`,promptTooLong:`Message exceeds the send limit ({{count}} / {{limit}}).`,sendAsNew:`Send as new message`,sendingAsNew:`Sending…`,stopTurn:`Stop current turn`,stoppingTurn:`Stopping current turn…`,stoppedTurn:`Current turn stopped.`,pendingFollowUpsHint:`{{count}} messages queued`,sendNextTurn:`Send next turn`,steerCurrentTurn:`Steer current turn`,steeringHint:`Use this instruction after the current tool step finishes.`,pendingSteeringHint:`{{count}} instructions received; waiting for the current tool step`,steeringMessagesTitle:`Pending instructions for this turn`,steerStaleTurn:`That turn has ended or changed. Your draft is kept; choose how to send it again.`,sourceFeedbackNew:`{{path}} · new line {{line}}`,sourceFeedbackOld:`{{path}} · old line {{line}}`,forkMessage:`Fork from here`,forkMessageHint:`Create a new conversation from this message. Keep the original conversation; no message is sent.`,forkSessionPending:`Creating a fork…`,forkSessionCreated:`Fork created. The original conversation remains in the sidebar.`,forkSessionCancelled:`Fork cancelled. The original conversation is kept.`,forkSessionUncertain:`The fork could not be confirmed. Refresh and inspect your conversations before trying again.`,forkSessionUnavailable:`Switch to this conversation and let its current work and queued messages finish before forking.`,reviewQuoteLine:`Reference this line`,reviewSelectOldLine:`Select old line {{line}}`,reviewSelectNewLine:`Select new line {{line}}`,queuedMore:`{{count}} more queued`,queuedImage:`Image attachment`,queuedMessageExpand:`Expand queued message`,queuedMessageCollapse:`Collapse queued message`,backgroundSessionRunning:`This session is running in the background…`,observedSessionTools:`{{count}} active tools`,toolsRequireCurrentSession:`Switch to this session to use interactive tools.`,activateViewedSession:`Switch to this session`,activateViewedSessionHint:`Send a message to continue this conversation.`,addWorkspace:`Add workspace`,addWorkspaceMenu:`Add workspace...`,archiveConversation:`Archive conversation`,pinnedConversations:`Pinned`,sidebarOptions:`Sidebar options`,sidebarProjectOptions:`Project sidebar options`,sidebarRecentOptions:`Chat sidebar options`,sidebarActivityOptions:`Activity view options`,sidebarShow:`Show`,sidebarGroupBy:`Group conversations`,sidebarByProject:`By project`,sidebarFlatList:`All conversations`,sidebarChatSort:`Conversation order`,sidebarRecent:`Recent`,sidebarProjectsInRecents:`Show projects in Recent`,sidebarShowMore:`Show more`,sidebarShowLess:`Show less`,sidebarFilterList:`Filter this list`,sidebarSaveFailed:`Could not save the change. Please try again.`,pinWorkspace:`Pin project`,unpinWorkspace:`Unpin project`,markConversationRead:`Mark as read`,markConversationUnread:`Mark as unread`,sidebarState_unread:`Unread conversation`,sidebarActivity:`Activity`,sidebarViewActivity:`View activity`,sidebarViewChats:`View conversations`,sidebarPriority:`Priority`,sidebarActivityEmpty:`Nothing needs attention`,sidebarActivityEmptyHint:`Completed work and conversations needing your attention appear here.`,sidebarMarkAllRead:`Mark all as read`,sidebarClearRead:`Clear read chats from Priority`,sidebarReadFailed:`Could not update read status. Please try again.`,sidebarToday:`Today`,sidebarYesterday:`Yesterday`,sidebarEarlier:`Earlier`,sidebarActivityCompleted:`Completed`,sidebarActivityFailed:`Failed`,sidebarActivityRead:`Read`,modelAdvanced:`Advanced parameters`,providerConnectionHeading:`Provider connection`,providerFetchModels:`Get available models`,providerFetchHint:`Enter the provider and endpoint, then choose models in one step.`,providerPickerTitle:`Choose models to add`,providerPickerAccess:`Connection credentials`,providerPickerKey:`Access key (optional)`,providerPickerKeyHint:`Leave blank to use saved credentials for this endpoint. A key entered here is used for discovery only and is not saved.`,providerPickerSearch:`Search models`,providerPickerSelectAll:`Select all`,providerPickerClear:`Clear selection`,providerPickerLoading:`Reading available models…`,providerPickerAdded:`Added`,providerPickerNoMatch:`No matching models`,providerPickerEmpty:`No models returned. You can still add one manually.`,providerPickerBounded:`Showing the first 500 models. Add other IDs manually.`,providerPickerError_load:`Could not read the model list. Check the endpoint and credentials, then retry or add a model manually.`,providerPickerError_save:`Could not confirm the save. Your selection is kept; check the connection before retrying.`,providerPickerError_conflict:`Configuration changed elsewhere. Close this dialog and reload configuration before saving again.`,providerPickerDefaults:`New models use {{context}} context / {{output}} output tokens. You can adjust these per model after adding.`,providerPickerRetry:`Refresh list`,providerPickerCount:`{{count}} selected · up to 100`,providerPickerSave:`Add selected`,sidebarState_running:`Running`,sidebarState_compacting:`Organizing context`,sidebarState_waiting:`Waiting for your response`,sidebarState_completed:`Completed · unread result`,sidebarState_failed:`Failed · open conversation for details`,pinnedOptions:`Pinned options`,pinConversation:`Pin conversation`,unpinConversation:`Unpin conversation`,pinnedRecentlyUpdated:`Recently updated`,pinnedManualOrder:`Manual order`,movePinUp:`Move up`,movePinDown:`Move down`,pinSaveFailed:`Could not save pinned conversations. Please try again.`,cancel:`Cancel`,chooseWorkspaceHint:`Choose a workspace and describe the work`,close:`Close`,closeSearch:`Close search`,collapseSidebar:`Collapse sidebar`,confirmEdit:`Save and rerun`,editMessageHint:`Rerun from here in a new branch. Keep the original conversation, images and file references. Existing workspace changes are kept.`,regenerateMessage:`Regenerate response`,regenerateMessageHint:`Rerun this question in a new branch, keeping its original attachments and conversation.`,messageRerunStarted:`Rerun admitted in a new branch. The original conversation is kept.`,openOriginalConversation:`View original conversation`,messageRerunWorkspaceHint:`Existing workspace changes are kept.`,modelRequestRecovered:`Request recovered`,modelReconnecting:`Reconnecting`,modelReconnectUnknown:`Reconnection status unconfirmed`,modelEarlierAttempts:`Earlier request errors`,modelFailedAttempts:`Failed attempts ({{count}})`,draftStorageUnavailable:`Draft could not be saved on this device. Keep this page open or copy your message.`,draftStorageInvalid:`Some saved draft content could not be restored. Check your message and attachments.`,draftStorageRetry:`Retry saving draft`,workbarBackToChat:`Back to chat`,workbarCollapseTools:`Collapse tools`,workbarEndTerminal:`Close {{name}} and end its process`,workbarNewTerminal:`New terminal`,workbarContinueInChat:`Continue in chat`,transcriptSearch:`Search message contents`,transcriptSearchPlaceholder:`Search titles, projects, or messages…`,transcriptSearchRecent:`Recent conversations`,transcriptSearchSessions:`Conversations`,transcriptSearchMessages:`Message contents`,transcriptSearchSessionResult:`Open conversation {{session}}`,transcriptSearchSessionOpenFailed:`Could not open this conversation. Try again.`,transcriptSearchIncludeArchived:`Include archived conversations`,transcriptSearching:`Searching messages…`,transcriptSearchEmpty:`No matching messages found.`,transcriptSearchFailed:`Could not search messages. Try again.`,transcriptSearchRetry:`Retry search`,transcriptSearchPartial:`Some history could not be searched. Results may be incomplete.`,transcriptSearchOpenFailed:`This message could not be opened. It may have moved or belong to another branch.`,transcriptSearchResult:`Open message from {{source}} in {{session}}`,transcriptSearchSource_user:`you`,transcriptSearchSource_assistant:`assistant`,transcriptSearchSource_tool_call:`tool call`,transcriptSearchSource_tool_result:`tool output`,connected:`Connected`,connecting:`Connecting`,conversationName:`Conversation name`,conversationOptions:`Conversation options`,sidebarRename:`Rename`,sidebarPin:`Pin`,sidebarUnpin:`Unpin`,sidebarFork:`Fork`,sidebarForkLocal:`Fork chat`,sidebarForkSameWorktree:`Fork in same worktree`,archiveNoticeTitle:`Chat archived`,archiveNoticeView:`View`,archiveNoticeUndo:`Undo`,archiveNoticeFailed:`Could not complete this action. Try again.`,sidebarForkWorktree:`Fork chat in new worktree`,sidebarForkCancelling:`Requesting cancellation…`,sidebarForkFinishing:`Cancellation is no longer available. Confirming the result…`,sidebarForkCancelUnconfirmed:`Cancellation could not be confirmed. Waiting for the fork result.`,sidebarForkWorktreePreserved:`The worktree was kept at {{path}}. Inspect it before retrying.`,sidebarForkWorktreePending:`Creating a worktree and conversation…`,sidebarForkOptionsLoading:`Checking worktree availability…`,sidebarForkOptionsFailed:`Unable to check worktrees. Reopen menu to retry.`,sidebarForkUnavailable:`Send a message before forking this conversation.`,sidebarForkArchived:`Restore this conversation before forking.`,sidebarForkFailed:`Could not create the fork. The original conversation is unchanged.`,sidebarCopy:`Copy`,sidebarCopyLink:`Copy conversation link`,sidebarCopyMarkdown:`Copy as Markdown`,sidebarCopyCwd:`Copy working directory`,sidebarCopied:`Copied`,sidebarCopyFailed:`Could not copy. Try again.`,sidebarNewWindow:`Open in new window`,sidebarOpenIn:`Open in`,sidebarAppsLoading:`Loading available apps…`,sidebarAppsFailed:`Unable to load apps. Reopen menu to retry.`,sidebarOpenFailed:`Unable to open this project in the selected app.`,sidebarArchive:`Archive`,sidebarRestore:`Restore`,sidebarDelete:`Permanently delete`,managedWorktreeRecoveryFull:`Check earlier unfinished removal requests before starting another.`,managedWorktreesChanged:`The worktree list changed. Refresh it before reviewing a target.`,managedWorktreesRefresh:`Refresh worktrees`,managedWorktreesBack:`Back to worktrees`,managedWorktreesRetry:`Retry request`,managedWorktrees:`Retained worktrees`,managedWorktreesDescription:`Worktrees created by OpenPI are kept when a conversation is deleted. Review an exact path before requesting removal. Active, shared, changed or unverified worktrees stay in place.`,managedWorktreeConfirm:`Remove this managed worktree? The server rechecks ownership, active conversations and local changes before removal.`,managedWorktreeRemoved:`Worktree removed.`,managedWorktreePreserved:`Worktree kept:`,managedWorktreeUncertainTerminal:`Removal outcome is uncertain. Automatic removal cannot be repeated. Inspect the retained path before taking further action.`,managedWorktreeUncertain:`Removal outcome is unknown. Retry to check the original request.`,managedWorktreeRemoving:`Checking and removing…`,managedWorktreeRemove:`Remove worktree`,managedWorktreeReview:`Review removal`,managedWorktreesEmpty:`No managed worktrees were found on this page.`,managedWorktreesUnavailable:`{{count}} ownership records could not be verified.`,managedWorktreesLoadFailed:`Could not load retained worktrees. Retry without changing the target.`,managedWorktreesMore:`Load more worktrees`,managedWorktreeRetainedAfterDelete:`Conversation deleted. Worktree kept at {{path}}. Review retained worktrees in the project menu.`,sidebarDeleteTitle:`Delete conversation?`,sidebarDeleteDescription:`Permanently delete “{{name}}”? This cannot be undone.`,sidebarDeleteConfirm:`Delete`,sidebarDeleting:`Deleting…`,sidebarDeleteFailed:`Could not delete this conversation. Retry or cancel.`,sidebarActionRunning:`Let current work and queued messages finish first.`,sidebarActionDisconnected:`Reconnect before changing this conversation.`,sessionDeleteCancelled:`Deletion cancelled`,sessionDeleteUncertain:`Could not confirm whether the conversation was deleted. Refresh and try again.`,sessionDeleted:`Conversation permanently deleted`,sessionDeleteMetadataPending:`The conversation was deleted, but its sidebar records could not be fully cleared.`,sessionLinkUnavailable:`The linked conversation no longer exists or its identity has changed.`,sidebarDropPin:`Drop here to pin`,sidebarDropProjectLast:`Move project to the end`,conversationTurns:`Conversation turns`,conversationTurnPosition:`Go to turn {{position}}`,turnPreviewLoading:`Loading preview…`,turnPreviewUnavailable:`Preview unavailable. Try again.`,commands:`Slash commands`,addContext:`Add context`,fileReference:`Reference workspace file`,fileReferenceTitle:`Reference workspace file`,fileReferenceDetail:`Add a path reference to the prompt without uploading file contents.`,fileReferenceLabel:`Workspace file path`,fileReferencePlaceholder:`src/app.tsx`,fileReferenceValidatedHint:`The current Session verifies that this is a readable workspace file.`,fileReferenceDraftHint:`This path will be resolved by Pi after the new Session starts.`,fileReferenceChecking:`Checking…`,fileReferenceFailed:`Could not verify this file.`,fileReferenceDenied:`Choose a file inside the current Session workspace.`,fileReferenceMissing:`This workspace file no longer exists.`,fileReferenceUnsupported:`Only regular workspace files can be referenced.`,fileReferenceExpired:`The active Session changed. Reopen the file reference and try again.`,fileReferenceBusy:`File validation is busy. Try again shortly.`,insertReference:`Insert reference`,commandsSessionRequired:`Slash commands are available after the Session starts.`,commandsEmptyDraftOnly:`Slash commands can be inserted only into an empty draft.`,commandsLoading:`Loading commands...`,commandsUnavailable:`Commands are temporarily unavailable.`,commandsNoMatch:`No matching commands.`,commandsNoAvailable:`No discovered commands can run in Web. Type a command name to inspect its availability.`,commandsBounded:`{{count}} more commands are not shown.`,commandSessionRequired:`Commands require an active Web session.`,commandUnsupported:`Not adapted · manual commands still reach Pi`,commandAcceptsArguments:`Accepts arguments`,commandSource_extension:`Extension`,commandSource_prompt:`Prompt template`,commandSource_skill:`Skill`,copiedMessage:`Copied`,copyMessage:`Copy message`,copyFailed:`Copy failed. Please select and copy the message manually.`,copiedCode:`Code copied`,copyCode:`Copy code`,copyCodeFailed:`Could not copy this code. Select and copy it manually.`,codeBlock:`Code block`,deleteWorkspace:`Delete workspace`,describeTask:`Describe a task`,editMessage:`Edit and rerun from here`,enterHint:`Enter to send, Shift+Enter for a new line.`,expandSidebar:`Expand sidebar`,importWorkspace:`Import workspace`,loadingModels:`Loading models...`,modelsTruncated:`Showing {{shown}} models. {{omitted}} more are available; search to find them.`,searchModels:`Search available models`,searchModelsPlaceholder:`Search provider, model name, or ID...`,searchingModels:`Searching models...`,noMatchingModels:`No matching models`,modelSearchFailed:`Could not search models. Try again.`,retryModelSearch:`Retry model search`,fileReferenceDraftChanged:`The draft changed. Reopen the file reference.`,modelSearchTruncated:`{{omitted}} matching models are not shown.`,modelPreparing:`Preparing task...`,modelRetrying:`Retrying model request...`,modelRunning:`Working...`,modelRequestFailed:`Model request failed`,modelRequestStopped:`Model request stopped`,modelFailureUnknown:`The provider did not return an error reason.`,retryPrompt:`Retry prompt`,retryingPrompt:`Retrying...`,newSession:`New session`,noConversations:`No conversations yet`,noMatching:`No matching conversations`,noMatchingLoaded:`No matching conversations in the loaded history`,noModels:`No models available`,noOutput:`no output`,noSessions:`No sessions`,openSidebar:`Open sidebar`,promptMessage:`Send a message or start a task, / for commands`,promptReadonly:`A non-active session cannot receive prompts`,promptStart:`Choose a workspace to begin.`,promptTask:`Describe what you want to build.`,landingTagline:`Small harness. Clean context. Deep extensions.`,queuedHint:`The message will be queued after the current turn.`,reconnecting:`Reconnecting`,removeWorkspace:`Remove from sidebar`,workspaceOptions:`Workspace options`,renameFailed:`Could not save the name. Your changes were kept.`,savingName:`Saving...`,workspaceRemoveFailed:`Could not remove the workspace. Try again.`,removingWorkspace:`Removing...`,renameConversation:`Rename conversation`,renameWorkspace:`Rename workspace`,save:`Save`,searchConversations:`Search conversations`,searchPlaceholder:`Filter titles and workspaces…`,selectModel:`Select model`,configureModels:`Configure models`,openModelSettings:`Model settings`,selectThinking:`Select thinking level`,resetThinking:`Restore the opening level ({{level}})`,modelThinkingNotEnabled:`Thinking is not enabled for this model. Enable reasoning support in model settings if your provider supports it.`,providerReasoningHint:`Enable only if the provider supports reasoning. Available levels come from Pi; adjust the level in the composer.`,providerImageHint:`When Image is unchecked, the model will not receive image attachments.`,selectWorkspace:`Select workspace`,send:`Send`,processDetails:`Execution details`,processRunning:`Working`,processThinkingCount_one:`{{count}} reasoning note`,processThinkingCount_other:`{{count}} reasoning notes`,processToolCount_one:`{{count}} tool call`,processToolCount_other:`{{count}} tool calls`,processActivityCount_one:`{{count}} agent activity`,processActivityCount_other:`{{count}} agent activities`,switchingSession:`Switching session...`,thinkingActive:`Thinking...`,thinkingActiveLevel:`Thinking ({{level}})...`,thinkingDone:`Thinking`,thinkingLoadFull:`Load full thinking`,thinkingLoadingFull:`Loading thinking…`,thinkingLoadFailed:`Unable to load thinking. Retry`,thinkingPartialText:`Showing part of the saved thinking. More text can be loaded below.`,thinkingPreviewOnly:`Thinking preview reached its limit. The full saved text will be available when this message finishes.`,toolState_running:`Running`,toolState_returned:`Returned`,toolState_failed:`Failed`,toolState_cancelled:`Stopped`,toolState_timed_out:`Timed out`,toolState_unknown:`Unconfirmed`,toolSnapshotMissingResult:`No result at fork`,toolActivity_running:`{{action}}…`,toolActivity_failed:`{{action}} failed`,toolActivity_cancelled:`{{action}} stopped`,toolActivity_timed_out:`{{action}} timed out`,toolActivity_unknown:`{{action}}`,toolAction_read:`Read`,toolAction_write:`Write file`,toolAction_edit:`Edit file`,toolAction_command:`Run command`,toolAction_search:`Search`,toolAction_list:`List files`,toolAction_web:`Browse web`,toolAction_agent:`Agent activity`,toolAction_workflow:`Workflow`,toolAction_plan:`Prepare plan`,toolAction_task:`Update tasks`,toolAction_goal:`Update goal`,toolAction_git:`Review changes`,toolAction_call:`Use tool`,toolActionDone_read:`Read`,toolActionDone_write:`Wrote file`,toolActionDone_edit:`Edited`,toolActionDone_command:`Ran command`,toolActionDone_search:`Searched`,toolActionDone_list:`Listed files`,toolActionDone_web:`Browsed web`,toolActionDone_agent:`Agent activity returned`,toolActionDone_workflow:`Workflow tool returned`,toolActionDone_plan:`Plan tool returned`,toolActionDone_task:`Task tool returned`,toolActionDone_goal:`Goal tool returned`,toolActionDone_git:`Reviewed changes`,toolActionDone_call:`Used tool`,toolActionGroup_read:`read files`,toolActionGroup_write:`write files`,toolActionGroup_edit:`edit files`,toolActionGroup_command:`run commands`,toolActionGroup_search:`search`,toolActionGroup_list:`list files`,toolActionGroup_web:`browse web`,toolActionGroup_agent:`agent activity`,toolActionGroup_workflow:`workflow activity`,toolActionGroup_plan:`planning`,toolActionGroup_task:`tasks`,toolActionGroup_goal:`goal`,toolActionGroup_git:`review changes`,toolActionGroup_call:`use tools`,toolGroup_done:`Activity · {{actions}}`,toolGroup_running:`Working · {{actions}}`,toolGroup_unknown:`Activity · {{actions}}`,toolGroupSeparator:`, `,toolSearchTarget:`“{{pattern}}” · {{path}}`,toolDiffStatsHelp:`Added and removed lines in the displayed diff`,toolRequestedFile:`File:`,toolWorkspace:`Workspace`,toolRawEvidence:`Arguments and original result`,toolCodemodeDetails:`Script and original result`,toolNestedOutputMissing:`This session records the call and its status, but not the nested tool output.`,toolNestedArgumentsMissing:`This session omits the full arguments and nested tool output.`,toolNestedIncomplete:`The nested-call record is incomplete; some calls, arguments or final states are unavailable.`,toolPartialEvidence:`Partial output: a byte, line or item limit was reached. The original result may also be truncated.`,toolFileChange_created:`File created`,toolFileChange_unchanged:`No content changes`,toolFileChange_overwritten:`File overwritten`,toolChangeUnavailable:`This result does not include a change comparison.`,toolTestResults:`Reported test results · {{format}}`,toolTestCounts:`{{tests}} tests · {{passed}} passed · {{failed}} failed · {{cancelled}} cancelled`,toolTestCountsHelp:`Counts come from command output. The execution status is shown separately.`,toolReadMore:`Read another range using the path and offset. The original result contains continuation details.`,toolFullOutputReference:`Full output:`,subagentBackgroundResult_one:`Background subagent result · {{count}}`,subagentBackgroundResult_other:`Background subagent results · {{count}}`,thinkingDraftHint:`Choose a workspace and create a session first.`,thinkingInactiveHint:`Only the active session can change its thinking level.`,thinkingLevelMismatch:`The confirmed thinking level is not offered by the current model. Choosing another level will correct it.`,thinkingLockedRunning:`Stop the current turn before changing the thinking level.`,thinkingModelPendingHint:`Wait for the model change to finish.`,thinkingNotConfirmed:`Thinking level was not confirmed. Please try again.`,thinkingPendingHint:`Applying the thinking level...`,thinkingUnsupported:`Thinking is unavailable`,thinkingUnsupportedHint:`No model is selected, or the current model does not support thinking.`,unavailable:`Unavailable`,ungrouped:`Ungrouped`,untitledSession:`New session`,workspaceDeleteConfirm:`The folder and conversation records will be kept. Its conversations will move to Ungrouped.`,workspaceName:`Workspace name`,workspaces:`Workspaces`,sidebarProjects:`Projects`}},zh:{translation:{promptPending:`正在处理请求…`,commandFeedbackTruncated:`这里只显示部分命令结果。请缩小查询范围,或在 TUI 查看完整输出。`,planMode_inactive:`普通模式`,planMode_planning:`规划中 · 禁止写入`,planMode_ready:`计划就绪 · 等待审阅`,planMode_invalid:`计划状态异常 · 禁止写入`,planModeEnter:`进入规划`,promptPlanMessage:`本次对话使用 Plan 模式 · 继续讨论计划,暂不实施`,planModeUnconfirmed:`暂时无法确认 Plan 状态,请刷新后再继续。`,planModeExit:`退出规划`,planModeImplement:`准备实施提示`,planImplementationReplaceDraft:`准备实施会替换当前草稿并关闭规划模式,但不会发送提示词。是否继续?`,commandSupport_plan:`支持规划和准备当前会话的实施提示;新建实施会话仍需使用 TUI。`,commandSupport_setup:`通过当前模型配置,在 Web 回答问题。`,handoffWaiting:`需要你操作`,handoffDone:`已完成`,handoffUnable:`无法完成`,handoffDoneHelp:`已执行操作,接下来由模型验证结果。`,handoffUnableHelp:`未能完成,可以补充遇到的障碍。`,handoffReview:`复核状态`,handoffSubmit:`提交状态`,handoffSignal:`预期结果:`,handoffVerify:`提交完成后,模型仍需验证结果;你的反馈本身不代表验证成功。`,planCardLabel:`开发计划`,planCardReady:`计划已就绪`,planCardResult:`计划结果`,planCardNotApproval:`此步骤仅生成计划,不代表已批准或开始实施。`,planCardCollapse:`收起`,planCardExpand:`展开`,planCardCopy:`复制计划`,planCardCopyPreview:`复制可见预览`,planCardTruncated:`当前仅显示截断预览。`,planCardLoadFull:`加载完整计划`,planCardLoadingFull:`正在加载计划...`,planCardLoadFailed:`无法加载完整计划,重试`,planCardEvidence:`工具结果 · plan_ready`,questionWaiting:`问题`,questionPreview:`查看预览`,questionSkip:`跳过`,questionProgress:`{{current}} / {{total}}`,questionReview:`复核答案`,questionReviewTitle:`确认这些选择?`,questionReviewHelp:`可以返回修改,点击提交后才会发送给助手。`,questionEdit:`修改答案:{{question}}`,questionDismiss:`关闭提问,不提交答案`,questionCustom:`或自行撰写回复`,questionCustomHelp:`留空提交,表示希望助手把问题说清楚或拆小。`,questionYourAnswer:`你的答案`,questionCustomPlaceholder:`说说你的想法…`,questionNotes:`补充说明(选填)`,questionNotesPlaceholder:`补充限制条件,或解释你的选择…`,questionRephrase:`请助手把问题说清楚或拆小`,questionBack:`上一步`,questionNext:`下一题`,questionSubmit:`提交答案`,questionSubmitting:`正在提交…`,questionRetry:`核对提交结果`,questionUncertain:`暂时无法确认是否送达,已保留本次提交的答案。点击核对可恢复结果,不会重复提交。`,questionDisconnected:`正在重新连接… 已保留你的选择,暂时无法提交。`,questionLimit:`每项答案或补充说明不能超过 {{count}} 个 UTF-8 字节。`,questionLoadFailed:`暂时无法读取等待回答的问题。`,questionDraftLimit:`提问草稿已达上限,请缩短或清空已有答案后再添加内容。`,questionRetryLoad:`重试`,questionCloseReceipt:`关闭问答状态提示`,questionState_dismissed:`已关闭提问,没有提交答案。`,questionState_cancelled:`提问已取消,没有提交答案。`,questionState_expired:`提问已过期,没有提交答案。`,questionState_stale:`该提问已失效,请查看对话中的处理结果。`,conversationView:`会话视图`,jumpToLatest:`跳至最新`,historyLoading:`正在加载历史…`,historyOmitted:`还有 {{count}} 条较早记录 · 向上滚动自动加载`,historyChanged:`会话分支已更改,已切换到当前分支的历史。`,historyUnavailable:`历史记录加载失败,请重试。`,historyValidationUnavailable:`无法校验会话历史,请重试。`,historyVerifying:`正在校验会话历史…`,messageLoadFull:`加载完整消息`,messageLoadMore:`加载更多`,messageLoadingFull:`正在加载消息…`,messageLoadFailed:`无法加载这条消息,重试`,filePreview:`文件预览`,changeEvidence:`变更`,changeEvidenceScope:`按所选范围查看当前工作目录的只读 Git 变更。`,turnLabel:`第 {{number}} 轮`,turnState_running:`运行中`,turnState_complete:`已完成`,turnState_failed:`失败`,turnState_interrupted:`已中断`,turnState_waiting:`等待回复`,turnState_forked:`已分叉,可继续对话`,turnChanges:`本轮更改 {{count}} 个文件`,turnChangesPartial:`本轮已记录 {{count}} 个文件`,turnChangesIncomplete:`这一轮的变更记录不完整。`,turnChangesMore:`再显示 {{count}} 个文件`,turnChangesLess:`收起文件`,turnChangesReview:`审阅本轮变更`,turnChangesReviewButton:`审阅`,turnChangesBack:`返回本轮变更`,turnChangesLoading:`正在加载本轮变更…`,turnChangesUnavailable:`无法读取本轮保存的差异。`,messageCopyRequiresFull:`加载完整消息后才能复制。`,filesChanged:`{{count}} 个文件已更改`,reviewChanges:`查看变更`,workspaceChanges:`工作区更改`,overviewChanges:`变更`,overviewLineTotals:`当前 Git 比较范围内的文本新增与删除行数`,overviewPartialTotals:`仅展示已核实的行数,部分文件尚无法统计。点击变更查看详情。`,overviewCounting:`统计中…`,overviewCountsUnknown:`行数未知`,overviewReviewUnavailable:`暂不可用`,sessionSources:`来源`,sourcesAdd:`添加来源`,sourcesEmpty:`暂无来源`,sourcesFailed:`来源加载失败。`,sourcesViewAll:`查看全部`,sourcesLoadMore:`加载更多来源`,sourcesBack:`返回来源列表`,sourcesPartial:`已达到列表展示上限,更早的来源仍可在对话中查看。`,turnChangesScope:`该轮开始至结束的工作区差异 · 已保存`,turnEdits:`已编辑 {{count}} 个文件`,turnEditsPartial:`已记录 {{count}} 个文件的编辑`,turnEditsScope:`本轮文件工具写入记录 · 已保存;不含命令行与外部修改`,turnEditStatsUnknown:`行数未知`,turnEditReason_before_unavailable:`文件已写入,但该操作未授权读取旧内容,无法提供可靠的前后差异。`,turnEditReason_content_limit:`文件已写入,内容超过已保存对比的大小限制,无法提供准确行数。`,turnEditReason_concurrent_change:`文件在已记录的操作之间发生了变化,无法确认本轮净增删行数。`,gitReviewLoadedCount:`已载入 {{count}} 个文件`,gitReviewPartialLabel:`部分`,gitReviewSearch:`搜索文件路径`,gitReviewExpand:`展开审阅`,gitReviewSearchLoaded:`搜索已载入文件`,gitReviewMarkViewed:`标记 {{path}} 为已查看`,gitReviewMarkCurrentViewed:`标记当前文件 {{path}} 为已查看`,gitReviewViewedLabel:`已查看`,gitReviewViewedProgress:`已查看 {{viewed}} / 已加载 {{loaded}} 个文件`,gitReviewViewedLimit:`本次对比最多保留 {{count}} 个已查看标记。`,gitReviewNoMatch:`没有匹配的文件。`,gitReviewNoLoadedMatch:`已载入文件中没有匹配项。`,gitReviewLoadNext:`载入下一批文件`,gitReviewChanged:`工作区已有变化,请刷新清单后继续载入。`,gitReviewNewVersion:`有新的更改,当前仍显示你正在阅读的版本。`,gitReviewShowLatest:`查看最新差异`,gitReviewBinary:`此二进制文件无法显示文本差异。`,gitReviewBinaryShort:`二进制`,gitReviewPendingStats:`待读取`,gitReviewComparison:`{{current}} 对比 {{base}}`,gitReviewWorkingTree:`工作区对比 HEAD`,gitReviewSessionSnapshot:`自本会话开始后的变更`,gitReviewDetached:`游离 HEAD`,gitReviewLoading:`正在读取 Git 变更…`,gitReviewRetry:`重试`,gitReviewRefresh:`刷新变更`,gitReviewOlderResult:`当前显示上一次读取结果。`,gitReviewNotRepository:`此工作区不是 Git 仓库。`,gitReviewUnborn:`此仓库还没有可读取的 HEAD。`,gitReviewFailed:`无法读取 Git 变更。`,gitReviewTruncated:`结果不完整,部分文件或差异未载入。`,gitReviewEmpty:`当前范围内没有文件变更。`,gitReviewHiddenLines:`另有 {{count}} 行 diff 未显示。`,gitReviewDiffTruncated:`快照已达到大小上限,未加载此文件的 diff。`,gitReviewShowMore:`再显示 {{count}} 个文件`,gitReviewBackToFiles:`返回变更文件`,gitReviewFilePreview:`{{file}} 的差异`,gitReviewNoDiff:`此文件没有可显示的文本差异。`,changeDiff:`变更差异`,diffView:`差异`,gitFileStatus_added:`已新增`,gitFileStatus_modified:`已修改`,gitFileStatus_deleted:`已删除`,gitFileStatus_renamed:`已重命名`,gitFileStatus_copied:`已复制`,gitFileStatus_untracked:`未跟踪`,gitFileStatus_unknown:`已变更`,closePreview:`关闭预览`,artifactReadOnly:`只读`,artifactReferenceUnavailable:`此视图无法打开文件预览:{{path}}`,artifactSession:`所属会话 {{sessionId}}`,copyFilePath:`复制文件路径`,filePathCopied:`已复制文件路径`,refreshFile:`刷新文件`,downloadFile:`下载文件`,downloadingFile:`正在下载…`,artifactOlderPreview:`当前显示旧版预览。`,readingFile:`正在读取文件…`,artifactVersion:`版本`,artifactBytes:`{{count}} 字节`,artifactPreviewTruncated:`预览已截断;下载文件可获取完整内容。`,artifactUnsupported:`此类型无法预览,请下载文件。`,chatView:`对话`,trajectory:`执行轨迹`,trajectoryScope:`按记录顺序展示会话消息,不表示执行耗时,也不是完整模型请求。`,trajectoryRunning:`任务仍在进行。已保存记录到达后自动更新;实时生成内容可在“对话”中查看。`,trajectoryTruncated:`当前历史不完整:省略 {{entries}} 条记录、{{parts}} 个内容片段,{{messages}} 条消息被截断。`,trajectoryEmpty:`尚无已保存记录。`,trajectoryOrder:`记录顺序`,trajectoryRecordCount:`{{count}} 条记录`,trajectoryMatches:`{{count}} 条匹配`,trajectorySearch:`搜索已加载记录`,trajectoryNoMatches:`没有匹配的记录。`,trajectoryEarlierGroup:`较早上下文`,trajectoryEventCount:`{{count}} 条会话变更`,trajectorySummary:`概览`,trajectoryInputTab:`输入`,trajectoryResultTab:`结果`,trajectoryConversationGroup:`本轮对话`,trajectoryReasoningTitle:`思考`,trajectoryRecordNumber:`记录 {{number}}`,trajectoryRecordInfo:`记录信息`,trajectoryRecordId:`记录 ID`,trajectoryCallId:`工具调用 ID`,trajectoryEventType:`事件类型`,trajectoryEvent_model_change:`切换模型`,trajectoryEvent_thinking_level_change:`调整思考级别`,trajectoryEvent_compaction:`压缩上下文`,trajectoryEvent_session_info:`更新会话信息`,trajectoryEvent_custom:`会话记录`,trajectoryEarlier:`显示更早记录(已加载历史中还有 {{count}} 条)`,trajectoryDetails:`记录详情`,trajectoryRecordedAt:`记录时间`,trajectoryEvidenceTruncated:`此证据在会话投影中已被截断。`,trajectoryArguments:`工具参数`,trajectoryRecordedContent:`已记录内容`,trajectoryThinking:`模型返回的推理内容`,trajectoryOutput:`工具结果`,trajectoryMissingResult:`当前记录中没有可明确配对的结果。这不表示工具仍在运行。`,trajectoryStructured:`结构化结果`,trajectoryEventOnly:`当前仅提供此事件的类型和记录时间。`,trajectory_user:`用户消息`,trajectory_assistant:`助手回复`,trajectory_call:`工具调用`,trajectory_result:`未配对结果`,trajectory_event:`会话事件`,trajectory_returned:`工具已返回结果。`,trajectory_error:`工具返回错误`,trajectory_unknown:`尚无法确定结果`,runtimeStatus:`运行状态`,refreshStatus:`刷新状态`,terminalDetails:`终端详情`,openTools:`打开工具`,sideConversation:`侧边对话`,sideConversationDescription:`在独立 Pi 会话中追问具体问题,不打断当前主任务。`,workbarChangesDescription:`查看当前目录的未暂存、已暂存、分支或会话变更。`,terminal:`终端`,renameTerminal:`重命名终端`,terminalName:`终端名称`,workbarTerminalDescription:`打开当前工作区的交互式终端。`,backgroundTerminalActivity:`Agent 命令活动`,restartTerminal:`重新启动终端`,reconnectTerminal:`重新连接终端`,restartTerminalTitle:`重新启动此终端?`,restartTerminalDetail:`当前终端会被关闭,其中运行的进程可能被中断。`,terminalReconnecting:`正在重新连接终端...`,terminalScrollToBottom:`回到底部`,terminalOutputResynced:`终端输出已重新同步`,terminalRestarting:`正在重新启动终端...`,terminalConnecting:`正在启动终端…`,terminalExited:`终端已退出。`,terminalExitCode:`终端已退出,状态码 {{code}}。`,terminalDisconnected:`终端连接意外中断。`,terminalError:`终端不可用。`,browser:`浏览器`,sessionFileRecords:`本会话文件记录`,gitReviewSource:`变更范围`,gitReviewBaseBranch:`对比分支`,gitReviewChooseBase:`选择对比分支`,gitReviewSearchBranches:`搜索分支`,gitReviewLocalBranch:`本地分支`,gitReviewRemoteBranch:`远程分支`,gitReviewBranchesTruncated:`显示有数量限制的分支列表,部分分支已省略。`,gitReviewNoMatchingBranches:`没有匹配的分支。`,gitReviewBaseUnavailable:`没有可用的默认对比分支。请选择分支以审阅已提交的变更。`,gitReviewBaseInvalid:`所选对比分支已不可用,请选择其他分支。`,gitReviewUnstaged:`未暂存(含未跟踪)`,gitReviewStaged:`已暂存变更`,gitReviewBranch:`分支变更`,gitReviewFileMissing:`此文件在当前范围内已无变更,请刷新文件列表。`,artifactExternalAccess:`此文件位于其他工作目录。可为当前会话授权只读打开这一个文件,不会开放其他文件的访问。`,artifactAuthorizeFile:`只读打开此文件`,sideConversationPending:`正在准备侧边会话…`,resizeSidebar:`调整侧边栏宽度`,resizePanes:`调整面板宽度`,resizeWorkbar:`调整工具栏宽度`,browserPasteTooLarge:`每次最多粘贴 {{count}} 个字符。`,browserInputTooLarge:`每次最多输入 {{count}} 个字符。`,browserInputTargetChanged:`输入目标已变化或无法确认,有输入操作未执行。`,workbarBrowserDescription:`在 OpenPI 工作栏内打开并操作网页。`,browserReady:`输入地址开始浏览`,browserStarting:`正在启动内嵌浏览器…`,browserOpened:`已在内嵌浏览器中打开`,browserOpenAgain:`再次打开`,browserOpenFailed:`内嵌浏览器暂不可用。`,browserBack:`后退`,browserForward:`前进`,browserReload:`重新加载`,browserTabs:`网页标签页`,browserNewTab:`新标签页`,browserAddTab:`新建网页标签页`,browserCloseTab:`关闭 {{title}}`,browserTabLimit:`最多打开 {{count}} 个网页标签页`,browserPageTitle:`网页:{{address}}`,browserEnteredAddress:`最近从此地址栏打开的地址`,browserAddressNotAllowed:`请输入不含用户名或密码、且不属于 OpenPI 自身地址的 HTTP(S) 网址。`,browserLocationUnknown:`网页已跳转,新地址无法读取。重新加载会返回你输入的地址。`,browserDirectDescription:`直接浏览网页。不允许嵌入的网站可在外部浏览器打开。`,browserDirectHint:`地址栏仅记录手动打开的地址。网页弹窗在外部浏览器打开;遇到空白页,可点击外部打开。`,browserEnhancedHint:`浏览增强已开启:地址自动同步,普通弹窗链接在内部标签页打开。部分站点限制、登录弹窗和跨站历史仍需外部浏览器。`,files:`文件`,filesExplorer:`工作区文件`,filesSearch:`筛选文件…`,refreshFiles:`刷新文件`,filesWorkspaceActions:`工作区文件操作`,filesCreateMenu:`新建`,filesImportMenu:`导入`,filesMoreMenu:`更多`,filesNewFile:`新建文件`,filesNewDirectory:`新建文件夹`,filesImport:`导入文件`,filesImportFolder:`导入文件夹`,filesImportFolderChoose:`选择要导入的文件夹`,filesImportFolderLimit:`每次最多导入 2,000 个文件和文件夹,目录层级最多 64 层。`,filesSelectMultiple:`多选文件`,filesSelectItem:`选择 {{name}}`,filesSelectedCount:`已选 {{count}} 项`,filesRename:`重命名`,filesNewName:`新名称`,filesMove:`移动`,filesMoveDestination:`目标文件夹(工作区内相对路径)`,filesTrashAction:`移入回收站`,filesTrash:`工作区回收站`,filesTrashDetail:`移除的文件保留在当前工作区,可恢复;不会覆盖同名文件。`,filesTrashEmpty:`暂无已移除文件`,filesTrashUnavailable:`{{count}} 项记录无法核验,内容仍保留在 .openpi-trash 中,暂不能自动恢复。`,filesRestore:`恢复`,filesRestoreItem:`恢复 {{name}}`,filesUndoTrash:`撤销移除`,filesOrganizationResults:`文件操作结果`,filesOperationDone:`完成`,filesRefreshBeforeOrganizing:`请先刷新文件树,再整理这项文件。`,filesImportChoose:`选择要导入的文件`,filesTargetDirectory:`目标目录`,filesWorkspaceRoot:`工作区根目录`,filesFileName:`文件名称`,filesDirectoryName:`文件夹名称`,filesCreate:`创建`,filesCreating:`创建中…`,filesCreated:`已创建:{{path}}`,filesNameInvalid:`请输入单个文件或文件夹名称,不要包含路径分隔符。`,filesNameExists:`此名称已存在,请更换名称;原有文件已保留。`,filesMutationFailed:`写入失败,输入已保留。`,filesWriteUnavailable:`请先切换到此会话,再修改工作区文件。`,filesImportLimit:`每个文件最多 50 MiB,同名文件不会覆盖。`,filesImportTooLarge:`此文件超过 50 MiB 导入上限。`,filesImportDirectoryUnsupported:`不支持导入整个文件夹,请选择其中的文件。`,filesImportResults:`文件导入结果`,filesImportPending:`等待导入`,filesImporting:`导入中…`,filesImported:`已保存到工作区`,filesImportedNoPreview:`已保存。预览上限为 20 MiB;可复制路径,在对话中引用此文件。`,filesClearImported:`清除已完成的导入`,filesRetryImport:`重试导入`,filesPathActions:`{{name}} 的路径操作`,filesCopyRelativePath:`复制相对路径`,filesCopyAbsolutePath:`复制绝对路径`,filesPathCopied:`已复制路径:{{path}}`,filesReadFailed:`无法读取文件。`,filesSymlink:`符号链接,文件浏览器不会自动跟随`,filesTruncated:`结果不完整,请缩小搜索范围。`,filesNoMatches:`没有匹配的文件`,filesEmpty:`此文件夹为空`,filesChoose:`选择文件进行预览`,filesChooseDetail:`从右侧浏览工作区文件,在这里直接预览。`,filesHideTree:`收起文件树`,filesShowTree:`显示文件树`,filesPreview:`预览`,filesSource:`查看源代码`,filesEdit:`编辑`,filesMode:`文件视图`,filesEditor:`文件编辑器`,filesSave:`保存文件`,filesSaving:`保存中…`,filesSaved:`已保存`,filesUnsaved:`未保存的修改 · 草稿保留在当前窗口`,filesDiscard:`放弃草稿`,filesDiscardConfirm:`放弃此文件尚未保存的修改?`,filesSaveConflict:`磁盘上的文件已改变,编辑草稿已保留。请刷新查看最新内容,核对修改后再保存。`,filesSaveFailed:`保存失败,编辑草稿已保留。请检查文件后重试。`,filesEditLoadFirst:`请先继续读取完整文件,再编辑。`,filesEditUnavailable:`支持编辑工作区内不超过 1 MiB 的 UTF-8 文本,最多保留 16 份未保存草稿。`,filesOutline:`章节目录`,filesDiskVersion:`查看当前磁盘版本`,filesReconcile:`已核对,保留草稿并基于此版本继续编辑`,filesTable:`表格预览`,filesRow:`行`,filesSheets:`工作表`,filesTableTruncated:`当前显示部分表格;下载文件可查看全部行列。`,filesOfficeLayout:`文档内容预览;分页和排版可能与 Office 不同。`,filesSlidesLayout:`幻灯片文字与图片预览;主题、图表和动画可能与 PowerPoint 不同。`,filesPreviousPage:`上一页`,filesNextPage:`下一页`,filesZoomOut:`缩小`,filesZoomIn:`放大`,filesZoomReset:`重置缩放`,filesPdfPage:`第 {{page}} 页`,filesDocumentLimit:`此文档超出预览处理范围,请下载后在本地打开。`,filesPreviewFailed:`无法预览此文件,仍可下载后打开。`,filesDiagram:`Mermaid 图表`,filesExpandDiagram:`放大图表`,filesFitImage:`适应宽度`,filesOriginalImage:`原始尺寸`,filesLoadMore:`加载更多`,filesLoaded:`已加载 {{count}} 项`,filesReadMore:`继续读取`,filesContentChanged:`文件已更新。当前阅读内容已保留,可在准备好后刷新。`,workbarFilesDescription:`浏览工作区文件,在文件树旁直接预览。`,backToSideConversations:`返回侧边对话`,continueSideConversation:`继续追问…`,startSideConversation:`提出一个侧边问题…`,sideConversationModelInherited:`新侧边对话使用主会话的模型与思考等级。`,sideConversationModelFixed:`这是当前侧边对话使用的模型。`,stop:`停止`,start:`开始`,browserAddress:`浏览器地址`,browserGo:`打开地址`,openExternalBrowser:`在外部浏览器打开`,invalidBrowserAddress:`请输入有效的 HTTP 或 HTTPS 地址。`,addImages:`添加图片`,addFiles:`添加文件`,fileAttachments:`文件附件`,previewFileAttachment:`预览文件`,fileAttachmentDescription:`文档、表格、PDF、文本、代码及其他文件`,fileAttachmentCount:`最多可添加 {{count}} 个附件。`,fileAttachmentTooLarge:`文件总大小不能超过 50 MB。`,fileAttachmentReadFailed:`无法读取此文件,请检查格式或是否有密码保护。`,fileAttachmentTextReady:`文本已就绪`,fileAttachmentTextTruncated:`部分文本 · 保留原文件`,fileAttachmentOriginalReady:`原文件已就绪`,fileAttachmentExtractionFailed:`未提取文本 · 原文件保留`,fileAttachmentEncodingUnavailable:`无法读取文本编码,原文件字节已保留。`,fileAttachmentDocumentUnavailable:`无法提取文本。文件可能受密码保护或格式暂不支持,原文件字节已保留。`,fileAttachmentNoText:`发送后,代理可通过工具读取原文件;此文件未提取出文本。`,fileAttachmentPreviewTruncated:`预览显示前 20,000 个字符,发送时会附上全部已提取文本。`,fileAttachmentExtractedContent:`已提取文本`,fileAttachmentPromptLabel:`用户提供的文件:`,fileAttachmentPromptTooLong:`消息和文件引用超过输入限制,请缩短消息或减少附件。`,imageAttachmentDescription:`支持 PNG、JPEG、GIF 或 WebP`,imageAttachments:`图片附件`,imageAttachmentsLoading:`正在准备附件…`,commandOpensPanel:`打开面板`,commandPanelArguments:`此命令用于打开面板,不能携带参数或图片。请移除后重试,或直接使用对应面板。`,commandPanelUnavailable:`未能打开面板,已保留命令。`,commandUnavailable_terminal_only:`需要在 Pi 终端界面中使用。`,commandUnavailable_not_integrated:`此扩展命令尚未接入 Web,请在 Pi 终端中使用。`,artifactImagePreviewFailed:`图片预览失败。请刷新文件重试,或下载后查看。`,artifactFileDetails:`文件信息`,turnElapsedRunning:`已处理 {{duration}}`,compactionElapsed:`已等待 {{duration}}`,compactionRunning:`正在压缩上下文`,compactionCompleted:`上下文已自动压缩`,compactionFailed:`上下文压缩失败`,compactionInterrupted:`压缩已中断`,compactionUnchanged:`压缩已结束,未生成新的摘要`,compactionUnavailable:`上下文压缩状态暂不可用`,compactionReconnectHelp:`连接已中断,恢复连接后将核实当前状态。`,compactionDraftHelp:`正在压缩上下文,发送的消息会排队等待。`,turnElapsedFinished:`用时 {{duration}}`,composerAdd:`添加`,composerCommands:`指令`,composerFile:`文件`,composerGoal:`目标`,composerPlan:`计划`,composerCompact:`压缩`,composerModel:`模型`,composerBack:`返回`,composerGoalDescription:`设置或查看长期任务目标`,composerPlanDescription:`进入或退出计划模式`,composerCompactDescription:`整理之前的对话,释放上下文空间`,composerModelDescription:`选择本会话使用的模型`,compactionQueueWaiting:`等待压缩完成`,compactionQueueBlocked:`消息已保留,可重试或清空队列。`,clearPromptQueue:`清空队列`,turnElapsedOutcome_cancelled:`已停止`,turnElapsedOutcome_failed:`失败`,turnElapsedOutcome_uncertain:`结果待确认`,settingsSetupBusyHint:`Agent 配置需等待当前轮次结束;显示设置可直接调整。`,resetChatContentWidth:`恢复默认聊天宽度`,resetChatFontSize:`恢复默认字体大小`,setupResolveAdmission:`请先返回对话,处理尚未确认的消息,再应用设置。`,removeAttachment:`移除附件`,dropImagesHere:`将文件或图片拖到这里`,imageAttachmentCount:`最多可添加 {{count}} 张图片。`,imageAttachmentTooLarge:`单张图片不能超过 10 MB。`,imageAttachmentTotalTooLarge:`图片总大小不能超过 32 MB。`,imageAttachmentUnsupported:`仅支持有效的 PNG、JPEG、GIF 和 WebP 图片。`,imageAttachmentReadFailed:`无法读取此图片,请重新添加重试;消息内容已保留。`,attachedImage:`已附加图片`,previewAttachment:`预览图片`,closeImagePreview:`关闭图片预览`,imagePreviewFailed:`无法显示这张图片。`,fitImage:`适应窗口`,originalImageSize:`原始尺寸`,imageViewMode:`图片查看`,sessionUsage:`会话 Token 用量`,sessionInputTokens:`输入 Token`,sessionOutputTokens:`输出 Token`,sessionCacheTokens:`缓存 Token`,sessionContextUsage:`上下文占用与窗口大小`,usageContextLabel:`上下文`,usageUnknown:`未知`,usageOpenDetails:`输入 {{input}} · 输出 {{output}} · 上下文 {{percent}} / {{capacity}} · 查看会话用量`,usageContextHelp:`当前分支的估算占用 / 模型上下文容量上限。`,usageSessionTotals:`累计用量`,usageInputLabel:`输入`,usageOutputLabel:`输出`,usageTotalLabel:`总计`,usageWorkspaceLabel:`工作区`,usageSessionId:`会话 ID`,usageTotalsHelp:`本会话累计 Token 用量,包含缓存。`,subagentDetails:`子代理`,sessionOverview:`会话概览`,sessionOverviewChanges:`当前审阅范围的更改`,subagentSummaryRunning:`{{count}} 运行中`,subagentSummaryDone:`{{count}} 完成`,subagentSummaryOther:`{{count}} 其他记录`,subagentNoneYet:`暂无子代理`,subagentOtherGroup:`失败 / 已中断`,subagentShowMore:`再显示 {{count}} 个`,backToSubagents:`返回子代理列表`,subagentActiveGroup:`运行中`,subagentFinishedGroup:`完成`,subagentNoneRunning:`暂无正在运行的子代理。`,subagentNoneFinished:`任务结束后会显示在这里。`,subagentProgress:`子代理:{{running}} 运行中 · {{completed}} 已完成`,subagentSummaryUnknown:`{{count}} 个状态未确认`,subagentTasks:`子代理任务列表`,inspectSubagent:`打开子代理:{{name}}`,subagentState_running:`运行中`,subagentState_done:`已完成`,subagentState_error:`失败`,subagentState_interrupted:`已中断`,subagentStarting:`正在启动…`,subagentSpawnFailed:`启动失败`,subagentStateUnavailable:`已启动 · 状态未保留`,subagentSpawnReceipt:`启动回执`,subagentSpawnReceiptHint:`此回执仅确认启动请求,不表示子代理任务已完成。`,subagentTask:`分配的任务`,subagentTranscript:`子代理对话`,subagentResult:`执行结果`,subagentSaved:`已保存记录`,subagentRecordedState:`最后记录的状态`,subagentSavedHint:`来自当前父会话已保存的回执;结果可能包含同批其他任务,并非子代理的完整实时对话。`,subagentLive:`正在执行 · 自动更新`,subagentReadOnly:`只读查看 · 关闭此面板不会停止任务`,subagentUnavailable:`当前会话已无法提供此子代理的实时详情。启动回执不代表任务已完成。`,subagentStale:`刷新失败,下方保留的是上次收到的状态。`,subagentNoMessages:`暂未收到消息。`,subagentTranscriptUnavailable:`此视图仅保留任务摘要,无法显示完整子代理对话。`,subagentWorkflowsTruncated:`另有 {{count}} 个 workflow 未包含在当前列表中,其任务数量未知。`,subagentState_unknown:`未确认`,subagentUnconfirmedGroup:`未确认`,subagentTruncated:`当前显示有界摘录,已省略 {{count}} 条较早消息,部分文本可能已截短。`,subagentListTruncated:`另有 {{count}} 个任务未包含在当前列表中。`,subagentThinkingRedacted:`服务商已隐藏此段思考内容。`,subagentTool_running:`执行中`,subagentTool_done:`已返回`,subagentTool_error:`失败`,subagentTool_unknown:`结果未保留`,inspectionChanged:`当前会话已切换,请重新打开详情。`,inspectionUnavailable:`暂时无法读取详情。`,inspectionLoading:`正在读取状态…`,thinkingUnavailable:`暂时无法读取思考等级。`,trustUnavailable:`暂时无法读取项目信任状态。`,executionState:`状态`,terminalCommand:`命令`,copyTerminalCommand:`复制命令`,copyVisibleOutput:`复制当前可见{{stream}}`,copySetupCommand:`复制配置命令`,savedTrustDecision:`已保存决定`,activeSessionTrust:`当前会话信任`,trustDecision_trusted:`已信任`,trustDecision_denied:`已拒绝`,trustDecision_undecided:`未决定`,trustDecision_unknown:`未知`,trustActiveYes:`当前会话已信任`,trustActiveNo:`当前会话未信任`,terminalDirectory:`目录`,startedAt:`启动时间`,exitCode:`退出码`,detailTruncated:`部分详情已截断,以限制页面加载量。`,standardOutput:`标准输出`,standardError:`错误输出`,outputTruncated:`此输出视图省略了 {{count}} 字节。`,outputRecovery:`运行时报告已保留日志;此处仅显示有大小限制的片段。`,modelAndThinking:`模型与思考`,selectedModel:`当前模型`,thinkingLevel:`思考等级`,availableThinking:`支持的等级`,unknownState:`未知`,projectTrust:`项目信任`,trust_trusted:`当前会话信任此工作区。`,trust_untrusted:`此工作区的信任已被拒绝。`,trust_restricted:`项目资源受到限制,等待信任决定。`,trust_unknown:`尚无法确定信任状态。`,trustRefreshNeeded:`保存的信任决定与当前会话不同,请通过 Pi 刷新会话后生效。`,providerAvailability:`服务商凭据`,settings:`设置`,settingsNavigation:`设置导航`,generalSettings:`常规`,configurationSettings:`配置`,configurationIntro:`配置工具权限、网络访问与模型响应。`,configurationReadFailure:`无法安全读取配置。请修复设置文件后刷新。`,configurationUserScope:`用户配置`,configurationSetupHint:`响应与搜索选项通过 OpenPI setup 应用`,configurationApproval:`批准策略`,configurationApprovalDetail:`工具审批沿用已安装 Pi 扩展的权限机制。`,configurationPiPermissions:`由 Pi 扩展管理`,configurationSandbox:`沙箱设置`,configurationSandboxDetail:`工具使用宿主进程的权限运行。`,configurationSandboxUnavailable:`未提供 OS 沙箱`,configurationSearchDetail:`允许当前会话模型在支持时访问网络。`,configurationSearchOff:`不向当前模型提供原生搜索。`,configurationSearchOn:`在当前连接支持时允许原生搜索。`,configurationVerbosity:`输出详细程度`,configurationVerbosityDetail:`选择模型回复包含细节的详细程度。`,configurationResponsesUnavailable:`当前连接未使用支持的 Responses 接口。`,configurationVerbosity_default:`模型默认`,configurationVerbosity_low:`简短`,configurationVerbosity_medium:`适中`,configurationVerbosity_high:`详细`,configurationVerbosityHelp_low:`简短直接地回答,减少额外细节。`,configurationVerbosityHelp_medium:`给出必要解释与适量细节。`,configurationVerbosityHelp_high:`提供更完整的解释与细节。`,configurationVerbosityRequest:`只把 response_verbosity 设为 {{value}},保留其他 OpenPI 配置。`,configurationSummary:`推理摘要`,configurationSummaryDetail:`选择向支持的推理模型请求哪种摘要。`,configurationSummaryUnavailable:`当前连接不支持推理摘要。`,configurationSummary_default:`模型默认`,configurationSummary_auto:`自动`,configurationSummary_concise:`简洁`,configurationSummary_detailed:`详细`,configurationSummary_none:`关闭`,configurationSummaryHelp_auto:`由模型自动选择摘要长度。`,configurationSummaryHelp_concise:`请求简洁的推理摘要。`,configurationSummaryHelp_detailed:`请求较详细的推理摘要。`,configurationSummaryHelp_none:`不请求推理摘要;保留当前推理强度。`,configurationSummaryRequest:`只把 response_reasoning_summary 设为 {{value}},保留其他 OpenPI 配置。`,configurationModelFeatures:`模型功能`,configurationReasoningLevels:`可用推理强度`,configurationReasoningDetail:`选择在模型控件中显示哪些受支持的级别。当前级别仍会显示,推理强度不变。`,configurationReasoningCount:`已选择 {{count}} 个`,configurationDependencies:`工作空间依赖项`,configurationEnvironment:`本地运行环境`,configurationEnvironmentDetail:`Node.js、Python 等工具由当前环境提供。OpenPI 不安装捆绑的工作空间运行时。`,configurationRuntimeStatus:`运行状态`,browserSettings:`浏览器`,webSearchSettings:`联网搜索`,webSearchCurrentModel:`当前会话模型`,webSearchNativeDetail:`调用当前模型供应商的原生搜索,复用现有连接和凭据。`,webSearchSupported:`当前连接支持原生搜索。开启后,由模型决定何时联网。`,webSearchUnsupported:`当前连接不支持或尚未确认支持原生搜索,不提供搜索工具,也不会切换到其他供应商。`,webSearchNativeRequest:`开启联网搜索,使用当前会话模型的原生搜索和已有 Pi 凭据。不要切换模型、连接协议或搜索供应商;当前连接不支持或支持情况未知时,不提供搜索工具。`,webSearchIntro:`让模型搜索最新资料,并打开原始网页核实。`,webSearchPackageDetail:`通过可选 Pi 插件提供搜索、网页读取和 PDF 提取。`,webSearchDefaultOff:`默认关闭。可选扩展跟随当前会话模型,无需另填搜索密钥或安装插件。`,webSearchLoaded:`本会话已加载插件`,webSearchNotLoaded:`本会话尚未加载插件`,webSearchSource:`查看插件源码`,webSearchProfile:`搜索设置`,webSearchExa:`Exa — 无需 API 密钥`,webSearchExisting:`保留我已有的搜索偏好`,webSearchProfileHint:`Exa 提供搜索,网页由本机直接读取。已有偏好会原样保留;安装后也可更换搜索服务。`,webSearchEnable:`启用联网搜索…`,webSearchDisable:`关闭联网搜索…`,webSearchConfigure:`更换搜索服务…`,webSearchExaRequest:`启用可选联网搜索,使用 Pi Web Access 和无需 API 密钥的 Exa。让我审阅插件安装确认,保留其他偏好,不要自动重新加载。`,webSearchExistingRequest:`启用可选联网搜索,使用 Pi Web Access,原样保留我已有的搜索偏好。让我审阅插件安装确认,保留其他偏好,不要自动重新加载。`,webSearchDisableRequest:`关闭原生联网搜索。保留其他设置和会话记录。`,webSearchProviderRequest:`帮我更换已安装 Pi Web Access 插件的搜索服务。介绍可用服务与权限,保留无关偏好,密钥留在搜索插件中,不要自动重新加载。`,browserSettingsIntro:`让 OpenPI 阅读网页、点击、输入和截图。`,browserControl:`浏览器控制`,browserControlHint:`提交设置变更请求,保存配置后生效。`,browserDefault:`默认浏览器`,browserDefaultHint:`提交设置变更请求,选择未指定浏览器时使用的默认项。`,browserEmbedded:`OpenPI 内置浏览器`,browserAllowedTitle:`允许使用的浏览器`,browserOffHint:`下方选择将在开启浏览器控制后生效。`,browserConnected:`已连接`,browserNeedsSetup:`需要连接浏览器扩展`,browserNotFound:`未检测到此浏览器`,browserUpdateNeeded:`需要更新扩展`,browserBlocked:`未授权`,browserDefaultBlocked:`当前默认浏览器未获授权,请允许使用或更换默认值。`,browserSetUp:`设置`,browserManage:`管理`,browserSetupNamed:`设置 {{browser}}`,browserManageNamed:`管理 {{browser}}`,browserAllowNamed:`允许使用 {{browser}}`,browserMore:`更多浏览器`,browserSpeakHint:`对话中说“使用 Chrome …”,即可指定这次使用的浏览器。`,browserGuideTitle:`连接 {{browser}}`,browserGuideEyebrow:`跟着做,一次一步`,browserConnectionTitle:`连接状态`,browserCloseGuide:`收起浏览器设置引导`,browserConnectionReady:`连接正常,可选择是否允许 OpenPI 使用。`,browserEmbeddedDetail:`网页在 OpenPI 内打开。部分网站需要使用普通浏览器才能登录或正常显示。`,browserExternalDetail:`OpenPI 可以使用已连接的 {{browser}} 配置中的现有标签和登录状态。请在该配置中保留一个 OpenPI 标签页。`,browserManageExtension:`管理扩展`,browserAllowUse:`允许 OpenPI 使用`,browserMakeDefault:`设为默认`,browserInstallIn:`安装到`,browserInstallTitle:`安装 OpenPI Browser Bridge`,browserSetupSteps:`设置步骤`,browserGuidePopout:`在独立窗口中跟随操作`,browserGuideDetached:`引导已在独立窗口打开,可以对照浏览器设置逐步完成。`,browserShowGuide:`显示引导窗口`,browserGuideInline:`把引导放回这里`,browserGuideBlocked:`未能打开引导窗口。可允许弹出式窗口后重试,也可继续查看这里的步骤。`,browserSafariSettings:`Safari → 设置`,browserSafariDeveloper:`开发者设置`,browserSafariTemporary:`添加临时扩展…`,browserSafariOpenHint:`打开 Safari 后,在菜单栏选择「Safari → 设置」,对照此引导操作。需要 macOS 上的 Safari 26 或更新版本。`,browserSafariDeveloperTitle:`显示 Safari 开发者设置`,browserSafariDeveloperHint:`在「设置 → 高级」中开启「显示网页开发者功能」,再进入「开发者」标签。`,browserSafariLoadHint:`在「开发者」中点击「添加临时扩展」,选择下方文件夹。启用 OpenPI Browser Bridge,允许访问要控制的网站及本地 OpenPI 页面。退出 Safari 后需重新加载临时扩展。`,browserFirefoxThis:`此 Firefox`,browserFirefoxTemporary:`临时载入附加组件…`,browserFirefoxDeveloperTitle:`选择「此 Firefox」`,browserFirefoxDeveloperHint:`在 about:debugging 左侧选择「此 Firefox」。Firefox 不需要开启「开发者模式」开关。`,browserFirefoxLoadHint:`点击「临时载入附加组件」,选择下方文件夹中的 manifest.json。此安装在 Firefox 重启后失效;永久安装需要经过 Mozilla 签名的扩展包。`,browserFirefoxDone:`已选中,下一步`,browserStepCount:`第 {{step}} 步,共 {{total}} 步`,browserStepLabel:`第 {{step}} 步:{{label}}`,browserStepOpen:`打开扩展页`,browserStepAdd:`添加扩展`,browserStepConnect:`连接`,browserOpenManagerTitle:`打开 {{browser}} 扩展页`,browserOpenManagerHint:`从这里开始,我们会帮你打开对应的页面。`,browserOpenManager:`打开 {{browser}} 扩展页`,browserReopenManager:`重新打开扩展页`,browserAlreadyInstalled:`已经安装?直接连接`,browserDeveloperMode:`开发者模式`,browserDeveloperTitle:`开启「开发者模式」`,browserDeveloperHint:`在刚打开的扩展页,找到并开启「开发者模式」开关。`,browserDeveloperDone:`已开启,下一步`,browserIllustration:`操作示意 · 在 {{browser}} 中完成`,browserExtensions:`扩展程序`,browserLoadUnpacked:`加载已解压的扩展程序`,browserLoadHint:`在浏览器中点击「加载已解压的扩展程序」,选择下面的文件夹。`,browserFolderBundled:`已随 OpenPI 准备好`,browserOpenFolder:`打开文件夹`,browserFolderOpened:`扩展文件夹已打开。`,browserPathCopied:`已复制路径`,browserCopyFailed:`未能复制,请选中上方路径手动复制。`,browserChooseFolderMac:`在文件选择窗口按 ⌘ ⇧ G,粘贴路径并回车,再点击「选择」。`,browserChooseFolderOther:`在文件选择窗口的地址栏粘贴路径,再选择该文件夹。`,browserInstalledConnect:`已添加,连接 OpenPI`,browserPreviousStep:`上一步`,browserWaiting:`等待 OpenPI Browser Bridge 连接,连接后会自动进入下一步。`,browserInstallBrowserFirst:`请先安装 {{browser}},或在已安装的浏览器中打开当前 OpenPI 地址。`,browserConnectTitle:`连接 OpenPI`,browserConnectHint:`在 {{browser}} 中打开 OpenPI,使用刚安装扩展的浏览器配置。`,browserOpenIn:`在 {{browser}} 中打开`,browserAllowHint:`连接成功后,可以允许 OpenPI 使用此浏览器。安装扩展不会自动开启浏览器控制。`,browserCheck:`检查连接`,browserNotConnectedYet:`还未连接。请完成安装,在该浏览器中刷新 OpenPI 后再次检查。`,browserHelp:`设置帮助`,browserReloadHint:`已安装旧版?在扩展页重新加载 OpenPI Browser Bridge,再刷新 OpenPI。如浏览器提示权限,请完成其原生确认。`,browserSupportedHint:`Chrome、Edge、Brave、Chromium 145+ 可控制内置页面及普通标签。macOS Safari 26+、Firefox 128+ 通过兼容扩展控制普通标签,嵌套框架需单独打开。Safari、Firefox 的临时安装需在浏览器重启后重新加载。`,browserCopyPath:`复制扩展文件夹路径`,browserLoading:`正在检查浏览器连接…`,browserSaved:`已保存,浏览器权限立即生效。`,browserSaving:`正在保存…`,modelSettings:`模型`,skillsSettings:`技能`,subagentsSettings:`子代理`,pluginsSettings:`插件`,configureOpenPi:`配置 OpenPI`,setupRequestReviewAll:`和我一起检查全部 OpenPI 配置项`,setupRequestSetTheme:`仅将 OpenPI Web 主题设置为 {{value}},其他配置保持不变`,setupRequestSetChatWidth:`仅将 OpenPI Web 聊天内容宽度设置为 {{value}}px,其他配置保持不变`,setupRequestSetChatFontSize:`仅将 OpenPI Web 聊天字体大小设置为 {{value}}px,其他配置保持不变`,setupRequestEnableExpandedThinking:`仅将 OpenPI Web 的思考块改为默认展开,其他配置保持不变`,setupRequestDisableExpandedThinking:`仅将 OpenPI Web 的思考块改为默认折叠,其他配置保持不变`,setupRequestSubagents:`检查并配置 Agent 角色模型和工作流上限`,setupRequestFailed:`OpenPI 配置请求未被接收。`,setupRequestRunning:`正在应用 OpenPI 设置…`,setupRequestAccepted:`配置请求已接收。`,setupPlanBlocked:`Agent 配置需先退出 Plan 模式;显示设置可直接调整。退出不会开始实施计划。`,setupPlanBusy:`Agent 配置需等待当前回合结束并退出 Plan 模式;显示设置可直接调整。`,setupOutcome_pending:`配置请求正在处理,尚未收到保存回执。`,toolCallArguments:`工具参数`,toolCallOutput:`工具结果`,setupOutcome_saved:`OpenPI 配置已保存并应用。`,setupOutcome_unchanged:`配置已保存,实际设置没有变化。`,setupOutcome_failed:`配置请求失败,请查看错误和当前设置后再重试。`,setupOutcome_cancelled:`配置过程已取消,未确认成功保存。`,setupOutcome_unconfirmed:`本次未确认成功保存,请核对当前设置后再运行 /openpi-setup。`,settingsUpdateFailed:`无法保存 Web 显示设置。`,settingsPreferencesSaved:`显示设置已保存。`,settingsPreferencesSaveFailed:`无法保存显示设置,请检查配置诊断后重试。`,settingsCatalogLoading:`正在加载 Pi 资源…`,settingsCatalogFailed:`无法加载 Pi 设置资源。`,appearance:`外观`,settingsPersonal:`个人`,settingsAgent:`Agent`,settingsIntegrations:`集成`,settingsArchivedChats:`已归档聊天`,settingsSearch:`搜索设置`,settingsClearSearch:`清除搜索`,settingsNoResults:`没有匹配的设置`,appearanceVisualStyle:`视觉风格`,appearanceMode:`模式`,appearanceTheme:`主题`,appearanceAccent:`强调色`,appearanceBackground:`背景`,appearanceForeground:`前景`,appearanceFont:`字体`,appearanceFont_codex:`Codex 默认`,appearanceFont_sans:`无衬线`,appearanceFont_serif:`衬线`,appearanceFont_mono:`等宽`,appearanceAccent0:`默认`,appearanceAccent1:`蓝色`,appearanceAccent2:`紫色`,appearanceAccent3:`粉色`,appearanceAccent4:`橙色`,appearanceAccent5:`绿色`,appearanceCustomAccent:`自定义强调色`,appearanceAdvanced:`高级`,appearanceReset:`恢复默认设置`,appearanceResetAction:`重置外观`,appearanceImport:`导入主题`,appearanceCopy:`复制主题`,appearanceCopied:`主题已复制`,appearanceCopyFailed:`无法复制主题,请重试。`,appearanceThemeValue:`主题数据`,appearanceImportPlaceholder:`粘贴 OpenPI 主题…`,appearanceImportInvalid:`请输入有效的 OpenPI 主题数据。`,appearanceImportAction:`导入`,searchArchivedChats:`搜索已归档聊天`,archiveProjectFilter:`按项目筛选`,archiveAllProjects:`所有项目`,archiveProjectGroup:`{{project}} · {{count}} 条归档聊天`,archiveSort:`归档聊天排序`,archiveSortUpdated:`最近更新`,archiveSortCreated:`创建时间`,restoreArchivedChat:`恢复 {{title}}`,themeLight:`浅色`,themeDark:`深色`,themeMist:`雾青`,themeRose:`蔷薇`,themePine:`松夜`,themeSystem:`跟随系统`,conversationSettings:`对话`,expandThinkingByDefault:`默认展开思考块`,chatContentWidth:`聊天内容宽度`,chatFontSize:`聊天字体大小`,agentBehavior:`Agent 行为`,capabilityDiscovery:`能力发现`,capabilityDiscovery_explicit:`明确请求`,capabilityDiscovery_adaptive:`自适应`,workflowLimits:`工作流上限`,workflowConcurrency:`工作流并行上限`,workflowCalls:`总调用次数`,agentSettingsSetupHint:`Agent 设置通过当前会话中的 /openpi-setup 生效。`,setupRequestDiscovery:`将能力发现设置为 {{mode}},保留其他配置。`,setupRequestLimits:`将工作流并行上限设置为 {{concurrency}},总子代理调用上限设置为 {{calls}},保留其他配置。`,setupRequestEnableSuggestions:`启用下一步建议。如需模型配置,请帮助我选择模型,保留其他配置。`,setupRequestDisableSuggestions:`关闭下一步建议,保留其他配置。`,setupRequestPostEdit:`帮我配置或关闭编辑后命令。先展示当前配置,再询问要使用的命令。`,configurePostEdit:`配置编辑后命令`,workflowLimitsValue:`并行 {{concurrency}} · 总调用 {{calls}}`,nextActionSuggestions:`下一步建议`,enabled:`已启用`,disabled:`已关闭`,configured:`已配置`,postEditCommand:`编辑后命令`,resultDisplay:`默认结果显示`,subagentResults:`子代理结果`,bashOperations:`Bash 操作`,fileMutations:`Write / Edit 操作`,footer:`页脚`,terminalFooter:`Pi 终端页脚`,terminalFooterStyle:`终端页脚样式`,terminalFooterHint:`影响 Pi 命令行界面的页脚;已打开的 Pi 界面在下次启动或配置应用后更新。`,detailDisplay_full:`完整`,detailDisplay_compact:`紧凑`,sessionSettings:`会话`,currentModel:`当前`,useThisModel:`使用此模型`,model:`模型`,modelConnection:`模型连接`,provider:`服务商`,modelId:`模型 ID`,providerStatusUnavailable:`此服务商不在当前有界认证快照中。`,providerSettings:`服务商凭据`,providerSettingsIntro:`查看当前 Web 会话可通过哪些 Pi 服务商完成认证。`,openRuntimeDetails:`打开运行详情`,currentWorkspace:`当前工作区`,providerAuth_api_key:`API 密钥`,providerAuth_oauth:`OAuth`,providerAuthUnknown:`未报告认证方式`,authentication:`认证方式`,accessType:`访问方式`,providerAccessSubscription:`订阅账户`,providerAccessStandard:`服务商凭据`,configurationOwner:`配置归属`,providerLoading:`正在加载服务商状态…`,providerLoadFailed:`无法加载服务商状态。`,providerReadOnly:`由 Pi 管理`,selectProvider:`选择服务商`,gitReviewBaselineUnavailable:`未保留可用的会话基线,可能超出了捕获限额。请切换到未暂存、已暂存或分支查看 Git 变更,也可打开本会话文件记录。`,modelsIntro:`登录账户或添加 API 密钥。已有的 Pi 连接也会显示在这里。`,accountLoginMethod:`连接方式`,accountLoginTab:`账户登录`,accountLoginChatGPT:`ChatGPT 账户`,accountLoginClaude:`Claude 账户`,accountLoginKeyTab:`API 密钥`,accountLoginConfigured:`账户已登录`,accountLoginIntro:`在浏览器中完成授权,无需填写 API 密钥。`,accountLoginExisting:`账户凭据已保存在 Pi 中。`,accountLoginStart:`登录`,accountLoginAgain:`重新登录`,accountLoginUnsaved:`请先保存或放弃其他修改,再登录账户。`,accountLoginStarting:`正在准备登录…`,accountLoginWaiting:`等待账户授权`,accountLoginChoose:`选择登录方式`,accountLoginCancelling:`正在取消登录…`,accountLoginBrowser:`在浏览器中继续`,accountLoginDevice:`使用设备码登录`,accountLoginBrowserOption:`在当前电脑上登录,完成后自动返回。`,accountLoginDeviceOption:`适合远程服务器,或无法自动返回的情况。`,accountLoginBrowserHelp:`打开登录页并完成授权,这里会自动更新。`,accountLoginDeviceHelp:`打开授权页并输入下方代码,请保持此页面打开。`,accountLoginOpen:`打开登录页`,accountLoginCopyCode:`复制设备码`,accountLoginPaste:`授权码或回调地址`,accountLoginContinue:`继续`,accountLoginFallback:`已登录,但这里没有更新?`,accountLoginRemoteHelp:`如果无法自动返回,请复制浏览器最后的回调地址,并粘贴到下方。`,accountLoginCancel:`取消登录`,accountLogin_failed:`登录未完成,请重试或选择其他登录方式。`,accountLogin_expired:`登录已过期,请重新开始获取新的授权链接。`,accountLogin_cancelled:`已取消登录。`,accountLoginRequestFailed:`请求未完成,请先刷新状态再重试。`,accountLoginStatusUnknown:`暂时无法查询登录状态,账户授权可能仍在进行。`,accountLoginRefreshRequired:`凭据已保存,但 Pi 未能更新模型列表。请重载 Pi 后使用此连接。`,accountLogout:`退出登录`,accountLogoutRefreshRequired:`已移除保存的凭据,但 Pi 未能更新模型列表。请重载 Pi 刷新状态。`,accountLogoutTitle:`退出 {{provider}}?`,accountLogoutDetail:`将移除此电脑上 Pi 保存的该服务凭据,其他使用它的 Pi 会话也需要重新登录。环境凭据不受影响。`,providerInputTypes:`输入类型`,providerInputText:`文本`,providerInputImage:`图片`,providerCustomTag:`自定义`,providerEdit:`编辑`,providerRemove:`删除`,providerSave:`保存`,editProvider:`编辑 {{provider}}`,removeProvider:`删除 {{provider}}`,providerAdd:`添加模型提供商`,providerAddMode:`添加方式`,providerAddCatalog:`第三方模型提供商`,providerAddCustom:`自定义模型 API`,providerAccountHint:`使用已有账户连接模型,选择服务商后前往浏览器授权。`,providerCatalogHint:`从内置目录中选择提供商,填入其 API 密钥即可使用。`,providerCustomHint:`连接中转站、自部署服务或其他兼容 OpenAI / Anthropic 协议的接口,需填写 API 地址、协议和模型。`,providerKeyKeep:`已配置密钥,留空保持不变`,providerKeyOptional:`输入 API 密钥,或留空使用环境认证`,providerDisplayName:`提供商名称`,providerCustomSettings:`自定义设置`,providerSaved:`已保存 {{provider}}。`,modelDefaultTitle:`新会话默认模型`,modelDefaultChoose:`选择模型`,modelDefaultBadge:`默认`,modelCurrentBadge:`当前使用`,modelDefaultNotSet:`未设置 · 新会话启动时由 Pi 选择`,modelDefaultHint:`选择以后新会话使用的模型,已有会话保留自己的选择。此设置也会更新 Pi 的默认模型。`,modelDefaultReadFailed:`暂时无法读取默认模型。`,modelDefaultProjectOverride:`此工作区有 Pi 独立设置:{{model}}。`,modelDefaultSave:`保存默认模型`,modelMakeDefault:`同时设为新会话默认模型`,modelDefaultSaveFailed:`默认模型保存尚未确认,请刷新状态后重试。`,modelDefaultPartial:`当前模型已切换,但默认模型保存尚未确认,请刷新状态后再试。`,modelConnectionNextHint:`从此连接选择一个模型,用于当前会话。`,modelConnectionSearch:`搜索模型…`,modelConnectionChooseProvider:`选择 {{provider}} 的模型`,modelConnectionUse:`用于当前会话`,modelConnectionUseFailed:`模型切换尚未确认,请刷新模型列表后重试。`,modelConnectionLoadFailed:`暂时无法读取模型列表。`,modelConnectionNoModels:`暂无可选模型,请检查连接或添加模型定义。`,modelConnectionNoMatch:`没有匹配的模型。`,modelConnectionMore:`还有 {{count}} 个模型,可搜索缩小范围。`,providerModelsEmpty:`还没有模型,获取可用模型或手动添加。`,providerModelsInherited:`使用提供商的内置模型目录。`,providerModelsReadOnly:`此提供商包含当前页面未支持的模型设置,请在 Pi 配置文件中编辑。`,providerModelId:`模型 {{number}} ID`,providerModelName:`模型 {{number}} 名称`,providerModelDetails:`模型参数:{{model}}`,providerRemoveModel:`删除模型:{{model}}`,providerIdInvalid:`请使用未被占用的提供商 ID,仅包含字母、数字、连字符、点或下划线。`,providerNativeAuth:`此提供商使用 Pi 原生登录。`,providerConfigurationFailed:`保存失败,请检查填写内容,并在会话空闲时重试。`,providerProfileSavedKeyFailed:`提供商配置已保存,但密钥保存失败。重试将只保存密钥。`,providerReload:`放弃草稿并重新加载`,providerCurrentRemoval:`请先切换当前使用的模型,再删除。`,providerRemoveDetail:`删除此提供商的配置和自定义模型?由 Pi 管理的凭据将保留。`,providerPickerIntro:`以下是模型提供商的可用模型,勾选要添加的模型。`,providerPickerSelected:`已选 {{count}} 个`,providerApiKey:`API 密钥`,providerKeyPlaceholder:`粘贴密钥以添加或替换`,saveProviderKey:`保存密钥`,savingSettings:`正在保存…`,keepEditing:`继续编辑`,discardAndContinue:`放弃更改并继续`,unsavedSettingsTitle:`放弃未保存的更改?`,unsavedSettingsDetail:`未保存的模型和凭据修改将被丢弃。`,unsavedCredentialTitle:`放弃未保存的凭据?`,unsavedCredentialDetail:`新密钥尚未保存,继续后将清空。`,modelSelectionBusy:`当前会话忙碌,暂不能切换模型。`,providerKeySaved:`已保存到 Pi 凭据存储。已有密钥不会回显。`,providerSaveFailed:`密钥保存未完成。请等待会话空闲,刷新状态后重试;部分服务商需要额外认证信息。`,providerWriteDetail:`在这里直接保存到 Pi 凭据存储,密钥不会进入模型对话。OAuth 或需要额外字段的认证请使用 Pi 原生登录。`,editModelConfiguration:`添加或编辑自定义模型`,modelConfigurationDetail:`先设置提供商连接,再获取模型列表或手动添加。保存配置不会调用模型。`,configuredModels:`自定义模型配置`,addModel:`添加模型`,modelConfig_provider:`服务商 ID`,modelConfig_id:`模型 ID`,modelConfig_name:`显示名称`,modelConfig_baseUrl:`API 地址`,modelConfig_api:`API 格式`,modelConfig_contextWindow:`上下文窗口`,modelConfig_maxTokens:`最大输出 token 数`,providerCapacityLabel:`{{field}} {{number}}`,providerModelOptions:`模型选项`,providerModelInvalid:`模型 {{number}}:模型 ID 不能为空或重复;容量需为正数,例如 128K 或 1M,留空使用默认值。`,modelConfig_reasoning:`支持推理`,saveModelConfiguration:`保存模型`,reloadModelConfiguration:`放弃草稿并载入最新配置`,retryModelConfiguration:`重试读取`,discardModelDraftTitle:`放弃这份模型草稿?`,discardModelDraftDetail:`最新配置将替换这份未保存的草稿。`,discardAndReload:`放弃并重新载入`,modelConfigurationUnsaved:`未保存的更改`,modelConfigurationConflict:`模型配置已在别处更改,当前草稿已保留。`,modelConfigurationLoadFailed:`无法读取模型配置,草稿已保留。`,modelConfigurationSaved:`已保存到 Pi models.json。配置服务商密钥后即可选择此模型。`,modelConfigurationFailed:`模型保存未完成,草稿已保留。`,setupConfigurationRequest:`配置需求`,configureViaSetup:`通过 OpenPI setup 应用`,setupFormDetail:`统一走 /openpi-setup。请在对话中查看进度及必要的确认;提交成功不等于配置已保存。`,setupSkillsPlaceholder:`填写要添加或调整的技能,以及来源或本地路径`,setupPluginsPlaceholder:`填写要配置的 Pi 插件,以及准确的包名或本地路径`,enableSkillInvocation:`允许模型调用`,disableSkillInvocation:`改为仅显式调用`,setupSkillInvocationRequest:`配置这个 Pi 技能:{{path}}。将原生 disable-model-invocation 字段设为 {{disabled}},保留其余内容,并说明何时生效。`,setupRoleFormRequest:`将 OpenPI 的 {{role}} 角色配置为使用 {{model}},工作流并发设为 {{concurrency}}。推理级别继承父会话,校验选择有效性,并保留其他配置。`,providerReadOnlyDetail:`此页面只读且不会接收凭据内容。请通过 Pi 配置服务商认证,然后刷新此状态。`,openProviderSettings:`打开服务商设置`,credentialConfigured:`已配置`,credentialMissing:`未配置`,authNotVerified:`凭据已配置不代表模型请求一定成功。`,configurationViaPi:`此处为只读状态。模型凭据与信任由 Pi 管理,OpenPI 选项通过 /openpi-setup 配置。`,noSkillsFound:`当前会话没有加载技能。`,addSkill:`添加技能`,addPlugin:`添加插件`,searchResources:`搜索名称或来源`,filterResourceScope:`资源范围`,allResourceScopes:`全部范围`,noMatchingResources:`没有匹配的资源`,resourceBulkTooLarge:`请进一步筛选列表后,再提交批量配置请求。`,resourceManagement:`Pi 资源`,resourceSourceAuto:`Pi 自动发现`,resourceSourceLocal:`本地资源`,resourcePackageSource:`软件包、仓库或本地路径`,resourcePackageSourcePlaceholder:`npm:包名@版本 · git:owner/repo · /path/to/skill`,resourceInstallIntro:`选择来源和范围,在对话中通过 OpenPI setup 审查并应用。`,resourceInstallReview:`请在对话中确认准确来源和权限。提交请求不代表已安装或已加载。`,resourceRequestSubmitted:`请求已提交。请在对话中查看进度和确认,完成后刷新此目录。`,browseSkills:`浏览 skills.sh 技能`,resourceSessionState:`应用到当前会话`,resourcesReloadNote:`刷新只读取目录;重新加载才会将已保存的资源应用到空闲会话。配置变更不会自动重新加载。`,reloadResources:`重新加载资源`,resourceReloadReview:`将已保存的 Pi 技能与插件配置应用到当前会话,并重新启动扩展?请先等待运行中的工作结束。`,resourceReloaded:`资源已重新加载,请查看更新后的目录和诊断。`,resourceReloadFailed:`无法重新加载资源。请等待当前会话空闲,刷新后重试。`,advancedResourceConfiguration:`高级配置`,resourceDiagnostics:`Pi 报告了 {{extensionErrors}} 项扩展诊断与 {{skillErrors}} 项技能诊断。`,resourceConfigurationDiagnostics:`{{count}} 项设置读取失败,请检查 Pi 配置诊断。`,resourceCatalogTruncated:`此目录有数量上限,部分资源未展示。`,resourceTargetTruncated:`此来源或路径已截断,请通过高级配置确认完整目标后再进行管理。`,updateResource:`检查更新`,removeResource:`审查移除`,skillsEmptyTitle:`添加你的第一个技能`,skillsEmptyIntro:`技能为 Pi 提供可复用的指引。可以添加软件包、仓库或本地技能;项目技能遵循 Pi 的项目信任。`,pluginsEmptyTitle:`用插件扩展 Pi`,pluginsEmptyIntro:`软件包可以包含扩展、技能、提示词和主题。添加来源后,通过 OpenPI setup 审查安装。`,pluginCount:`{{count}} 个插件来源`,installedVersion:`已安装版本`,configuredVersion:`配置版本`,resourceVersionUnpinned:`未固定版本 / 本地来源`,pluginState_loaded:`本会话资源已加载`,pluginState_installed:`已安装 · 未加载`,pluginState_disabled:`配置已禁用`,pluginState_missing:`软件包缺失`,pluginState_error:`加载诊断`,pluginState_notLoaded:`未加载`,pluginLoadedResources:`当前会话目录包含 {{count}} 项资源。配置变更需要明确重新加载后才会应用。`,pluginAction_enable:`审查启用`,pluginAction_disable:`审查禁用`,pluginAction_update:`检查更新`,pluginAction_remove:`审查移除`,enableVisibleSkills:`允许模型使用(当前 {{count}} 项)`,disableVisibleSkills:`仅显式调用(当前 {{count}} 项)`,enableVisiblePlugins:`启用当前 {{count}} 个软件包`,disableVisiblePlugins:`禁用当前 {{count}} 个软件包`,setupResourceInstallRequest:`添加 Pi {{kind}},来源为 {{source}},范围为 {{scope}}。先检查来源并确定固定的软件包身份,通过 ask_user 与我确认安装权限,再使用 Pi 原生的软件包或技能配置。添加技能时保留其他扩展和资源。保留现有偏好与项目信任,不要自动重新加载当前会话。分别报告已保存的配置与仍需执行的操作,不要改动无关的 OpenPI 设置。`,setupPluginOperationRequest:`审查 Pi 软件包操作 {{action}},只针对配置来源 {{source}}、原生安装目录 {{path}}、范围 {{scope}}。相对来源应以该范围的原生设置目录解析。使用 Pi 原生包管理;更新时检查可用版本,通过 ask_user 与我确认固定的目标身份和安装权限。保留资源过滤器及所有无关偏好;如果切换会破坏过滤器,停止并说明。移除时不得删除本地来源目录。不要自动重新加载,分别报告已持久化与当前会话状态,不要改动无关的 OpenPI 设置。`,setupSkillManageRequest:`审查 Pi 技能操作 {{action}},只针对文件 {{path}}、来源 {{source}}、范围 {{scope}}。先检查原生资源归属,通过 ask_user 与我确认更新或移除及所需权限。保留无关技能与软件包资源,不要为了移除一个技能删除整个共享软件包。保留项目信任,不要自动重新加载,也不要改动无关的 OpenPI 设置。`,setupSkillsBulkRequest:`只针对当前展示的 Pi 技能文件 {{paths}},将原生 disable-model-invocation 设为 {{disabled}}。检查资源归属,保留其余内容和偏好,与我审查必要变更,报告无法安全修改的文件。显式 /skill 调用仍应可用。不要自动重新加载,也不要改动无关的 OpenPI 设置。`,setupPluginsBulkRequest:`只针对当前展示的 Pi 软件包 {{packages}},通过 Pi 原生配置将 disabled 设为 {{disabled}}。保留其他偏好与资源过滤器;无法保留过滤器的条目应跳过并报告。遵循范围与项目信任,与我审查必要变更,不要自动重新加载,也不要改动无关的 OpenPI 设置。`,resourceRequestFinished:`配置回合已结束。请刷新并查看 Pi 原生配置与会话资源,确认实际变更。`,skillCount_one:`{{count}} 个技能`,skillCount_other:`{{count}} 个技能`,skill:`技能`,copySkillInvocation:`复制调用命令`,source:`来源`,scope:`范围`,invocation:`调用方式`,modelInvocation:`模型调用`,resourceScope_user:`全局`,resourceScope_project:`项目`,resourceScope_temporary:`临时`,explicitOnly:`仅允许明确调用`,availableToModel:`模型可按需使用`,skillFile:`技能文件`,selectSkill:`选择一个技能`,subagentConfiguration:`Pi 原生子代理角色`,subagentConfigurationIntro:`未在 OpenPI 配置中指定模型时,角色继承父会话模型。`,subagentActiveCount_one:`{{count}} 个运行中`,subagentActiveCount_other:`{{count}} 个运行中`,subagentCompletedCount_one:`{{count}} 条记录`,subagentCompletedCount_other:`{{count}} 条记录`,subagentConcurrency:`上限 {{count}}`,builtInRoles:`内置角色`,subagentRole_explorer:`探索者`,subagentRole_implementer:`实现者`,subagentRole_reviewer:`审查者`,subagentRole_advisor:`顾问`,subagentRoleShort_explorer:`只读调查`,subagentRoleShort_implementer:`聚焦实现`,subagentRoleShort_reviewer:`正确性审查`,subagentRoleShort_advisor:`技术分析`,subagentRoleDescription_explorer:`调查代码库并报告证据,不修改文件。`,subagentRoleDescription_implementer:`实现边界明确的改动并运行相关仓库检查。`,subagentRoleDescription_reviewer:`审查正确性、安全性、回归风险和缺失验证。`,subagentRoleDescription_advisor:`分析困难技术问题并提出具体下一步建议。`,configureRoles:`配置角色`,builtInRole:`内置角色`,builtIn:`内置`,modelAssignment:`模型分配`,inheritParentModel:`继承父会话模型`,effectiveModel:`实际模型`,workflowConcurrencyLabel:`并行 Agent`,workflowCallLimit:`Agent 总调用数`,runtimeBoundaries:`运行时边界`,subagentAuthorityNote:`子会话权限是父会话与角色能力的故障关闭交集,不会静默扩大权限。`,subagentModelNote:`不会硬编码服务商;未分配的角色继承父会话模型和思考等级。`,resourceCount_one:`{{count}} 项资源`,resourceCount_other:`{{count}} 项资源`,noPluginsFound:`Pi 未报告已加载的插件来源。`,pluginCatalogTotals:`{{extensions}} 扩展 · {{skills}} 技能 · {{prompts}} 提示词 · {{themes}} 主题`,loaded:`已加载`,resourceOrigin:`来源类型`,resourceOrigin_package:`软件包`,resourceOrigin_topLevel:`顶层资源`,resources:`资源`,baseDirectory:`基础目录`,notReported:`未报告`,extensions:`扩展`,extensionSurfaceCount:`{{tools}} 个工具 · {{commands}} 个命令`,prompts:`提示词`,themes:`主题`,pluginResourceSummary:`{{extensions}} 扩展 · {{skills}} 技能 · {{prompts}} 提示词 · {{themes}} 主题`,pluginsManagedByPi:`这些资源由 Pi 加载。可通过上方 setup 表单提交变更;软件包操作沿用原生确认,并通过 Pi 的重新加载流程生效。`,selectPlugin:`选择一个插件来源`,statusCaptured:`采集于 {{time}} · 刷新查看最新状态`,conversationViews:`会话视图`,currentConversations:`当前`,archivedConversations:`已归档`,refreshArchives:`刷新归档会话`,loadingArchives:`正在加载归档会话...`,moreArchives:`加载更多归档会话`,retryArchives:`重试读取归档会话`,archiveLoadFailed:`无法加载归档会话。`,archiveCursorStale:`归档会话已变化,请刷新后继续。`,archiveScanBounded:`还有 {{count}} 条更早记录未扫描。`,noArchivedSessions:`没有归档会话。`,noScannedArchives:`已扫描历史中没有归档会话。`,noMatchingScannedArchives:`已扫描历史中没有匹配的归档会话。`,draftLimit:`草稿暂存已满,请先发送或清空已有草稿。`,restoreConversation:`恢复会话`,restoringConversation:`正在恢复…`,loadedArchives:`已加载历史中的归档会话`,loadedHistoryBounded:`另有 {{sessions}} 个会话和 {{workspaces}} 个工作区摘要未加载。搜索仅覆盖已加载列表。`,noLoadedArchives:`已加载列表中没有归档会话。`,restoreFailed:`暂时无法确认恢复结果,请刷新后重试。`,execution_running:`运行中`,execution_done:`已完成`,execution_killed:`已停止`,execution_timed_out:`已超时`,execution_failed:`失败`,execution_uncertain:`状态不确定`,activeOnlyHint:`只有当前 Web 会话可以接收消息。`,stopTurn:`停止当前轮次`,stoppingTurn:`正在停止当前轮次…`,stoppedTurn:`当前轮次已停止。`,pendingFollowUpsHint:`{{count}} 条消息正在排队`,sendNextTurn:`下一轮发送`,steerCurrentTurn:`当前执行纠偏`,steeringHint:`在当前工具步骤结束后加入这条指示。`,pendingSteeringHint:`已接收 {{count}} 条纠偏指示,等待当前工具步骤结束`,steeringMessagesTitle:`当前轮次待处理的纠偏指示`,steerStaleTurn:`目标轮次已结束或变化。草稿已保留,请重新选择发送方式。`,sourceFeedbackNew:`{{path}} · 新版本第 {{line}} 行`,sourceFeedbackOld:`{{path}} · 旧版本第 {{line}} 行`,forkMessage:`从此处分叉`,forkMessageHint:`从此消息创建新聊天,保留原聊天;不会自动发送消息。`,forkSessionPending:`正在创建分叉会话…`,forkSessionCreated:`已创建分叉会话,原会话保留在侧栏。`,forkSessionCancelled:`分叉已取消,原会话已保留。`,forkSessionUncertain:`无法确认分叉结果。请先刷新并检查会话列表,再决定是否重试。`,forkSessionUnavailable:`切换到此会话并等待当前执行和排队消息结束后,可以从这里创建新会话。`,reviewQuoteLine:`引用此行`,reviewSelectOldLine:`选择旧版本第 {{line}} 行`,reviewSelectNewLine:`选择新版本第 {{line}} 行`,queuedMore:`还有 {{count}} 条排队消息`,queuedImage:`图片附件`,queuedMessageExpand:`展开排队消息`,queuedMessageCollapse:`收起排队消息`,backgroundSessionRunning:`此会话正在后台运行…`,observedSessionTools:`{{count}} 个正在执行的工具`,toolsRequireCurrentSession:`切换到此会话后可使用交互工具。`,activateViewedSession:`切换到此会话`,activateViewedSessionHint:`发送消息即可继续此会话。`,acceptedHint:`OpenPI Web 已接收消息。`,promptAdmissionUnknown:`无法确认上次发送的消息是否已被接收。`,promptAdmissionUnknownDetail:`请先核对已刷新的会话历史和运行状态,再决定下一步。作为新消息发送可能产生重复消息。`,promptAdmissionCheckingDetail:`正在核对最新的会话历史和运行状态,核对完成前不能作为新消息发送。`,promptAdmissionVerificationFailedDetail:`暂时无法刷新最新的会话历史和运行状态。请重新核对后再决定是否作为新消息发送。`,abandonAdmission:`暂不重新发送`,retryAdmissionCheck:`重新核对`,retryOriginalAdmission:`重试原消息`,promptTooLong:`文本超出发送上限({{count}} / {{limit}})。`,sendAsNew:`作为新消息发送`,sendingAsNew:`正在发送…`,addWorkspace:`添加工作区`,addWorkspaceMenu:`添加工作区...`,archiveConversation:`归档会话`,pinnedConversations:`置顶`,sidebarOptions:`侧栏选项`,sidebarProjectOptions:`项目侧栏选项`,sidebarRecentOptions:`会话侧栏选项`,sidebarActivityOptions:`动态视图选项`,sidebarShow:`显示`,sidebarGroupBy:`会话分组`,sidebarByProject:`按项目分组`,sidebarFlatList:`所有会话`,sidebarChatSort:`会话排序`,sidebarRecent:`最近`,sidebarProjectsInRecents:`在最近列表显示项目会话`,sidebarShowMore:`展开显示`,sidebarShowLess:`收起显示`,sidebarFilterList:`筛选当前列表`,sidebarSaveFailed:`更改未能保存,请重试。`,pinWorkspace:`置顶项目`,unpinWorkspace:`取消置顶项目`,markConversationRead:`标记为已读`,markConversationUnread:`标记为未读`,sidebarState_unread:`未读会话`,sidebarActivity:`动态`,sidebarViewActivity:`查看动态`,sidebarViewChats:`查看会话`,sidebarPriority:`优先关注`,sidebarActivityEmpty:`没有需要关注的会话`,sidebarActivityEmptyHint:`已完成的工作和需要你处理的会话会显示在这里。`,sidebarMarkAllRead:`全部标记为已读`,sidebarClearRead:`清除优先关注中的已读会话`,sidebarReadFailed:`未能更新已读状态,请重试。`,sidebarToday:`今天`,sidebarYesterday:`昨天`,sidebarEarlier:`更早`,sidebarActivityCompleted:`已完成`,sidebarActivityFailed:`执行失败`,sidebarActivityRead:`已读`,modelAdvanced:`高级参数`,providerConnectionHeading:`提供商连接`,providerFetchModels:`获取可用模型`,providerFetchHint:`填写提供商和端点后,可一次选择多个模型。`,providerPickerTitle:`选择要添加的模型`,providerPickerAccess:`连接凭据`,providerPickerKey:`访问密钥(可选)`,providerPickerKeyHint:`留空使用此端点已保存的凭据。此处输入的密钥仅用于获取列表,不会保存。`,providerPickerSearch:`搜索模型`,providerPickerSelectAll:`全选`,providerPickerClear:`清空选择`,providerPickerLoading:`正在获取可用模型…`,providerPickerAdded:`已添加`,providerPickerNoMatch:`没有匹配的模型`,providerPickerEmpty:`提供商没有返回模型,仍可手动添加。`,providerPickerBounded:`当前显示前 500 个模型,其他模型可手动填写 ID。`,providerPickerError_load:`未能获取模型列表,请检查端点和凭据后重试,也可以手动添加。`,providerPickerError_save:`尚未确认保存成功。已保留你的选择,请检查连接后重试。`,providerPickerError_conflict:`配置已在其他地方更新,请关闭弹窗、重新读取配置后再保存。`,providerPickerDefaults:`新模型使用 {{context}} 上下文 / {{output}} 输出 token,添加后可逐个调整。`,providerPickerRetry:`刷新列表`,providerPickerCount:`已选 {{count}} 个 · 最多 100 个`,providerPickerSave:`添加所选`,sidebarState_running:`执行中`,sidebarState_compacting:`正在整理上下文`,sidebarState_waiting:`等待你的回复`,sidebarState_completed:`已完成 · 结果未读`,sidebarState_failed:`执行失败 · 打开会话查看详情`,pinnedOptions:`置顶选项`,pinConversation:`置顶会话`,unpinConversation:`取消置顶`,pinnedRecentlyUpdated:`最近更新`,pinnedManualOrder:`手动排序`,movePinUp:`上移`,movePinDown:`下移`,pinSaveFailed:`置顶设置未能保存,请重试。`,cancel:`取消`,chooseWorkspaceHint:`选择工作区并描述任务`,close:`关闭`,closeSearch:`关闭搜索`,collapseSidebar:`收起侧边栏`,confirmEdit:`保存并重新运行`,editMessageHint:`从这里创建新分支并重新运行;保留原对话、图片和文件引用。已有工作区改动会保留。`,regenerateMessage:`重新生成回答`,regenerateMessageHint:`在新分支重新运行这条问题,保留原附件和原对话。`,messageRerunStarted:`已在新分支接收重跑消息,原对话已保留。`,openOriginalConversation:`查看原对话`,messageRerunWorkspaceHint:`已有工作区改动会保留。`,modelRequestRecovered:`请求已恢复`,modelReconnecting:`正在重新连接`,modelReconnectUnknown:`重连状态待确认`,modelEarlierAttempts:`先前请求错误`,modelFailedAttempts:`失败尝试({{count}} 次)`,draftStorageUnavailable:`草稿未能保存到此设备,请保持页面打开或复制消息。`,draftStorageInvalid:`部分保存的草稿内容无法恢复,请检查消息和附件。`,draftStorageRetry:`重试保存草稿`,workbarBackToChat:`返回聊天`,workbarCollapseTools:`收起工具栏`,workbarEndTerminal:`关闭 {{name}} 并结束进程`,workbarNewTerminal:`新建终端`,workbarContinueInChat:`继续追问`,transcriptSearch:`搜索消息内容`,transcriptSearchPlaceholder:`搜索标题、项目或消息…`,transcriptSearchRecent:`最近会话`,transcriptSearchSessions:`会话`,transcriptSearchMessages:`消息内容`,transcriptSearchSessionResult:`打开会话 {{session}}`,transcriptSearchSessionOpenFailed:`暂时无法打开此会话,请重试。`,transcriptSearchIncludeArchived:`包含归档会话`,transcriptSearching:`正在搜索消息…`,transcriptSearchEmpty:`没有匹配的消息。`,transcriptSearchFailed:`暂时无法搜索消息,请重试。`,transcriptSearchRetry:`重试搜索`,transcriptSearchPartial:`部分历史未能搜索,结果可能不完整。`,transcriptSearchOpenFailed:`无法打开这条消息,它可能已移动或位于其他分支。`,transcriptSearchResult:`打开 {{session}} 中来自{{source}}的消息`,transcriptSearchSource_user:`你`,transcriptSearchSource_assistant:`助手`,transcriptSearchSource_tool_call:`工具调用`,transcriptSearchSource_tool_result:`工具结果`,connected:`已连接`,connecting:`正在连接`,conversationName:`会话名称`,conversationOptions:`会话选项`,sidebarRename:`重命名`,sidebarPin:`置顶`,sidebarUnpin:`取消置顶`,sidebarFork:`分叉`,sidebarForkLocal:`创建聊天分支`,sidebarForkSameWorktree:`在同一工作树中分叉`,archiveNoticeTitle:`聊天已归档`,archiveNoticeView:`查看`,archiveNoticeUndo:`撤销`,archiveNoticeFailed:`操作未完成,请重试。`,sidebarForkWorktree:`在新工作树中创建聊天分支`,sidebarForkCancelling:`正在请求取消…`,sidebarForkFinishing:`无法再取消,正在确认创建结果…`,sidebarForkCancelUnconfirmed:`无法确认取消,正在等待分叉结果。`,sidebarForkWorktreePreserved:`工作树已保留在 {{path}},请检查后再重试。`,sidebarForkWorktreePending:`正在创建工作树和聊天分支…`,sidebarForkOptionsLoading:`正在检查工作树是否可用…`,sidebarForkOptionsFailed:`无法检查工作树,请重新打开菜单重试。`,sidebarForkUnavailable:`发送消息后才能创建此聊天的分支。`,sidebarForkArchived:`请先恢复此会话,再创建分叉。`,sidebarForkFailed:`未能创建分叉,原会话已保留。`,sidebarCopy:`复制`,sidebarCopyLink:`复制会话链接`,sidebarCopyMarkdown:`复制为 Markdown`,sidebarCopyCwd:`复制工作目录`,sidebarCopied:`已复制`,sidebarCopyFailed:`复制失败,请重试。`,sidebarNewWindow:`在新窗口中打开`,sidebarOpenIn:`打开方式`,sidebarAppsLoading:`正在加载可用应用…`,sidebarAppsFailed:`无法加载应用,请重新打开菜单重试。`,sidebarOpenFailed:`无法在所选应用中打开此项目。`,sidebarArchive:`归档`,sidebarRestore:`恢复`,sidebarDelete:`永久删除`,managedWorktreeRecoveryFull:`请先核对先前未确认的移除请求,再开始新的请求。`,managedWorktreesChanged:`工作树列表已变化,请刷新后重新核对目标。`,managedWorktreesRefresh:`刷新工作树列表`,managedWorktreesBack:`返回工作树列表`,managedWorktreesRetry:`重试请求`,managedWorktrees:`保留的工作树`,managedWorktreesDescription:`删除会话会保留 OpenPI 创建的工作树。请核对准确路径后再请求移除。使用中、共享、有改动或无法确认归属的工作树会保留。`,managedWorktreeConfirm:`移除此工作树?服务端会重新核对归属、使用中的会话及本地改动后再操作。`,managedWorktreeRemoved:`工作树已移除。`,managedWorktreePreserved:`工作树已保留:`,managedWorktreeUncertainTerminal:`移除结果无法确认,不能自动重复移除。请先检查保留路径,再决定后续操作。`,managedWorktreeUncertain:`尚不能确认移除结果。重试会核对原请求。`,managedWorktreeRemoving:`正在核对并移除…`,managedWorktreeRemove:`移除工作树`,managedWorktreeReview:`核对移除`,managedWorktreesEmpty:`这一页没有找到托管工作树。`,managedWorktreesUnavailable:`有 {{count}} 条归属记录无法确认。`,managedWorktreesLoadFailed:`无法加载保留的工作树。请重试,目标不会改变。`,managedWorktreesMore:`加载更多工作树`,managedWorktreeRetainedAfterDelete:`会话已删除,工作树保留在 {{path}}。可从项目菜单核对保留的工作树。`,sidebarDeleteTitle:`删除会话?`,sidebarDeleteDescription:`确定永久删除“{{name}}”?此操作无法撤销。`,sidebarDeleteConfirm:`删除`,sidebarDeleting:`正在删除…`,sidebarDeleteFailed:`未能删除此会话,请重试或取消。`,sidebarActionRunning:`请等待当前工作和排队消息结束。`,sidebarActionDisconnected:`请先恢复连接,再修改此会话。`,sessionDeleteCancelled:`删除已取消`,sessionDeleteUncertain:`无法确认会话是否删除,请刷新后重试`,sessionDeleted:`会话已永久删除`,sessionDeleteMetadataPending:`会话已删除,但侧栏记录未清理完成`,sessionLinkUnavailable:`链接中的会话已不存在或身份已变化`,sidebarDropPin:`拖到此处置顶`,sidebarDropProjectLast:`将项目移到最后`,conversationTurns:`会话轮次`,conversationTurnPosition:`前往第 {{position}} 轮`,turnPreviewLoading:`正在加载预览…`,turnPreviewUnavailable:`暂时无法读取,请重试。`,commands:`斜杠命令`,addContext:`添加上下文`,fileReference:`引用工作区文件`,fileReferenceTitle:`引用工作区文件`,fileReferenceDetail:`将路径引用加入提示词,不上传文件内容。`,fileReferenceLabel:`工作区文件路径`,fileReferencePlaceholder:`src/app.tsx`,fileReferenceValidatedHint:`当前会话会验证该路径是可读取的工作区文件。`,fileReferenceDraftHint:`新会话启动后,Pi 会按其工具权限解析该路径。`,fileReferenceChecking:`正在检查…`,fileReferenceFailed:`无法验证该文件。`,fileReferenceDenied:`请选择当前会话工作区内的文件。`,fileReferenceMissing:`该工作区文件已不存在。`,fileReferenceUnsupported:`只能引用工作区中的普通文件。`,fileReferenceExpired:`活动会话已变化,请重新打开文件引用后再试。`,fileReferenceBusy:`文件校验正忙,请稍后重试。`,insertReference:`插入引用`,commandsSessionRequired:`会话启动后才能插入斜杠命令。`,commandsEmptyDraftOnly:`只能在空白草稿中插入斜杠命令。`,commandsLoading:`正在加载命令…`,commandsUnavailable:`暂时无法读取命令。`,commandsNoMatch:`没有匹配的命令。`,commandsNoAvailable:`已发现的命令均不能在 Web 中运行。输入具体命令名可查看其可用性。`,commandsBounded:`另有 {{count}} 个命令未显示。`,commandSessionRequired:`命令仅在已创建的 Web 会话中可用。`,commandUnsupported:`尚未适配 · 手动命令仍交给 Pi`,commandAcceptsArguments:`可输入参数`,commandSource_extension:`扩展命令`,commandSource_prompt:`提示词模板`,commandSource_skill:`技能`,copiedMessage:`已复制`,copyMessage:`复制消息`,copyFailed:`复制失败,请选中消息后手动复制。`,copiedCode:`代码已复制`,copyCode:`复制代码`,copyCodeFailed:`无法复制代码,请选中后手动复制。`,codeBlock:`代码块`,deleteWorkspace:`删除工作区`,describeTask:`描述任务`,editMessage:`修改并从这里重跑`,enterHint:`按 Enter 发送,Shift+Enter 换行。`,expandSidebar:`展开侧边栏`,importWorkspace:`导入工作区`,loadingModels:`正在加载模型...`,modelsTruncated:`当前显示 {{shown}} 个模型,还有 {{omitted}} 个可用;搜索即可查找。`,searchModels:`搜索可用模型`,searchModelsPlaceholder:`搜索服务商、模型名称或 ID...`,searchingModels:`正在搜索模型...`,noMatchingModels:`没有匹配的模型`,modelSearchFailed:`模型搜索失败,请重试。`,retryModelSearch:`重试模型搜索`,fileReferenceDraftChanged:`草稿已变化,请重新打开文件引用。`,modelSearchTruncated:`还有 {{omitted}} 个匹配模型未显示。`,modelPreparing:`正在准备任务...`,modelRetrying:`模型请求重试中...`,modelRunning:`正在运行...`,modelRequestFailed:`模型请求失败`,modelRequestStopped:`模型请求已停止`,modelFailureUnknown:`服务商没有返回具体失败原因。`,retryPrompt:`重试消息`,retryingPrompt:`正在重试…`,newSession:`新建会话`,noConversations:`暂无对话`,noMatching:`没有匹配的会话`,noMatchingLoaded:`已加载历史中没有匹配的会话`,noModels:`没有可用模型`,noOutput:`无输出`,noSessions:`暂无会话`,openSidebar:`打开侧边栏`,promptMessage:`发消息或创建任务,/ 调用指令`,promptReadonly:`非当前会话不能接收消息`,promptStart:`选择一个工作区开始`,promptTask:`描述你想要构建的任务`,landingTagline:`小骨架 · 净上下文 · 深扩展`,queuedHint:`当前回合结束后将发送消息。`,reconnecting:`正在重连`,removeWorkspace:`从侧边栏移除`,workspaceOptions:`工作区选项`,renameFailed:`无法保存名称,已保留你的修改。`,savingName:`正在保存...`,workspaceRemoveFailed:`无法移出工作区,请重试。`,removingWorkspace:`正在移出...`,renameConversation:`重命名会话`,renameWorkspace:`重命名工作区`,save:`保存`,searchConversations:`搜索会话`,searchPlaceholder:`筛选标题与工作目录…`,selectModel:`选择模型`,configureModels:`配置模型`,openModelSettings:`模型设置`,selectThinking:`选择思考等级`,resetThinking:`恢复打开时的等级({{level}})`,modelThinkingNotEnabled:`此模型未启用思考。如提供商支持,可在模型设置中开启「支持推理」。`,providerReasoningHint:`按提供商能力开启;可用档位由 Pi 提供,在聊天输入框调节强度。`,providerImageHint:`未勾选图片时,模型不会收到图片附件。`,selectWorkspace:`选择工作区`,send:`发送`,processDetails:`执行过程`,processRunning:`正在执行`,processThinkingCount:`{{count}} 段思考`,processToolCount:`{{count}} 次工具调用`,processActivityCount:`{{count}} 项 Agent 活动`,switchingSession:`正在切换会话...`,thinkingActive:`思考中...`,thinkingActiveLevel:`思考中({{level}})...`,thinkingDone:`思考过程`,thinkingLoadFull:`查看完整思考`,thinkingLoadingFull:`正在加载思考…`,thinkingLoadFailed:`思考加载失败,点击重试`,thinkingPartialText:`当前显示部分已保存的思考,可继续加载下方内容。`,thinkingPreviewOnly:`思考预览已达到显示上限,此消息保存后可查看完整内容。`,toolState_running:`执行中`,toolState_returned:`已返回`,toolState_failed:`失败`,toolState_cancelled:`已停止`,toolState_timed_out:`超时`,toolState_unknown:`未确认`,toolSnapshotMissingResult:`分叉时尚无结果`,toolActivity_running:`正在{{action}}`,toolActivity_failed:`{{action}}失败`,toolActivity_cancelled:`{{action}}已停止`,toolActivity_timed_out:`{{action}}超时`,toolActivity_unknown:`{{action}}`,toolAction_read:`读取`,toolAction_write:`写入文件`,toolAction_edit:`编辑文件`,toolAction_command:`运行`,toolAction_search:`搜索`,toolAction_list:`列出文件`,toolAction_web:`浏览网页`,toolAction_agent:`使用子代理`,toolAction_workflow:`调用工作流`,toolAction_plan:`准备计划`,toolAction_task:`处理任务`,toolAction_goal:`处理目标`,toolAction_git:`查看变更`,toolAction_call:`调用工具`,toolActionDone_read:`已读取`,toolActionDone_write:`已写入`,toolActionDone_edit:`已编辑`,toolActionDone_command:`已运行`,toolActionDone_search:`已搜索`,toolActionDone_list:`已列出的文件`,toolActionDone_web:`已浏览网页`,toolActionDone_agent:`子代理工具已返回`,toolActionDone_workflow:`工作流工具已返回`,toolActionDone_plan:`计划工具已返回`,toolActionDone_task:`任务工具已返回`,toolActionDone_goal:`目标工具已返回`,toolActionDone_git:`已查看变更`,toolActionDone_call:`已调用工具`,toolActionGroup_read:`读取文件`,toolActionGroup_write:`写入文件`,toolActionGroup_edit:`编辑文件`,toolActionGroup_command:`运行命令`,toolActionGroup_search:`搜索`,toolActionGroup_list:`列出文件`,toolActionGroup_web:`浏览网页`,toolActionGroup_agent:`子代理活动`,toolActionGroup_workflow:`工作流活动`,toolActionGroup_plan:`准备计划`,toolActionGroup_task:`处理任务`,toolActionGroup_goal:`处理目标`,toolActionGroup_git:`查看变更`,toolActionGroup_call:`调用工具`,toolGroup_done:`已{{actions}}`,toolGroup_running:`正在{{actions}}`,toolGroup_unknown:`{{actions}}`,toolGroupSeparator:`、`,toolSearchTarget:`“{{pattern}}” · {{path}}`,toolDiffStatsHelp:`当前显示差异中的新增和删除行数`,toolRequestedFile:`文件:`,toolWorkspace:`工作区`,toolRawEvidence:`参数与原始结果`,toolCodemodeDetails:`脚本与原始结果`,toolNestedOutputMissing:`会话记录保留了调用和状态,未保存此子工具的输出。`,toolNestedArgumentsMissing:`会话记录未保留完整参数和此子工具的输出。`,toolNestedIncomplete:`子调用记录不完整,部分调用、参数或最终状态不可用。`,toolPartialEvidence:`输出未完整显示:已达到字节、行数或条目上限。原始结果也可能被截断。`,toolFileChange_created:`已创建文件`,toolFileChange_unchanged:`文件内容未改变`,toolFileChange_overwritten:`已覆盖文件`,toolChangeUnavailable:`此工具结果未提供修改对比。`,toolTestResults:`测试结果摘要 · {{format}}`,toolTestCounts:`{{tests}} 项测试 · {{passed}} 通过 · {{failed}} 失败 · {{cancelled}} 取消`,toolTestCountsHelp:`数量来自命令输出,执行状态单独显示。`,toolReadMore:`可使用文件路径和 offset 继续读取,具体方式见原始结果。`,toolFullOutputReference:`完整输出:`,subagentBackgroundResult:`后台子代理结果 · {{count}}`,thinkingDraftHint:`请先选择工作区并创建会话。`,thinkingInactiveHint:`只有当前会话可以更改思考等级。`,thinkingLevelMismatch:`当前确认的思考等级不在此模型支持范围内;选择其它等级即可修正。`,thinkingLockedRunning:`请先停止当前轮次,再更改思考等级。`,thinkingModelPendingHint:`请等待模型切换完成。`,thinkingNotConfirmed:`思考等级未获确认,请重试。`,thinkingPendingHint:`正在应用思考等级...`,thinkingUnsupported:`暂不支持思考`,thinkingUnsupportedHint:`尚未选择模型,或当前模型不支持思考。`,unavailable:`不可用`,ungrouped:`未分组`,untitledSession:`新会话`,workspaceDeleteConfirm:`文件夹与会话记录会保留,其中的会话会被放到“未分组”;再次打开此目录时将是一个干净的工作区。`,workspaceName:`工作区名称`,workspaces:`工作区`,sidebarProjects:`项目`}}},lJ=navigator.language?.toLowerCase().startsWith(`zh`)?`zh`:`en`;In.use(tr).init({fallbackLng:`en`,initAsync:!1,interpolation:{escapeValue:!1},lng:lJ,resources:cJ}),document.documentElement.lang=lJ===`zh`?`zh-CN`:`en`;var uJ=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},dJ=10,fJ=13,pJ=32,mJ=6;function hJ(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{maxBufferSize:t,onComment:n,onError:r,onEvent:i,onId:a,onRetry:o}=e,s=[],c=0,l=!0,u,d=``,f=0,p,m=!1,h=!1,g=!1;function _(e){if(m)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(l&&(l=!1,e.charCodeAt(0)===65279?e=e.slice(1):e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),(h||g)&&(e=v(e),!e))return;if(!s.length){let t=S(e);t!==``&&y(t),x();return}if(e.indexOf(` -`)===-1&&e.indexOf(`\r`)===-1){if(cthis._refresh()),eG&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=CG(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=RW(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-wG),wG),t/=wG,t/Math.abs(t)+Math.round(t*(TG-1)))}shouldForceSelection(e){return XW?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),EG)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(XW&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&tthis._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,a=i.lines.get(e[1]);if(!a)return;let o=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(a,e[0]),c=s,l=e[0]-s,u=0,d=0,f=0,p=0;if(o.charAt(s)===` `){for(;s>0&&o.charAt(s-1)===` `;)s--;for(;c1&&(p+=r-1,c+=r-1);t>0&&s>0&&!this._isCharWordSeparator(a.loadCell(t-1,this._workCell));){a.loadCell(t-1,this._workCell);let e=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,t--):e>1&&(f+=e-1,s-=e-1),s--,t--}for(;n1&&(p+=e-1,c+=e-1),c++,n++}}c++;let m=s+l-u+f,h=Math.min(this._bufferService.cols,c-s+u+d-f-p);if(!(!t&&o.slice(s,c).trim()===``)){if(n&&m===0&&a.getCodePoint(0)!==32){let t=i.lines.get(e[1]-1);if(t&&a.isWrapped&&t.getCodePoint(this._bufferService.cols-1)!==32){let t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){let e=this._bufferService.cols-t.start;m-=e,h+=e}}}if(r&&m+h===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let t=i.lines.get(e[1]+1);if(t?.isWrapped&&t.getCodePoint(0)!==32){let t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(h+=t.length)}}return{start:m,length:h}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=CG(n,this._bufferService.cols)}};kG=Wz([Gz(3,vB),Gz(4,bB),Gz(5,MB),Gz(6,wB),Gz(7,NB),Gz(8,jB)],kG);var AG=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},jG=class{constructor(){this._color=new AG,this._css=new AG}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},MG=Object.freeze((()=>{let e=[oW.toColor(`#2e3436`),oW.toColor(`#cc0000`),oW.toColor(`#4e9a06`),oW.toColor(`#c4a000`),oW.toColor(`#3465a4`),oW.toColor(`#75507b`),oW.toColor(`#06989a`),oW.toColor(`#d3d7cf`),oW.toColor(`#555753`),oW.toColor(`#ef2929`),oW.toColor(`#8ae234`),oW.toColor(`#fce94f`),oW.toColor(`#729fcf`),oW.toColor(`#ad7fa8`),oW.toColor(`#34e2e2`),oW.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:iW.toCss(r,i,a),rgba:iW.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:iW.toCss(n,n,n),rgba:iW.toRgba(n,n,n)})}return e})()),NG=oW.toColor(`#ffffff`),PG=oW.toColor(`#000000`),FG=oW.toColor(`#ffffff`),IG=PG,LG={css:`rgba(255, 255, 255, 0.3)`,rgba:4294967117},RG=NG,zG=class extends sV{constructor(e){super(),this._optionsService=e,this._contrastCache=new jG,this._halfContrastCache=new jG,this._onChangeColors=this._register(new OV),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:NG,background:PG,cursor:FG,cursorAccent:IG,selectionForeground:void 0,selectionBackgroundTransparent:LG,selectionBackgroundOpaque:aW.blend(PG,LG),selectionInactiveBackgroundTransparent:LG,selectionInactiveBackgroundOpaque:aW.blend(PG,LG),scrollbarSliderBackground:aW.opacity(NG,.2),scrollbarSliderHoverBackground:aW.opacity(NG,.4),scrollbarSliderActiveBackground:aW.opacity(NG,.5),overviewRulerBorder:NG,ansi:MG.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange(`minimumContrastRatio`,()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange(`theme`,()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=BG(e.foreground,NG),t.background=BG(e.background,PG),t.cursor=aW.blend(t.background,BG(e.cursor,FG)),t.cursorAccent=aW.blend(t.background,BG(e.cursorAccent,IG)),t.selectionBackgroundTransparent=BG(e.selectionBackground,LG),t.selectionBackgroundOpaque=aW.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=BG(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=aW.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?BG(e.selectionForeground,rW):void 0,t.selectionForeground===rW&&(t.selectionForeground=void 0),aW.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=aW.opacity(t.selectionBackgroundTransparent,.3)),aW.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=aW.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=BG(e.scrollbarSliderBackground,aW.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=BG(e.scrollbarSliderHoverBackground,aW.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=BG(e.scrollbarSliderActiveBackground,aW.opacity(t.foreground,.5)),t.overviewRulerBorder=BG(e.overviewRulerBorder,RG),t.ansi=MG.slice(),t.ansi[0]=BG(e.black,MG[0]),t.ansi[1]=BG(e.red,MG[1]),t.ansi[2]=BG(e.green,MG[2]),t.ansi[3]=BG(e.yellow,MG[3]),t.ansi[4]=BG(e.blue,MG[4]),t.ansi[5]=BG(e.magenta,MG[5]),t.ansi[6]=BG(e.cyan,MG[6]),t.ansi[7]=BG(e.white,MG[7]),t.ansi[8]=BG(e.brightBlack,MG[8]),t.ansi[9]=BG(e.brightRed,MG[9]),t.ansi[10]=BG(e.brightGreen,MG[10]),t.ansi[11]=BG(e.brightYellow,MG[11]),t.ansi[12]=BG(e.brightBlue,MG[12]),t.ansi[13]=BG(e.brightMagenta,MG[13]),t.ansi[14]=BG(e.brightCyan,MG[14]),t.ansi[15]=BG(e.brightWhite,MG[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;re.index-t.index),r=[];for(let t of n){let n=this._services.get(t.id);if(!n)throw Error(`[createInstance] ${e.name} depends on UNKNOWN service ${t.id._id}.`);r.push(n)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},UG={trace:0,debug:1,info:2,warn:3,error:4,off:5},WG=`xterm.js: `,GG=class extends sV{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),KG=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=UG[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;tthis._length)for(let t=this._length;t=e;t--)this._array[this._getCyclicIndex(t+n.length)]=this._array[this._getCyclicIndex(t)];for(let t=0;tthis._maxLength){let e=this._length+n.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw Error(`start argument out of range`);if(e+n<0)throw Error(`Cannot shift elements in list beyond index 0`);if(n>0){for(let r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):n]}set(e,t){this._data[e*JG+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*JG+0]=e|2097152|t[2]<<22):this._data[e*JG+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*JG+0]>>22}hasWidth(e){return this._data[e*JG+0]&12582912}getFg(e){return this._data[e*JG+1]}getBg(e){return this._data[e*JG+2]}hasContent(e){return this._data[e*JG+0]&4194303}getCodePoint(e){let t=this._data[e*JG+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*JG+0]&2097152}getString(e){let t=this._data[e*JG+0];return t&2097152?this._combined[e]:t&2097151?rB(t&2097151):``}isProtected(e){return this._data[e*JG+2]&536870912}loadCell(e,t){return XG=e*JG,t.content=this._data[XG+0],t.fg=this._data[XG+1],t.bg=this._data[XG+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*JG+0]=t.content,this._data[e*JG+1]=t.fg,this._data[e*JG+2]=t.bg}setCellFromCodepoint(e,t,n,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*JG+0]=t|n<<22,this._data[e*JG+1]=r.fg,this._data[e*JG+2]=r.bg}addCodepointToCell(e,t,n){let r=this._data[e*JG+0];r&2097152?this._combined[e]+=rB(t):r&2097151?(this._combined[e]=rB(r&2097151)+rB(t),r&=-2097152,r|=2097152):r=t|1<<22,n&&(r&=-12582913,r|=n<<22),this._data[e*JG+0]=r}insertCells(e,t,n){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,n),t=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let r=0;rthis.length){if(this._data.buffer.byteLength>=n*4)this._data=new Uint32Array(this._data.buffer,0,n);else{let e=new Uint32Array(n);e.set(this._data),this._data=e}for(let n=this.length;n=e&&delete this._combined[r]}let r=Object.keys(this._extendedAttrs);for(let t=0;t=e&&delete this._extendedAttrs[n]}}return this.length=e,n*4*ZG=0;--e)if(this._data[e*JG+0]&4194303)return e+(this._data[e*JG+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*JG+0]&4194303||this._data[e*JG+2]&50331648)return e+(this._data[e*JG+0]>>22);return 0}copyCellsFrom(e,t,n,r,i){let a=e._data;if(i)for(let i=r-1;i>=0;i--){for(let e=0;e=t&&(this._combined[i-t+n]=e._combined[i])}}translateToString(e,t,n,r){t??=0,n??=this.length,e&&(n=Math.min(n,this.getTrimmedLength())),r&&(r.length=0);let i=``;for(;t>22||1}return r&&r.push(t),i}};function $G(e,t,n,r,i,a){let o=[];for(let s=0;s=s&&r0&&(e>d||u[e].getTrimmedLength()===0);e--)h++;h>0&&(o.push(s+u.length-h),o.push(h)),s+=u.length-1}return o}function eK(e,t){let n=[],r=0,i=t[r],a=0;for(let o=0;orK(e,r,t)).reduce((e,t)=>e+t),a=0,o=0,s=0;for(;sc&&(a-=c,o++);let l=e[o].getWidth(a-1)===2;l&&a--;let u=l?n-1:n;r.push(u),s+=u}return r}function rK(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var iK=class e{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=e._nextId++,this._onDispose=this.register(new OV),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),nV(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};iK._nextId=1;var aK=iK,oK={},sK=oK.B;oK[0]={"`":`◆`,a:`▒`,b:`␉`,c:`␌`,d:`␍`,e:`␊`,f:`°`,g:`±`,h:`␤`,i:`␋`,j:`┘`,k:`┐`,l:`┌`,m:`└`,n:`┼`,o:`⎺`,p:`⎻`,q:`─`,r:`⎼`,s:`⎽`,t:`├`,u:`┤`,v:`┴`,w:`┬`,x:`│`,y:`≤`,z:`≥`,"{":`π`,"|":`≠`,"}":`£`,"~":`·`},oK.A={"#":`£`},oK.B=void 0,oK[4]={"#":`£`,"@":`¾`,"[":`ij`,"\\":`½`,"]":`|`,"{":`¨`,"|":`f`,"}":`¼`,"~":`´`},oK.C=oK[5]={"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},oK.R={"#":`£`,"@":`à`,"[":`°`,"\\":`ç`,"]":`§`,"{":`é`,"|":`ù`,"}":`è`,"~":`¨`},oK.Q={"@":`à`,"[":`â`,"\\":`ç`,"]":`ê`,"^":`î`,"`":`ô`,"{":`é`,"|":`ù`,"}":`è`,"~":`û`},oK.K={"@":`§`,"[":`Ä`,"\\":`Ö`,"]":`Ü`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`ß`},oK.Y={"#":`£`,"@":`§`,"[":`°`,"\\":`ç`,"]":`é`,"`":`ù`,"{":`à`,"|":`ò`,"}":`è`,"~":`ì`},oK.E=oK[6]={"@":`Ä`,"[":`Æ`,"\\":`Ø`,"]":`Å`,"^":`Ü`,"`":`ä`,"{":`æ`,"|":`ø`,"}":`å`,"~":`ü`},oK.Z={"#":`£`,"@":`§`,"[":`¡`,"\\":`Ñ`,"]":`¿`,"{":`°`,"|":`ñ`,"}":`ç`},oK.H=oK[7]={"@":`É`,"[":`Ä`,"\\":`Ö`,"]":`Å`,"^":`Ü`,"`":`é`,"{":`ä`,"|":`ö`,"}":`å`,"~":`ü`},oK[`=`]={"#":`ù`,"@":`à`,"[":`é`,"\\":`ç`,"]":`ê`,"^":`î`,_:`è`,"`":`ô`,"{":`ä`,"|":`ö`,"}":`ü`,"~":`û`};var cK=4294967295,lK=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=YG.clone(),this.savedCharset=sK,this.markers=[],this._nullCell=dB.fromCharData([0,sB,1,0]),this._whitespaceCell=dB.fromCharData([0,cB,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new aG,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new qG(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new uB),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new uB),this._whitespaceCell}getBlankLine(e,t){return new QG(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&ecK?cK:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=YG);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new qG(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(YG),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new QG(e,n)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let t=0;t.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend===`conpty`&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=$G(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(YG),n);if(r.length>0){let n=eK(this.lines,r);tK(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(YG),i=n;for(;i-->0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;o--){let s=this.lines.get(o);if(!s||!s.isWrapped&&s.getTrimmedLength()<=e)continue;let c=[s];for(;s.isWrapped&&o>0;)s=this.lines.get(--o),c.unshift(s);if(!n){let e=this.ybase+this.y;if(e>=o&&e0&&(i.push({start:o+c.length+a,newLines:p}),a+=p.length),c.push(...p);let m=u.length-1,h=u[m];h===0&&(m--,h=u[m]);let g=c.length-d-1,_=l;for(;g>=0;){let e=Math.min(_,h);if(c[m]===void 0)break;c[m].copyCellsFrom(c[g],_-e,h-e,e,!0),h-=e,h===0&&(m--,h=u[m]),_-=e,_===0&&(g--,_=rK(c,Math.max(g,0),this._cols))}for(let t=0;t0;)this.ybase===0?this.y0){let e=[],t=[];for(let e=0;e=0;l--)if(s&&s.start>r+c){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(l--,s.newLines[e]);l++,e.push({index:r+1,amount:s.newLines.length}),c+=s.newLines.length,s=i[++o]}else this.lines.set(l,t[r--]);let l=0;for(let t=e.length-1;t>=0;t--)e[t].index+=l,this.lines.onInsertEmitter.fire(e[t]),l+=e[t].amount;let u=Math.max(0,n+a-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):``}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+10;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e??=this.x;!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.linee.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},uK=class extends sV{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new OV),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this._register(this._optionsService.onSpecificOptionChange(`scrollback`,()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this._register(this._optionsService.onSpecificOptionChange(`tabStopWidth`,()=>this.setupTabStops()))}reset(){this._normal=new lK(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new lK(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}},dK=2,fK=1,pK=class extends sV{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new OV),this.onResize=this._onResize.event,this._onScroll=this._register(new OV),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,dK),this.rows=Math.max(e.rawOptions.rows||0,fK),this.buffers=this._register(new uK(e,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let e=n.lines.isFull;a===n.lines.length-1?e?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(a+1,0,r.clone()),e?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let e=a-i+1;n.lines.shiftElements(i+1,e-1,-1),n.lines.set(a,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};pK=Wz([Gz(0,wB)],pK);var mK={cols:80,rows:24,cursorBlink:!1,cursorStyle:`block`,cursorWidth:1,cursorInactiveStyle:`outline`,customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:`alt`,fastScrollSensitivity:5,fontFamily:`monospace`,fontSize:15,fontWeight:`normal`,fontWeightBold:`bold`,ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:`info`,logger:null,scrollback:1e3,scrollOnEraseInDisplay:!1,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},reflowCursorLine:!1,rescaleOverlappingGlyphs:!1,rightClickSelectsWord:XW,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:` ()[]{}',"\``,altClickMovesCursor:!0,convertEol:!1,termName:`xterm`,cancelEvents:!1,overviewRuler:{}},hK=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],gK=class extends sV{constructor(e){super(),this._onOptionChange=this._register(new OV),this.onOptionChange=this._onOptionChange.event;let t={...mK};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(e){console.error(e)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(iV(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=e=>{if(!(e in mK))throw Error(`No option with key "${e}"`);return this.rawOptions[e]},t=(e,t)=>{if(!(e in mK))throw Error(`No option with key "${e}"`);t=this._sanitizeAndValidateOption(e,t),this.rawOptions[e]!==t&&(this.rawOptions[e]=t,this._onOptionChange.fire(e))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case`cursorStyle`:if(t||=mK[e],!_K(t))throw Error(`"${t}" is not a valid value for ${e}`);break;case`wordSeparator`:t||=mK[e];break;case`fontWeight`:case`fontWeightBold`:if(typeof t==`number`&&1<=t&&t<=1e3)break;t=hK.includes(t)?t:mK[e];break;case`cursorWidth`:t=Math.floor(t);case`lineHeight`:case`tabStopWidth`:if(t<1)throw Error(`${e} cannot be less than 1, value: ${t}`);break;case`minimumContrastRatio`:t=Math.max(1,Math.min(21,Math.round(t*10)/10));break;case`scrollback`:if(t=Math.min(t,4294967295),t<0)throw Error(`${e} cannot be less than 0, value: ${t}`);break;case`fastScrollSensitivity`:case`scrollSensitivity`:if(t<=0)throw Error(`${e} cannot be less than or equal to 0, value: ${t}`);break;case`rows`:case`cols`:if(!t&&t!==0)throw Error(`${e} must be numeric, value: ${t}`);break;case`windowsPty`:t??={}}return t}};function _K(e){return e===`block`||e===`underline`||e===`bar`}function vK(e,t=5){if(typeof e!=`object`)return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&vK(e[r],t-1);return n}var yK=Object.freeze({insertMode:!1}),bK=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),xK=class extends sV{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new OV),this.onData=this._onData.event,this._onUserInput=this._register(new OV),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new OV),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new OV),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=vK(yK),this.decPrivateModes=vK(bK)}reset(){this.modes=vK(yK),this.decPrivateModes=vK(bK)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace(`sending data (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace(`sending binary (codes)`,()=>e.split(``).map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};xK=Wz([Gz(0,vB),Gz(1,CB),Gz(2,wB)],xK);var SK={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>e.action!==32||e.button!==3},ANY:{events:31,restrict:e=>!0}};function CK(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var wK=String.fromCharCode,TK={DEFAULT:e=>{let t=[CK(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?``:`\x1B[M${wK(t[0])}${wK(t[1])}${wK(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${CK(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?`m`:`M`;return`\x1B[<${CK(e,!0)};${e.x};${e.y}${t}`}},EK=class extends sV{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol=``,this._activeEncoding=``,this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new OV),this.onProtocolChange=this._onProtocolChange.event;for(let e of Object.keys(SK))this.addProtocol(e,SK[e]);for(let e of Object.keys(TK))this.addEncoding(e,TK[e]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol=`NONE`,this.activeEncoding=`DEFAULT`,this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding===`SGR_PIXELS`))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding===`DEFAULT`?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};EK=Wz([Gz(0,vB),Gz(1,bB),Gz(2,wB)],EK);var DK=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],OK=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],kK;function AK(e,t){let n=0,r=t.length-1,i;if(et[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=MK.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return MK.createPropertyValue(0,n,r)}},MK=class e{constructor(){this._providers=Object.create(null),this._active=``,this._onChange=new OV,this.onChange=this._onChange.event;let e=new jK;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return!!(e&1)}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,n=!1){return(e&16777215)<<3|(t&3)<<1|!!n}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let a=0;a=i)return n+this.wcwidth(o);let e=t.charCodeAt(a);56320<=e&&e<=57343?o=(o-55296)*1024+e-56320+65536:n+=this.wcwidth(e)}let s=this.charProperties(o,r),c=e.extractWidth(s);e.extractShouldJoin(s)&&(c-=e.extractWidth(r)),n+=c,r=s}return n}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},NK=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}};function PK(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var FK=2147483647,IK=256,LK=class e{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>IK)throw Error(`maxSubParamsLength must not be greater than 256`);this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new e;if(!t.length)return n;for(let e=+!!Array.isArray(t[0]);e>8,r=this._subParamsIdx[t]&255;r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>FK?FK:e}addSubParam(e){if(this._digitIsSub=!0,this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw Error(`values lesser than -1 are not allowed`);this._subParams[this._subParamsLength++]=e>FK?FK:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,n=this._subParamsIdx[e]&255;return n-t>0?this._subParams.subarray(t,n):null}getSubParamsAll(){let e={};for(let t=0;t>8,r=this._subParamsIdx[t]&255;r-n>0&&(e[t]=this._subParams.slice(n,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let n=this._digitIsSub?this._subParams:this.params,r=n[t-1];n[t-1]=~r?Math.min(r*10+e,FK):e}},RK=[],zK=class{constructor(){this._state=0,this._active=RK,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=RK}reset(){if(this._state===2)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].end(!1);this._stack.paused=!1,this._active=RK,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||RK,!this._active.length)this._handlerFb(this._id,`START`);else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,`PUT`,iB(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,`END`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=RK,this._id=-1,this._state=0}}},BK=class{constructor(e){this._handler=e,this._data=``,this._hitLimit=!1}start(){this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=iB(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data=``,this._hitLimit=!1,e));return this._data=``,this._hitLimit=!1,t}},VK=[],HK=class{constructor(){this._handlers=Object.create(null),this._active=VK,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=VK}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=VK,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||VK,!this._active.length)this._handlerFb(this._ident,`HOOK`,t);else for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,`PUT`,iB(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,`UNHOOK`,e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=VK,this._ident=0}},UK=new LK;UK.addParam(0);var WK=class{constructor(e){this._handler=e,this._data=``,this._params=UK,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():UK,this._data=``,this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=iB(e,t,n),this._data.length>1e7&&(this._data=``,this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=UK,this._data=``,this._hitLimit=!1,e));return this._params=UK,this._data=``,this._hitLimit=!1,t}},GK=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;it),n=(e,n)=>t.slice(e,n),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let a=n(0,14),o;for(o in e.setDefault(1,0),e.addMany(r,0,2,0),a)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(KK,0,2,0),e.add(KK,8,5,8),e.add(KK,6,0,6),e.add(KK,11,0,11),e.add(KK,13,13,13),e}(),JK=class extends sV{constructor(e=qK){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new LK,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(e,t,n)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(iV(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new zK),this._dcsParser=this._register(new HK),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:`\\`},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw Error(`only one byte as prefix supported`);if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw Error(`prefix must be in range 0x3c .. 0x3f`)}if(e.intermediates){if(e.intermediates.length>2)throw Error(`only two bytes as intermediates are supported`);for(let t=0;tr||r>47)throw Error(`intermediate must be in range 0x20 .. 0x2f`);n<<=8,n|=r}}if(e.final.length!==1)throw Error(`final must be a single byte`);let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join(``)}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,a=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,Error(`improper continuation due to previous async handler, giving up parsing`);let t=this._parseStack.handlers,i=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](this._params),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&i>-1){for(;i>=0&&(o=t[i](),o!==!0);i--)if(o instanceof Promise)return this._parseStack.handlerPos=i,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let n=a;n>4){case 2:for(let i=n+1;;++i){if(i>=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=t||(r=e[i])<32||r>126&&r=0&&(o=a[s](this._params),o!==!0);s--)if(o instanceof Promise)return this._preserveStack(3,a,s,i,n),o;s<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++n47&&r<60);n--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let c=this._escHandlers[this._collect<<8|r],l=c?c.length-1:-1;for(;l>=0&&(o=c[l](),o!==!0);l--)if(o instanceof Promise)return this._preserveStack(4,c,l,i,n),o;l<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let i=n+1;;++i)if(i>=t||(r=e[i])===24||r===26||r===27||r>127&&r=t||(r=e[i])<32||r>127&&r>4:i>>8}return n}}function QK(e,t){let n=e.toString(16),r=n.length<2?`0`+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function $K(e,t=16){let[n,r,i]=e;return`rgb:${QK(n,t)}/${QK(r,t)}/${QK(i,t)}`}var eq={"(":0,")":1,"*":2,"+":3,"-":1,".":2},tq=131072,nq=10;function rq(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var iq=5e3,aq=0,oq=class extends sV{constructor(e,t,n,r,i,a,o,s,c=new JK){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=a,this._coreMouseService=o,this._unicodeService=s,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new aB,this._utf8Decoder=new oB,this._windowTitle=``,this._iconName=``,this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=YG.clone(),this._eraseAttrDataInternal=YG.clone(),this._onRequestBell=this._register(new OV),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new OV),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new OV),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new OV),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new OV),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new OV),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new OV),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new OV),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new OV),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new OV),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new OV),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new OV),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new OV),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this._register(this._parser),this._dirtyRowTracker=new sq(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug(`Unknown CSI code: `,{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug(`Unknown ESC code: `,{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug(`Unknown EXECUTE code: `,{code:e})}),this._parser.setOscHandlerFallback((e,t,n)=>{this._logService.debug(`Unknown OSC code: `,{identifier:e,action:t,data:n})}),this._parser.setDcsHandlerFallback((e,t,n)=>{t===`HOOK`&&(n=n.toArray()),this._logService.debug(`Unknown DCS code: `,{identifier:this._parser.identToString(e),action:t,payload:n})}),this._parser.setPrintHandler((e,t,n)=>this.print(e,t,n)),this._parser.registerCsiHandler({final:`@`},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:` `,final:`@`},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:`A`},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:` `,final:`A`},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:`B`},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:`C`},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:`D`},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:`E`},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:`F`},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:`G`},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:`H`},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:`I`},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:`J`},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`J`},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:`K`},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:`?`,final:`K`},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:`L`},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:`M`},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:`P`},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:`S`},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:`T`},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:`X`},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:`Z`},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:`a`},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:`b`},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:`c`},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:`>`,final:`c`},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:`d`},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:`e`},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:`f`},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:`g`},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:`h`},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`h`},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:`l`},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:`?`,final:`l`},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:`m`},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:`n`},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:`?`,final:`n`},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:`!`,final:`p`},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:` `,final:`q`},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:`r`},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:`s`},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:`t`},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:`u`},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`}`},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:`'`,final:`~`},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:`"`,final:`q`},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:`$`,final:`p`},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:`?`,intermediates:`$`,final:`p`},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler($.BEL,()=>this.bell()),this._parser.setExecuteHandler($.LF,()=>this.lineFeed()),this._parser.setExecuteHandler($.VT,()=>this.lineFeed()),this._parser.setExecuteHandler($.FF,()=>this.lineFeed()),this._parser.setExecuteHandler($.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler($.BS,()=>this.backspace()),this._parser.setExecuteHandler($.HT,()=>this.tab()),this._parser.setExecuteHandler($.SO,()=>this.shiftOut()),this._parser.setExecuteHandler($.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(XU.IND,()=>this.index()),this._parser.setExecuteHandler(XU.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(XU.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new BK(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new BK(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new BK(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new BK(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new BK(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new BK(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new BK(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new BK(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new BK(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new BK(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new BK(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new BK(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:`7`},()=>this.saveCursor()),this._parser.registerEscHandler({final:`8`},()=>this.restoreCursor()),this._parser.registerEscHandler({final:`D`},()=>this.index()),this._parser.registerEscHandler({final:`E`},()=>this.nextLine()),this._parser.registerEscHandler({final:`H`},()=>this.tabSet()),this._parser.registerEscHandler({final:`M`},()=>this.reverseIndex()),this._parser.registerEscHandler({final:`=`},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:`>`},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:`c`},()=>this.fullReset()),this._parser.registerEscHandler({final:`n`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`o`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`|`},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:`}`},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:`~`},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:`%`,final:`@`},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:`%`,final:`G`},()=>this.selectDefaultCharset());for(let e in oK)this._parser.registerEscHandler({intermediates:`(`,final:e},()=>this.selectCharset(`(`+e)),this._parser.registerEscHandler({intermediates:`)`,final:e},()=>this.selectCharset(`)`+e)),this._parser.registerEscHandler({intermediates:`*`,final:e},()=>this.selectCharset(`*`+e)),this._parser.registerEscHandler({intermediates:`+`,final:e},()=>this.selectCharset(`+`+e)),this._parser.registerEscHandler({intermediates:`-`,final:e},()=>this.selectCharset(`-`+e)),this._parser.registerEscHandler({intermediates:`.`,final:e},()=>this.selectCharset(`.`+e)),this._parser.registerEscHandler({intermediates:`/`,final:e},()=>this.selectCharset(`/`+e));this._parser.registerEscHandler({intermediates:`#`,final:`8`},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error(`Parsing error: `,e),e)),this._parser.registerDcsHandler({intermediates:`$`,final:`q`},new WK((e,t)=>this.requestStatusString(e,t)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t(`#SLOW_TIMEOUT`),iq))]).catch(e=>{if(e!==`#SLOW_TIMEOUT`)throw e;console.warn(`async parser handler taking longer than ${iq} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,a=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>tq&&(a=this._parseStack.position+tq)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e==`string`?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join(``)}"`}`),this._logService.logLevel===0&&this._logService.trace(`parsing data (codes)`,typeof e==`string`?e.split(``).map(e=>e.charCodeAt(0)):e),this._parseBuffer.lengthtq)for(let t=a;t0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let f=this._parser.precedingJoinState;for(let p=t;ps){if(c){let e=d,t=this._activeBuffer.x-m;for(this._activeBuffer.x=m,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),m>0&&d instanceof QG&&d.copyCellsFrom(e,t,0,m,!1);t=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(l&&(d.insertCells(this._activeBuffer.x,i-m,this._activeBuffer.getNullCell(u)),d.getWidth(s-1)===2&&d.setCellFromCodepoint(s-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=f,this._activeBuffer.x0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final===`t`&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,e=>!rq(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e)):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new WK(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new BK(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let c=s;for(let e=1;e0||(this._is(`xterm`)||this._is(`rxvt-unicode`)||this._is(`screen`)?this._coreService.triggerDataEvent($.ESC+`[?1;2c`):this._is(`linux`)&&this._coreService.triggerDataEvent($.ESC+`[?6c`)),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is(`xterm`)?this._coreService.triggerDataEvent($.ESC+`[>0;276;0c`):this._is(`rxvt-unicode`)?this._coreService.triggerDataEvent($.ESC+`[>85;95;0c`):this._is(`linux`)?this._coreService.triggerDataEvent(e.params[0]+`c`):this._is(`screen`)&&this._coreService.triggerDataEvent($.ESC+`[>83;40003;0c`)),!0}_is(e){return(this._optionsService.rawOptions.termName+``).indexOf(e)===0}setMode(e){for(let t=0;t(e[e.NOT_RECOGNIZED=0]=`NOT_RECOGNIZED`,e[e.SET=1]=`SET`,e[e.RESET=2]=`RESET`,e[e.PERMANENTLY_SET=3]=`PERMANENTLY_SET`,e[e.PERMANENTLY_RESET=4]=`PERMANENTLY_RESET`))(n||={});let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:a}=this._coreMouseService,o=this._coreService,{buffers:s,cols:c}=this._bufferService,{active:l,alt:u}=s,d=this._optionsService.rawOptions,f=(e,n)=>(o.triggerDataEvent(`${$.ESC}[${t?``:`?`}${e};${n}$y`),!0),p=e=>e?1:2,m=e.params[0];return t?m===2?f(m,4):m===4?f(m,p(o.modes.insertMode)):m===12?f(m,3):m===20?f(m,p(d.convertEol)):f(m,0):m===1?f(m,p(r.applicationCursorKeys)):m===3?f(m,d.windowOptions.setWinLines?c===80?2:+(c===132):0):m===6?f(m,p(r.origin)):m===7?f(m,p(r.wraparound)):m===8?f(m,3):m===9?f(m,p(i===`X10`)):m===12?f(m,p(d.cursorBlink)):m===25?f(m,p(!o.isCursorHidden)):m===45?f(m,p(r.reverseWraparound)):m===66?f(m,p(r.applicationKeypad)):m===67?f(m,4):m===1e3?f(m,p(i===`VT200`)):m===1002?f(m,p(i===`DRAG`)):m===1003?f(m,p(i===`ANY`)):m===1004?f(m,p(r.sendFocus)):m===1005?f(m,4):m===1006?f(m,p(a===`SGR`)):m===1015?f(m,4):m===1016?f(m,p(a===`SGR_PIXELS`)):m===1048?f(m,1):m===47||m===1047||m===1049?f(m,p(l===u)):m===2004?f(m,p(r.bracketedPasteMode)):m===2026?f(m,p(r.synchronizedOutput)):f(m,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=lB.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,a=0;do{if(r[a+i]=e.params[t+a],e.hasSubParams(t+a)){let n=e.getSubParams(t+a),o=0;do r[1]===5&&(i=1),r[a+o+1+i]=n[o];while(++o=2||r[1]===2&&a+i>=5)break;r[1]&&(i=1)}while(++a+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=YG.fg,e.bg=YG.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=n-90|16777224):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=n-100|16777224):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=YG.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=YG.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=YG.fg&16777215,r.bg&=-67108864,r.bg|=YG.bg&16777215):this._logService.debug(`Unknown SGR attribute: %d.`,n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${$.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${$.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=YG.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle=`block`;break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle=`underline`;break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle=`bar`}let e=t%2==1;this._coreService.decPrivateModes.cursorBlink=e}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!rq(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${$.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>nq&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>nq&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(`;`);for(;n.length>1;){let e=n.shift(),r=n.shift();if(/^\d+$/.exec(e)){let n=parseInt(e);if(cq(n))if(r===`?`)t.push({type:0,index:n});else{let e=ZK(r);e&&t.push({type:1,index:n,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(`;`);if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):!n.trim()&&this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(`:`),r,i=n.findIndex(e=>e.startsWith(`id=`));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(`;`);for(let e=0;e=this._specialColors.length);++e,++t)if(n[e]===`?`)this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let r=ZK(n[e]);r&&this._onColor.fire([{type:1,index:this._specialColors[t],color:r}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(`;`);for(let e=0;e=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=YG.clone(),this._eraseAttrDataInternal=YG.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new dB;e.content=4194373,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t(this._coreService.triggerDataEvent(`${$.ESC}${e}${$.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e===`"q`?`P1$r${+!!this._curAttrData.isProtected()}"q`:e===`"p`?`P1$r61;1"p`:e===`r`?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e===`m`?`P1$r0m`:e===` q`?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-+!!i.cursorBlink} q`:`P0$r`)}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},sq=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){ethis.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(aq=e,e=t,t=aq),ethis.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};sq=Wz([Gz(0,vB)],sq);function cq(e){return 0<=e&&e<256}var lq=5e7,uq=12,dq=50,fq=class extends sV{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new OV),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>lq)throw Error(`write data discarded, use flow control to avoid losing data`);if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let e=this._writeBuffer[this._bufferOffset],r=this._action(e,t);if(r){r.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e=>performance.now()-n>=uq?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(n,e));return}let i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,performance.now()-n>=uq)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>dq&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}},pq=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let n=t.addMarker(t.ybase+t.y),r={data:e,id:this._nextId++,lines:[n]};return n.onDispose(()=>this._removeMarkerFromLink(r,n)),this._dataByLinkId.set(r.id,r),r.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let a=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(o,a)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(e=>e.line!==t)){let e=this._bufferService.buffer.addMarker(t);n.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(n,e))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};pq=Wz([Gz(0,vB)],pq);var mq=!1,hq=class extends sV{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new cV),this._onBinary=this._register(new OV),this.onBinary=this._onBinary.event,this._onData=this._register(new OV),this.onData=this._onData.event,this._onLineFeed=this._register(new OV),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new OV),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new OV),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new OV),this._instantiationService=new HG,this.optionsService=this._register(new gK(e)),this._instantiationService.setService(wB,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(pK)),this._instantiationService.setService(vB,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(GG)),this._instantiationService.setService(CB,this._logService),this.coreService=this._register(this._instantiationService.createInstance(xK)),this._instantiationService.setService(bB,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(EK)),this._instantiationService.setService(yB,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(MK)),this._instantiationService.setService(EB,this.unicodeService),this._charsetService=this._instantiationService.createInstance(NK),this._instantiationService.setService(xB,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(pq),this._instantiationService.setService(TB,this._oscLinkService),this._inputHandler=this._register(new oq(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(hV.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(hV.forward(this._bufferService.onResize,this._onResize)),this._register(hV.forward(this.coreService.onData,this._onData)),this._register(hV.forward(this.coreService.onBinary,this._onBinary)),this._register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom(!0))),this._register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this._register(this.optionsService.onMultipleOptionChange([`windowsMode`,`windowsPty`],()=>this._handleWindowsPtyOptionChange())),this._register(this._bufferService.onScroll(()=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this._register(new fq((e,t)=>this._inputHandler.parse(e,t))),this._register(hV.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new OV),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!mq&&(this._logService.warn(`writeSync is unreliable and will be removed soon.`),mq=!0),this._writeBuffer.writeSync(e,t)}input(e,t=!0){this.coreService.triggerDataEvent(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,dK),t=Math.max(t,fK),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t){this._bufferService.scrollLines(e,t)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}registerEscHandler(e,t){return this._inputHandler.registerEscHandler(e,t)}registerDcsHandler(e,t){return this._inputHandler.registerDcsHandler(e,t)}registerCsiHandler(e,t){return this._inputHandler.registerCsiHandler(e,t)}registerOscHandler(e,t){return this._inputHandler.registerOscHandler(e,t)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let e=!1,t=this.optionsService.rawOptions.windowsPty;t&&t.buildNumber!==void 0&&t.buildNumber!==void 0?e=t.backend===`conpty`&&t.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let e=[];e.push(this.onLineFeed(PK.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:`H`},()=>(PK(this._bufferService),!1))),this._windowsWrappingHeuristics.value=iV(()=>{for(let t of e)t.dispose()})}}},gq={48:[`0`,`)`],49:[`1`,`!`],50:[`2`,`@`],51:[`3`,`#`],52:[`4`,`$`],53:[`5`,`%`],54:[`6`,`^`],55:[`7`,`&`],56:[`8`,`*`],57:[`9`,`(`],186:[`;`,`:`],187:[`=`,`+`],188:[`,`,`<`],189:[`-`,`_`],190:[`.`,`>`],191:[`/`,`?`],192:["`",`~`],219:[`[`,`{`],220:[`\\`,`|`],221:[`]`,`}`],222:[`'`,`"`]};function _q(e,t,n,r){let i={type:0,cancel:!1,key:void 0},a=!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key===`UIKeyInputUpArrow`?i.key=t?$.ESC+`OA`:$.ESC+`[A`:e.key===`UIKeyInputLeftArrow`?i.key=t?$.ESC+`OD`:$.ESC+`[D`:e.key===`UIKeyInputRightArrow`?i.key=t?$.ESC+`OC`:$.ESC+`[C`:e.key===`UIKeyInputDownArrow`&&(i.key=t?$.ESC+`OB`:$.ESC+`[B`);break;case 8:i.key=e.ctrlKey?`\b`:$.DEL,e.altKey&&(i.key=$.ESC+i.key);break;case 9:if(e.shiftKey){i.key=$.ESC+`[Z`;break}i.key=$.HT,i.cancel=!0;break;case 13:i.key=e.altKey?$.ESC+$.CR:$.CR,i.cancel=!0;break;case 27:i.key=$.ESC,e.altKey&&(i.key=$.ESC+$.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`D`:t?$.ESC+`OD`:$.ESC+`[D`;break;case 39:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`C`:t?$.ESC+`OC`:$.ESC+`[C`;break;case 38:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`A`:t?$.ESC+`OA`:$.ESC+`[A`;break;case 40:if(e.metaKey)break;i.key=a?$.ESC+`[1;`+(a+1)+`B`:t?$.ESC+`OB`:$.ESC+`[B`;break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=$.ESC+`[2~`);break;case 46:i.key=a?$.ESC+`[3;`+(a+1)+`~`:$.ESC+`[3~`;break;case 36:i.key=a?$.ESC+`[1;`+(a+1)+`H`:t?$.ESC+`OH`:$.ESC+`[H`;break;case 35:i.key=a?$.ESC+`[1;`+(a+1)+`F`:t?$.ESC+`OF`:$.ESC+`[F`;break;case 33:e.shiftKey?i.type=2:i.key=e.ctrlKey?$.ESC+`[5;`+(a+1)+`~`:$.ESC+`[5~`;break;case 34:e.shiftKey?i.type=3:i.key=e.ctrlKey?$.ESC+`[6;`+(a+1)+`~`:$.ESC+`[6~`;break;case 112:i.key=a?$.ESC+`[1;`+(a+1)+`P`:$.ESC+`OP`;break;case 113:i.key=a?$.ESC+`[1;`+(a+1)+`Q`:$.ESC+`OQ`;break;case 114:i.key=a?$.ESC+`[1;`+(a+1)+`R`:$.ESC+`OR`;break;case 115:i.key=a?$.ESC+`[1;`+(a+1)+`S`:$.ESC+`OS`;break;case 116:i.key=a?$.ESC+`[15;`+(a+1)+`~`:$.ESC+`[15~`;break;case 117:i.key=a?$.ESC+`[17;`+(a+1)+`~`:$.ESC+`[17~`;break;case 118:i.key=a?$.ESC+`[18;`+(a+1)+`~`:$.ESC+`[18~`;break;case 119:i.key=a?$.ESC+`[19;`+(a+1)+`~`:$.ESC+`[19~`;break;case 120:i.key=a?$.ESC+`[20;`+(a+1)+`~`:$.ESC+`[20~`;break;case 121:i.key=a?$.ESC+`[21;`+(a+1)+`~`:$.ESC+`[21~`;break;case 122:i.key=a?$.ESC+`[23;`+(a+1)+`~`:$.ESC+`[23~`;break;case 123:i.key=a?$.ESC+`[24;`+(a+1)+`~`:$.ESC+`[24~`;break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=$.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=$.DEL:e.keyCode===219?i.key=$.ESC:e.keyCode===220?i.key=$.FS:e.keyCode===221&&(i.key=$.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let t=gq[e.keyCode]?.[+!!e.shiftKey];if(t)i.key=$.ESC+t;else if(e.keyCode>=65&&e.keyCode<=90){let t=e.ctrlKey?e.keyCode-64:e.keyCode+32,n=String.fromCharCode(t);e.shiftKey&&(n=n.toUpperCase()),i.key=$.ESC+n}else if(e.keyCode===32)i.key=$.ESC+(e.ctrlKey?$.NUL:` `);else if(e.key===`Dead`&&e.code.startsWith(`Key`)){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),i.key=$.ESC+t,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key===`_`&&(i.key=$.US),e.key===`@`&&(i.key=$.NUL))}return i}var vq=0,yq=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new aG,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new aG,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((e,t)=>this._getKey(e)-this._getKey(t)),t=0,n=0,r=Array(this._array.length+this._insertedValues.length);for(let i=0;i=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(vq=this._search(t),vq===-1)||this._getKey(this._array[vq])!==t)return!1;do if(this._array[vq]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(vq),!0;while(++vqe-t),t=0,n=Array(this._array.length-e.length),r=0;for(let i=0;i0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(vq=this._search(e),!(vq<0||vq>=this._array.length)&&this._getKey(this._array[vq])===e))do yield this._array[vq];while(++vq=this._array.length)&&this._getKey(this._array[vq])===e))do t(this._array[vq]);while(++vq=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},bq=0,xq=0,Sq=class extends sV{constructor(){super(),this._decorations=new yq(e=>e?.marker.line),this._onDecorationRegistered=this._register(new OV),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new OV),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(iV(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Cq(e);if(t){let e=t.marker.onDispose(()=>t.dispose()),n=t.onDispose(()=>{n.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let a of this._decorations.getKeyIterator(t))r=a.options.x??0,i=r+(a.options.width??1),e>=r&&e{bq=t.options.x??0,xq=bq+(t.options.width??1),e>=bq&&e=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let e=r-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},Eq=20,Dq=class extends sV{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce=``;let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement(`div`),this._accessibilityContainer.classList.add(`xterm-accessibility`),this._rowContainer=i.createElement(`div`),this._rowContainer.setAttribute(`role`,`list`),this._rowContainer.classList.add(`xterm-accessibility-tree`),this._rowElements=[];for(let e=0;ethis._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement(`div`),this._liveRegion.classList.add(`live-region`),this._liveRegion.setAttribute(`aria-live`,`assertive`),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Tq(this._renderRows.bind(this))),!this._terminal.element)throw Error(`Cannot enable accessibility before Terminal.open`);this._terminal.element.insertAdjacentElement(`afterbegin`,this._accessibilityContainer),this._register(this._terminal.onResize(e=>this._handleResize(e.rows))),this._register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(e=>this._handleChar(e))),this._register(this._terminal.onLineFeed(()=>this._handleChar(` +`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register($H(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(iV(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Eq+1&&(this._liveRegion.textContent+=Yz.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(!(!a||!o)){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;ee;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e{nV(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register($H(this._element,`mouseleave`,()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register($H(this._element,`mousemove`,this._handleMouseMove.bind(this))),this._register($H(this._element,`mousedown`,this._handleMouseDown.bind(this))),this._register($H(this._element,`mouseup`,this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let e=0;e{e?.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[r,i]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(r)&&(n=this._checkLinkProviderResult(r,e,n)):i.provideLinks(e.y,t=>{if(this._isMouseOut)return;let i=t?.map(e=>({link:e}));this._activeProviderReplies?.set(r,i),n=this._checkLinkProviderResult(r,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;re?this._bufferService.cols:r.link.range.end.x;for(let e=a;e<=o;e++){if(n.has(e)){i.splice(t--,1);break}n.add(e)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let t=0;tthis._linkAtPosition(e.link,t));e&&(n=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let e=0;ethis._linkAtPosition(e.link,t));if(r){n=!0,this._handleNewLink(r);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&kq(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,nV(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:e=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&this._element.classList.toggle(`xterm-cursor-pointer`,e))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:t=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;let t=e.start===0?0:e.start+1+this._bufferService.buffer.ydisp,n=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=n&&(this._clearCurrentLink(t,n),this._lastMouseEvent)){let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add(`xterm-cursor-pointer`)),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove(`xterm-cursor-pointer`)),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};Oq=Wz([Gz(1,MB),Gz(2,NB),Gz(3,vB),Gz(4,LB)],Oq);function kq(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var Aq=class extends hq{constructor(e={}){super(e),this._linkifier=this._register(new cV),this.browser=HW,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new cV),this._onCursorMove=this._register(new OV),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new OV),this.onKey=this._onKey.event,this._onRender=this._register(new OV),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new OV),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new OV),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new OV),this.onBell=this._onBell.event,this._onFocus=this._register(new OV),this._onBlur=this._register(new OV),this._onA11yCharEmitter=this._register(new OV),this._onA11yTabEmitter=this._register(new OV),this._onWillOpen=this._register(new OV),this._setup(),this._decorationService=this._instantiationService.createInstance(Sq),this._instantiationService.setService(DB,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(LW),this._instantiationService.setService(LB,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(OB)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(e=>this.refresh(e?.start??0,e?.end??this.rows-1))),this._register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this._register(this._inputHandler.onRequestReset(()=>this.reset())),this._register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this._register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this._register(hV.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(hV.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(hV.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(hV.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this._register(iV(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let e,n=``;switch(t.index){case 256:e=`foreground`,n=`10`;break;case 257:e=`background`,n=`11`;break;case 258:e=`cursor`,n=`12`;break;default:e=`ansi`,n=`4;`+t.index}switch(t.type){case 0:let r=aW.toColorRGB(e===`ansi`?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${$.ESC}]${n};${$K(r)}${ZU.ST}`);break;case 1:if(e===`ansi`)this._themeService.modifyColors(e=>e.ansi[t.index]=iW.toColor(...t.color));else{let n=e;this._themeService.modifyColors(e=>e[n]=iW.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(e){e?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(Dq,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[I`),this.element.classList.add(`focus`),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value=``,this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent($.ESC+`[O`),this.element.classList.remove(`focus`),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,s=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+`px`,this.textarea.style.top=o+`px`,this.textarea.style.width=a+`px`,this.textarea.style.height=r+`px`,this.textarea.style.lineHeight=r+`px`,this.textarea.style.zIndex=`-5`}_initGlobal(){this._bindKeys(),this._register($H(this.element,`copy`,e=>{this.hasSelection()&&Qz(e,this._selectionService)}));let e=e=>$z(e,this.textarea,this.coreService,this.optionsService);this._register($H(this.textarea,`paste`,e)),this._register($H(this.element,`paste`,e)),KW?this._register($H(this.element,`mousedown`,e=>{e.button===2&&nB(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register($H(this.element,`contextmenu`,e=>{nB(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),eG&&this._register($H(this.element,`auxclick`,e=>{e.button===1&&tB(e,this.textarea,this.screenElement)}))}_bindKeys(){this._register($H(this.textarea,`keyup`,e=>this._keyUp(e),!0)),this._register($H(this.textarea,`keydown`,e=>this._keyDown(e),!0)),this._register($H(this.textarea,`keypress`,e=>this._keyPress(e),!0)),this._register($H(this.textarea,`compositionstart`,()=>this._compositionHelper.compositionstart())),this._register($H(this.textarea,`compositionupdate`,e=>this._compositionHelper.compositionupdate(e))),this._register($H(this.textarea,`compositionend`,()=>this._compositionHelper.compositionend())),this._register($H(this.textarea,`input`,e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){if(!e)throw Error(`Terminal requires a parent element.`);if(e.isConnected||this._logService.debug(`Terminal.open was called on an element that was not attached to the DOM`),this.element?.ownerDocument.defaultView&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement(`div`),this.element.dir=`ltr`,this.element.classList.add(`terminal`),this.element.classList.add(`xterm`),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement(`div`),this._viewportElement.classList.add(`xterm-viewport`),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement(`div`),this.screenElement.classList.add(`xterm-screen`),this._register($H(this.screenElement,`mousemove`,e=>this.updateCursorStyle(e))),this._helperContainer=this._document.createElement(`div`),this._helperContainer.classList.add(`xterm-helpers`),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement(`textarea`);this.textarea.classList.add(`xterm-helper-textarea`),this.textarea.setAttribute(`aria-label`,qz.get()),tG||this.textarea.setAttribute(`aria-multiline`,`false`),this.textarea.setAttribute(`autocorrect`,`off`),this.textarea.setAttribute(`autocapitalize`,`off`),this.textarea.setAttribute(`spellcheck`,`false`),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange(`disableStdin`,()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(FW,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<`u`?window.document:null)),this._instantiationService.setService(jB,this._coreBrowserService),this._register($H(this.textarea,`focus`,e=>this._handleTextAreaFocus(e))),this._register($H(this.textarea,`blur`,()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(jW,this._document,this._helperContainer),this._instantiationService.setService(AB,this._charSizeService),this._themeService=this._instantiationService.createInstance(zG),this._instantiationService.setService(IB,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(fW),this._instantiationService.setService(FB,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(sG,this.rows,this.screenElement)),this._instantiationService.setService(NB,this._renderService),this._register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=this._document.createElement(`div`),this._compositionView.classList.add(`composition-view`),this._compositionHelper=this._instantiationService.createInstance(QU,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(BW),this._instantiationService.setService(MB,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(Oq,this.screenElement));this.element.appendChild(t);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this._register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this._register(this.onBlur(()=>this._renderService.handleBlur())),this._register(this.onFocus(()=>this._renderService.handleFocus())),this._viewport=this._register(this._instantiationService.createInstance(UU,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(e=>{super.scrollLines(e,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(kG,this.element,this.screenElement,r)),this._instantiationService.setService(PB,this._selectionService),this._register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this._register(hV.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(WU,this.screenElement)),this._register($H(this.element,`mousedown`,e=>this._selectionService.handleMouseDown(e))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add(`enable-mouse-events`)):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(Dq,this)),this._register(this.optionsService.onSpecificOptionChange(`screenReaderMode`,e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(YU,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange(`overviewRuler`,e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(YU,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(AW,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(t){let n=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!n)return!1;let r,i;switch(t.overrideType||t.type){case`mousemove`:i=32,t.buttons===void 0?(r=3,t.button!==void 0&&(r=t.button<3?t.button:3)):r=t.buttons&1?0:t.buttons&4?1:t.buttons&2?2:3;break;case`mouseup`:i=0,r=t.button<3?t.button:3;break;case`mousedown`:i=1,r=t.button<3?t.button:3;break;case`wheel`:if(e._customWheelEventHandler&&e._customWheelEventHandler(t)===!1)return!1;let n=t.deltaY;if(n===0||e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;i=n<0?0:1,r=4;break;default:return!1}return i===void 0||r===void 0||r>4?!1:e.coreMouseService.triggerMouseEvent({col:n.col,row:n.row,x:n.x,y:n.y,button:r,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:e=>(n(e),e.buttons||(this._document.removeEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.removeEventListener(`mousemove`,r.mousedrag)),this.cancel(e)),wheel:e=>(n(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&n(e)},mousemove:e=>{e.buttons||n(e)}};this._register(this.coreMouseService.onProtocolChange(e=>{e?(this.optionsService.rawOptions.logLevel===`debug`&&this._logService.debug(`Binding to mouse events:`,this.coreMouseService.explainEvents(e)),this.element.classList.add(`enable-mouse-events`),this._selectionService.disable()):(this._logService.debug(`Unbinding from mouse events.`),this.element.classList.remove(`enable-mouse-events`),this._selectionService.enable()),e&8?r.mousemove||=(t.addEventListener(`mousemove`,i.mousemove),i.mousemove):(t.removeEventListener(`mousemove`,r.mousemove),r.mousemove=null),e&16?r.wheel||=(t.addEventListener(`wheel`,i.wheel,{passive:!1}),i.wheel):(t.removeEventListener(`wheel`,r.wheel),r.wheel=null),e&2?r.mouseup||=i.mouseup:(this._document.removeEventListener(`mouseup`,r.mouseup),r.mouseup=null),e&4?r.mousedrag||=i.mousedrag:(this._document.removeEventListener(`mousemove`,r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register($H(t,`mousedown`,e=>{if(e.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(e)))return n(e),r.mouseup&&this._document.addEventListener(`mouseup`,r.mouseup),r.mousedrag&&this._document.addEventListener(`mousemove`,r.mousedrag),this.cancel(e)})),this._register($H(t,`wheel`,t=>{if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(t)===!1)return!1;if(!this.buffer.hasScrollback){if(t.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(t,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(t,!0);let n=$.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?`O`:`[`)+(t.deltaY<0?`A`:`B`);return this.coreService.triggerDataEvent(n,!0),this.cancel(t,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.shouldColumnSelect(e)?this.element.classList.add(`column-select`):this.element.classList.remove(`column-select`)}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){eB(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw Error(`Terminal must be opened first`);this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:``}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key===`Dead`||e.key===`AltGraph`)&&(this._unprocessedDeadKey=!0);let n=_q(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let t=this.rows-1;return this.scrollLines(n.type===2?-t:t),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===$.ETX||n.key===$.CR)&&(this.textarea.value=``),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState(`AltGraph`);return t.type===`keypress`?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(jq(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType===`insertText`&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){this._charSizeService?.measure()}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new dB)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},Pq=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new Nq(t)}getNullCell(){return new dB}},Fq=class extends sV{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new OV),this.onBufferChange=this._onBufferChange.event,this._normal=new Pq(this._core.buffers.normal,`normal`),this._alternate=new Pq(this._core.buffers.alt,`alternate`),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw Error(`Active buffer is neither normal nor alternate`)}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}},Iq=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,n)=>t(e,n.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},Lq=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}},Rq=[`cols`,`rows`],zq=0,Bq=class extends sV{constructor(e){super(),this._core=this._register(new Aq(e)),this._addonManager=this._register(new Mq),this._publicOptions={...this._core.options};let t=e=>this._core.options[e],n=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(let e in this._core.options){let r={get:t.bind(this,e),set:n.bind(this,e)};Object.defineProperty(this._publicOptions,e,r)}}_checkReadonlyOptions(e){if(Rq.includes(e))throw Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw Error(`You must set the allowProposedApi option to true to use proposed API`)}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||=new Iq(this._core),this._parser}get unicode(){return this._checkProposedApi(),new Lq(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||=this._register(new Fq(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t=`none`;switch(this._core.coreMouseService.activeProtocol){case`X10`:t=`x10`;break;case`VT200`:t=`vt200`;break;case`DRAG`:t=`drag`;break;case`ANY`:t=`any`}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r +`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return qz.get()},set promptLabel(e){qz.set(e)},get tooMuchOutput(){return Yz.get()},set tooMuchOutput(e){Yz.set(e)}}}_verifyIntegers(...e){for(zq of e)if(zq===1/0||isNaN(zq)||zq%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(zq of e)if(zq&&(zq===1/0||isNaN(zq)||zq%1!=0||zq<0))throw Error(`This API only accepts positive integers`)}};function Vq(){return{background:`#101316`,foreground:`#d7dde3`,cursor:`#7db8ff`,selectionBackground:`#365b8a`,black:`#1d2227`,red:`#ff7b72`,green:`#56d364`,yellow:`#e3b341`,blue:`#79c0ff`,magenta:`#d2a8ff`,cyan:`#39c5cf`,white:`#e6edf3`,brightBlack:`#6e7681`,brightRed:`#ffa198`,brightGreen:`#7ee787`,brightYellow:`#f2cc60`,brightBlue:`#a5d6ff`,brightMagenta:`#d2a8ff`,brightCyan:`#56d4dd`,brightWhite:`#ffffff`}}function Hq({sessionId:e,cwd:t,tabId:n,active:r=!0,onConnectionChange:i}){let{t:a}=cr(),o=(0,_.useMemo)(()=>new lf,[]),s=kk(),c=n?s?.terminals?.[n]:s?.terminal,l=t.replace(/[\\/]+$/u,``).split(/[\\/]/u).pop()||t,u=(0,_.useRef)(r);u.current=r;let d=(0,_.useRef)(null),f=(0,_.useRef)(null),p=(0,_.useRef)(c?.id??null),[m,h]=(0,_.useState)(`connecting`),[g,v]=(0,_.useState)(null),[y,b]=(0,_.useState)(null),[x,S]=(0,_.useState)(!1),[C,T]=(0,_.useState)(!1),[E,D]=(0,_.useState)(0),O=(0,_.useRef)(null),k=(0,_.useRef)(null),[A,j]=(0,_.useState)(!1),[M,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(null),I=(0,_.useRef)(i);I.current=i,(0,_.useEffect)(()=>{I.current?.({id:p.current,pending:[`connecting`,`reconnecting`,`restarting`].includes(m)})},[m]),(0,_.useEffect)(()=>{let r=d.current;if(!r)return;let i=n?s?.terminals?.[n]:s?.terminal;p.current??=i?.id??null;let c=!1,l=!1,m=!1,g=!1,_,y=!1,x=Promise.resolve(void 0),C=null,w=new AbortController;h(`connecting`),v(null),b(null),S(!1),T(!1),j(!1),N(!1),F(null);let D=new Bq({cursorBlink:!0,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace`,fontSize:13,lineHeight:1.25,scrollback:8e3,screenReaderMode:!0,disableStdin:!0,theme:Vq()}),A=i?{...i}:void 0,M=new Bz;D.loadAddon(M),D.open(r);let P=f.current;f.current=null,!r.closest(`[hidden], [inert]`)&&(E===0||r.closest(`.interactive-terminal`)?.contains(document.activeElement)||P?.sessionId===e&&P.cwd===t&&P.generation===E&&document.activeElement===document.body)&&D.focus(),D.attachCustomKeyEventHandler(e=>{if(e.type!==`keydown`)return!0;let t=e.key.toLowerCase();return t===`escape`&&e.stopPropagation(),!((e.ctrlKey||e.metaKey)&&t===`v`||(e.ctrlKey||e.metaKey)&&t===`c`&&D.hasSelection())});let I=e=>!c&&w===e&&!e.signal.aborted,L=()=>{m=!1,y=!0,C=null,D.options.disableStdin=!0,w.abort()},R=e=>{c||(L(),v(e instanceof Error?e.message:a(`terminalError`)),h(`error`))},ee=e=>{if(y||c)return;let t=w;x=x.then(()=>{if(I(t)&&!y&&m&&!l)return e()}).catch(e=>{I(t)&&R(e)})},z=t=>{let n=p.current;if(!(!n||!u.current||!m||l||y))for(let r of t.match(/[\s\S]{1,32768}/gu)??[]){if(C&&C.data.length+r.length<=65536){C.data+=r;continue}let t={data:r};C=t,ee(async()=>{C===t&&(C=null),await o.writeInteractiveTerminal(e,n,t.data)})}},B=(t,n)=>{let r=p.current;!r||!m||l||y||(C=null,ee(()=>o.resizeInteractiveTerminal(e,r,t,n)))},V=()=>{if(!(!r.offsetWidth||!r.offsetHeight))try{M.fit()}catch{}},H=(e=D.buffer.active.viewportY)=>{let t=e>=D.buffer.active.baseY;S(!t);let r=p.current;if(s&&r&&!A){let i={...n?s.terminals?.[n]:s.terminal,id:r,viewport:e,atBottom:t};n?(s.terminals??={})[n]=i:s.terminal=i}},te=e=>{if(!c){if(e.type===`output`){if(e.reset)D.reset(),_!==void 0&&T(!0);else if(_!==void 0&&e.offset<=_)return;D.write(e.data,()=>{c||(A&&=(A.atBottom?D.scrollToBottom():D.scrollToLine(A.viewport),void 0),H())}),_=e.offset;return}l=!0,m=!1,D.options.disableStdin=!0,w.abort(),b(e.type===`exit`?e.exitCode:null),h(`exited`)}},ne=D.onData(z),re=D.onScroll(H),ie=D.onResize(({cols:e,rows:t})=>B(e,t)),ae=typeof ResizeObserver>`u`?void 0:new ResizeObserver(V);ae?.observe(r);let U=async()=>{if(c||g||m)return;g=!0,L();let r=new AbortController;w=r,x=Promise.resolve();let i=p.current;h(i?`reconnecting`:`connecting`),v(null),V();try{let c=i?await o.interactiveTerminal(e,i,r.signal):await o.createInteractiveTerminal(e,D.cols,D.rows,r.signal,n?`${n}:${E}`:void 0);if(!I(r))return;if(!c.id||c.sessionId!==e||c.cwd!==t||i&&c.id!==i)throw Error(a(`inspectionChanged`));if(g=!1,p.current=c.id,s){let e={viewport:0,atBottom:!0,...n?s.terminals?.[n]:s.terminal,id:c.id};n?(s.terminals??={})[n]=e:s.terminal=e}l=c.exited,m=!c.exited,y=c.exited,D.options.disableStdin=c.exited,h(c.exited?`exited`:`ready`),b(c.exitCode),V(),c.exited||B(D.cols,D.rows),await o.streamInteractiveTerminal(e,c.id,_,r.signal,e=>{I(r)&&te(e)}),I(r)&&!l&&R(Error(a(`terminalDisconnected`)))}catch(e){I(r)&&R(e)}finally{w===r&&(g=!1)}},oe={reconnect:()=>{U()},suspend:L,scrollToBottom:()=>{c||(D.scrollToBottom(),D.focus())}};return O.current=oe,U(),()=>{c=!0,L(),O.current===oe&&(O.current=null),k.current===oe&&(k.current=null),ae?.disconnect(),ne.dispose(),re.dispose(),ie.dispose(),x.catch(()=>void 0),D.dispose(),p.current=null}},[o,t,E,e,a,s,n]);let L=async r=>{let i=O.current;if(!i||k.current)return;k.current=i,N(!0),F(null),h(`restarting`),v(null),i.suspend();let c=p.current;try{if(c&&await o.closeInteractiveTerminal(e,c),O.current!==i)return;if(p.current=null,s)if(n){let e=s.terminals?.[n]?.title;(s.terminals??={})[n]={viewport:0,atBottom:!0,title:e}}else s.terminal=void 0;r&&(f.current={sessionId:e,cwd:t,generation:E+1}),j(!1),D(e=>e+1)}catch(e){if(O.current===i){let t=e instanceof Error?e.message:a(`terminalError`);v(t),F(t),h(`error`),k.current=null,N(!1)}}};return(0,K.jsxs)(`section`,{className:`interactive-terminal`,"aria-label":a(`terminal`),children:[(0,K.jsxs)(`header`,{className:`interactive-terminal-status`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`span`,{className:`terminal-status-dot ${m}`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`terminal-cwd`,title:t,children:l}),m===`ready`&&(0,K.jsx)(`span`,{className:`terminal-connection-state`,children:a(`connected`)})]}),(0,K.jsxs)(`div`,{className:`interactive-terminal-actions`,children:[m===`error`&&(0,K.jsxs)(`button`,{type:`button`,"aria-label":a(`reconnectTerminal`),title:a(`reconnectTerminal`),className:`terminal-reconnect-action`,disabled:M,onClick:()=>O.current?.reconnect(),children:[(0,K.jsx)(dt,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:a(`reconnectTerminal`)})]}),(0,K.jsx)(`button`,{type:`button`,"aria-label":a(`restartTerminal`),title:a(`restartTerminal`),disabled:M||m===`connecting`||m===`reconnecting`,onClick:()=>{F(null),j(!0)},children:(0,K.jsx)(ft,{"aria-hidden":`true`})})]})]}),(0,K.jsxs)(`div`,{className:`interactive-terminal-notice`,"aria-live":`polite`,children:[g?(0,K.jsx)(`span`,{className:`error`,children:g}):m===`exited`?(0,K.jsx)(`span`,{children:y===null?a(`terminalExited`):a(`terminalExitCode`,{code:y})}):m===`connecting`?(0,K.jsx)(`span`,{children:a(`terminalConnecting`)}):m===`reconnecting`?(0,K.jsx)(`span`,{children:a(`terminalReconnecting`)}):m===`restarting`?(0,K.jsx)(`span`,{children:a(`terminalRestarting`)}):null,C&&(0,K.jsx)(`span`,{className:`terminal-output-resynced`,children:a(`terminalOutputResynced`)})]}),(0,K.jsxs)(`div`,{className:`interactive-terminal-viewport`,children:[(0,K.jsx)(`div`,{ref:d,className:`interactive-terminal-host`}),x&&(0,K.jsxs)(`button`,{type:`button`,className:`terminal-scroll-bottom`,onClick:()=>O.current?.scrollToBottom(),children:[(0,K.jsx)(w,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:a(`terminalScrollToBottom`)})]})]}),(0,K.jsx)(iM,{isOpen:A,purpose:`form`,width:430,"aria-label":a(`restartTerminalTitle`),onOpenChange:e=>{!e&&!k.current&&j(!1)},children:(0,K.jsxs)(`form`,{className:`openpi-dialog`,"aria-busy":M,onSubmit:e=>{e.preventDefault(),L(e.currentTarget.contains(document.activeElement))},children:[(0,K.jsx)(`strong`,{children:a(`restartTerminalTitle`)}),(0,K.jsx)(`p`,{children:a(`restartTerminalDetail`)}),P&&(0,K.jsx)(`p`,{className:`terminal-restart-error`,role:`alert`,children:P}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:M,onClick:()=>{k.current||j(!1)},children:a(`cancel`)}),(0,K.jsx)(`button`,{type:`submit`,className:`danger`,disabled:M,children:a(M?`terminalRestarting`:`restartTerminal`)})]})]})},`${e}:${t}`)]})}function Uq(e){return e.startsWith(`terminal:`)?`terminal`:e}function Wq(e){return e===`launcher`?{tabs:[],active:null,launcherOpen:!0,activationHistory:[]}:{tabs:[e],active:e,launcherOpen:!1,activationHistory:[e]}}function Gq(e,t){return t===`launcher`?{...e,launcherOpen:!0}:{tabs:e.tabs.includes(t)?e.tabs:[...e.tabs,t],active:t,launcherOpen:!1,activationHistory:[...e.activationHistory.filter(e=>e!==t),t]}}function Kq(e,t){return e.tabs.includes(t)?Gq(e,t):e}function qq(e,t){if(!e.tabs.includes(t))return e;let n=e.tabs.filter(e=>e!==t),r=e.activationHistory.filter(e=>e!==t);if(e.active!==t)return{...e,tabs:n,activationHistory:r};let i=r.at(-1),a=e.tabs.indexOf(t),o=n[Math.min(a,n.length-1)],s=i??o??null;return{tabs:n,active:s,launcherOpen:e.launcherOpen||s===null,activationHistory:r}}function Jq(e){return{...e,launcherOpen:e.active===null}}var Yq=[{kind:`side-conversation`,icon:qe,title:`sideConversation`,description:`sideConversationDescription`},{kind:`review`,icon:ye,title:`changeEvidence`,description:`workbarChangesDescription`},{kind:`terminal`,icon:Tt,title:`terminal`,description:`workbarTerminalDescription`},{kind:`browser`,icon:me,title:`browser`,description:`workbarBrowserDescription`},{kind:`files`,icon:G,title:`files`,description:`workbarFilesDescription`}];function Xq({onSelect:e}){let{t}=cr();return(0,K.jsx)(`section`,{className:`workbar-launcher`,"aria-label":t(`openTools`),children:(0,K.jsx)(`div`,{className:`workbar-launcher-list`,children:Yq.map(n=>{let r=n.icon;return(0,K.jsxs)(`button`,{type:`button`,onClick:()=>e(n.kind),children:[(0,K.jsx)(r,{"aria-hidden":`true`}),(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:t(n.title)}),(0,K.jsx)(`small`,{children:t(n.description)})]}),(0,K.jsx)(ee,{"aria-hidden":`true`})]},n.kind)})})})}function Zq({sessionId:e,cwd:t,snapshot:n,activity:r}){let{t:i}=cr(),a=(0,_.useMemo)(()=>new lf,[]),o=kk(),[s,c]=(0,_.useState)(o?.sideConversation?.selectedId??null),[l,u]=(0,_.useState)(o?.sideConversation?.drafts??{});(0,_.useLayoutEffect)(()=>{o&&(o.sideConversation={selectedId:s,drafts:l})},[o,s,l]);let d=l[s??``]??``,f=(0,_.useRef)(0),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1),b=(0,_.useRef)(!1),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(0),[E,D]=(0,_.useState)(null),O=(0,_.useRef)(null);(0,_.useEffect)(()=>()=>O.current?.abort(),[]);let A=(r?.items??[]).filter(e=>e.origin===`btw`),j=A.find(e=>e.id===s),M=j?.status??E,N=p?.id===s?p:null,P=n?.models.find(e=>s?`${e.provider}/${e.id}`===N?.model:e.current),F=s?N?.model:P&&`${P.provider}/${P.id}`,I=P?.name||P?.id||F||i(`usageUnknown`),L=!s&&n?.thinking?.supported?n.thinking.level:void 0,R=N?.cwd??t,z=n?.workspaces.find(e=>e.path===R)?.name??rj(R),B=i(s?`continueSideConversation`:`startSideConversation`),V=i(v?`sideConversationPending`:s?`send`:`start`),H=e=>{f.current++,c(e),D(null),S(null),g(null)},te=async t=>{t.preventDefault();let n=d.trim();if(!n||b.current)return;b.current=!0,O.current?.abort();let r=new AbortController,o=f.current,l=s??``;O.current=r,y(!0),S(null);try{let t=await a.subagentAction(e,s?{kind:`subagents`,action:`send-btw`,id:s,text:n}:{kind:`subagents`,action:`spawn-btw`,prompt:n},r.signal);if(r.signal.aborted)return;if(t.sessionId!==e||s&&t.detail.id!==s)throw Error(i(`inspectionChanged`));if(u(e=>e[l]===d?{...e,[l]:``}:e),o!==f.current)return;c(t.detail.id),D(t.detail.status),w(e=>e+1)}catch(e){!r.signal.aborted&&o===f.current&&S(e instanceof Error?e.message:i(`inspectionUnavailable`))}finally{r.signal.aborted||(b.current=!1,y(!1))}},ne=async()=>{if(!s||b.current)return;b.current=!0,O.current?.abort();let t=new AbortController,n=f.current;O.current=t,y(!0),S(null);try{let r=await a.subagentAction(e,{kind:`subagents`,action:`cancel-btw`,id:s},t.signal);if(t.signal.aborted||n!==f.current)return;if(r.sessionId!==e||r.detail.id!==s)throw Error(i(`inspectionChanged`));D(r.detail.status),w(e=>e+1)}catch(e){!t.signal.aborted&&n===f.current&&S(e instanceof Error?e.message:i(`inspectionUnavailable`))}finally{t.signal.aborted||(b.current=!1,y(!1))}};return(0,K.jsxs)(`div`,{className:`side-conversation-body`,children:[s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{type:`button`,className:`workbar-back`,onClick:()=>H(null),children:[(0,K.jsx)(T,{"aria-hidden":`true`}),` `,i(`backToSideConversations`)]}),(0,K.jsx)($I,{sessionId:e,id:s,activity:j,client:a,liveAvailable:!0,refreshRevision:C,fullView:!1,readOnlyNote:!1,onDetail:e=>m({id:e.id,cwd:e.cwd,model:e.model})},`${e}:${s}`)]}):(0,K.jsxs)(`div`,{className:`side-conversation-list`,"data-empty":A.length===0,children:[(0,K.jsxs)(`div`,{className:`side-conversation-intro`,children:[(0,K.jsx)(qe,{"aria-hidden":`true`}),(0,K.jsx)(`h3`,{children:i(`sideConversation`)}),(0,K.jsx)(`p`,{children:i(`sideConversationDescription`)})]}),A.length>0&&(0,K.jsx)(`ul`,{children:A.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`button`,{type:`button`,onClick:()=>H(e.id),children:[(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:e.title||e.id}),(0,K.jsx)(`small`,{children:i(`subagentState_${e.status}`)})]}),(0,K.jsx)(ee,{"aria-hidden":`true`})]})},e.id))})]}),x&&(0,K.jsx)(`p`,{className:`workbar-error`,role:`alert`,children:x}),(0,K.jsx)(`div`,{className:`composer-dock`,children:(0,K.jsxs)(`form`,{className:`composer composer-m02 side-conversation-composer`,onSubmit:te,"aria-busy":v,children:[(0,K.jsx)(`textarea`,{rows:1,value:d,disabled:v,"aria-label":B,placeholder:B,onChange:e=>{let t=e.currentTarget.value;u(e=>({...e,[s??``]:t}))},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.defaultPrevented&&!e.nativeEvent.isComposing&&e.nativeEvent.keyCode!==229&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}}),(0,K.jsxs)(`div`,{className:`composer-toolbar`,children:[(0,K.jsxs)(`div`,{className:`composer-toolbar-context`,children:[(0,K.jsx)(`button`,{type:`button`,className:`composer-context-trigger icon-button`,"aria-label":i(`addContext`),title:i(`fileReference`),disabled:v,onClick:()=>g({key:s??``,generation:f.current}),children:(0,K.jsx)(lt,{"aria-hidden":`true`})}),(0,K.jsxs)(`span`,{className:`composer-workspace-label`,title:R,children:[(0,K.jsx)(De,{"aria-hidden":`true`}),` `,z]})]}),(0,K.jsxs)(`div`,{className:`composer-toolbar-controls`,children:[(0,K.jsx)(`div`,{className:`model-picker-wrap`,children:(0,K.jsx)(iN,{className:`model-selector model-picker`,label:`${i(`model`)}: ${I}`,isLabelHidden:!0,value:F??``,triggerLabel:(0,K.jsxs)(`span`,{className:`model-thinking-label`,title:F||I,children:[(0,K.jsx)(`span`,{className:`model-picker-label`,children:I}),L&&(0,K.jsx)(`span`,{className:`model-picker-thinking`,children:L[0].toUpperCase()+L.slice(1)})]}),variant:`ghost`,size:`sm`,placement:`above`,alignment:`end`,isDisabled:!F,children:()=>(0,K.jsxs)(`div`,{className:`side-conversation-model-details`,children:[(0,K.jsx)(`strong`,{children:I}),(0,K.jsx)(`code`,{children:F}),(0,K.jsx)(`p`,{children:i(s?`sideConversationModelFixed`:`sideConversationModelInherited`)})]})},s??`new`)}),s&&M===`running`&&(0,K.jsx)(`button`,{type:`button`,className:`send-button`,"aria-label":i(`stop`),title:i(`stop`),disabled:v,onClick:()=>void ne(),children:(0,K.jsx)(Et,{"aria-hidden":`true`})}),(!s||M!==`running`||!!d.trim())&&(0,K.jsx)(`button`,{type:`submit`,className:`send-button`,disabled:v||!d.trim(),"aria-label":V,title:V,children:(0,K.jsx)(k,{"aria-hidden":`true`})})]})]})]})}),(0,K.jsx)($M,{open:h!==null,sessionId:e,onClose:()=>g(null),onInsert:e=>{if(!h||h.generation!==f.current||h.key!==(s??``)||b.current)return i(`fileReferenceDraftChanged`);let t=h.key;u(n=>({...n,[t]:`${n[t]??``}${n[t]?` +`:``}${eN(e)}`}))}})]})}function Qq({sessionId:e,cwd:t,activity:n,tabId:r,active:i,onConnectionChange:a}){let{t:o}=cr(),s=n?.items??[];return(0,K.jsxs)(`div`,{className:`terminal-workspace`,children:[(0,K.jsx)(Hq,{sessionId:e,cwd:t,tabId:r,active:i,onConnectionChange:a}),s.length>0&&(0,K.jsxs)(`details`,{className:`terminal-agent-activity`,children:[(0,K.jsxs)(`summary`,{children:[(0,K.jsx)(Tt,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:o(`backgroundTerminalActivity`)}),(0,K.jsx)(`small`,{children:s.length}),(0,K.jsx)(ee,{"aria-hidden":`true`})]}),(0,K.jsx)(`ul`,{children:s.map(e=>(0,K.jsx)(`li`,{children:(0,K.jsxs)(`span`,{children:[(0,K.jsx)(`strong`,{children:e.title||e.id}),(0,K.jsx)(`small`,{children:o(`execution_${e.status}`,{defaultValue:e.status})})]})},e.id))})]})]})}function $q({visible:e,requestedTool:t,requestRevision:n,sessionId:r,sessionPath:i,cwd:a,snapshot:o,capabilities:s,review:c,reviewInitialFilePath:l,reviewTurn:u,onWorkspaceReview:d,conversationCollapsed:f,onRestoreConversation:p,onExpandReview:m,onClose:h,onActiveToolChange:g,canControl:v=!0,onActivateSession:y,readingState:b,onReferenceLine:x,onBrowserReady:S}){let{t:C}=cr(),w=(0,_.useRef)({}),E=b??w.current;E.terminal&&!E.terminals?.terminal&&((E.terminals??={}).terminal=E.terminal,E.terminal=void 0);let[D,O]=(0,_.useState)(()=>E?.tabs?E.requestRevision===n?E.tabs:Gq(E.tabs,t):Wq(t)),k=JSON.stringify([r,i]),A=(0,_.useRef)(new Map),j=(0,_.useRef)(null),M=(0,_.useRef)(null),N=(0,_.useRef)(null),P=(0,_.useMemo)(()=>new lf,[]),[F,I]=(0,_.useState)({}),[L,R]=(0,_.useState)([]),ee=(0,_.useRef)(new Set),z=(0,_.useRef)(0);(0,_.useEffect)(()=>()=>{z.current++},[]);let[B,V]=(0,_.useState)(null),[H,te]=(0,_.useState)(null),[ne,re]=(0,_.useState)(``),[ie,ae]=(0,_.useState)(()=>Object.fromEntries(Object.entries(E.terminals??{}).flatMap(([e,t])=>t.title?[[e,t.title]]:[]))),U=e=>ie[e]??(e===`terminal`?C(`terminal`):`${C(`terminal`)} ${D.tabs.filter(e=>Uq(e)===`terminal`).indexOf(e)+1}`);(0,_.useLayoutEffect)(()=>{let t=N.current;if(N.current=null,!t||t.scope!==k||!e||(t.tool?D.launcherOpen||D.active!==t.tool:!D.launcherOpen))return;let n=requestAnimationFrame(()=>{let e=t.tool?A.current.get(t.tool):j.current;!e?.isConnected||e.closest(`[hidden], [inert]`)||document.activeElement!==document.body&&!e.closest(`.workbar-panel`)?.contains(document.activeElement)&&!document.getElementById(j.current?.getAttribute(`aria-controls`)??``)?.contains(document.activeElement)||e.focus({preventScroll:!0})});return()=>cancelAnimationFrame(n)},[D,k,e]);let oe=e&&!D.launcherOpen&&D.active===`browser`&&v,[se,ce]=(0,_.useState)(null);(0,_.useLayoutEffect)(()=>{oe?ce(k):(!e||!v||!D.tabs.includes(`browser`)||se!==k)&&ce(null)},[oe,k,e,v,D,se]),(0,_.useLayoutEffect)(()=>{E&&(E.tabs=D,E.requestRevision=n)},[E,D,n]);let le=Nz(r,i,a,u?.promptEntryId),ue=(0,_.useRef)(n);(0,_.useEffect)(()=>(g?.(e?D.launcherOpen?`launcher`:D.active?Uq(D.active):null:null),()=>g?.(null)),[e,D.launcherOpen,D.active,g]),(0,_.useEffect)(()=>{ue.current!==n&&(ue.current=n,O(e=>Gq(e,t)))},[n,t]);let de=e=>{let t=e===`terminal`&&D.tabs.some(e=>Uq(e)===`terminal`)?`terminal:${crypto.randomUUID()}`:e;if(t!==`launcher`&&(N.current={tool:t,scope:k}),t.startsWith(`terminal:`)){let e=Math.max(1,...Object.values(ie).map(e=>Number(e.match(/\s(\d+)$/u)?.[1])||0))+1,n=`${C(`terminal`)} ${e}`;ae(e=>({...e,[t]:n})),(E.terminals??={})[t]={viewport:0,atBottom:!0,title:n}}O(e=>Gq(e,t))},fe=async(e,t)=>{let n=z.current,i=t.contains(document.activeElement);if(Uq(e)===`terminal`&&v){if(ee.current.has(e)||F[e]?.pending)return;let t=F[e]?.id??E.terminals?.[e]?.id;if(t){ee.current.add(e),R(t=>[...t,e]),V(null);try{await P.closeInteractiveTerminal(r,t)}catch(e){n===z.current&&V(e instanceof Error?e.message:C(`terminalError`));return}finally{n===z.current&&(ee.current.delete(e),R(t=>t.filter(t=>t!==e)))}if(n!==z.current)return}}Uq(e)===`terminal`&&E.terminals&&delete E.terminals[e],O(n=>{let r=qq(n,e);return(t.contains(document.activeElement)||i&&document.activeElement===document.body)&&(N.current={tool:r.launcherOpen?null:r.active,scope:k}),r})},pe=D.active?Uq(D.active):null,me=D.launcherOpen?`openTools`:Yq.find(e=>e.kind===pe)?.title??`openTools`;return Ki({isActive:e,onDismiss:()=>{D.launcherOpen&&D.active?(N.current={tool:D.active,scope:k},O(Jq)):h()},getContainer:()=>M.current,isPresent:()=>M.current?.contains(document.activeElement)??!1}),(0,K.jsx)(Ok.Provider,{value:E,children:(0,K.jsx)(Ti,{children:(0,K.jsxs)(`aside`,{ref:M,className:`workbar-panel`,hidden:!e,"aria-label":C(me??`openTools`),children:[(0,K.jsxs)(`header`,{className:`workbar-tabbar`,children:[(0,K.jsxs)(`div`,{className:`workbar-tabs`,role:`toolbar`,"aria-label":C(`openTools`),children:[D.tabs.length===0&&(0,K.jsxs)(`span`,{className:`workbar-tab-placeholder`,children:[(0,K.jsx)(lt,{"aria-hidden":`true`}),` `,C(`openTools`)]}),D.tabs.map(e=>{let t=Uq(e),n=Yq.find(e=>e.kind===t),r=n.icon,i=!D.launcherOpen&&D.active===e,a=t===`terminal`?U(e):C(n.title),o=()=>{t===`terminal`&&(re(a),te(e))};return(0,K.jsxs)(`div`,{className:`workbar-tab`,"data-active":i||void 0,children:[(0,K.jsxs)(`button`,{type:`button`,ref:t=>{t?A.current.set(e,t):A.current.delete(e)},"aria-pressed":i,title:t===`terminal`?`${a} · ${C(`renameTerminal`)}`:a,onDoubleClick:o,onContextMenu:e=>{t===`terminal`&&(e.preventDefault(),o())},onKeyDown:e=>{t===`terminal`&&e.key===`F2`&&(e.preventDefault(),o())},onClick:()=>O(t=>Kq(t,e)),children:[(0,K.jsx)(r,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:a})]}),(0,K.jsx)(`button`,{type:`button`,className:`workbar-tab-close`,"aria-label":t===`terminal`&&v?C(`workbarEndTerminal`,{name:a}):`${C(`close`)} ${a}`,title:t===`terminal`&&v?C(`workbarEndTerminal`,{name:a}):`${C(`close`)} ${a}`,disabled:t===`terminal`&&v&&(L.includes(e)||F[e]?.pending!==!1),onClick:t=>void fe(e,t.currentTarget),children:(0,K.jsx)(Lt,{"aria-hidden":`true`})})]},e)})]}),(0,K.jsxs)(`div`,{className:`workbar-tabbar-actions`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`workbar-back-to-chat`,onClick:()=>{f?p():h(),requestAnimationFrame(()=>document.querySelector(`.composer textarea`)?.focus({preventScroll:!0}))},children:[(0,K.jsx)(T,{"aria-hidden":`true`}),(0,K.jsx)(`span`,{children:C(`workbarBackToChat`)})]}),!f&&D.active===`review`&&m&&(0,K.jsx)(`button`,{type:`button`,className:`icon-button review-expand`,"aria-label":C(`gitReviewExpand`),title:C(`gitReviewExpand`),onClick:m,children:(0,K.jsx)(nt,{"aria-hidden":`true`,style:{transform:`rotate(180deg)`}})}),D.active?(0,K.jsx)(IA,{className:`workbar-tool-picker`,button:{ref:j,className:`icon-button workbar-add-tab`,icon:(0,K.jsx)(lt,{"aria-hidden":`true`}),label:C(`openTools`),isIconOnly:!0,variant:`ghost`,"aria-label":C(`openTools`),tooltip:C(`openTools`)},onOpenChange:e=>{e||(N.current??={tool:D.active,scope:k},O(Jq))},items:Yq.map(e=>({id:e.kind,icon:(0,K.jsx)(e.icon,{"aria-hidden":`true`}),label:C(e.kind===`terminal`?`workbarNewTerminal`:e.title),description:C(e.description),onClick:()=>de(e.kind)})),menuWidth:`min(300px, calc(100vw - 24px))`,alignment:`end`,hasChevron:!1}):(0,K.jsx)(`button`,{type:`button`,ref:j,className:`icon-button workbar-add-tab`,"aria-label":C(`openTools`),title:C(`openTools`),"aria-pressed":D.launcherOpen,onClick:()=>O(e=>Gq(e,`launcher`)),children:(0,K.jsx)(lt,{"aria-hidden":`true`})}),(0,K.jsx)(`button`,{type:`button`,className:`icon-button`,"aria-label":C(`workbarCollapseTools`),title:C(`workbarCollapseTools`),onClick:h,children:(0,K.jsx)(rt,{"aria-hidden":`true`})})]})]}),B&&(0,K.jsx)(`p`,{className:`error`,role:`alert`,children:B}),(0,K.jsxs)(`div`,{className:`workbar-panels`,children:[(0,K.jsx)(`div`,{className:`workbar-tool-panel`,hidden:!D.launcherOpen,children:(0,K.jsx)(Xq,{onSelect:de})}),D.tabs.map(t=>{let n=Uq(t);return(0,K.jsx)(`div`,{className:`workbar-tool-panel`,"data-tool":n,"data-tab":t,hidden:D.launcherOpen||D.active!==t,inert:D.launcherOpen||D.active!==t||!e,children:n===`terminal`&&e&&v?(0,K.jsx)(Qq,{sessionId:r,cwd:a,tabId:t,active:!D.launcherOpen&&D.active===t,onConnectionChange:e=>I(n=>({...n,[t]:e})),activity:s[`background-terminals`]}):n===`browser`&&e&&v&&(oe||se===k)?(0,K.jsx)(Lz,{onReady:S},k):e&&!D.launcherOpen&&D.active===t?!v&&[`side-conversation`,`terminal`,`browser`].includes(n)?(0,K.jsxs)(`div`,{className:`workbar-empty`,children:[(0,K.jsx)(`p`,{children:C(`toolsRequireCurrentSession`)}),y&&(0,K.jsx)(`button`,{type:`button`,className:`secondary`,onClick:y,children:C(`activateViewedSession`)})]}):n===`side-conversation`?(0,K.jsx)(Zq,{sessionId:r,cwd:a,snapshot:o,activity:s.subagents}):n===`review`?(0,K.jsx)(Mz,{review:u?{...le,setSource:e=>{c.setSource?.(e),d?.()}}:c,initialFilePath:u?.filePath??l,readingScope:u?`turn:${u.promptEntryId}:${u.revision}`:`workspace:${c.source??`unstaged`}`,onOpenFiles:()=>de(`files`),onReferenceLine:v?x:void 0,onClose:()=>O(e=>qq(e,`review`)),embedded:!0},u?`${u.promptEntryId}:${u.revision}`:c.source??`workspace`):(0,K.jsx)(nz,{sessionId:r,sessionPath:i,cwd:a,active:!0,canWrite:v},JSON.stringify([r,i,a])):null},t)})]}),(0,K.jsx)(iM,{isOpen:H!==null,purpose:`form`,"aria-label":C(`renameTerminal`),onOpenChange:e=>{e||te(null)},children:(0,K.jsxs)(`form`,{className:`openpi-dialog`,onSubmit:e=>{e.preventDefault();let t=ne.trim();if(!H||!t)return;ae(e=>({...e,[H]:t}));let n=(E.terminals??={})[H];E.terminals[H]={...n??{viewport:0,atBottom:!0},title:t},te(null)},children:[(0,K.jsx)(`strong`,{children:C(`renameTerminal`)}),(0,K.jsx)(`input`,{"aria-label":C(`terminalName`),value:ne,maxLength:80,onChange:e=>re(e.target.value)}),(0,K.jsxs)(`div`,{className:`dialog-actions`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>te(null),children:C(`cancel`)}),(0,K.jsx)(`button`,{type:`submit`,disabled:!ne.trim(),children:C(`save`)})]})]})})]})})})}var eJ=`openpi:workbar-positions:v1`;function tJ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function nJ(e,t=4096){return typeof e==`string`&&e.length<=t?e:``}function rJ(e,t=0,n=0,r=5e7){return typeof e==`number`&&Number.isFinite(e)&&e>=n&&e<=r?e:t}function iJ(e,t=100){return Array.isArray(e)?e.slice(0,t).filter(e=>typeof e==`string`&&e.length<=4096):[]}function aJ(e){return YR(nJ(e),window.location.origin)}function oJ(e){return typeof e==`string`&&([`files`,`review`,`browser`,`terminal`,`side-conversation`].includes(e)||/^terminal:[a-zA-Z0-9-]{1,128}$/u.test(e))}function sJ(e){return typeof e==`string`&&[`launcher`,`files`,`review`,`browser`,`terminal`,`side-conversation`].includes(e)}function cJ(e){let t={};if(!tJ(e))return t;if(tJ(e.tabs)){let n=Array.isArray(e.tabs.tabs)?[...new Set(e.tabs.tabs.filter(oJ))].slice(0,16):[],r=oJ(e.tabs.active)&&n.includes(e.tabs.active)?e.tabs.active:null;t.tabs={tabs:n,active:r,launcherOpen:e.tabs.launcherOpen===!0||r===null,activationHistory:Array.isArray(e.tabs.activationHistory)?[...new Set(e.tabs.activationHistory.filter(oJ).filter(e=>n.includes(e)))].slice(-16):[]},t.requestRevision=rJ(e.requestRevision)}if(tJ(e.files)&&(t.files={selected:nJ(e.files.selected),treeVisible:e.files.treeVisible!==!1,query:nJ(e.files.query,200),expanded:iJ(e.files.expanded),treeScroll:rJ(e.files.treeScroll)}),tJ(e.artifact)){t.artifact={reference:nJ(e.artifact.reference),source:e.artifact.source===!0,editing:!1,scroll:rJ(e.artifact.scroll)};let n=e.artifact.document;tJ(n)&&typeof n.revision==`string`&&/^[a-f0-9]{64}$/u.test(n.revision)&&(t.artifact.document={path:nJ(n.path),revision:n.revision,page:Math.floor(rJ(n.page,1,1,1e5)),...typeof n.scale==`number`?{scale:rJ(n.scale,1,.1,8)}:{}})}let n=e.review;tJ(n)&&(n.source===`unstaged`||n.source===`staged`||n.source===`branch`||n.source===`session`)&&(t.review={scope:nJ(n.scope),source:n.source,...typeof n.baseRef==`string`?{baseRef:nJ(n.baseRef,1024)}:{},selected:typeof n.selected==`string`?nJ(n.selected):null,query:nJ(n.query,200),collapsedDirectories:iJ(n.collapsedDirectories),visibleFiles:rJ(n.visibleFiles,50,0,200),listScroll:rJ(n.listScroll),previewScroll:rJ(n.previewScroll)},tJ(n.viewed)&&typeof n.viewed.revision==`string`&&(t.review.viewed={revision:nJ(n.viewed.revision,128),paths:iJ(n.viewed.paths,200)}));let r=e.browser;if(tJ(r)&&Array.isArray(r.tabs)){let e=new Set,n=r.tabs.flatMap(t=>{if(!tJ(t)||!Number.isSafeInteger(t.id)||typeof t.id!=`number`||t.id<0||t.id>5e7||e.has(t.id))return[];e.add(t.id);let n=aJ(t.initialUrl);return[{id:t.id,title:nJ(t.title,200),...n?{initialUrl:n}:{}}]}).slice(0,8),i={};for(let e of n){let t=tJ(r.pages)?r.pages[e.id]:void 0;if(!tJ(t))continue;let n=iJ(t.history,32).flatMap(e=>aJ(e)??[]);i[e.id]={draft:aJ(t.draft)??``,history:n,index:n.length?Math.min(Math.floor(rJ(t.index)),n.length-1):-1}}t.browser={tabs:n,selected:n.some(e=>e.id===r.selected)?Number(r.selected):n[0]?.id??0,pages:i}}if(tJ(e.terminals)){t.terminals={};for(let[n,r]of Object.entries(e.terminals).slice(0,16))!oJ(n)||n!==`terminal`&&!n.startsWith(`terminal:`)||!t.tabs?.tabs.includes(n)||!tJ(r)||(t.terminals[n]={...typeof r.id==`string`?{id:nJ(r.id,128)}:{},...typeof r.title==`string`?{title:nJ(r.title,80)}:{},viewport:rJ(r.viewport),atBottom:r.atBottom!==!1})}return tJ(e.terminal)&&typeof e.terminal.id==`string`&&(t.terminal={id:nJ(e.terminal.id,128),viewport:rJ(e.terminal.viewport),atBottom:e.terminal.atBottom!==!1}),tJ(e.sideConversation)&&(t.sideConversation={selectedId:typeof e.sideConversation.selectedId==`string`?nJ(e.sideConversation.selectedId,128):null,drafts:{}}),t}function lJ(e){if(!tJ(e)||!nJ(e.sessionId,128)||!nJ(e.sessionPath)||!sJ(e.tool))return null;let t={sessionId:nJ(e.sessionId,128),sessionPath:nJ(e.sessionPath),tool:e.tool,open:e.open===!0,requestRevision:rJ(e.requestRevision),reading:cJ(e.reading)};return tJ(e.reviewTurn)&&nJ(e.reviewTurn.promptEntryId,512)&&(t.reviewTurn={promptEntryId:nJ(e.reviewTurn.promptEntryId,512),revision:rJ(e.reviewTurn.revision),...typeof e.reviewTurn.filePath==`string`?{filePath:nJ(e.reviewTurn.filePath)}:{}}),t}function uJ(){try{let e=localStorage.getItem(eJ);if(!e||e.length>256e3)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];let n=new Map;for(let e of t.slice(-32)){let t=lJ(e);t&&n.set(JSON.stringify([t.sessionId,t.sessionPath]),t)}return[...n.values()]}catch{return[]}}function dJ(e){try{let t=e.slice(-32).flatMap(e=>lJ(e)??[]),n=JSON.stringify(t);for(;n.length>256e3&&t.length;)t.shift(),n=JSON.stringify(t);localStorage.setItem(eJ,n)}catch{}}function fJ(e,t,n){if([`session_start`,`session_switched`,`session_created`].includes(t))return e.length===0?e:[];if([`agent_settled`,`turn_settled`].includes(t))return e.some(e=>e.state===`running`)?e.map(e=>e.state===`running`?{...e,state:`unknown`}:e):e;if(!t.startsWith(`tool_execution_`))return e;let r=n.toolCallId;if(typeof r!=`string`||r.length>500)return e;let i=e.find(e=>e.call.id===r);if(i&&i.state!==`running`&&(i.state!==`unknown`||t!==`tool_execution_end`))return e;let a=Rd(n.call),o=a.type===`toolCall`&&typeof a.name==`string`&&typeof a.arguments==`string`?a:i?.call;if(!o||o.evidenceTruncated&&o.id?.includes(`[truncated]`))return e;let s=Rd(n.result),c=typeof s.content==`string`?s:i?.result,l=typeof n.parentToolCallId==`string`&&n.parentToolCallId.length<=500?n.parentToolCallId:i?.parentToolCallId,u={call:o,result:c,...l?{parentToolCallId:l}:{},state:t===`tool_execution_end`?n.isError===!0?`failed`:`returned`:`running`},d=(i?e.map(e=>e.call.id===r?u:e):[...e,u]).slice(-32);for(;d.length>0&&new TextEncoder().encode(JSON.stringify(d)).byteLength>524288;)d.shift();return d}var pJ={en:{translation:{promptPending:`Processing your request…`,commandFeedbackTruncated:`This is a limited command preview. Narrow the query or run it in the TUI for the full output.`,planMode_inactive:`Normal mode`,planMode_planning:`Planning · writes blocked`,planMode_ready:`Plan ready · awaiting review`,planMode_invalid:`Plan state invalid · writes blocked`,planModeEnter:`Plan`,promptPlanMessage:`This conversation uses Plan mode · discuss the plan; no implementation yet`,planModeUnconfirmed:`Could not confirm Plan mode. Refresh before continuing.`,planModeExit:`Exit planning`,planModeImplement:`Prepare implementation prompt`,planImplementationReplaceDraft:`Preparing this plan will replace the current draft and turn off Plan mode. The prompt will not be sent. Continue?`,commandSupport_plan:`Planning and same-session implementation prompts are available. Starting a fresh implementation session still requires the TUI.`,commandSupport_setup:`Configuration uses the active model; questions are answered in Web.`,handoffWaiting:`Manual action`,handoffDone:`Done`,handoffUnable:`Unable to complete`,handoffDoneHelp:`I performed the action. The agent still needs to verify it.`,handoffUnableHelp:`I could not finish. I can add a note about the blocker.`,handoffReview:`Review status`,handoffSubmit:`Submit status`,handoffSignal:`Expected result:`,handoffVerify:`Reporting Done lets the agent continue and verify; it is not proof of success.`,planCardLabel:`Development plan`,planCardReady:`Plan ready`,planCardResult:`Plan result`,planCardNotApproval:`This step produced a plan. It did not approve or start implementation.`,planCardCollapse:`Collapse`,planCardExpand:`Expand`,planCardCopy:`Copy plan`,planCardCopyPreview:`Copy visible preview`,planCardTruncated:`Only a bounded preview is displayed.`,planCardLoadFull:`Load full plan`,planCardLoadingFull:`Loading plan...`,planCardLoadFailed:`Could not load the full plan. Retry`,planCardEvidence:`Tool result · plan_ready`,questionWaiting:`Question`,questionPreview:`View preview`,questionSkip:`Skip`,questionProgress:`{{current}} of {{total}}`,questionReview:`Review answers`,questionReviewTitle:`Ready to send?`,questionReviewHelp:`Review your choices. Nothing is sent until you submit.`,questionEdit:`Edit answer: {{question}}`,questionDismiss:`Dismiss questions without answering`,questionCustom:`Or write your own reply`,questionCustomHelp:`Or leave it blank to ask for a clearer question.`,questionYourAnswer:`Your answer`,questionCustomPlaceholder:`Describe what you have in mind…`,questionNotes:`Additional context (optional)`,questionNotesPlaceholder:`Add a constraint or clarify your choice…`,questionRephrase:`Ask for a clearer or smaller question`,questionBack:`Back`,questionNext:`Next question`,questionSubmit:`Submit answers`,questionSubmitting:`Sending…`,questionRetry:`Check submission`,questionUncertain:`We could not confirm delivery. Your submitted answers are kept here. Check submission to recover the result without sending them twice.`,questionDisconnected:`Reconnecting… Your choices stay here; submitting is paused.`,questionLimit:`Keep each answer or note within {{count}} UTF-8 bytes.`,questionLoadFailed:`Could not check for questions awaiting your answer.`,questionDraftLimit:`Question drafts are full. Shorten or clear an existing answer before adding more text.`,questionRetryLoad:`Try again`,questionCloseReceipt:`Close question status`,questionState_dismissed:`Questions dismissed. No answers were submitted.`,questionState_cancelled:`Questions cancelled. No answers were submitted.`,questionState_expired:`Questions expired. No answers were submitted.`,questionState_stale:`This request is no longer active. Check the conversation for its result.`,conversationView:`Conversation view`,jumpToLatest:`Jump to latest`,historyLoading:`Loading history…`,historyOmitted:`{{count}} earlier entries · Scroll up to load automatically`,historyChanged:`The Session branch changed. History has been reset to the current branch.`,historyUnavailable:`Could not load history. Please retry.`,historyValidationUnavailable:`Could not verify the conversation history. Please retry.`,historyVerifying:`Checking conversation history…`,messageLoadFull:`Load full message`,messageLoadMore:`Load more`,messageLoadingFull:`Loading message…`,messageLoadFailed:`Could not load this message. Retry`,filePreview:`File preview`,changeEvidence:`Changes`,changeEvidenceScope:`Read-only Git snapshot of changes since this session started.`,turnLabel:`Turn {{number}}`,turnState_running:`Running`,turnState_complete:`Completed`,turnState_failed:`Failed`,turnState_interrupted:`Interrupted`,turnState_waiting:`Waiting for response`,turnState_forked:`Forked · Ready to continue`,turnChanges_one:`{{count}} file changed during this turn`,turnChanges_other:`{{count}} files changed during this turn`,turnChangesPartial:`At least {{count}} files changed during this turn`,turnChangesIncomplete:`This turn's change record is incomplete.`,turnChangesMore:`Show {{count}} more files`,turnChangesLess:`Show fewer files`,turnChangesReview:`Review turn changes`,turnChangesReviewButton:`Review`,turnChangesBack:`Back to turn changes`,turnChangesLoading:`Loading this turn's changes…`,turnChangesUnavailable:`This turn's saved diff is unavailable.`,messageCopyRequiresFull:`Load the full message before copying.`,filesChanged_one:`{{count}} file changed`,filesChanged_other:`{{count}} files changed`,reviewChanges:`Review changes`,workspaceChanges:`Workspace changes`,overviewChanges:`Changes`,overviewLineTotals:`Text lines added and removed across the current Git comparison`,overviewPartialTotals:`Known line counts only; some files could not be counted. Open Changes for details.`,overviewCounting:`Counting…`,overviewCountsUnknown:`Counts unavailable`,overviewReviewUnavailable:`Unavailable`,sessionSources:`Sources`,sourcesAdd:`Add source`,sourcesEmpty:`No sources yet`,sourcesFailed:`Could not load sources.`,sourcesViewAll:`View all`,sourcesLoadMore:`Load more sources`,sourcesBack:`Back to sources`,sourcesPartial:`This list has reached its display limit. Earlier sources remain in the conversation.`,turnChangesScope:`Saved workspace changes during this turn`,turnEdits_one:`Edited {{count}} file`,turnEdits_other:`Edited {{count}} files`,turnEditsPartial:`Recorded edits to {{count}} files`,turnEditsScope:`This turn's recorded file-tool writes · saved; shell and external edits are not included`,turnEditStatsUnknown:`Line counts unavailable`,turnEditReason_before_unavailable:`The write completed, but previous contents were not authorized for reading. A before/after diff is unavailable.`,turnEditReason_content_limit:`The write completed. Content exceeds the saved comparison limit, so exact line counts are unavailable.`,turnEditReason_concurrent_change:`The file changed between recorded operations. A reliable net diff for this turn is unavailable.`,gitReviewLoadedCount:`{{count}} files loaded`,gitReviewPartialLabel:`Partial`,gitReviewSearch:`Search file paths`,gitReviewExpand:`Expand review`,gitReviewSearchLoaded:`Search loaded files`,gitReviewMarkViewed:`Mark {{path}} as viewed`,gitReviewMarkCurrentViewed:`Mark current file {{path}} as viewed`,gitReviewViewedLabel:`Viewed`,gitReviewViewedProgress:`Viewed {{viewed}} / {{loaded}} loaded files`,gitReviewViewedLimit:`Up to {{count}} viewed marks are remembered for this comparison.`,gitReviewNoMatch:`No matching files.`,gitReviewNoLoadedMatch:`No matches in the loaded files.`,gitReviewLoadNext:`Load the next files`,gitReviewChanged:`The workspace changed. Refresh the list before loading more.`,gitReviewNewVersion:`New changes are available. You are reading the previous version.`,gitReviewShowLatest:`Show latest diff`,gitReviewBinary:`No text diff is available for this binary file.`,gitReviewBinaryShort:`Binary`,gitReviewPendingStats:`Not loaded`,gitReviewComparison:`{{current}} compared with {{base}}`,gitReviewWorkingTree:`Working tree compared with HEAD`,gitReviewSessionSnapshot:`Changes since this session started`,gitReviewDetached:`Detached HEAD`,gitReviewLoading:`Reading Git changes…`,gitReviewRetry:`Retry`,gitReviewRefresh:`Refresh changes`,gitReviewOlderResult:`Showing the previous result.`,gitReviewNotRepository:`This workspace is not a Git repository.`,gitReviewUnborn:`This repository has no readable HEAD yet.`,gitReviewFailed:`Git changes could not be read.`,gitReviewTruncated:`The change snapshot reached its file or diff size limit.`,gitReviewEmpty:`No changes in this comparison.`,gitReviewHiddenLines:`{{count}} more diff lines hidden.`,gitReviewDiffTruncated:`This file's diff was not loaded because the snapshot reached its size limit.`,gitReviewShowMore:`Show {{count}} more files`,gitReviewBackToFiles:`Back to changed files`,gitReviewFilePreview:`Diff for {{file}}`,gitReviewNoDiff:`No text diff is available for this file.`,changeDiff:`Change diff`,diffView:`Diff`,gitFileStatus_added:`Added`,gitFileStatus_modified:`Modified`,gitFileStatus_deleted:`Deleted`,gitFileStatus_renamed:`Renamed`,gitFileStatus_copied:`Copied`,gitFileStatus_untracked:`Untracked`,gitFileStatus_unknown:`Changed`,closePreview:`Close preview`,artifactReadOnly:`Read-only`,artifactReferenceUnavailable:`File preview is unavailable in this view: {{path}}`,artifactSession:`Session {{sessionId}}`,copyFilePath:`Copy file path`,filePathCopied:`File path copied`,refreshFile:`Refresh file`,downloadFile:`Download file`,downloadingFile:`Downloading…`,artifactOlderPreview:`Showing an older preview. `,readingFile:`Reading file…`,artifactVersion:`Version`,artifactBytes:`{{count}} bytes`,artifactPreviewTruncated:`Preview truncated. Download the file for the complete content.`,artifactUnsupported:`This file type cannot be previewed. Use Download.`,chatView:`Chat`,trajectory:`Trajectory`,trajectoryScope:`Recorded Session messages in order, not execution durations or the complete model request.`,trajectoryRunning:`Work is active. This view updates as saved records arrive; in-flight text is available in Chat.`,trajectoryTruncated:`Loaded history is partial: {{entries}} entries omitted, {{parts}} parts omitted, {{messages}} messages truncated.`,trajectoryEmpty:`No saved records yet.`,trajectoryOrder:`Record order`,trajectoryRecordCount:`{{count}} records`,trajectoryMatches:`{{count}} matches`,trajectorySearch:`Search loaded records`,trajectoryNoMatches:`No matching records.`,trajectoryEarlierGroup:`Earlier context`,trajectoryEventCount:`{{count}} Session changes`,trajectorySummary:`Overview`,trajectoryInputTab:`Input`,trajectoryResultTab:`Result`,trajectoryConversationGroup:`Conversation`,trajectoryReasoningTitle:`Thinking`,trajectoryRecordNumber:`Record {{number}}`,trajectoryRecordInfo:`Record information`,trajectoryRecordId:`Record ID`,trajectoryCallId:`Tool call ID`,trajectoryEventType:`Event type`,trajectoryEvent_model_change:`Model changed`,trajectoryEvent_thinking_level_change:`Thinking level changed`,trajectoryEvent_compaction:`Context compacted`,trajectoryEvent_session_info:`Session information updated`,trajectoryEvent_custom:`Session record`,trajectoryEarlier:`Show earlier records ({{count}} remaining in loaded history)`,trajectoryDetails:`Record details`,trajectoryRecordedAt:`Record timestamp`,trajectoryEvidenceTruncated:`This evidence was truncated in the Session projection.`,trajectoryArguments:`Tool arguments`,trajectoryRecordedContent:`Recorded content`,trajectoryThinking:`Recorded model reasoning`,trajectoryOutput:`Tool result`,trajectoryMissingResult:`No unambiguous result is included in the loaded records. This does not imply the tool is still running.`,trajectoryStructured:`Structured result`,trajectoryEventOnly:`Only this event’s type and timestamp are available.`,trajectory_user:`User message`,trajectory_assistant:`Assistant`,trajectory_call:`Tool call`,trajectory_result:`Unpaired result`,trajectory_event:`Session event`,trajectory_returned:`Tool returned a result.`,trajectory_error:`Tool returned an error`,trajectory_unknown:`Outcome not established`,runtimeStatus:`Runtime status`,refreshStatus:`Refresh status`,terminalDetails:`Terminal details`,openTools:`Open tools`,sideConversation:`Side conversation`,sideConversationDescription:`Ask a focused question in a separate Pi session without interrupting the main task.`,workbarChangesDescription:`Inspect the current Git branch and working tree.`,terminal:`Terminal`,renameTerminal:`Rename terminal`,terminalName:`Terminal name`,workbarTerminalDescription:`Open an interactive shell for the current workspace.`,backgroundTerminalActivity:`Agent command activity`,restartTerminal:`Restart terminal`,reconnectTerminal:`Reconnect terminal`,restartTerminalTitle:`Restart this terminal?`,restartTerminalDetail:`The current terminal will be closed. Running processes may be interrupted.`,terminalReconnecting:`Reconnecting terminal...`,terminalScrollToBottom:`Scroll to bottom`,terminalOutputResynced:`Terminal output resynchronized.`,terminalRestarting:`Restarting terminal...`,terminalConnecting:`Starting terminal…`,terminalExited:`Terminal exited.`,terminalExitCode:`Terminal exited with code {{code}}.`,terminalDisconnected:`Terminal connection ended unexpectedly.`,terminalError:`Terminal unavailable.`,browser:`Browser`,sessionFileRecords:`Session file records`,gitReviewSource:`Changes`,gitReviewBaseBranch:`Compare against branch`,gitReviewChooseBase:`Choose comparison branch`,gitReviewSearchBranches:`Search branches`,gitReviewLocalBranch:`Local branch`,gitReviewRemoteBranch:`Remote branch`,gitReviewBranchesTruncated:`Showing a bounded list of branches. Some branches are omitted.`,gitReviewNoMatchingBranches:`No matching branches.`,gitReviewBaseUnavailable:`No default comparison branch is available. Choose a branch to review committed changes.`,gitReviewBaseInvalid:`The selected comparison branch is unavailable. Choose another branch.`,gitReviewUnstaged:`Unstaged changes`,gitReviewStaged:`Staged changes`,gitReviewBranch:`Branch changes`,gitReviewFileMissing:`This file no longer has changes in this view. Refresh the file list.`,artifactExternalAccess:`This file is in another working directory. You can authorize read-only access to this file for this session; other files remain inaccessible.`,artifactAuthorizeFile:`Open this file read-only`,sideConversationPending:`Preparing side conversation…`,resizeSidebar:`Resize sidebar`,resizePanes:`Resize panes`,resizeWorkbar:`Resize workbar`,browserPasteTooLarge:`Paste at most {{count}} characters at a time.`,browserInputTooLarge:`Enter at most {{count}} characters at a time.`,browserInputTargetChanged:`The input target changed or could not be confirmed. An input operation was not executed.`,workbarBrowserDescription:`Open and interact with a page inside the OpenPI workbar.`,browserReady:`Enter an address to start browsing`,browserStarting:`Starting the embedded browser…`,browserOpened:`Opened in the embedded browser`,browserOpenAgain:`Open again`,browserOpenFailed:`The embedded browser is unavailable.`,browserBack:`Back`,browserForward:`Forward`,browserReload:`Reload`,browserTabs:`Browser tabs`,browserNewTab:`New tab`,browserAddTab:`New browser tab`,browserCloseTab:`Close {{title}}`,browserTabLimit:`Up to {{count}} browser tabs`,browserPageTitle:`Web page: {{address}}`,browserEnteredAddress:`Last address opened from this toolbar`,browserAddressNotAllowed:`Enter an HTTP(S) address without embedded credentials, outside this application's origin.`,browserLocationUnknown:`This page navigated. Its new address is unavailable. Reload returns to the address you entered.`,browserDirectDescription:`Browse pages directly. Sites that refuse embedding can be opened in your external browser.`,browserDirectHint:`The address records toolbar navigation only. Page popups open in your external browser. Blank page? Use Open in external browser.`,browserEnhancedHint:`Browser enhancement is on: addresses sync and ordinary popup links open in these tabs. Some site policies, login popups and cross-site history still require an external browser.`,files:`Files`,filesExplorer:`Workspace files`,filesSearch:`Filter files…`,refreshFiles:`Refresh files`,filesWorkspaceActions:`Workspace file actions`,filesCreateMenu:`New`,filesImportMenu:`Import`,filesMoreMenu:`More`,filesNewFile:`New file`,filesNewDirectory:`New folder`,filesImport:`Import files`,filesImportFolder:`Import folder`,filesImportFolderChoose:`Choose a folder to import`,filesImportFolderLimit:`Import up to 2,000 files and folders at a time, with at most 64 nested levels.`,filesSelectMultiple:`Select multiple files`,filesSelectItem:`Select {{name}}`,filesSelectedCount:`{{count}} selected`,filesRename:`Rename`,filesNewName:`New name`,filesMove:`Move`,filesMoveDestination:`Destination folder (workspace relative path)`,filesTrashAction:`Move to trash`,filesTrash:`Workspace trash`,filesTrashDetail:`Removed files stay in this workspace and can be restored. Existing names are preserved.`,filesTrashEmpty:`No removed files`,filesTrashUnavailable:`{{count}} entries could not be verified. Their contents remain in .openpi-trash; automatic restore is unavailable.`,filesRestore:`Restore`,filesRestoreItem:`Restore {{name}}`,filesUndoTrash:`Undo removal`,filesOrganizationResults:`File operation results`,filesOperationDone:`Done`,filesRefreshBeforeOrganizing:`Refresh the file tree before organizing this item.`,filesImportChoose:`Choose files to import`,filesTargetDirectory:`Destination`,filesWorkspaceRoot:`Workspace root`,filesFileName:`File name`,filesDirectoryName:`Folder name`,filesCreate:`Create`,filesCreating:`Creating…`,filesCreated:`Created: {{path}}`,filesNameInvalid:`Enter one file or folder name without path separators.`,filesNameExists:`This name already exists. Choose a different name; the existing file was preserved.`,filesMutationFailed:`Could not write this file. Your input is preserved.`,filesWriteUnavailable:`Switch to this session to write workspace files.`,filesImportLimit:`Each file can be up to 50 MiB. Existing names are never overwritten.`,filesImportTooLarge:`This file exceeds the 50 MiB import limit.`,filesImportDirectoryUnsupported:`Folders cannot be imported. Choose the files inside the folder.`,filesImportResults:`File import results`,filesImportPending:`Waiting to import`,filesImporting:`Importing…`,filesImported:`Saved to the workspace`,filesImportedNoPreview:`Saved. Preview supports up to 20 MiB; copy the path to use this file in chat.`,filesClearImported:`Clear completed imports`,filesRetryImport:`Retry import`,filesPathActions:`Path actions for {{name}}`,filesCopyRelativePath:`Copy relative path`,filesCopyAbsolutePath:`Copy absolute path`,filesPathCopied:`Copied path: {{path}}`,filesReadFailed:`Unable to read files.`,filesSymlink:`Symbolic link — not followed by the file browser`,filesTruncated:`The result is incomplete. Refine your search.`,filesNoMatches:`No matching files`,filesEmpty:`This folder is empty`,filesChoose:`Choose a file to preview`,filesChooseDetail:`Browse your workspace on the right. Files open here, keeping the explorer in place.`,filesHideTree:`Hide file tree`,filesShowTree:`Show file tree`,filesPreview:`Preview`,filesSource:`View source`,filesEdit:`Edit`,filesMode:`File view`,filesEditor:`File editor`,filesSave:`Save file`,filesSaving:`Saving…`,filesSaved:`Saved`,filesUnsaved:`Unsaved changes · draft kept in this window`,filesDiscard:`Discard draft`,filesDiscardConfirm:`Discard your unsaved changes to this file?`,filesSaveConflict:`The file changed on disk. Your draft is preserved. Refresh to inspect the current version, then reconcile your changes before saving.`,filesSaveFailed:`Could not save. Your draft is preserved; check the file and retry.`,filesEditLoadFirst:`Continue reading the complete file before editing.`,filesEditUnavailable:`Editing supports workspace UTF-8 text files up to 1 MiB. At most 16 unsaved drafts can be kept.`,filesOutline:`Document outline`,filesDiskVersion:`Inspect current disk version`,filesReconcile:`Reviewed · continue editing my draft against this version`,filesTable:`Table preview`,filesRow:`Row`,filesSheets:`Worksheets`,filesTableTruncated:`Showing a bounded table preview. Download the file for all rows and columns.`,filesOfficeLayout:`Document content preview; pagination and typography may differ from Office.`,filesSlidesLayout:`Slide text and images; themes, charts and animations may differ from PowerPoint.`,filesPreviousPage:`Previous page`,filesNextPage:`Next page`,filesZoomOut:`Zoom out`,filesZoomIn:`Zoom in`,filesZoomReset:`Reset zoom`,filesPdfPage:`Page {{page}}`,filesDocumentLimit:`This document exceeds the preview limit. Download it to open locally.`,filesPreviewFailed:`Unable to preview this file. You can still download it.`,filesDiagram:`Mermaid diagram`,filesExpandDiagram:`Expand diagram`,filesFitImage:`Fit`,filesOriginalImage:`Original size`,filesLoadMore:`Load more`,filesLoaded:`{{count}} items loaded`,filesReadMore:`Continue reading`,filesContentChanged:`The file changed. Refresh when ready; your current reading position is preserved.`,workbarFilesDescription:`Browse workspace files with an inline preview and file tree.`,backToSideConversations:`Back to side conversations`,continueSideConversation:`Send a follow-up…`,startSideConversation:`Ask a side question…`,sideConversationModelInherited:`New side conversations use the main conversation’s model and thinking level.`,sideConversationModelFixed:`This is the model used by this side conversation.`,stop:`Stop`,start:`Start`,browserAddress:`Browser address`,browserGo:`Open address`,openExternalBrowser:`Open in external browser`,invalidBrowserAddress:`Enter a valid HTTP or HTTPS address.`,addImages:`Add images`,addFiles:`Add files`,fileAttachments:`File attachments`,previewFileAttachment:`Preview file`,fileAttachmentDescription:`Documents, spreadsheets, PDFs, text, code, and other files`,fileAttachmentCount:`Attach up to {{count}} items.`,fileAttachmentTooLarge:`Files must total 50 MB or less.`,fileAttachmentReadFailed:`Could not read this file. Check the format or whether it is password protected.`,fileAttachmentTextReady:`Text ready`,fileAttachmentTextTruncated:`Partial text · original retained`,fileAttachmentOriginalReady:`Original file ready`,fileAttachmentExtractionFailed:`Text unavailable · original retained`,fileAttachmentEncodingUnavailable:`The text encoding could not be read. The original bytes are preserved.`,fileAttachmentDocumentUnavailable:`Text could not be extracted. The document may be password protected or have an unsupported format. The original bytes are preserved.`,fileAttachmentNoText:`The original file will be attached for the agent to read with its tools. No text was extracted.`,fileAttachmentPreviewTruncated:`Preview shows the first 20,000 characters. The complete extracted text will be attached.`,fileAttachmentExtractedContent:`Extracted text`,fileAttachmentPromptLabel:`User-provided files:`,fileAttachmentPromptTooLong:`The message and file references exceed the input limit. Shorten the message or attach fewer files.`,imageAttachmentDescription:`PNG, JPEG, GIF, or WebP`,imageAttachments:`Image attachments`,imageAttachmentsLoading:`Preparing attachments…`,commandOpensPanel:`Open panel`,commandPanelArguments:`This command opens a panel and cannot include arguments or images. Remove them, or use the panel directly.`,commandPanelUnavailable:`The panel could not be opened. Your command is preserved.`,commandUnavailable_terminal_only:`Requires Pi's terminal interface.`,commandUnavailable_not_integrated:`This extension command is not connected to Web yet. Use it in Pi's terminal.`,artifactImagePreviewFailed:`Unable to preview this image. Refresh the file to retry, or download it.`,artifactFileDetails:`File details`,turnElapsedRunning:`Working for {{duration}}`,compactionElapsed:`Waiting {{duration}}`,compactionRunning:`Compacting context`,compactionCompleted:`Context automatically compacted`,compactionFailed:`Context compaction failed`,compactionInterrupted:`Compaction interrupted`,compactionUnchanged:`Compaction finished without a new summary`,compactionUnavailable:`Context compaction status unavailable`,compactionReconnectHelp:`Connection interrupted. The current status will be checked after reconnecting.`,compactionDraftHelp:`Compacting history. Messages you send will be queued.`,turnElapsedFinished:`Worked for {{duration}}`,composerAdd:`Add`,composerCommands:`Commands`,composerFile:`File`,composerGoal:`Goal`,composerPlan:`Plan`,composerCompact:`Compact`,composerModel:`Model`,composerBack:`Back`,composerGoalDescription:`Set or view a long-running goal`,composerPlanDescription:`Enter or leave Plan mode`,composerCompactDescription:`Summarize earlier conversation history`,composerModelDescription:`Select this Session's model`,compactionQueueWaiting:`Waiting for compaction to finish`,compactionQueueBlocked:`Messages retained. Retry when ready or clear the queue.`,clearPromptQueue:`Clear queue`,turnElapsedOutcome_cancelled:`Stopped`,turnElapsedOutcome_failed:`Failed`,turnElapsedOutcome_uncertain:`Outcome unconfirmed`,settingsSetupBusyHint:`Agent configuration is available after this turn. Display settings can be changed now.`,resetChatContentWidth:`Reset chat content width`,resetChatFontSize:`Reset chat font size`,setupResolveAdmission:`Return to the conversation to resolve the pending message before applying settings.`,removeAttachment:`Remove attachment`,dropImagesHere:`Drop files or images here`,imageAttachmentCount:`Attach up to {{count}} images.`,imageAttachmentTooLarge:`Each image must be 10 MB or smaller.`,imageAttachmentTotalTooLarge:`The attached images must total 32 MB or less.`,imageAttachmentUnsupported:`Only valid PNG, JPEG, GIF, and WebP images are supported.`,imageAttachmentReadFailed:`Could not read this image. Add it again to retry; your message is preserved.`,attachedImage:`Attached image`,previewAttachment:`Preview image`,closeImagePreview:`Close image preview`,imagePreviewFailed:`Unable to display this image.`,fitImage:`Fit image`,originalImageSize:`Original size`,imageViewMode:`Image view`,sessionUsage:`Session token usage`,sessionInputTokens:`Input tokens`,sessionOutputTokens:`Output tokens`,sessionCacheTokens:`Cached tokens`,sessionContextUsage:`Context usage and context window`,usageContextLabel:`Context`,usageUnknown:`Unknown`,usageOpenDetails:`Input {{input}} · Output {{output}} · Context {{percent}} / {{capacity}} · View token usage`,usageContextHelp:`Estimated tokens in the current branch / model context limit.`,usageSessionTotals:`Session totals`,usageInputLabel:`Input`,usageOutputLabel:`Output`,usageTotalLabel:`Total`,usageWorkspaceLabel:`Workspace`,usageSessionId:`Session ID`,usageTotalsHelp:`Session token totals include cache usage.`,subagentDetails:`Subagents`,sessionOverview:`Session overview`,sessionOverviewChanges:`Changes in the current review scope`,subagentSummaryRunning:`{{count}} running`,subagentSummaryDone:`{{count}} completed`,subagentSummaryOther:`{{count}} other`,subagentNoneYet:`No subagents yet`,subagentOtherGroup:`Failed / interrupted`,subagentShowMore:`Show {{count}} more`,backToSubagents:`Back to subagents`,subagentActiveGroup:`Active`,subagentFinishedGroup:`Completed`,subagentNoneRunning:`No subagents running.`,subagentNoneFinished:`Completed tasks will appear here.`,subagentProgress:`Subagents: {{running}} running · {{completed}} completed`,subagentSummaryUnknown:`{{count}} without confirmed status`,subagentTasks:`Subagent tasks`,inspectSubagent:`Open subagent: {{name}}`,subagentState_running:`Running`,subagentState_done:`Completed`,subagentState_error:`Failed`,subagentState_interrupted:`Interrupted`,subagentStarting:`Starting…`,subagentSpawnFailed:`Failed to start`,subagentStateUnavailable:`Started · state unavailable`,subagentSpawnReceipt:`Start receipt`,subagentSpawnReceiptHint:`This confirms the start request, not the subagent's final result.`,subagentTask:`Assigned task`,subagentTranscript:`Subagent conversation`,subagentResult:`Result`,subagentSaved:`Saved record`,subagentRecordedState:`Last recorded state`,subagentSavedHint:`From this parent session's saved receipts. A result may include other tasks from the same batch; this is not the child's full live conversation.`,subagentLive:`Working · updates automatically`,subagentReadOnly:`Read-only view · closing this panel does not stop the task`,subagentUnavailable:`Live details are no longer available for this subagent in the current session. The start receipt is not evidence of completion.`,subagentStale:`Could not refresh. The details below are the last received snapshot.`,subagentNoMessages:`No messages received yet.`,subagentTranscriptUnavailable:`This view retains a task summary and cannot show the full child conversation.`,subagentWorkflowsTruncated:`{{count}} workflows are outside the loaded list; their task counts are unknown.`,subagentState_unknown:`Unconfirmed`,subagentUnconfirmedGroup:`Unconfirmed`,subagentTruncated:`Showing a bounded excerpt; {{count}} earlier messages omitted. Some text may be shortened.`,subagentListTruncated:`{{count}} additional tasks are outside the loaded list.`,subagentThinkingRedacted:`Reasoning was redacted by the provider.`,subagentTool_running:`Running`,subagentTool_done:`Returned`,subagentTool_error:`Failed`,subagentTool_unknown:`Result not retained`,inspectionChanged:`The active session changed. Reopen this panel.`,inspectionUnavailable:`Details are unavailable.`,inspectionLoading:`Loading status…`,thinkingUnavailable:`Thinking state is unavailable.`,trustUnavailable:`Project trust status is unavailable.`,executionState:`State`,terminalCommand:`Command`,copyTerminalCommand:`Copy command`,copyVisibleOutput:`Copy visible {{stream}}`,copySetupCommand:`Copy setup command`,savedTrustDecision:`Saved decision`,activeSessionTrust:`Active Session trust`,trustDecision_trusted:`Trusted`,trustDecision_denied:`Denied`,trustDecision_undecided:`Undecided`,trustDecision_unknown:`Unknown`,trustActiveYes:`Trusted in this Session`,trustActiveNo:`Not trusted in this Session`,terminalDirectory:`Directory`,startedAt:`Started`,exitCode:`Exit code`,detailTruncated:`Some details are shortened to keep this view bounded.`,standardOutput:`Standard output`,standardError:`Standard error`,outputTruncated:`{{count}} bytes omitted from this output view.`,outputRecovery:`The runtime reports a retained log. This view shows only a bounded excerpt.`,modelAndThinking:`Model and reasoning`,selectedModel:`Current model`,thinkingLevel:`Thinking level`,availableThinking:`Available levels`,unknownState:`Unknown`,projectTrust:`Project trust`,trust_trusted:`This session trusts the workspace.`,trust_untrusted:`Trust for this workspace has been denied.`,trust_restricted:`Project resources are restricted pending a trust decision.`,trust_unknown:`Trust state is not available.`,trustRefreshNeeded:`The saved decision and active session differ. Refresh the session through Pi to apply it.`,providerAvailability:`Provider credentials`,settings:`Settings`,settingsNavigation:`Settings navigation`,generalSettings:`General`,configurationSettings:`Configuration`,configurationIntro:`Permissions, web access and model responses.`,configurationReadFailure:`Configuration could not be read safely. Fix the settings file, then refresh.`,configurationUserScope:`User configuration`,configurationSetupHint:`Response and search changes use OpenPI setup`,configurationApproval:`Approval policy`,configurationApprovalDetail:`Tool approvals follow the installed Pi extensions.`,configurationPiPermissions:`Pi extensions`,configurationSandbox:`Sandbox`,configurationSandboxDetail:`Tools run with the host process permissions.`,configurationSandboxUnavailable:`No OS sandbox`,configurationSearchDetail:`Let the current Session model search the web when supported.`,configurationSearchOff:`Do not offer native search to the current model.`,configurationSearchOn:`Offer native search when the current connection supports it.`,configurationVerbosity:`Output verbosity`,configurationVerbosityDetail:`Choose how much detail the model includes in its response.`,configurationResponsesUnavailable:`The current connection does not use a supported Responses API.`,configurationVerbosity_default:`Model default`,configurationVerbosity_low:`Low`,configurationVerbosity_medium:`Medium`,configurationVerbosity_high:`High`,configurationVerbosityHelp_low:`Prefer short answers with fewer details.`,configurationVerbosityHelp_medium:`Include useful explanation and a moderate amount of detail.`,configurationVerbosityHelp_high:`Include more complete explanation and detail.`,configurationVerbosityRequest:`Set only response_verbosity to {{value}}; preserve the other OpenPI settings.`,configurationSummary:`Reasoning summary`,configurationSummaryDetail:`Choose the summary requested from a supported reasoning model.`,configurationSummaryUnavailable:`The current connection does not support reasoning summaries.`,configurationSummary_default:`Model default`,configurationSummary_auto:`Auto`,configurationSummary_concise:`Concise`,configurationSummary_detailed:`Detailed`,configurationSummary_none:`Off`,configurationSummaryHelp_auto:`Let the model choose the summary length.`,configurationSummaryHelp_concise:`Request a brief reasoning summary.`,configurationSummaryHelp_detailed:`Request a more detailed reasoning summary.`,configurationSummaryHelp_none:`Do not request a summary. Keep the current reasoning effort.`,configurationSummaryRequest:`Set only response_reasoning_summary to {{value}}; preserve the other OpenPI settings.`,configurationModelFeatures:`Model features`,configurationReasoningLevels:`Available reasoning efforts`,configurationReasoningDetail:`Choose which supported levels appear in model controls. The current level stays visible; its value is unchanged.`,configurationReasoningCount:`{{count}} selected`,configurationDependencies:`Workspace dependencies`,configurationEnvironment:`Local environment`,configurationEnvironmentDetail:`Node.js, Python and other tools come from your environment. OpenPI does not install a bundled workspace runtime.`,configurationRuntimeStatus:`Runtime status`,browserSettings:`Browser`,webSearchSettings:`Web search`,webSearchCurrentModel:`Current Session model`,webSearchNativeDetail:`Use your current model provider's native search with the existing connection and credentials.`,webSearchSupported:`This connection supports native search. When enabled, the model decides when to search.`,webSearchUnsupported:`Native search is unsupported or unconfirmed for this connection. No search tool is provided and no other provider is used.`,webSearchNativeRequest:`Enable native web search using the current Session model and existing Pi credentials. Do not switch model, connection protocol, or search provider. Unsupported or unknown connections must receive no search tool.`,webSearchIntro:`Let your model search current sources and read the original pages.`,webSearchPackageDetail:`Optional search, page reading, and PDF extraction through a Pi package.`,webSearchDefaultOff:`Off by default. This optional extension follows the current Session model; it needs no separate search key or plugin installation.`,webSearchLoaded:`Package loaded in this Session`,webSearchNotLoaded:`Package not loaded in this Session`,webSearchSource:`Review plugin source`,webSearchProfile:`Search setup`,webSearchExa:`Exa — no API key required`,webSearchExisting:`Keep my existing search preferences`,webSearchProfileHint:`Exa uses search queries with direct page reading. Existing preferences stay untouched. Other search services can be configured after installation.`,webSearchEnable:`Enable web search…`,webSearchDisable:`Disable web search…`,webSearchConfigure:`Change search service…`,webSearchExaRequest:`Enable optional web search with Pi Web Access and Exa, which needs no API key. Let me review the installation confirmation, preserve other preferences, and do not reload automatically.`,webSearchExistingRequest:`Enable optional web search with Pi Web Access and keep my existing search preferences unchanged. Let me review the installation confirmation, preserve other preferences, and do not reload automatically.`,webSearchDisableRequest:`Disable native web search. Preserve other settings and Session history.`,webSearchProviderRequest:`Help me change the search service for my installed Pi Web Access plugin. Explain available services and permissions, preserve unrelated preferences, keep credentials with the search plugin, and do not reload automatically.`,browserSettingsIntro:`Let OpenPI read pages, click, type and take screenshots.`,browserControl:`Browser control`,browserControlHint:`Requests a setup change. Access changes after the configuration is saved.`,browserDefault:`Default browser`,browserDefaultHint:`Requests a setup change for the browser used when none is named.`,browserEmbedded:`OpenPI browser`,browserAllowedTitle:`Allowed browsers`,browserOffHint:`Your choices take effect when browser control is on.`,browserConnected:`Connected`,browserNeedsSetup:`Extension setup needed`,browserNotFound:`Browser not detected`,browserUpdateNeeded:`Extension update needed`,browserBlocked:`Not allowed`,browserDefaultBlocked:`Your default browser is not allowed. Allow it or choose another default.`,browserSetUp:`Set up`,browserManage:`Manage`,browserSetupNamed:`Set up {{browser}}`,browserManageNamed:`Manage {{browser}}`,browserAllowNamed:`Allow {{browser}}`,browserMore:`More browsers`,browserSpeakHint:`Say “Use Chrome to…” to choose a different browser for a request.`,browserGuideTitle:`Connect {{browser}}`,browserGuideEyebrow:`One step at a time`,browserConnectionTitle:`Connection`,browserCloseGuide:`Close browser setup`,browserConnectionReady:`Connected. Choose whether OpenPI may use this browser.`,browserEmbeddedDetail:`Pages open inside OpenPI. Some websites require a regular browser to sign in or display correctly.`,browserExternalDetail:`OpenPI can use existing tabs and signed-in pages in your connected {{browser}} profile. Keep an OpenPI tab open in that profile.`,browserManageExtension:`Manage extension`,browserAllowUse:`Allow OpenPI to use it`,browserMakeDefault:`Use as default`,browserInstallIn:`Install in`,browserInstallTitle:`Install OpenPI Browser Bridge`,browserSetupSteps:`Setup steps`,browserGuidePopout:`Keep this guide in a separate window`,browserGuideDetached:`Your guide is open in a separate window. Follow it alongside the browser settings.`,browserShowGuide:`Show guide`,browserGuideInline:`Return guide here`,browserGuideBlocked:`The guide window could not open. Allow pop-ups and try again, or follow the steps here.`,browserSafariSettings:`Safari → Settings`,browserSafariDeveloper:`Developer settings`,browserSafariTemporary:`Add Temporary Extension…`,browserSafariOpenHint:`Open Safari, then choose Safari → Settings. Keep this guide alongside it. Requires Safari 26 or later on macOS.`,browserSafariDeveloperTitle:`Show Safari’s developer settings`,browserSafariDeveloperHint:`In Settings → Advanced, turn on Show features for web developers. Then select the Developer tab.`,browserSafariLoadHint:`In Developer, click Add Temporary Extension and select the folder below. Enable OpenPI Browser Bridge and allow the websites you want to control, including the local OpenPI page. Temporary extensions need reloading after Safari quits.`,browserFirefoxThis:`This Firefox`,browserFirefoxTemporary:`Load Temporary Add-on…`,browserFirefoxDeveloperTitle:`Select This Firefox`,browserFirefoxDeveloperHint:`On about:debugging, choose This Firefox in the left sidebar. Firefox does not need a Developer mode switch.`,browserFirefoxLoadHint:`Click Load Temporary Add-on and select manifest.json in the folder below. This development installation lasts until Firefox restarts; a permanent installation requires a Mozilla-signed package.`,browserFirefoxDone:`Selected. Next`,browserStepCount:`Step {{step}} of {{total}}`,browserStepLabel:`Step {{step}}: {{label}}`,browserStepOpen:`Open page`,browserStepAdd:`Add extension`,browserStepConnect:`Connect`,browserOpenManagerTitle:`Open {{browser}} extensions`,browserOpenManagerHint:`Start here. We’ll open the right page for you.`,browserOpenManager:`Open {{browser}} extensions`,browserReopenManager:`Open extensions page again`,browserAlreadyInstalled:`Already installed? Connect`,browserDeveloperMode:`Developer mode`,browserDeveloperTitle:`Turn on Developer mode`,browserDeveloperHint:`In the extensions page you just opened, turn on the Developer mode switch.`,browserDeveloperDone:`It’s on. Next`,browserIllustration:`Illustration · In {{browser}}`,browserExtensions:`Extensions`,browserLoadUnpacked:`Load unpacked`,browserLoadHint:`Click Load unpacked in your browser, then select the folder below.`,browserFolderBundled:`Included with OpenPI`,browserOpenFolder:`Open folder`,browserFolderOpened:`Extension folder opened.`,browserPathCopied:`Path copied`,browserCopyFailed:`Couldn’t copy. Select the path above and copy it manually.`,browserChooseFolderMac:`In the folder picker, press ⌘ ⇧ G, paste this path and press Return, then click Select.`,browserChooseFolderOther:`In the folder picker, paste this path into the address bar and select the folder.`,browserInstalledConnect:`Added. Connect to OpenPI`,browserPreviousStep:`Back`,browserWaiting:`Waiting for OpenPI Browser Bridge… We’ll detect it automatically.`,browserInstallBrowserFirst:`Install {{browser}} first, or open this OpenPI address in your installed browser.`,browserConnectTitle:`Connect to OpenPI`,browserConnectHint:`Open OpenPI in {{browser}}. Use the profile where you installed the extension.`,browserOpenIn:`Open in {{browser}}`,browserAllowHint:`Once connected, you can allow OpenPI to use this browser. Installing the extension does not change your browser permissions.`,browserCheck:`Check connection`,browserNotConnectedYet:`No connection yet. Finish installation, refresh OpenPI in that browser and check again.`,browserHelp:`Setup help`,browserReloadHint:`Already installed? Reload OpenPI Browser Bridge in the extension manager and refresh OpenPI. Accept the browser’s permission prompt if shown.`,browserSupportedHint:`Chrome, Edge, Brave and Chromium 145+ support embedded and native pages. Safari 26+ on macOS and Firefox 128+ use the portable extension for native tabs; nested frames must be opened separately. Temporary Safari/Firefox installations need reloading after browser restart.`,browserCopyPath:`Copy extension folder path`,browserLoading:`Checking browser connections…`,browserSaved:`Saved. Browser permissions take effect immediately.`,browserSaving:`Saving…`,modelSettings:`Models`,skillsSettings:`Skills`,subagentsSettings:`Sub-agents`,pluginsSettings:`Plugins`,configureOpenPi:`Configure OpenPI`,setupRequestReviewAll:`review every OpenPI configuration area with me`,setupRequestSetTheme:`set only the OpenPI Web theme to {{value}} and preserve every other setting`,setupRequestSetChatWidth:`set only the OpenPI Web chat content width to {{value}}px and preserve every other setting`,setupRequestSetChatFontSize:`set only the OpenPI Web chat font size to {{value}}px and preserve every other setting`,setupRequestEnableExpandedThinking:`expand thinking blocks by default in OpenPI Web and preserve every other setting`,setupRequestDisableExpandedThinking:`collapse thinking blocks by default in OpenPI Web and preserve every other setting`,setupRequestSubagents:`review and configure Agent role models and workflow limits`,setupRequestFailed:`The OpenPI setup request was not accepted.`,setupRequestRunning:`Applying OpenPI settings…`,setupRequestAccepted:`Configuration request accepted.`,setupPlanBlocked:`Exit Plan mode before changing agent configuration. Display settings can be changed directly; exiting does not start implementation.`,setupPlanBusy:`Agent configuration requires an idle turn and leaving Plan mode. Display settings can be changed now.`,setupOutcome_pending:`Configuration request is awaiting a save receipt.`,toolCallArguments:`Tool arguments`,toolCallOutput:`Tool result`,setupOutcome_saved:`OpenPI configuration was saved and applied.`,setupOutcome_unchanged:`Configuration was saved; effective settings are unchanged.`,setupOutcome_failed:`The setup request failed. Review the error and current settings before retrying.`,setupOutcome_cancelled:`Setup was cancelled without a confirmed save.`,setupOutcome_unconfirmed:`No successful save was confirmed. Review current settings before retrying /openpi-setup.`,settingsUpdateFailed:`The Web preference could not be saved.`,settingsPreferencesSaved:`Display settings saved.`,settingsPreferencesSaveFailed:`Could not save display settings. Check configuration diagnostics and retry.`,settingsCatalogLoading:`Loading Pi resources…`,settingsCatalogFailed:`Could not load Pi settings resources.`,appearance:`Appearance`,settingsPersonal:`Personal`,settingsAgent:`Agent`,settingsIntegrations:`Integrations`,settingsArchivedChats:`Archived chats`,settingsSearch:`Search settings`,settingsClearSearch:`Clear search`,settingsNoResults:`No matching settings`,appearanceVisualStyle:`Visual style`,appearanceMode:`Mode`,appearanceTheme:`Theme`,appearanceAccent:`Accent color`,appearanceBackground:`Background`,appearanceForeground:`Foreground`,appearanceFont:`Font`,appearanceFont_codex:`Codex default`,appearanceFont_sans:`Sans serif`,appearanceFont_serif:`Serif`,appearanceFont_mono:`Monospace`,appearanceAccent0:`Default`,appearanceAccent1:`Blue`,appearanceAccent2:`Purple`,appearanceAccent3:`Pink`,appearanceAccent4:`Orange`,appearanceAccent5:`Green`,appearanceCustomAccent:`Custom accent color`,appearanceAdvanced:`Advanced`,appearanceReset:`Restore defaults`,appearanceResetAction:`Reset appearance`,appearanceImport:`Import theme`,appearanceCopy:`Copy theme`,appearanceCopied:`Theme copied`,appearanceCopyFailed:`Could not copy theme. Try again.`,appearanceThemeValue:`Theme data`,appearanceImportPlaceholder:`Paste an OpenPI theme…`,appearanceImportInvalid:`Enter valid OpenPI theme data.`,appearanceImportAction:`Import`,searchArchivedChats:`Search archived chats`,archiveProjectFilter:`Filter by project`,archiveAllProjects:`All projects`,archiveProjectGroup:`{{project}} · {{count}} archived chats`,archiveSort:`Sort archived chats`,archiveSortUpdated:`Last updated`,archiveSortCreated:`Date created`,restoreArchivedChat:`Restore {{title}}`,themeLight:`Light`,themeDark:`Dark`,themeMist:`Mist`,themeRose:`Rose`,themePine:`Pine`,themeSystem:`System`,conversationSettings:`Conversation`,expandThinkingByDefault:`Expand thinking by default`,chatContentWidth:`Chat content width`,chatFontSize:`Chat font size`,agentBehavior:`Agent behavior`,capabilityDiscovery:`Capability discovery`,capabilityDiscovery_explicit:`Explicit`,capabilityDiscovery_adaptive:`Adaptive`,workflowLimits:`Workflow limits`,workflowConcurrency:`Workflow concurrency`,workflowCalls:`Total calls`,agentSettingsSetupHint:`Agent changes are applied through /openpi-setup in the current session.`,setupRequestDiscovery:`Set capability discovery to {{mode}}. Preserve other settings.`,setupRequestLimits:`Set workflow concurrency to {{concurrency}} and total agent calls to {{calls}}. Preserve other settings.`,setupRequestEnableSuggestions:`Enable next-action suggestions. Help me choose a model if required; preserve other settings.`,setupRequestDisableSuggestions:`Disable next-action suggestions. Preserve other settings.`,setupRequestPostEdit:`Help me configure or disable the post-edit command. Show the current configuration and ask which command to use.`,configurePostEdit:`Configure post-edit command`,workflowLimitsValue:`{{concurrency}} concurrent · {{calls}} total calls`,nextActionSuggestions:`Next-action suggestions`,enabled:`Enabled`,disabled:`Disabled`,configured:`Configured`,postEditCommand:`Post-edit command`,resultDisplay:`Default result display`,subagentResults:`Subagent results`,bashOperations:`Bash operations`,fileMutations:`Write / Edit operations`,footer:`Footer`,terminalFooter:`Pi terminal footer`,terminalFooterStyle:`Terminal footer style`,terminalFooterHint:`Applies to Pi's command-line interface. An already open Pi interface updates when restarted or when setup is applied.`,detailDisplay_full:`Full`,detailDisplay_compact:`Compact`,sessionSettings:`Session`,currentModel:`Current`,useThisModel:`Use model`,model:`Model`,modelConnection:`Model connection`,provider:`Provider`,modelId:`Model ID`,providerStatusUnavailable:`This provider is not present in the bounded authentication snapshot.`,providerSettings:`Provider credentials`,providerSettingsIntro:`Inspect which Pi providers can authenticate the current Web session.`,openRuntimeDetails:`Open runtime details`,currentWorkspace:`Current workspace`,providerAuth_api_key:`API key`,providerAuth_oauth:`OAuth`,providerAuthUnknown:`Authentication method not reported`,authentication:`Authentication`,accessType:`Access`,providerAccessSubscription:`Subscription account`,providerAccessStandard:`Provider credentials`,configurationOwner:`Configuration owner`,providerLoading:`Loading provider status…`,providerLoadFailed:`Could not load provider status.`,providerReadOnly:`Managed by Pi`,selectProvider:`Select a provider`,gitReviewBaselineUnavailable:`No usable session baseline was retained (it may exceed the capture limit). Choose Unstaged, Staged or Branch to inspect Git changes, or open the session file records.`,modelsIntro:`Sign in with an account or add an API key. Your existing Pi connections are available here.`,accountLoginMethod:`Connection method`,accountLoginTab:`Account`,accountLoginChatGPT:`ChatGPT account`,accountLoginClaude:`Claude account`,accountLoginKeyTab:`API key`,accountLoginConfigured:`Account signed in`,accountLoginIntro:`Continue in your browser. No API key needed.`,accountLoginExisting:`Your account credential is saved in Pi.`,accountLoginStart:`Sign in`,accountLoginAgain:`Sign in again`,accountLoginUnsaved:`Save or discard your other changes before signing in.`,accountLoginStarting:`Preparing sign-in…`,accountLoginWaiting:`Waiting for authorization`,accountLoginChoose:`Choose how to sign in`,accountLoginCancelling:`Cancelling sign-in…`,accountLoginBrowser:`Continue in browser`,accountLoginDevice:`Use a device code`,accountLoginBrowserOption:`Sign in on this computer. Returns here automatically.`,accountLoginDeviceOption:`For remote servers or when browser sign-in is unavailable.`,accountLoginBrowserHelp:`Open the sign-in page and approve access. This page updates automatically.`,accountLoginDeviceHelp:`Open the authorization page and enter this code. Keep this page open.`,accountLoginOpen:`Open sign-in page`,accountLoginCopyCode:`Copy device code`,accountLoginPaste:`Authorization code or callback URL`,accountLoginContinue:`Continue`,accountLoginFallback:`Signed in but still waiting?`,accountLoginRemoteHelp:`If automatic return does not work, copy the final callback URL from your browser and paste it here.`,accountLoginCancel:`Cancel sign-in`,accountLogin_failed:`Sign-in failed. Try again or choose another method.`,accountLogin_expired:`Sign-in expired. Start again to get a new authorization link.`,accountLogin_cancelled:`Sign-in cancelled.`,accountLoginRequestFailed:`The request did not complete. Refresh status before retrying.`,accountLoginStatusUnknown:`Cannot check sign-in status. Your authorization may still be in progress.`,accountLoginRefreshRequired:`The credential was saved, but Pi could not update its model list. Reload Pi before using this connection.`,accountLogout:`Sign out`,accountLogoutRefreshRequired:`The saved credential was removed, but Pi could not update its model list. Reload Pi to refresh the status.`,accountLogoutTitle:`Sign out of {{provider}}?`,accountLogoutDetail:`Removes this provider’s saved credential from Pi on this machine. Other Pi sessions using it will also need to sign in again. Environment credentials are unchanged.`,providerInputTypes:`Input types`,providerInputText:`Text`,providerInputImage:`Images`,providerCustomTag:`Custom`,providerEdit:`Edit`,providerRemove:`Delete`,providerSave:`Save`,editProvider:`Edit {{provider}}`,removeProvider:`Delete {{provider}}`,providerAdd:`Add model provider`,providerAddMode:`How to add`,providerAddCatalog:`Third-party providers`,providerAddCustom:`Custom model API`,providerAccountHint:`Use an existing account to connect. Choose a provider and continue in your browser.`,providerCatalogHint:`Choose a provider from the built-in catalog and enter its API key.`,providerCustomHint:`Connect a gateway or self-hosted service using an OpenAI or Anthropic compatible API.`,providerKeyKeep:`Leave blank to keep the existing key`,providerKeyOptional:`Enter an API key, or leave blank to use environment authentication`,providerDisplayName:`Provider name`,providerCustomSettings:`Custom settings`,providerSaved:`Saved {{provider}}.`,modelDefaultTitle:`Default for new chats`,modelDefaultChoose:`Choose model`,modelDefaultBadge:`Default`,modelCurrentBadge:`In use`,modelDefaultNotSet:`Not set · Pi chooses when a new chat starts`,modelDefaultHint:`Choose the model for future chats. Existing chats keep their own model. This also updates Pi's default.`,modelDefaultReadFailed:`Could not read the default model.`,modelDefaultProjectOverride:`This workspace has a Pi override: {{model}}.`,modelDefaultSave:`Save default`,modelMakeDefault:`Also make this the default for new chats`,modelDefaultSaveFailed:`The default was not confirmed. Refresh status and try again.`,modelDefaultPartial:`The chat model changed, but saving the default was not confirmed. Refresh status before retrying.`,modelConnectionNextHint:`Choose a model from this connection to use in the current chat.`,modelConnectionSearch:`Search models…`,modelConnectionChooseProvider:`Choose a model from {{provider}}`,modelConnectionUse:`Use in this chat`,modelConnectionUseFailed:`The model change was not confirmed. Refresh the model list and try again.`,modelConnectionLoadFailed:`Could not load models.`,modelConnectionNoModels:`No selectable models yet. Check the connection or add a model definition.`,modelConnectionNoMatch:`No matching models.`,modelConnectionMore:`{{count}} more models. Search to narrow the list.`,providerModelsEmpty:`No models yet. Fetch available models or add one manually.`,providerModelsInherited:`Uses the provider’s built-in model catalog.`,providerModelsReadOnly:`This provider contains model settings that must be edited in Pi’s configuration file.`,providerModelId:`Model {{number}} ID`,providerModelName:`Model {{number}} name`,providerModelDetails:`Model details: {{model}}`,providerRemoveModel:`Remove model: {{model}}`,providerIdInvalid:`Use a unique provider ID with letters, numbers, hyphens, dots or underscores.`,providerNativeAuth:`This provider uses Pi’s native sign-in.`,providerConfigurationFailed:`Could not save. Check the fields and retry when the session is idle.`,providerProfileSavedKeyFailed:`The provider was saved, but its API key was not. Retry saving the key.`,providerReload:`Discard draft and reload`,providerCurrentRemoval:`Select another model before removing the model currently in use.`,providerRemoveDetail:`Remove this provider’s configuration and custom models? Credentials managed by Pi are kept.`,providerPickerIntro:`Select the models you want to add from this provider.`,providerPickerSelected:`{{count}} selected`,providerApiKey:`API key`,providerKeyPlaceholder:`Paste a key to add or replace it`,saveProviderKey:`Save API key`,savingSettings:`Saving…`,keepEditing:`Keep editing`,discardAndContinue:`Discard and continue`,unsavedSettingsTitle:`Discard unsaved changes?`,unsavedSettingsDetail:`Unsaved model and credential changes will be lost.`,unsavedCredentialTitle:`Discard the unsaved credential?`,unsavedCredentialDetail:`The new key has not been saved and will be cleared.`,modelSelectionBusy:`This session is busy. Model changes are unavailable.`,providerKeySaved:`Saved to Pi credentials. Existing keys are never displayed.`,providerSaveFailed:`Credential save did not complete. Wait until the session is idle, refresh status and retry. Some providers need additional authentication settings.`,providerWriteDetail:`Save API keys here directly to Pi. Keys never enter a model conversation. For OAuth or additional provider fields, use Pi's native login.`,editModelConfiguration:`Add or edit a custom model`,modelConfigurationDetail:`Set up a provider connection, then choose available models or add one manually. Saving does not send a model request.`,configuredModels:`Custom model configuration`,addModel:`Add a model`,modelConfig_provider:`Provider ID`,modelConfig_id:`Model ID`,modelConfig_name:`Display name`,modelConfig_baseUrl:`API base URL`,modelConfig_api:`API format`,modelConfig_contextWindow:`Context window`,modelConfig_maxTokens:`Max output tokens`,providerCapacityLabel:`{{field}} {{number}}`,providerModelOptions:`Model options`,providerModelInvalid:`Model {{number}}: use a unique model ID and positive token counts, such as 128K or 1M. Leave capacities blank to use defaults.`,modelConfig_reasoning:`Supports reasoning`,saveModelConfiguration:`Save model`,reloadModelConfiguration:`Discard draft and load latest`,retryModelConfiguration:`Retry loading`,discardModelDraftTitle:`Discard this model draft?`,discardModelDraftDetail:`The latest configuration will replace this unsaved draft.`,discardAndReload:`Discard and reload`,modelConfigurationUnsaved:`Unsaved changes`,modelConfigurationConflict:`Model configuration changed elsewhere. Your draft is unchanged.`,modelConfigurationLoadFailed:`Could not load model configuration. Your draft is unchanged.`,modelConfigurationSaved:`Saved to Pi models.json. Configure the provider API key to make this model available.`,modelConfigurationFailed:`Model save did not complete. Your draft is unchanged.`,setupConfigurationRequest:`Configuration request`,configureViaSetup:`Apply via OpenPI setup`,setupFormDetail:`Uses /openpi-setup. Follow progress and any required confirmation in the conversation; submission does not mean the configuration is saved.`,setupSkillsPlaceholder:`Describe the skill to add or configure, including its source or local path`,setupPluginsPlaceholder:`Describe the Pi package to configure, including its exact package name or local path`,enableSkillInvocation:`Allow model invocation`,disableSkillInvocation:`Require explicit invocation`,setupSkillInvocationRequest:`Configure this Pi skill: {{path}}. Set its native disable-model-invocation field to {{disabled}}. Preserve other content and explain when the change takes effect.`,setupRoleFormRequest:`Configure the OpenPI {{role}} role to use {{model}} and set workflow concurrency to {{concurrency}}. Inherit parent thinking, validate the selection and preserve unrelated configuration.`,providerReadOnlyDetail:`This page is read-only and never receives credential values. Configure provider authentication through Pi, then refresh this status.`,openProviderSettings:`Open provider settings`,credentialConfigured:`Configured`,credentialMissing:`Not configured`,authNotVerified:`Configured credentials do not guarantee a successful model request.`,configurationViaPi:`Read-only status. Manage model credentials and trust through Pi; manage OpenPI options with /openpi-setup.`,noSkillsFound:`No skills are loaded for this Session.`,addSkill:`Add skill`,addPlugin:`Add plugin`,searchResources:`Search by name or source`,filterResourceScope:`Resource scope`,allResourceScopes:`All scopes`,noMatchingResources:`No matching resources`,resourceBulkTooLarge:`Filter the list further before submitting a bulk request.`,resourceManagement:`Pi resources`,resourceSourceAuto:`Pi automatic discovery`,resourceSourceLocal:`Local resource`,resourcePackageSource:`Package, repository or local path`,resourcePackageSourcePlaceholder:`npm:package@version · git:owner/repo · /path/to/skill`,resourceInstallIntro:`Choose a source and scope. OpenPI setup will review and apply the request in the conversation.`,resourceInstallReview:`Review the exact source and permissions in the conversation. Submitting this request does not mean it is installed or loaded.`,resourceRequestSubmitted:`Request submitted. Follow progress and confirmations in the conversation, then refresh this catalog.`,browseSkills:`Browse skills.sh`,resourceSessionState:`Apply to this Session`,resourcesReloadNote:`Refresh reads the catalog. Reload applies saved resources to this idle Session; changes are never reloaded automatically.`,reloadResources:`Reload resources`,resourceReloadReview:`Apply saved Pi skill and plugin configuration and restart extensions in the current Session? Wait for running work to finish first.`,resourceReloaded:`Resources reloaded. Review the refreshed catalog and diagnostics.`,resourceReloadFailed:`Could not reload resources. Wait for this Session to become idle and refresh before retrying.`,advancedResourceConfiguration:`Advanced configuration`,resourceDiagnostics:`Pi reports {{extensionErrors}} extension diagnostics and {{skillErrors}} skill diagnostics.`,resourceConfigurationDiagnostics:`{{count}} settings files could not be read. Review Pi configuration diagnostics.`,resourceCatalogTruncated:`This catalog is bounded; some resources are omitted.`,resourceTargetTruncated:`This source or path is truncated. Confirm the full target through Advanced configuration before making changes.`,updateResource:`Review update`,removeResource:`Review removal`,skillsEmptyTitle:`Add your first skill`,skillsEmptyIntro:`Skills give Pi reusable instructions. Add a package, repository or local skill; project skills follow Pi project trust.`,pluginsEmptyTitle:`Extend Pi with a plugin`,pluginsEmptyIntro:`Packages can include extensions, skills, prompts and themes. Add a source to review its installation through OpenPI setup.`,pluginCount:`{{count}} plugin sources`,installedVersion:`Installed version`,configuredVersion:`Configured version`,resourceVersionUnpinned:`Not pinned / local source`,pluginState_loaded:`Session resources loaded`,pluginState_installed:`Installed · not loaded`,pluginState_disabled:`Disabled in configuration`,pluginState_missing:`Package missing`,pluginState_error:`Load diagnostics`,pluginState_notLoaded:`Not loaded`,pluginLoadedResources:`{{count}} resources in this Session's catalog. Configuration changes require an explicit reload.`,pluginAction_enable:`Review enable`,pluginAction_disable:`Review disable`,pluginAction_update:`Review update`,pluginAction_remove:`Review removal`,enableVisibleSkills:`Allow model use ({{count}} shown)`,disableVisibleSkills:`Explicit use only ({{count}} shown)`,enableVisiblePlugins:`Enable {{count}} shown packages`,disableVisiblePlugins:`Disable {{count}} shown packages`,setupResourceInstallRequest:`Add these Pi {{kind}} from source {{source}} in scope {{scope}}. Inspect the source and resolve a fixed package identity, review required installation permissions with me using ask_user, then use Pi's native package/skill configuration. For a skill request, preserve unrelated extensions and other resources. Preserve existing preferences and project trust; do not reload this Session automatically. Report saved configuration and any remaining action separately. Do not change unrelated OpenPI settings.`,setupPluginOperationRequest:`Review Pi package action {{action}} for exactly configured source {{source}}, native root {{path}}, scope {{scope}}. Resolve relative sources against the native scope's settings directory. Use Pi's native package management. For updates, inspect available versions and review a fixed target identity and required permissions with me using ask_user before installing. Preserve resource filters and all unrelated preferences; if a toggle would destroy filters, stop and explain. Removal must not delete a local source directory. Do not reload automatically. Report persisted and active states separately; do not change unrelated OpenPI settings.`,setupSkillManageRequest:`Review Pi skill action {{action}} for exactly file {{path}}, source {{source}}, scope {{scope}}. Inspect native ownership first. Review the update/removal and required permissions with me using ask_user. Preserve unrelated skills and package resources; do not remove an entire shared package to remove one skill. Preserve project trust and do not reload automatically. Do not change unrelated OpenPI settings.`,setupSkillsBulkRequest:`For exactly these currently displayed Pi skill files {{paths}}, set native disable-model-invocation to {{disabled}}. Inspect ownership, preserve all other content and preferences, review necessary changes with me, and report any files that cannot be changed safely. Explicit /skill invocation remains available. Do not reload automatically or change unrelated OpenPI settings.`,setupPluginsBulkRequest:`For exactly these currently displayed Pi packages {{packages}}, set disabled to {{disabled}} through native Pi configuration. Preserve all other preferences and resource filters; skip and report entries whose filters cannot be preserved. Respect scope and project trust, review necessary changes with me, and do not reload automatically or change unrelated OpenPI settings.`,resourceRequestFinished:`The setup turn has ended. Refresh and inspect Pi's configuration and Session resources to confirm what changed.`,skillCount_one:`{{count}} skill`,skillCount_other:`{{count}} skills`,skill:`Skill`,copySkillInvocation:`Copy invocation`,source:`Source`,scope:`Scope`,invocation:`Invocation`,modelInvocation:`Model invocation`,resourceScope_user:`Global`,resourceScope_project:`Project`,resourceScope_temporary:`Temporary`,explicitOnly:`Explicit invocation only`,availableToModel:`Available to the model`,skillFile:`Skill file`,selectSkill:`Select a skill`,subagentConfiguration:`Pi-native subagent roles`,subagentConfigurationIntro:`Role models inherit from the parent unless OpenPI setup assigns an available model.`,subagentActiveCount_one:`{{count}} active`,subagentActiveCount_other:`{{count}} active`,subagentCompletedCount_one:`{{count}} recorded`,subagentCompletedCount_other:`{{count}} recorded`,subagentConcurrency:`Limit {{count}}`,builtInRoles:`Built-in roles`,subagentRole_explorer:`Explorer`,subagentRole_implementer:`Implementer`,subagentRole_reviewer:`Reviewer`,subagentRole_advisor:`Advisor`,subagentRoleShort_explorer:`Read-only investigation`,subagentRoleShort_implementer:`Focused implementation`,subagentRoleShort_reviewer:`Correctness review`,subagentRoleShort_advisor:`Technical analysis`,subagentRoleDescription_explorer:`Explores the codebase and reports evidence without modifying files.`,subagentRoleDescription_implementer:`Implements a bounded change and runs the relevant repository checks.`,subagentRoleDescription_reviewer:`Reviews correctness, safety, regressions, and missing validation.`,subagentRoleDescription_advisor:`Analyzes difficult technical questions and recommends a concrete next step.`,configureRoles:`Configure roles`,builtInRole:`Built-in role`,builtIn:`Built-in`,modelAssignment:`Model assignment`,inheritParentModel:`Inherit parent model`,effectiveModel:`Effective model`,workflowConcurrencyLabel:`Concurrent agents`,workflowCallLimit:`Total agent calls`,runtimeBoundaries:`Runtime boundaries`,subagentAuthorityNote:`Child authority is the fail-closed intersection of the parent Session and role capabilities.`,subagentModelNote:`No hardcoded provider is introduced; an unassigned role follows the parent model and thinking level.`,resourceCount_one:`{{count}} resource`,resourceCount_other:`{{count}} resources`,noPluginsFound:`No loaded plugin sources were reported.`,pluginCatalogTotals:`{{extensions}} ext · {{skills}} skills · {{prompts}} prompts · {{themes}} themes`,loaded:`Loaded`,resourceOrigin:`Origin`,resourceOrigin_package:`Package`,resourceOrigin_topLevel:`Top-level resource`,resources:`Resources`,baseDirectory:`Base directory`,notReported:`Not reported`,extensions:`Extensions`,extensionSurfaceCount:`{{tools}} tools · {{commands}} commands`,prompts:`Prompts`,themes:`Themes`,pluginResourceSummary:`{{extensions}} ext · {{skills}} skills · {{prompts}} prompts · {{themes}} themes`,pluginsManagedByPi:`These resources are loaded by Pi. Submit changes using the setup form above. Package changes follow native confirmation and take effect through Pi's reload lifecycle.`,selectPlugin:`Select a plugin source`,statusCaptured:`Snapshot at {{time}} · refresh for the latest state`,conversationViews:`Conversation views`,currentConversations:`Current`,archivedConversations:`Archived`,refreshArchives:`Refresh archived conversations`,loadingArchives:`Loading archived conversations...`,moreArchives:`Load more archived conversations`,retryArchives:`Retry archived conversations`,archiveLoadFailed:`Could not load archived conversations.`,archiveCursorStale:`Archived conversations changed. Refresh to continue.`,archiveScanBounded:`{{count}} older records have not been scanned.`,noArchivedSessions:`No archived conversations.`,noScannedArchives:`No archived conversations in the scanned history.`,noMatchingScannedArchives:`No matching archived conversations in the scanned history.`,draftLimit:`Draft storage is full. Send or clear an existing draft before adding more content.`,restoreConversation:`Restore conversation`,restoringConversation:`Restoring…`,loadedArchives:`Archived conversations in the loaded history`,loadedHistoryBounded:`{{sessions}} more sessions and {{workspaces}} workspace summaries are not loaded. Search covers the loaded list only.`,noLoadedArchives:`No archived conversations in this loaded list.`,restoreFailed:`Could not confirm restoration. Refresh and try again.`,execution_running:`Running`,execution_done:`Completed`,execution_killed:`Stopped`,execution_timed_out:`Timed out`,execution_failed:`Failed`,execution_uncertain:`Uncertain`,activeOnlyHint:`Only the active Web session accepts messages.`,acceptedHint:`Message accepted by OpenPI Web.`,promptAdmissionUnknown:`It is unclear whether the last message was received.`,promptAdmissionUnknownDetail:`Review the refreshed Session history and runtime status before deciding. Sending as a new message may create a duplicate message.`,promptAdmissionCheckingDetail:`Checking the latest Session history and runtime status before resend options are enabled.`,promptAdmissionVerificationFailedDetail:`Could not refresh the latest Session history and runtime status. Check again before sending as a new message.`,abandonAdmission:`Don't resend for now`,retryAdmissionCheck:`Check again`,retryOriginalAdmission:`Retry original message`,promptTooLong:`Message exceeds the send limit ({{count}} / {{limit}}).`,sendAsNew:`Send as new message`,sendingAsNew:`Sending…`,stopTurn:`Stop current turn`,stoppingTurn:`Stopping current turn…`,stoppedTurn:`Current turn stopped.`,pendingFollowUpsHint:`{{count}} messages queued`,sendNextTurn:`Send next turn`,steerCurrentTurn:`Steer current turn`,steeringHint:`Use this instruction after the current tool step finishes.`,pendingSteeringHint:`{{count}} instructions received; waiting for the current tool step`,steeringMessagesTitle:`Pending instructions for this turn`,steerStaleTurn:`That turn has ended or changed. Your draft is kept; choose how to send it again.`,sourceFeedbackNew:`{{path}} · new line {{line}}`,sourceFeedbackOld:`{{path}} · old line {{line}}`,forkMessage:`Fork from here`,forkMessageHint:`Create a new conversation from this message. Keep the original conversation; no message is sent.`,forkSessionPending:`Creating a fork…`,forkSessionCreated:`Fork created. The original conversation remains in the sidebar.`,forkSessionCancelled:`Fork cancelled. The original conversation is kept.`,forkSessionUncertain:`The fork could not be confirmed. Refresh and inspect your conversations before trying again.`,forkSessionUnavailable:`Switch to this conversation and let its current work and queued messages finish before forking.`,reviewQuoteLine:`Reference this line`,reviewSelectOldLine:`Select old line {{line}}`,reviewSelectNewLine:`Select new line {{line}}`,queuedMore:`{{count}} more queued`,queuedImage:`Image attachment`,queuedMessageExpand:`Expand queued message`,queuedMessageCollapse:`Collapse queued message`,backgroundSessionRunning:`This session is running in the background…`,observedSessionTools:`{{count}} active tools`,toolsRequireCurrentSession:`Switch to this session to use interactive tools.`,activateViewedSession:`Switch to this session`,activateViewedSessionHint:`Send a message to continue this conversation.`,addWorkspace:`Add workspace`,addWorkspaceMenu:`Add workspace...`,archiveConversation:`Archive conversation`,pinnedConversations:`Pinned`,sidebarOptions:`Sidebar options`,sidebarProjectOptions:`Project sidebar options`,sidebarRecentOptions:`Chat sidebar options`,sidebarActivityOptions:`Activity view options`,sidebarShow:`Show`,sidebarGroupBy:`Group conversations`,sidebarByProject:`By project`,sidebarFlatList:`All conversations`,sidebarChatSort:`Conversation order`,sidebarRecent:`Recent`,sidebarProjectsInRecents:`Show projects in Recent`,sidebarShowMore:`Show more`,sidebarShowLess:`Show less`,sidebarFilterList:`Filter this list`,sidebarSaveFailed:`Could not save the change. Please try again.`,pinWorkspace:`Pin project`,unpinWorkspace:`Unpin project`,markConversationRead:`Mark as read`,markConversationUnread:`Mark as unread`,sidebarState_unread:`Unread conversation`,sidebarActivity:`Activity`,sidebarViewActivity:`View activity`,sidebarViewChats:`View conversations`,sidebarPriority:`Priority`,sidebarActivityEmpty:`Nothing needs attention`,sidebarActivityEmptyHint:`Completed work and conversations needing your attention appear here.`,sidebarMarkAllRead:`Mark all as read`,sidebarClearRead:`Clear read chats from Priority`,sidebarReadFailed:`Could not update read status. Please try again.`,sidebarToday:`Today`,sidebarYesterday:`Yesterday`,sidebarEarlier:`Earlier`,sidebarActivityCompleted:`Completed`,sidebarActivityFailed:`Failed`,sidebarActivityRead:`Read`,modelAdvanced:`Advanced parameters`,providerConnectionHeading:`Provider connection`,providerFetchModels:`Get available models`,providerFetchHint:`Enter the provider and endpoint, then choose models in one step.`,providerPickerTitle:`Choose models to add`,providerPickerAccess:`Connection credentials`,providerPickerKey:`Access key (optional)`,providerPickerKeyHint:`Leave blank to use saved credentials for this endpoint. A key entered here is used for discovery only and is not saved.`,providerPickerSearch:`Search models`,providerPickerSelectAll:`Select all`,providerPickerClear:`Clear selection`,providerPickerLoading:`Reading available models…`,providerPickerAdded:`Added`,providerPickerNoMatch:`No matching models`,providerPickerEmpty:`No models returned. You can still add one manually.`,providerPickerBounded:`Showing the first 500 models. Add other IDs manually.`,providerPickerError_load:`Could not read the model list. Check the endpoint and credentials, then retry or add a model manually.`,providerPickerError_save:`Could not confirm the save. Your selection is kept; check the connection before retrying.`,providerPickerError_conflict:`Configuration changed elsewhere. Close this dialog and reload configuration before saving again.`,providerPickerDefaults:`New models use {{context}} context / {{output}} output tokens. You can adjust these per model after adding.`,providerPickerRetry:`Refresh list`,providerPickerCount:`{{count}} selected · up to 100`,providerPickerSave:`Add selected`,sidebarState_running:`Running`,sidebarState_compacting:`Organizing context`,sidebarState_waiting:`Waiting for your response`,sidebarState_completed:`Completed · unread result`,sidebarState_failed:`Failed · open conversation for details`,pinnedOptions:`Pinned options`,pinConversation:`Pin conversation`,unpinConversation:`Unpin conversation`,pinnedRecentlyUpdated:`Recently updated`,pinnedManualOrder:`Manual order`,movePinUp:`Move up`,movePinDown:`Move down`,pinSaveFailed:`Could not save pinned conversations. Please try again.`,cancel:`Cancel`,chooseWorkspaceHint:`Choose a workspace and describe the work`,close:`Close`,closeSearch:`Close search`,collapseSidebar:`Collapse sidebar`,confirmEdit:`Save and rerun`,editMessageHint:`Rerun from here in a new branch. Keep the original conversation, images and file references. Existing workspace changes are kept.`,regenerateMessage:`Regenerate response`,regenerateMessageHint:`Rerun this question in a new branch, keeping its original attachments and conversation.`,messageRerunStarted:`Rerun admitted in a new branch. The original conversation is kept.`,openOriginalConversation:`View original conversation`,messageRerunWorkspaceHint:`Existing workspace changes are kept.`,modelRequestRecovered:`Request recovered`,modelReconnecting:`Reconnecting`,modelReconnectUnknown:`Reconnection status unconfirmed`,modelEarlierAttempts:`Earlier request errors`,modelFailedAttempts:`Failed attempts ({{count}})`,draftStorageUnavailable:`Draft could not be saved on this device. Keep this page open or copy your message.`,draftStorageInvalid:`Some saved draft content could not be restored. Check your message and attachments.`,draftStorageRetry:`Retry saving draft`,workbarBackToChat:`Back to chat`,workbarCollapseTools:`Collapse tools`,workbarEndTerminal:`Close {{name}} and end its process`,workbarNewTerminal:`New terminal`,workbarContinueInChat:`Continue in chat`,transcriptSearch:`Search message contents`,transcriptSearchPlaceholder:`Search titles, projects, or messages…`,transcriptSearchRecent:`Recent conversations`,transcriptSearchSessions:`Conversations`,transcriptSearchMessages:`Message contents`,transcriptSearchSessionResult:`Open conversation {{session}}`,transcriptSearchSessionOpenFailed:`Could not open this conversation. Try again.`,transcriptSearchIncludeArchived:`Include archived conversations`,transcriptSearching:`Searching messages…`,transcriptSearchEmpty:`No matching messages found.`,transcriptSearchFailed:`Could not search messages. Try again.`,transcriptSearchRetry:`Retry search`,transcriptSearchPartial:`Some history could not be searched. Results may be incomplete.`,transcriptSearchOpenFailed:`This message could not be opened. It may have moved or belong to another branch.`,transcriptSearchResult:`Open message from {{source}} in {{session}}`,transcriptSearchSource_user:`you`,transcriptSearchSource_assistant:`assistant`,transcriptSearchSource_tool_call:`tool call`,transcriptSearchSource_tool_result:`tool output`,connected:`Connected`,connecting:`Connecting`,conversationName:`Conversation name`,conversationOptions:`Conversation options`,sidebarRename:`Rename`,sidebarPin:`Pin`,sidebarUnpin:`Unpin`,sidebarFork:`Fork`,sidebarForkLocal:`Fork chat`,sidebarForkSameWorktree:`Fork in same worktree`,archiveNoticeTitle:`Chat archived`,archiveNoticeView:`View`,archiveNoticeUndo:`Undo`,archiveNoticeFailed:`Could not complete this action. Try again.`,sidebarForkWorktree:`Fork chat in new worktree`,sidebarForkCancelling:`Requesting cancellation…`,sidebarForkFinishing:`Cancellation is no longer available. Confirming the result…`,sidebarForkCancelUnconfirmed:`Cancellation could not be confirmed. Waiting for the fork result.`,sidebarForkWorktreePreserved:`The worktree was kept at {{path}}. Inspect it before retrying.`,sidebarForkWorktreePending:`Creating a worktree and conversation…`,sidebarForkOptionsLoading:`Checking worktree availability…`,sidebarForkOptionsFailed:`Unable to check worktrees. Reopen menu to retry.`,sidebarForkUnavailable:`Send a message before forking this conversation.`,sidebarForkArchived:`Restore this conversation before forking.`,sidebarForkFailed:`Could not create the fork. The original conversation is unchanged.`,sidebarCopy:`Copy`,sidebarCopyLink:`Copy conversation link`,sidebarCopyMarkdown:`Copy as Markdown`,sidebarCopyCwd:`Copy working directory`,sidebarCopied:`Copied`,sidebarCopyFailed:`Could not copy. Try again.`,sidebarNewWindow:`Open in new window`,sidebarOpenIn:`Open in`,sidebarAppsLoading:`Loading available apps…`,sidebarAppsFailed:`Unable to load apps. Reopen menu to retry.`,sidebarOpenFailed:`Unable to open this project in the selected app.`,sidebarArchive:`Archive`,sidebarRestore:`Restore`,sidebarDelete:`Permanently delete`,managedWorktreeRecoveryFull:`Check earlier unfinished removal requests before starting another.`,managedWorktreesChanged:`The worktree list changed. Refresh it before reviewing a target.`,managedWorktreesRefresh:`Refresh worktrees`,managedWorktreesBack:`Back to worktrees`,managedWorktreesRetry:`Retry request`,managedWorktrees:`Retained worktrees`,managedWorktreesDescription:`Worktrees created by OpenPI are kept when a conversation is deleted. Review an exact path before requesting removal. Active, shared, changed or unverified worktrees stay in place.`,managedWorktreeConfirm:`Remove this managed worktree? The server rechecks ownership, active conversations and local changes before removal.`,managedWorktreeRemoved:`Worktree removed.`,managedWorktreePreserved:`Worktree kept:`,managedWorktreeUncertainTerminal:`Removal outcome is uncertain. Automatic removal cannot be repeated. Inspect the retained path before taking further action.`,managedWorktreeUncertain:`Removal outcome is unknown. Retry to check the original request.`,managedWorktreeRemoving:`Checking and removing…`,managedWorktreeRemove:`Remove worktree`,managedWorktreeReview:`Review removal`,managedWorktreesEmpty:`No managed worktrees were found on this page.`,managedWorktreesUnavailable:`{{count}} ownership records could not be verified.`,managedWorktreesLoadFailed:`Could not load retained worktrees. Retry without changing the target.`,managedWorktreesMore:`Load more worktrees`,managedWorktreeRetainedAfterDelete:`Conversation deleted. Worktree kept at {{path}}. Review retained worktrees in the project menu.`,sidebarDeleteTitle:`Delete conversation?`,sidebarDeleteDescription:`Permanently delete “{{name}}”? This cannot be undone.`,sidebarDeleteConfirm:`Delete`,sidebarDeleting:`Deleting…`,sidebarDeleteFailed:`Could not delete this conversation. Retry or cancel.`,sidebarActionRunning:`Let current work and queued messages finish first.`,sidebarActionDisconnected:`Reconnect before changing this conversation.`,sessionDeleteCancelled:`Deletion cancelled`,sessionDeleteUncertain:`Could not confirm whether the conversation was deleted. Refresh and try again.`,sessionDeleted:`Conversation permanently deleted`,sessionDeleteMetadataPending:`The conversation was deleted, but its sidebar records could not be fully cleared.`,sessionLinkUnavailable:`The linked conversation no longer exists or its identity has changed.`,sidebarDropPin:`Drop here to pin`,sidebarDropProjectLast:`Move project to the end`,conversationTurns:`Conversation turns`,conversationTurnPosition:`Go to turn {{position}}`,turnPreviewLoading:`Loading preview…`,turnPreviewUnavailable:`Preview unavailable. Try again.`,commands:`Slash commands`,addContext:`Add context`,fileReference:`Reference workspace file`,fileReferenceTitle:`Reference workspace file`,fileReferenceDetail:`Add a path reference to the prompt without uploading file contents.`,fileReferenceLabel:`Workspace file path`,fileReferencePlaceholder:`src/app.tsx`,fileReferenceValidatedHint:`The current Session verifies that this is a readable workspace file.`,fileReferenceDraftHint:`This path will be resolved by Pi after the new Session starts.`,fileReferenceChecking:`Checking…`,fileReferenceFailed:`Could not verify this file.`,fileReferenceDenied:`Choose a file inside the current Session workspace.`,fileReferenceMissing:`This workspace file no longer exists.`,fileReferenceUnsupported:`Only regular workspace files can be referenced.`,fileReferenceExpired:`The active Session changed. Reopen the file reference and try again.`,fileReferenceBusy:`File validation is busy. Try again shortly.`,insertReference:`Insert reference`,commandsSessionRequired:`Slash commands are available after the Session starts.`,commandsEmptyDraftOnly:`Slash commands can be inserted only into an empty draft.`,commandsLoading:`Loading commands...`,commandsUnavailable:`Commands are temporarily unavailable.`,commandsNoMatch:`No matching commands.`,commandsNoAvailable:`No discovered commands can run in Web. Type a command name to inspect its availability.`,commandsBounded:`{{count}} more commands are not shown.`,commandSessionRequired:`Commands require an active Web session.`,commandUnsupported:`Not adapted · manual commands still reach Pi`,commandAcceptsArguments:`Accepts arguments`,commandSource_extension:`Extension`,commandSource_prompt:`Prompt template`,commandSource_skill:`Skill`,copiedMessage:`Copied`,copyMessage:`Copy message`,copyFailed:`Copy failed. Please select and copy the message manually.`,copiedCode:`Code copied`,copyCode:`Copy code`,copyCodeFailed:`Could not copy this code. Select and copy it manually.`,codeBlock:`Code block`,deleteWorkspace:`Delete workspace`,describeTask:`Describe a task`,editMessage:`Edit and rerun from here`,enterHint:`Enter to send, Shift+Enter for a new line.`,expandSidebar:`Expand sidebar`,importWorkspace:`Import workspace`,loadingModels:`Loading models...`,modelsTruncated:`Showing {{shown}} models. {{omitted}} more are available; search to find them.`,searchModels:`Search available models`,searchModelsPlaceholder:`Search provider, model name, or ID...`,searchingModels:`Searching models...`,noMatchingModels:`No matching models`,modelSearchFailed:`Could not search models. Try again.`,retryModelSearch:`Retry model search`,fileReferenceDraftChanged:`The draft changed. Reopen the file reference.`,modelSearchTruncated:`{{omitted}} matching models are not shown.`,modelPreparing:`Preparing task...`,modelRetrying:`Retrying model request...`,modelRunning:`Working...`,modelRequestFailed:`Model request failed`,modelRequestStopped:`Model request stopped`,modelFailureUnknown:`The provider did not return an error reason.`,retryPrompt:`Retry prompt`,retryingPrompt:`Retrying...`,newSession:`New session`,noConversations:`No conversations yet`,noMatching:`No matching conversations`,noMatchingLoaded:`No matching conversations in the loaded history`,noModels:`No models available`,noOutput:`no output`,noSessions:`No sessions`,openSidebar:`Open sidebar`,promptMessage:`Send a message or start a task, / for commands`,promptReadonly:`A non-active session cannot receive prompts`,promptStart:`Choose a workspace to begin.`,promptTask:`Describe what you want to build.`,landingTagline:`Small harness. Clean context. Deep extensions.`,queuedHint:`The message will be queued after the current turn.`,reconnecting:`Reconnecting`,removeWorkspace:`Remove from sidebar`,workspaceOptions:`Workspace options`,renameFailed:`Could not save the name. Your changes were kept.`,savingName:`Saving...`,workspaceRemoveFailed:`Could not remove the workspace. Try again.`,removingWorkspace:`Removing...`,renameConversation:`Rename conversation`,renameWorkspace:`Rename workspace`,save:`Save`,searchConversations:`Search conversations`,searchPlaceholder:`Filter titles and workspaces…`,selectModel:`Select model`,configureModels:`Configure models`,openModelSettings:`Model settings`,selectThinking:`Select thinking level`,resetThinking:`Restore the opening level ({{level}})`,modelThinkingNotEnabled:`Thinking is not enabled for this model. Enable reasoning support in model settings if your provider supports it.`,providerReasoningHint:`Enable only if the provider supports reasoning. Available levels come from Pi; adjust the level in the composer.`,providerImageHint:`When Image is unchecked, the model will not receive image attachments.`,selectWorkspace:`Select workspace`,send:`Send`,processDetails:`Execution details`,processRunning:`Working`,processThinkingCount_one:`{{count}} reasoning note`,processThinkingCount_other:`{{count}} reasoning notes`,processToolCount_one:`{{count}} tool call`,processToolCount_other:`{{count}} tool calls`,processActivityCount_one:`{{count}} agent activity`,processActivityCount_other:`{{count}} agent activities`,switchingSession:`Switching session...`,thinkingActive:`Thinking...`,thinkingActiveLevel:`Thinking ({{level}})...`,thinkingDone:`Thinking`,thinkingLoadFull:`Load full thinking`,thinkingLoadingFull:`Loading thinking…`,thinkingLoadFailed:`Unable to load thinking. Retry`,thinkingPartialText:`Showing part of the saved thinking. More text can be loaded below.`,thinkingPreviewOnly:`Thinking preview reached its limit. The full saved text will be available when this message finishes.`,toolState_running:`Running`,toolState_returned:`Returned`,toolState_failed:`Failed`,toolState_cancelled:`Stopped`,toolState_timed_out:`Timed out`,toolState_unknown:`Unconfirmed`,toolSnapshotMissingResult:`No result at fork`,toolActivity_running:`{{action}}…`,toolActivity_failed:`{{action}} failed`,toolActivity_cancelled:`{{action}} stopped`,toolActivity_timed_out:`{{action}} timed out`,toolActivity_unknown:`{{action}}`,toolAction_read:`Read`,toolAction_write:`Write file`,toolAction_edit:`Edit file`,toolAction_command:`Run command`,toolAction_search:`Search`,toolAction_list:`List files`,toolAction_web:`Browse web`,toolAction_agent:`Agent activity`,toolAction_workflow:`Workflow`,toolAction_plan:`Prepare plan`,toolAction_task:`Update tasks`,toolAction_goal:`Update goal`,toolAction_git:`Review changes`,toolAction_call:`Use tool`,toolActionDone_read:`Read`,toolActionDone_write:`Wrote file`,toolActionDone_edit:`Edited`,toolActionDone_command:`Ran command`,toolActionDone_search:`Searched`,toolActionDone_list:`Listed files`,toolActionDone_web:`Browsed web`,toolActionDone_agent:`Agent activity returned`,toolActionDone_workflow:`Workflow tool returned`,toolActionDone_plan:`Plan tool returned`,toolActionDone_task:`Task tool returned`,toolActionDone_goal:`Goal tool returned`,toolActionDone_git:`Reviewed changes`,toolActionDone_call:`Used tool`,toolActionGroup_read:`read files`,toolActionGroup_write:`write files`,toolActionGroup_edit:`edit files`,toolActionGroup_command:`run commands`,toolActionGroup_search:`search`,toolActionGroup_list:`list files`,toolActionGroup_web:`browse web`,toolActionGroup_agent:`agent activity`,toolActionGroup_workflow:`workflow activity`,toolActionGroup_plan:`planning`,toolActionGroup_task:`tasks`,toolActionGroup_goal:`goal`,toolActionGroup_git:`review changes`,toolActionGroup_call:`use tools`,toolGroup_done:`Activity · {{actions}}`,toolGroup_running:`Working · {{actions}}`,toolGroup_unknown:`Activity · {{actions}}`,toolGroupSeparator:`, `,toolSearchTarget:`“{{pattern}}” · {{path}}`,toolDiffStatsHelp:`Added and removed lines in the displayed diff`,toolRequestedFile:`File:`,toolWorkspace:`Workspace`,toolRawEvidence:`Arguments and original result`,toolCodemodeDetails:`Script and original result`,toolNestedOutputMissing:`This session records the call and its status, but not the nested tool output.`,toolNestedArgumentsMissing:`This session omits the full arguments and nested tool output.`,toolNestedIncomplete:`The nested-call record is incomplete; some calls, arguments or final states are unavailable.`,toolPartialEvidence:`Partial output: a byte, line or item limit was reached. The original result may also be truncated.`,toolFileChange_created:`File created`,toolFileChange_unchanged:`No content changes`,toolFileChange_overwritten:`File overwritten`,toolChangeUnavailable:`This result does not include a change comparison.`,toolTestResults:`Reported test results · {{format}}`,toolTestCounts:`{{tests}} tests · {{passed}} passed · {{failed}} failed · {{cancelled}} cancelled`,toolTestCountsHelp:`Counts come from command output. The execution status is shown separately.`,toolReadMore:`Read another range using the path and offset. The original result contains continuation details.`,toolFullOutputReference:`Full output:`,subagentBackgroundResult_one:`Background subagent result · {{count}}`,subagentBackgroundResult_other:`Background subagent results · {{count}}`,thinkingDraftHint:`Choose a workspace and create a session first.`,thinkingInactiveHint:`Only the active session can change its thinking level.`,thinkingLevelMismatch:`The confirmed thinking level is not offered by the current model. Choosing another level will correct it.`,thinkingLockedRunning:`Stop the current turn before changing the thinking level.`,thinkingModelPendingHint:`Wait for the model change to finish.`,thinkingNotConfirmed:`Thinking level was not confirmed. Please try again.`,thinkingPendingHint:`Applying the thinking level...`,thinkingUnsupported:`Thinking is unavailable`,thinkingUnsupportedHint:`No model is selected, or the current model does not support thinking.`,unavailable:`Unavailable`,ungrouped:`Ungrouped`,untitledSession:`New session`,workspaceDeleteConfirm:`The folder and conversation records will be kept. Its conversations will move to Ungrouped.`,workspaceName:`Workspace name`,workspaces:`Workspaces`,sidebarProjects:`Projects`}},zh:{translation:{promptPending:`正在处理请求…`,commandFeedbackTruncated:`这里只显示部分命令结果。请缩小查询范围,或在 TUI 查看完整输出。`,planMode_inactive:`普通模式`,planMode_planning:`规划中 · 禁止写入`,planMode_ready:`计划就绪 · 等待审阅`,planMode_invalid:`计划状态异常 · 禁止写入`,planModeEnter:`进入规划`,promptPlanMessage:`本次对话使用 Plan 模式 · 继续讨论计划,暂不实施`,planModeUnconfirmed:`暂时无法确认 Plan 状态,请刷新后再继续。`,planModeExit:`退出规划`,planModeImplement:`准备实施提示`,planImplementationReplaceDraft:`准备实施会替换当前草稿并关闭规划模式,但不会发送提示词。是否继续?`,commandSupport_plan:`支持规划和准备当前会话的实施提示;新建实施会话仍需使用 TUI。`,commandSupport_setup:`通过当前模型配置,在 Web 回答问题。`,handoffWaiting:`需要你操作`,handoffDone:`已完成`,handoffUnable:`无法完成`,handoffDoneHelp:`已执行操作,接下来由模型验证结果。`,handoffUnableHelp:`未能完成,可以补充遇到的障碍。`,handoffReview:`复核状态`,handoffSubmit:`提交状态`,handoffSignal:`预期结果:`,handoffVerify:`提交完成后,模型仍需验证结果;你的反馈本身不代表验证成功。`,planCardLabel:`开发计划`,planCardReady:`计划已就绪`,planCardResult:`计划结果`,planCardNotApproval:`此步骤仅生成计划,不代表已批准或开始实施。`,planCardCollapse:`收起`,planCardExpand:`展开`,planCardCopy:`复制计划`,planCardCopyPreview:`复制可见预览`,planCardTruncated:`当前仅显示截断预览。`,planCardLoadFull:`加载完整计划`,planCardLoadingFull:`正在加载计划...`,planCardLoadFailed:`无法加载完整计划,重试`,planCardEvidence:`工具结果 · plan_ready`,questionWaiting:`问题`,questionPreview:`查看预览`,questionSkip:`跳过`,questionProgress:`{{current}} / {{total}}`,questionReview:`复核答案`,questionReviewTitle:`确认这些选择?`,questionReviewHelp:`可以返回修改,点击提交后才会发送给助手。`,questionEdit:`修改答案:{{question}}`,questionDismiss:`关闭提问,不提交答案`,questionCustom:`或自行撰写回复`,questionCustomHelp:`留空提交,表示希望助手把问题说清楚或拆小。`,questionYourAnswer:`你的答案`,questionCustomPlaceholder:`说说你的想法…`,questionNotes:`补充说明(选填)`,questionNotesPlaceholder:`补充限制条件,或解释你的选择…`,questionRephrase:`请助手把问题说清楚或拆小`,questionBack:`上一步`,questionNext:`下一题`,questionSubmit:`提交答案`,questionSubmitting:`正在提交…`,questionRetry:`核对提交结果`,questionUncertain:`暂时无法确认是否送达,已保留本次提交的答案。点击核对可恢复结果,不会重复提交。`,questionDisconnected:`正在重新连接… 已保留你的选择,暂时无法提交。`,questionLimit:`每项答案或补充说明不能超过 {{count}} 个 UTF-8 字节。`,questionLoadFailed:`暂时无法读取等待回答的问题。`,questionDraftLimit:`提问草稿已达上限,请缩短或清空已有答案后再添加内容。`,questionRetryLoad:`重试`,questionCloseReceipt:`关闭问答状态提示`,questionState_dismissed:`已关闭提问,没有提交答案。`,questionState_cancelled:`提问已取消,没有提交答案。`,questionState_expired:`提问已过期,没有提交答案。`,questionState_stale:`该提问已失效,请查看对话中的处理结果。`,conversationView:`会话视图`,jumpToLatest:`跳至最新`,historyLoading:`正在加载历史…`,historyOmitted:`还有 {{count}} 条较早记录 · 向上滚动自动加载`,historyChanged:`会话分支已更改,已切换到当前分支的历史。`,historyUnavailable:`历史记录加载失败,请重试。`,historyValidationUnavailable:`无法校验会话历史,请重试。`,historyVerifying:`正在校验会话历史…`,messageLoadFull:`加载完整消息`,messageLoadMore:`加载更多`,messageLoadingFull:`正在加载消息…`,messageLoadFailed:`无法加载这条消息,重试`,filePreview:`文件预览`,changeEvidence:`变更`,changeEvidenceScope:`按所选范围查看当前工作目录的只读 Git 变更。`,turnLabel:`第 {{number}} 轮`,turnState_running:`运行中`,turnState_complete:`已完成`,turnState_failed:`失败`,turnState_interrupted:`已中断`,turnState_waiting:`等待回复`,turnState_forked:`已分叉,可继续对话`,turnChanges:`本轮更改 {{count}} 个文件`,turnChangesPartial:`本轮已记录 {{count}} 个文件`,turnChangesIncomplete:`这一轮的变更记录不完整。`,turnChangesMore:`再显示 {{count}} 个文件`,turnChangesLess:`收起文件`,turnChangesReview:`审阅本轮变更`,turnChangesReviewButton:`审阅`,turnChangesBack:`返回本轮变更`,turnChangesLoading:`正在加载本轮变更…`,turnChangesUnavailable:`无法读取本轮保存的差异。`,messageCopyRequiresFull:`加载完整消息后才能复制。`,filesChanged:`{{count}} 个文件已更改`,reviewChanges:`查看变更`,workspaceChanges:`工作区更改`,overviewChanges:`变更`,overviewLineTotals:`当前 Git 比较范围内的文本新增与删除行数`,overviewPartialTotals:`仅展示已核实的行数,部分文件尚无法统计。点击变更查看详情。`,overviewCounting:`统计中…`,overviewCountsUnknown:`行数未知`,overviewReviewUnavailable:`暂不可用`,sessionSources:`来源`,sourcesAdd:`添加来源`,sourcesEmpty:`暂无来源`,sourcesFailed:`来源加载失败。`,sourcesViewAll:`查看全部`,sourcesLoadMore:`加载更多来源`,sourcesBack:`返回来源列表`,sourcesPartial:`已达到列表展示上限,更早的来源仍可在对话中查看。`,turnChangesScope:`该轮开始至结束的工作区差异 · 已保存`,turnEdits:`已编辑 {{count}} 个文件`,turnEditsPartial:`已记录 {{count}} 个文件的编辑`,turnEditsScope:`本轮文件工具写入记录 · 已保存;不含命令行与外部修改`,turnEditStatsUnknown:`行数未知`,turnEditReason_before_unavailable:`文件已写入,但该操作未授权读取旧内容,无法提供可靠的前后差异。`,turnEditReason_content_limit:`文件已写入,内容超过已保存对比的大小限制,无法提供准确行数。`,turnEditReason_concurrent_change:`文件在已记录的操作之间发生了变化,无法确认本轮净增删行数。`,gitReviewLoadedCount:`已载入 {{count}} 个文件`,gitReviewPartialLabel:`部分`,gitReviewSearch:`搜索文件路径`,gitReviewExpand:`展开审阅`,gitReviewSearchLoaded:`搜索已载入文件`,gitReviewMarkViewed:`标记 {{path}} 为已查看`,gitReviewMarkCurrentViewed:`标记当前文件 {{path}} 为已查看`,gitReviewViewedLabel:`已查看`,gitReviewViewedProgress:`已查看 {{viewed}} / 已加载 {{loaded}} 个文件`,gitReviewViewedLimit:`本次对比最多保留 {{count}} 个已查看标记。`,gitReviewNoMatch:`没有匹配的文件。`,gitReviewNoLoadedMatch:`已载入文件中没有匹配项。`,gitReviewLoadNext:`载入下一批文件`,gitReviewChanged:`工作区已有变化,请刷新清单后继续载入。`,gitReviewNewVersion:`有新的更改,当前仍显示你正在阅读的版本。`,gitReviewShowLatest:`查看最新差异`,gitReviewBinary:`此二进制文件无法显示文本差异。`,gitReviewBinaryShort:`二进制`,gitReviewPendingStats:`待读取`,gitReviewComparison:`{{current}} 对比 {{base}}`,gitReviewWorkingTree:`工作区对比 HEAD`,gitReviewSessionSnapshot:`自本会话开始后的变更`,gitReviewDetached:`游离 HEAD`,gitReviewLoading:`正在读取 Git 变更…`,gitReviewRetry:`重试`,gitReviewRefresh:`刷新变更`,gitReviewOlderResult:`当前显示上一次读取结果。`,gitReviewNotRepository:`此工作区不是 Git 仓库。`,gitReviewUnborn:`此仓库还没有可读取的 HEAD。`,gitReviewFailed:`无法读取 Git 变更。`,gitReviewTruncated:`结果不完整,部分文件或差异未载入。`,gitReviewEmpty:`当前范围内没有文件变更。`,gitReviewHiddenLines:`另有 {{count}} 行 diff 未显示。`,gitReviewDiffTruncated:`快照已达到大小上限,未加载此文件的 diff。`,gitReviewShowMore:`再显示 {{count}} 个文件`,gitReviewBackToFiles:`返回变更文件`,gitReviewFilePreview:`{{file}} 的差异`,gitReviewNoDiff:`此文件没有可显示的文本差异。`,changeDiff:`变更差异`,diffView:`差异`,gitFileStatus_added:`已新增`,gitFileStatus_modified:`已修改`,gitFileStatus_deleted:`已删除`,gitFileStatus_renamed:`已重命名`,gitFileStatus_copied:`已复制`,gitFileStatus_untracked:`未跟踪`,gitFileStatus_unknown:`已变更`,closePreview:`关闭预览`,artifactReadOnly:`只读`,artifactReferenceUnavailable:`此视图无法打开文件预览:{{path}}`,artifactSession:`所属会话 {{sessionId}}`,copyFilePath:`复制文件路径`,filePathCopied:`已复制文件路径`,refreshFile:`刷新文件`,downloadFile:`下载文件`,downloadingFile:`正在下载…`,artifactOlderPreview:`当前显示旧版预览。`,readingFile:`正在读取文件…`,artifactVersion:`版本`,artifactBytes:`{{count}} 字节`,artifactPreviewTruncated:`预览已截断;下载文件可获取完整内容。`,artifactUnsupported:`此类型无法预览,请下载文件。`,chatView:`对话`,trajectory:`执行轨迹`,trajectoryScope:`按记录顺序展示会话消息,不表示执行耗时,也不是完整模型请求。`,trajectoryRunning:`任务仍在进行。已保存记录到达后自动更新;实时生成内容可在“对话”中查看。`,trajectoryTruncated:`当前历史不完整:省略 {{entries}} 条记录、{{parts}} 个内容片段,{{messages}} 条消息被截断。`,trajectoryEmpty:`尚无已保存记录。`,trajectoryOrder:`记录顺序`,trajectoryRecordCount:`{{count}} 条记录`,trajectoryMatches:`{{count}} 条匹配`,trajectorySearch:`搜索已加载记录`,trajectoryNoMatches:`没有匹配的记录。`,trajectoryEarlierGroup:`较早上下文`,trajectoryEventCount:`{{count}} 条会话变更`,trajectorySummary:`概览`,trajectoryInputTab:`输入`,trajectoryResultTab:`结果`,trajectoryConversationGroup:`本轮对话`,trajectoryReasoningTitle:`思考`,trajectoryRecordNumber:`记录 {{number}}`,trajectoryRecordInfo:`记录信息`,trajectoryRecordId:`记录 ID`,trajectoryCallId:`工具调用 ID`,trajectoryEventType:`事件类型`,trajectoryEvent_model_change:`切换模型`,trajectoryEvent_thinking_level_change:`调整思考级别`,trajectoryEvent_compaction:`压缩上下文`,trajectoryEvent_session_info:`更新会话信息`,trajectoryEvent_custom:`会话记录`,trajectoryEarlier:`显示更早记录(已加载历史中还有 {{count}} 条)`,trajectoryDetails:`记录详情`,trajectoryRecordedAt:`记录时间`,trajectoryEvidenceTruncated:`此证据在会话投影中已被截断。`,trajectoryArguments:`工具参数`,trajectoryRecordedContent:`已记录内容`,trajectoryThinking:`模型返回的推理内容`,trajectoryOutput:`工具结果`,trajectoryMissingResult:`当前记录中没有可明确配对的结果。这不表示工具仍在运行。`,trajectoryStructured:`结构化结果`,trajectoryEventOnly:`当前仅提供此事件的类型和记录时间。`,trajectory_user:`用户消息`,trajectory_assistant:`助手回复`,trajectory_call:`工具调用`,trajectory_result:`未配对结果`,trajectory_event:`会话事件`,trajectory_returned:`工具已返回结果。`,trajectory_error:`工具返回错误`,trajectory_unknown:`尚无法确定结果`,runtimeStatus:`运行状态`,refreshStatus:`刷新状态`,terminalDetails:`终端详情`,openTools:`打开工具`,sideConversation:`侧边对话`,sideConversationDescription:`在独立 Pi 会话中追问具体问题,不打断当前主任务。`,workbarChangesDescription:`查看当前目录的未暂存、已暂存、分支或会话变更。`,terminal:`终端`,renameTerminal:`重命名终端`,terminalName:`终端名称`,workbarTerminalDescription:`打开当前工作区的交互式终端。`,backgroundTerminalActivity:`Agent 命令活动`,restartTerminal:`重新启动终端`,reconnectTerminal:`重新连接终端`,restartTerminalTitle:`重新启动此终端?`,restartTerminalDetail:`当前终端会被关闭,其中运行的进程可能被中断。`,terminalReconnecting:`正在重新连接终端...`,terminalScrollToBottom:`回到底部`,terminalOutputResynced:`终端输出已重新同步`,terminalRestarting:`正在重新启动终端...`,terminalConnecting:`正在启动终端…`,terminalExited:`终端已退出。`,terminalExitCode:`终端已退出,状态码 {{code}}。`,terminalDisconnected:`终端连接意外中断。`,terminalError:`终端不可用。`,browser:`浏览器`,sessionFileRecords:`本会话文件记录`,gitReviewSource:`变更范围`,gitReviewBaseBranch:`对比分支`,gitReviewChooseBase:`选择对比分支`,gitReviewSearchBranches:`搜索分支`,gitReviewLocalBranch:`本地分支`,gitReviewRemoteBranch:`远程分支`,gitReviewBranchesTruncated:`显示有数量限制的分支列表,部分分支已省略。`,gitReviewNoMatchingBranches:`没有匹配的分支。`,gitReviewBaseUnavailable:`没有可用的默认对比分支。请选择分支以审阅已提交的变更。`,gitReviewBaseInvalid:`所选对比分支已不可用,请选择其他分支。`,gitReviewUnstaged:`未暂存(含未跟踪)`,gitReviewStaged:`已暂存变更`,gitReviewBranch:`分支变更`,gitReviewFileMissing:`此文件在当前范围内已无变更,请刷新文件列表。`,artifactExternalAccess:`此文件位于其他工作目录。可为当前会话授权只读打开这一个文件,不会开放其他文件的访问。`,artifactAuthorizeFile:`只读打开此文件`,sideConversationPending:`正在准备侧边会话…`,resizeSidebar:`调整侧边栏宽度`,resizePanes:`调整面板宽度`,resizeWorkbar:`调整工具栏宽度`,browserPasteTooLarge:`每次最多粘贴 {{count}} 个字符。`,browserInputTooLarge:`每次最多输入 {{count}} 个字符。`,browserInputTargetChanged:`输入目标已变化或无法确认,有输入操作未执行。`,workbarBrowserDescription:`在 OpenPI 工作栏内打开并操作网页。`,browserReady:`输入地址开始浏览`,browserStarting:`正在启动内嵌浏览器…`,browserOpened:`已在内嵌浏览器中打开`,browserOpenAgain:`再次打开`,browserOpenFailed:`内嵌浏览器暂不可用。`,browserBack:`后退`,browserForward:`前进`,browserReload:`重新加载`,browserTabs:`网页标签页`,browserNewTab:`新标签页`,browserAddTab:`新建网页标签页`,browserCloseTab:`关闭 {{title}}`,browserTabLimit:`最多打开 {{count}} 个网页标签页`,browserPageTitle:`网页:{{address}}`,browserEnteredAddress:`最近从此地址栏打开的地址`,browserAddressNotAllowed:`请输入不含用户名或密码、且不属于 OpenPI 自身地址的 HTTP(S) 网址。`,browserLocationUnknown:`网页已跳转,新地址无法读取。重新加载会返回你输入的地址。`,browserDirectDescription:`直接浏览网页。不允许嵌入的网站可在外部浏览器打开。`,browserDirectHint:`地址栏仅记录手动打开的地址。网页弹窗在外部浏览器打开;遇到空白页,可点击外部打开。`,browserEnhancedHint:`浏览增强已开启:地址自动同步,普通弹窗链接在内部标签页打开。部分站点限制、登录弹窗和跨站历史仍需外部浏览器。`,files:`文件`,filesExplorer:`工作区文件`,filesSearch:`筛选文件…`,refreshFiles:`刷新文件`,filesWorkspaceActions:`工作区文件操作`,filesCreateMenu:`新建`,filesImportMenu:`导入`,filesMoreMenu:`更多`,filesNewFile:`新建文件`,filesNewDirectory:`新建文件夹`,filesImport:`导入文件`,filesImportFolder:`导入文件夹`,filesImportFolderChoose:`选择要导入的文件夹`,filesImportFolderLimit:`每次最多导入 2,000 个文件和文件夹,目录层级最多 64 层。`,filesSelectMultiple:`多选文件`,filesSelectItem:`选择 {{name}}`,filesSelectedCount:`已选 {{count}} 项`,filesRename:`重命名`,filesNewName:`新名称`,filesMove:`移动`,filesMoveDestination:`目标文件夹(工作区内相对路径)`,filesTrashAction:`移入回收站`,filesTrash:`工作区回收站`,filesTrashDetail:`移除的文件保留在当前工作区,可恢复;不会覆盖同名文件。`,filesTrashEmpty:`暂无已移除文件`,filesTrashUnavailable:`{{count}} 项记录无法核验,内容仍保留在 .openpi-trash 中,暂不能自动恢复。`,filesRestore:`恢复`,filesRestoreItem:`恢复 {{name}}`,filesUndoTrash:`撤销移除`,filesOrganizationResults:`文件操作结果`,filesOperationDone:`完成`,filesRefreshBeforeOrganizing:`请先刷新文件树,再整理这项文件。`,filesImportChoose:`选择要导入的文件`,filesTargetDirectory:`目标目录`,filesWorkspaceRoot:`工作区根目录`,filesFileName:`文件名称`,filesDirectoryName:`文件夹名称`,filesCreate:`创建`,filesCreating:`创建中…`,filesCreated:`已创建:{{path}}`,filesNameInvalid:`请输入单个文件或文件夹名称,不要包含路径分隔符。`,filesNameExists:`此名称已存在,请更换名称;原有文件已保留。`,filesMutationFailed:`写入失败,输入已保留。`,filesWriteUnavailable:`请先切换到此会话,再修改工作区文件。`,filesImportLimit:`每个文件最多 50 MiB,同名文件不会覆盖。`,filesImportTooLarge:`此文件超过 50 MiB 导入上限。`,filesImportDirectoryUnsupported:`不支持导入整个文件夹,请选择其中的文件。`,filesImportResults:`文件导入结果`,filesImportPending:`等待导入`,filesImporting:`导入中…`,filesImported:`已保存到工作区`,filesImportedNoPreview:`已保存。预览上限为 20 MiB;可复制路径,在对话中引用此文件。`,filesClearImported:`清除已完成的导入`,filesRetryImport:`重试导入`,filesPathActions:`{{name}} 的路径操作`,filesCopyRelativePath:`复制相对路径`,filesCopyAbsolutePath:`复制绝对路径`,filesPathCopied:`已复制路径:{{path}}`,filesReadFailed:`无法读取文件。`,filesSymlink:`符号链接,文件浏览器不会自动跟随`,filesTruncated:`结果不完整,请缩小搜索范围。`,filesNoMatches:`没有匹配的文件`,filesEmpty:`此文件夹为空`,filesChoose:`选择文件进行预览`,filesChooseDetail:`从右侧浏览工作区文件,在这里直接预览。`,filesHideTree:`收起文件树`,filesShowTree:`显示文件树`,filesPreview:`预览`,filesSource:`查看源代码`,filesEdit:`编辑`,filesMode:`文件视图`,filesEditor:`文件编辑器`,filesSave:`保存文件`,filesSaving:`保存中…`,filesSaved:`已保存`,filesUnsaved:`未保存的修改 · 草稿保留在当前窗口`,filesDiscard:`放弃草稿`,filesDiscardConfirm:`放弃此文件尚未保存的修改?`,filesSaveConflict:`磁盘上的文件已改变,编辑草稿已保留。请刷新查看最新内容,核对修改后再保存。`,filesSaveFailed:`保存失败,编辑草稿已保留。请检查文件后重试。`,filesEditLoadFirst:`请先继续读取完整文件,再编辑。`,filesEditUnavailable:`支持编辑工作区内不超过 1 MiB 的 UTF-8 文本,最多保留 16 份未保存草稿。`,filesOutline:`章节目录`,filesDiskVersion:`查看当前磁盘版本`,filesReconcile:`已核对,保留草稿并基于此版本继续编辑`,filesTable:`表格预览`,filesRow:`行`,filesSheets:`工作表`,filesTableTruncated:`当前显示部分表格;下载文件可查看全部行列。`,filesOfficeLayout:`文档内容预览;分页和排版可能与 Office 不同。`,filesSlidesLayout:`幻灯片文字与图片预览;主题、图表和动画可能与 PowerPoint 不同。`,filesPreviousPage:`上一页`,filesNextPage:`下一页`,filesZoomOut:`缩小`,filesZoomIn:`放大`,filesZoomReset:`重置缩放`,filesPdfPage:`第 {{page}} 页`,filesDocumentLimit:`此文档超出预览处理范围,请下载后在本地打开。`,filesPreviewFailed:`无法预览此文件,仍可下载后打开。`,filesDiagram:`Mermaid 图表`,filesExpandDiagram:`放大图表`,filesFitImage:`适应宽度`,filesOriginalImage:`原始尺寸`,filesLoadMore:`加载更多`,filesLoaded:`已加载 {{count}} 项`,filesReadMore:`继续读取`,filesContentChanged:`文件已更新。当前阅读内容已保留,可在准备好后刷新。`,workbarFilesDescription:`浏览工作区文件,在文件树旁直接预览。`,backToSideConversations:`返回侧边对话`,continueSideConversation:`继续追问…`,startSideConversation:`提出一个侧边问题…`,sideConversationModelInherited:`新侧边对话使用主会话的模型与思考等级。`,sideConversationModelFixed:`这是当前侧边对话使用的模型。`,stop:`停止`,start:`开始`,browserAddress:`浏览器地址`,browserGo:`打开地址`,openExternalBrowser:`在外部浏览器打开`,invalidBrowserAddress:`请输入有效的 HTTP 或 HTTPS 地址。`,addImages:`添加图片`,addFiles:`添加文件`,fileAttachments:`文件附件`,previewFileAttachment:`预览文件`,fileAttachmentDescription:`文档、表格、PDF、文本、代码及其他文件`,fileAttachmentCount:`最多可添加 {{count}} 个附件。`,fileAttachmentTooLarge:`文件总大小不能超过 50 MB。`,fileAttachmentReadFailed:`无法读取此文件,请检查格式或是否有密码保护。`,fileAttachmentTextReady:`文本已就绪`,fileAttachmentTextTruncated:`部分文本 · 保留原文件`,fileAttachmentOriginalReady:`原文件已就绪`,fileAttachmentExtractionFailed:`未提取文本 · 原文件保留`,fileAttachmentEncodingUnavailable:`无法读取文本编码,原文件字节已保留。`,fileAttachmentDocumentUnavailable:`无法提取文本。文件可能受密码保护或格式暂不支持,原文件字节已保留。`,fileAttachmentNoText:`发送后,代理可通过工具读取原文件;此文件未提取出文本。`,fileAttachmentPreviewTruncated:`预览显示前 20,000 个字符,发送时会附上全部已提取文本。`,fileAttachmentExtractedContent:`已提取文本`,fileAttachmentPromptLabel:`用户提供的文件:`,fileAttachmentPromptTooLong:`消息和文件引用超过输入限制,请缩短消息或减少附件。`,imageAttachmentDescription:`支持 PNG、JPEG、GIF 或 WebP`,imageAttachments:`图片附件`,imageAttachmentsLoading:`正在准备附件…`,commandOpensPanel:`打开面板`,commandPanelArguments:`此命令用于打开面板,不能携带参数或图片。请移除后重试,或直接使用对应面板。`,commandPanelUnavailable:`未能打开面板,已保留命令。`,commandUnavailable_terminal_only:`需要在 Pi 终端界面中使用。`,commandUnavailable_not_integrated:`此扩展命令尚未接入 Web,请在 Pi 终端中使用。`,artifactImagePreviewFailed:`图片预览失败。请刷新文件重试,或下载后查看。`,artifactFileDetails:`文件信息`,turnElapsedRunning:`已处理 {{duration}}`,compactionElapsed:`已等待 {{duration}}`,compactionRunning:`正在压缩上下文`,compactionCompleted:`上下文已自动压缩`,compactionFailed:`上下文压缩失败`,compactionInterrupted:`压缩已中断`,compactionUnchanged:`压缩已结束,未生成新的摘要`,compactionUnavailable:`上下文压缩状态暂不可用`,compactionReconnectHelp:`连接已中断,恢复连接后将核实当前状态。`,compactionDraftHelp:`正在压缩上下文,发送的消息会排队等待。`,turnElapsedFinished:`用时 {{duration}}`,composerAdd:`添加`,composerCommands:`指令`,composerFile:`文件`,composerGoal:`目标`,composerPlan:`计划`,composerCompact:`压缩`,composerModel:`模型`,composerBack:`返回`,composerGoalDescription:`设置或查看长期任务目标`,composerPlanDescription:`进入或退出计划模式`,composerCompactDescription:`整理之前的对话,释放上下文空间`,composerModelDescription:`选择本会话使用的模型`,compactionQueueWaiting:`等待压缩完成`,compactionQueueBlocked:`消息已保留,可重试或清空队列。`,clearPromptQueue:`清空队列`,turnElapsedOutcome_cancelled:`已停止`,turnElapsedOutcome_failed:`失败`,turnElapsedOutcome_uncertain:`结果待确认`,settingsSetupBusyHint:`Agent 配置需等待当前轮次结束;显示设置可直接调整。`,resetChatContentWidth:`恢复默认聊天宽度`,resetChatFontSize:`恢复默认字体大小`,setupResolveAdmission:`请先返回对话,处理尚未确认的消息,再应用设置。`,removeAttachment:`移除附件`,dropImagesHere:`将文件或图片拖到这里`,imageAttachmentCount:`最多可添加 {{count}} 张图片。`,imageAttachmentTooLarge:`单张图片不能超过 10 MB。`,imageAttachmentTotalTooLarge:`图片总大小不能超过 32 MB。`,imageAttachmentUnsupported:`仅支持有效的 PNG、JPEG、GIF 和 WebP 图片。`,imageAttachmentReadFailed:`无法读取此图片,请重新添加重试;消息内容已保留。`,attachedImage:`已附加图片`,previewAttachment:`预览图片`,closeImagePreview:`关闭图片预览`,imagePreviewFailed:`无法显示这张图片。`,fitImage:`适应窗口`,originalImageSize:`原始尺寸`,imageViewMode:`图片查看`,sessionUsage:`会话 Token 用量`,sessionInputTokens:`输入 Token`,sessionOutputTokens:`输出 Token`,sessionCacheTokens:`缓存 Token`,sessionContextUsage:`上下文占用与窗口大小`,usageContextLabel:`上下文`,usageUnknown:`未知`,usageOpenDetails:`输入 {{input}} · 输出 {{output}} · 上下文 {{percent}} / {{capacity}} · 查看会话用量`,usageContextHelp:`当前分支的估算占用 / 模型上下文容量上限。`,usageSessionTotals:`累计用量`,usageInputLabel:`输入`,usageOutputLabel:`输出`,usageTotalLabel:`总计`,usageWorkspaceLabel:`工作区`,usageSessionId:`会话 ID`,usageTotalsHelp:`本会话累计 Token 用量,包含缓存。`,subagentDetails:`子代理`,sessionOverview:`会话概览`,sessionOverviewChanges:`当前审阅范围的更改`,subagentSummaryRunning:`{{count}} 运行中`,subagentSummaryDone:`{{count}} 完成`,subagentSummaryOther:`{{count}} 其他记录`,subagentNoneYet:`暂无子代理`,subagentOtherGroup:`失败 / 已中断`,subagentShowMore:`再显示 {{count}} 个`,backToSubagents:`返回子代理列表`,subagentActiveGroup:`运行中`,subagentFinishedGroup:`完成`,subagentNoneRunning:`暂无正在运行的子代理。`,subagentNoneFinished:`任务结束后会显示在这里。`,subagentProgress:`子代理:{{running}} 运行中 · {{completed}} 已完成`,subagentSummaryUnknown:`{{count}} 个状态未确认`,subagentTasks:`子代理任务列表`,inspectSubagent:`打开子代理:{{name}}`,subagentState_running:`运行中`,subagentState_done:`已完成`,subagentState_error:`失败`,subagentState_interrupted:`已中断`,subagentStarting:`正在启动…`,subagentSpawnFailed:`启动失败`,subagentStateUnavailable:`已启动 · 状态未保留`,subagentSpawnReceipt:`启动回执`,subagentSpawnReceiptHint:`此回执仅确认启动请求,不表示子代理任务已完成。`,subagentTask:`分配的任务`,subagentTranscript:`子代理对话`,subagentResult:`执行结果`,subagentSaved:`已保存记录`,subagentRecordedState:`最后记录的状态`,subagentSavedHint:`来自当前父会话已保存的回执;结果可能包含同批其他任务,并非子代理的完整实时对话。`,subagentLive:`正在执行 · 自动更新`,subagentReadOnly:`只读查看 · 关闭此面板不会停止任务`,subagentUnavailable:`当前会话已无法提供此子代理的实时详情。启动回执不代表任务已完成。`,subagentStale:`刷新失败,下方保留的是上次收到的状态。`,subagentNoMessages:`暂未收到消息。`,subagentTranscriptUnavailable:`此视图仅保留任务摘要,无法显示完整子代理对话。`,subagentWorkflowsTruncated:`另有 {{count}} 个 workflow 未包含在当前列表中,其任务数量未知。`,subagentState_unknown:`未确认`,subagentUnconfirmedGroup:`未确认`,subagentTruncated:`当前显示有界摘录,已省略 {{count}} 条较早消息,部分文本可能已截短。`,subagentListTruncated:`另有 {{count}} 个任务未包含在当前列表中。`,subagentThinkingRedacted:`服务商已隐藏此段思考内容。`,subagentTool_running:`执行中`,subagentTool_done:`已返回`,subagentTool_error:`失败`,subagentTool_unknown:`结果未保留`,inspectionChanged:`当前会话已切换,请重新打开详情。`,inspectionUnavailable:`暂时无法读取详情。`,inspectionLoading:`正在读取状态…`,thinkingUnavailable:`暂时无法读取思考等级。`,trustUnavailable:`暂时无法读取项目信任状态。`,executionState:`状态`,terminalCommand:`命令`,copyTerminalCommand:`复制命令`,copyVisibleOutput:`复制当前可见{{stream}}`,copySetupCommand:`复制配置命令`,savedTrustDecision:`已保存决定`,activeSessionTrust:`当前会话信任`,trustDecision_trusted:`已信任`,trustDecision_denied:`已拒绝`,trustDecision_undecided:`未决定`,trustDecision_unknown:`未知`,trustActiveYes:`当前会话已信任`,trustActiveNo:`当前会话未信任`,terminalDirectory:`目录`,startedAt:`启动时间`,exitCode:`退出码`,detailTruncated:`部分详情已截断,以限制页面加载量。`,standardOutput:`标准输出`,standardError:`错误输出`,outputTruncated:`此输出视图省略了 {{count}} 字节。`,outputRecovery:`运行时报告已保留日志;此处仅显示有大小限制的片段。`,modelAndThinking:`模型与思考`,selectedModel:`当前模型`,thinkingLevel:`思考等级`,availableThinking:`支持的等级`,unknownState:`未知`,projectTrust:`项目信任`,trust_trusted:`当前会话信任此工作区。`,trust_untrusted:`此工作区的信任已被拒绝。`,trust_restricted:`项目资源受到限制,等待信任决定。`,trust_unknown:`尚无法确定信任状态。`,trustRefreshNeeded:`保存的信任决定与当前会话不同,请通过 Pi 刷新会话后生效。`,providerAvailability:`服务商凭据`,settings:`设置`,settingsNavigation:`设置导航`,generalSettings:`常规`,configurationSettings:`配置`,configurationIntro:`配置工具权限、网络访问与模型响应。`,configurationReadFailure:`无法安全读取配置。请修复设置文件后刷新。`,configurationUserScope:`用户配置`,configurationSetupHint:`响应与搜索选项通过 OpenPI setup 应用`,configurationApproval:`批准策略`,configurationApprovalDetail:`工具审批沿用已安装 Pi 扩展的权限机制。`,configurationPiPermissions:`由 Pi 扩展管理`,configurationSandbox:`沙箱设置`,configurationSandboxDetail:`工具使用宿主进程的权限运行。`,configurationSandboxUnavailable:`未提供 OS 沙箱`,configurationSearchDetail:`允许当前会话模型在支持时访问网络。`,configurationSearchOff:`不向当前模型提供原生搜索。`,configurationSearchOn:`在当前连接支持时允许原生搜索。`,configurationVerbosity:`输出详细程度`,configurationVerbosityDetail:`选择模型回复包含细节的详细程度。`,configurationResponsesUnavailable:`当前连接未使用支持的 Responses 接口。`,configurationVerbosity_default:`模型默认`,configurationVerbosity_low:`简短`,configurationVerbosity_medium:`适中`,configurationVerbosity_high:`详细`,configurationVerbosityHelp_low:`简短直接地回答,减少额外细节。`,configurationVerbosityHelp_medium:`给出必要解释与适量细节。`,configurationVerbosityHelp_high:`提供更完整的解释与细节。`,configurationVerbosityRequest:`只把 response_verbosity 设为 {{value}},保留其他 OpenPI 配置。`,configurationSummary:`推理摘要`,configurationSummaryDetail:`选择向支持的推理模型请求哪种摘要。`,configurationSummaryUnavailable:`当前连接不支持推理摘要。`,configurationSummary_default:`模型默认`,configurationSummary_auto:`自动`,configurationSummary_concise:`简洁`,configurationSummary_detailed:`详细`,configurationSummary_none:`关闭`,configurationSummaryHelp_auto:`由模型自动选择摘要长度。`,configurationSummaryHelp_concise:`请求简洁的推理摘要。`,configurationSummaryHelp_detailed:`请求较详细的推理摘要。`,configurationSummaryHelp_none:`不请求推理摘要;保留当前推理强度。`,configurationSummaryRequest:`只把 response_reasoning_summary 设为 {{value}},保留其他 OpenPI 配置。`,configurationModelFeatures:`模型功能`,configurationReasoningLevels:`可用推理强度`,configurationReasoningDetail:`选择在模型控件中显示哪些受支持的级别。当前级别仍会显示,推理强度不变。`,configurationReasoningCount:`已选择 {{count}} 个`,configurationDependencies:`工作空间依赖项`,configurationEnvironment:`本地运行环境`,configurationEnvironmentDetail:`Node.js、Python 等工具由当前环境提供。OpenPI 不安装捆绑的工作空间运行时。`,configurationRuntimeStatus:`运行状态`,browserSettings:`浏览器`,webSearchSettings:`联网搜索`,webSearchCurrentModel:`当前会话模型`,webSearchNativeDetail:`调用当前模型供应商的原生搜索,复用现有连接和凭据。`,webSearchSupported:`当前连接支持原生搜索。开启后,由模型决定何时联网。`,webSearchUnsupported:`当前连接不支持或尚未确认支持原生搜索,不提供搜索工具,也不会切换到其他供应商。`,webSearchNativeRequest:`开启联网搜索,使用当前会话模型的原生搜索和已有 Pi 凭据。不要切换模型、连接协议或搜索供应商;当前连接不支持或支持情况未知时,不提供搜索工具。`,webSearchIntro:`让模型搜索最新资料,并打开原始网页核实。`,webSearchPackageDetail:`通过可选 Pi 插件提供搜索、网页读取和 PDF 提取。`,webSearchDefaultOff:`默认关闭。可选扩展跟随当前会话模型,无需另填搜索密钥或安装插件。`,webSearchLoaded:`本会话已加载插件`,webSearchNotLoaded:`本会话尚未加载插件`,webSearchSource:`查看插件源码`,webSearchProfile:`搜索设置`,webSearchExa:`Exa — 无需 API 密钥`,webSearchExisting:`保留我已有的搜索偏好`,webSearchProfileHint:`Exa 提供搜索,网页由本机直接读取。已有偏好会原样保留;安装后也可更换搜索服务。`,webSearchEnable:`启用联网搜索…`,webSearchDisable:`关闭联网搜索…`,webSearchConfigure:`更换搜索服务…`,webSearchExaRequest:`启用可选联网搜索,使用 Pi Web Access 和无需 API 密钥的 Exa。让我审阅插件安装确认,保留其他偏好,不要自动重新加载。`,webSearchExistingRequest:`启用可选联网搜索,使用 Pi Web Access,原样保留我已有的搜索偏好。让我审阅插件安装确认,保留其他偏好,不要自动重新加载。`,webSearchDisableRequest:`关闭原生联网搜索。保留其他设置和会话记录。`,webSearchProviderRequest:`帮我更换已安装 Pi Web Access 插件的搜索服务。介绍可用服务与权限,保留无关偏好,密钥留在搜索插件中,不要自动重新加载。`,browserSettingsIntro:`让 OpenPI 阅读网页、点击、输入和截图。`,browserControl:`浏览器控制`,browserControlHint:`提交设置变更请求,保存配置后生效。`,browserDefault:`默认浏览器`,browserDefaultHint:`提交设置变更请求,选择未指定浏览器时使用的默认项。`,browserEmbedded:`OpenPI 内置浏览器`,browserAllowedTitle:`允许使用的浏览器`,browserOffHint:`下方选择将在开启浏览器控制后生效。`,browserConnected:`已连接`,browserNeedsSetup:`需要连接浏览器扩展`,browserNotFound:`未检测到此浏览器`,browserUpdateNeeded:`需要更新扩展`,browserBlocked:`未授权`,browserDefaultBlocked:`当前默认浏览器未获授权,请允许使用或更换默认值。`,browserSetUp:`设置`,browserManage:`管理`,browserSetupNamed:`设置 {{browser}}`,browserManageNamed:`管理 {{browser}}`,browserAllowNamed:`允许使用 {{browser}}`,browserMore:`更多浏览器`,browserSpeakHint:`对话中说“使用 Chrome …”,即可指定这次使用的浏览器。`,browserGuideTitle:`连接 {{browser}}`,browserGuideEyebrow:`跟着做,一次一步`,browserConnectionTitle:`连接状态`,browserCloseGuide:`收起浏览器设置引导`,browserConnectionReady:`连接正常,可选择是否允许 OpenPI 使用。`,browserEmbeddedDetail:`网页在 OpenPI 内打开。部分网站需要使用普通浏览器才能登录或正常显示。`,browserExternalDetail:`OpenPI 可以使用已连接的 {{browser}} 配置中的现有标签和登录状态。请在该配置中保留一个 OpenPI 标签页。`,browserManageExtension:`管理扩展`,browserAllowUse:`允许 OpenPI 使用`,browserMakeDefault:`设为默认`,browserInstallIn:`安装到`,browserInstallTitle:`安装 OpenPI Browser Bridge`,browserSetupSteps:`设置步骤`,browserGuidePopout:`在独立窗口中跟随操作`,browserGuideDetached:`引导已在独立窗口打开,可以对照浏览器设置逐步完成。`,browserShowGuide:`显示引导窗口`,browserGuideInline:`把引导放回这里`,browserGuideBlocked:`未能打开引导窗口。可允许弹出式窗口后重试,也可继续查看这里的步骤。`,browserSafariSettings:`Safari → 设置`,browserSafariDeveloper:`开发者设置`,browserSafariTemporary:`添加临时扩展…`,browserSafariOpenHint:`打开 Safari 后,在菜单栏选择「Safari → 设置」,对照此引导操作。需要 macOS 上的 Safari 26 或更新版本。`,browserSafariDeveloperTitle:`显示 Safari 开发者设置`,browserSafariDeveloperHint:`在「设置 → 高级」中开启「显示网页开发者功能」,再进入「开发者」标签。`,browserSafariLoadHint:`在「开发者」中点击「添加临时扩展」,选择下方文件夹。启用 OpenPI Browser Bridge,允许访问要控制的网站及本地 OpenPI 页面。退出 Safari 后需重新加载临时扩展。`,browserFirefoxThis:`此 Firefox`,browserFirefoxTemporary:`临时载入附加组件…`,browserFirefoxDeveloperTitle:`选择「此 Firefox」`,browserFirefoxDeveloperHint:`在 about:debugging 左侧选择「此 Firefox」。Firefox 不需要开启「开发者模式」开关。`,browserFirefoxLoadHint:`点击「临时载入附加组件」,选择下方文件夹中的 manifest.json。此安装在 Firefox 重启后失效;永久安装需要经过 Mozilla 签名的扩展包。`,browserFirefoxDone:`已选中,下一步`,browserStepCount:`第 {{step}} 步,共 {{total}} 步`,browserStepLabel:`第 {{step}} 步:{{label}}`,browserStepOpen:`打开扩展页`,browserStepAdd:`添加扩展`,browserStepConnect:`连接`,browserOpenManagerTitle:`打开 {{browser}} 扩展页`,browserOpenManagerHint:`从这里开始,我们会帮你打开对应的页面。`,browserOpenManager:`打开 {{browser}} 扩展页`,browserReopenManager:`重新打开扩展页`,browserAlreadyInstalled:`已经安装?直接连接`,browserDeveloperMode:`开发者模式`,browserDeveloperTitle:`开启「开发者模式」`,browserDeveloperHint:`在刚打开的扩展页,找到并开启「开发者模式」开关。`,browserDeveloperDone:`已开启,下一步`,browserIllustration:`操作示意 · 在 {{browser}} 中完成`,browserExtensions:`扩展程序`,browserLoadUnpacked:`加载已解压的扩展程序`,browserLoadHint:`在浏览器中点击「加载已解压的扩展程序」,选择下面的文件夹。`,browserFolderBundled:`已随 OpenPI 准备好`,browserOpenFolder:`打开文件夹`,browserFolderOpened:`扩展文件夹已打开。`,browserPathCopied:`已复制路径`,browserCopyFailed:`未能复制,请选中上方路径手动复制。`,browserChooseFolderMac:`在文件选择窗口按 ⌘ ⇧ G,粘贴路径并回车,再点击「选择」。`,browserChooseFolderOther:`在文件选择窗口的地址栏粘贴路径,再选择该文件夹。`,browserInstalledConnect:`已添加,连接 OpenPI`,browserPreviousStep:`上一步`,browserWaiting:`等待 OpenPI Browser Bridge 连接,连接后会自动进入下一步。`,browserInstallBrowserFirst:`请先安装 {{browser}},或在已安装的浏览器中打开当前 OpenPI 地址。`,browserConnectTitle:`连接 OpenPI`,browserConnectHint:`在 {{browser}} 中打开 OpenPI,使用刚安装扩展的浏览器配置。`,browserOpenIn:`在 {{browser}} 中打开`,browserAllowHint:`连接成功后,可以允许 OpenPI 使用此浏览器。安装扩展不会自动开启浏览器控制。`,browserCheck:`检查连接`,browserNotConnectedYet:`还未连接。请完成安装,在该浏览器中刷新 OpenPI 后再次检查。`,browserHelp:`设置帮助`,browserReloadHint:`已安装旧版?在扩展页重新加载 OpenPI Browser Bridge,再刷新 OpenPI。如浏览器提示权限,请完成其原生确认。`,browserSupportedHint:`Chrome、Edge、Brave、Chromium 145+ 可控制内置页面及普通标签。macOS Safari 26+、Firefox 128+ 通过兼容扩展控制普通标签,嵌套框架需单独打开。Safari、Firefox 的临时安装需在浏览器重启后重新加载。`,browserCopyPath:`复制扩展文件夹路径`,browserLoading:`正在检查浏览器连接…`,browserSaved:`已保存,浏览器权限立即生效。`,browserSaving:`正在保存…`,modelSettings:`模型`,skillsSettings:`技能`,subagentsSettings:`子代理`,pluginsSettings:`插件`,configureOpenPi:`配置 OpenPI`,setupRequestReviewAll:`和我一起检查全部 OpenPI 配置项`,setupRequestSetTheme:`仅将 OpenPI Web 主题设置为 {{value}},其他配置保持不变`,setupRequestSetChatWidth:`仅将 OpenPI Web 聊天内容宽度设置为 {{value}}px,其他配置保持不变`,setupRequestSetChatFontSize:`仅将 OpenPI Web 聊天字体大小设置为 {{value}}px,其他配置保持不变`,setupRequestEnableExpandedThinking:`仅将 OpenPI Web 的思考块改为默认展开,其他配置保持不变`,setupRequestDisableExpandedThinking:`仅将 OpenPI Web 的思考块改为默认折叠,其他配置保持不变`,setupRequestSubagents:`检查并配置 Agent 角色模型和工作流上限`,setupRequestFailed:`OpenPI 配置请求未被接收。`,setupRequestRunning:`正在应用 OpenPI 设置…`,setupRequestAccepted:`配置请求已接收。`,setupPlanBlocked:`Agent 配置需先退出 Plan 模式;显示设置可直接调整。退出不会开始实施计划。`,setupPlanBusy:`Agent 配置需等待当前回合结束并退出 Plan 模式;显示设置可直接调整。`,setupOutcome_pending:`配置请求正在处理,尚未收到保存回执。`,toolCallArguments:`工具参数`,toolCallOutput:`工具结果`,setupOutcome_saved:`OpenPI 配置已保存并应用。`,setupOutcome_unchanged:`配置已保存,实际设置没有变化。`,setupOutcome_failed:`配置请求失败,请查看错误和当前设置后再重试。`,setupOutcome_cancelled:`配置过程已取消,未确认成功保存。`,setupOutcome_unconfirmed:`本次未确认成功保存,请核对当前设置后再运行 /openpi-setup。`,settingsUpdateFailed:`无法保存 Web 显示设置。`,settingsPreferencesSaved:`显示设置已保存。`,settingsPreferencesSaveFailed:`无法保存显示设置,请检查配置诊断后重试。`,settingsCatalogLoading:`正在加载 Pi 资源…`,settingsCatalogFailed:`无法加载 Pi 设置资源。`,appearance:`外观`,settingsPersonal:`个人`,settingsAgent:`Agent`,settingsIntegrations:`集成`,settingsArchivedChats:`已归档聊天`,settingsSearch:`搜索设置`,settingsClearSearch:`清除搜索`,settingsNoResults:`没有匹配的设置`,appearanceVisualStyle:`视觉风格`,appearanceMode:`模式`,appearanceTheme:`主题`,appearanceAccent:`强调色`,appearanceBackground:`背景`,appearanceForeground:`前景`,appearanceFont:`字体`,appearanceFont_codex:`Codex 默认`,appearanceFont_sans:`无衬线`,appearanceFont_serif:`衬线`,appearanceFont_mono:`等宽`,appearanceAccent0:`默认`,appearanceAccent1:`蓝色`,appearanceAccent2:`紫色`,appearanceAccent3:`粉色`,appearanceAccent4:`橙色`,appearanceAccent5:`绿色`,appearanceCustomAccent:`自定义强调色`,appearanceAdvanced:`高级`,appearanceReset:`恢复默认设置`,appearanceResetAction:`重置外观`,appearanceImport:`导入主题`,appearanceCopy:`复制主题`,appearanceCopied:`主题已复制`,appearanceCopyFailed:`无法复制主题,请重试。`,appearanceThemeValue:`主题数据`,appearanceImportPlaceholder:`粘贴 OpenPI 主题…`,appearanceImportInvalid:`请输入有效的 OpenPI 主题数据。`,appearanceImportAction:`导入`,searchArchivedChats:`搜索已归档聊天`,archiveProjectFilter:`按项目筛选`,archiveAllProjects:`所有项目`,archiveProjectGroup:`{{project}} · {{count}} 条归档聊天`,archiveSort:`归档聊天排序`,archiveSortUpdated:`最近更新`,archiveSortCreated:`创建时间`,restoreArchivedChat:`恢复 {{title}}`,themeLight:`浅色`,themeDark:`深色`,themeMist:`雾青`,themeRose:`蔷薇`,themePine:`松夜`,themeSystem:`跟随系统`,conversationSettings:`对话`,expandThinkingByDefault:`默认展开思考块`,chatContentWidth:`聊天内容宽度`,chatFontSize:`聊天字体大小`,agentBehavior:`Agent 行为`,capabilityDiscovery:`能力发现`,capabilityDiscovery_explicit:`明确请求`,capabilityDiscovery_adaptive:`自适应`,workflowLimits:`工作流上限`,workflowConcurrency:`工作流并行上限`,workflowCalls:`总调用次数`,agentSettingsSetupHint:`Agent 设置通过当前会话中的 /openpi-setup 生效。`,setupRequestDiscovery:`将能力发现设置为 {{mode}},保留其他配置。`,setupRequestLimits:`将工作流并行上限设置为 {{concurrency}},总子代理调用上限设置为 {{calls}},保留其他配置。`,setupRequestEnableSuggestions:`启用下一步建议。如需模型配置,请帮助我选择模型,保留其他配置。`,setupRequestDisableSuggestions:`关闭下一步建议,保留其他配置。`,setupRequestPostEdit:`帮我配置或关闭编辑后命令。先展示当前配置,再询问要使用的命令。`,configurePostEdit:`配置编辑后命令`,workflowLimitsValue:`并行 {{concurrency}} · 总调用 {{calls}}`,nextActionSuggestions:`下一步建议`,enabled:`已启用`,disabled:`已关闭`,configured:`已配置`,postEditCommand:`编辑后命令`,resultDisplay:`默认结果显示`,subagentResults:`子代理结果`,bashOperations:`Bash 操作`,fileMutations:`Write / Edit 操作`,footer:`页脚`,terminalFooter:`Pi 终端页脚`,terminalFooterStyle:`终端页脚样式`,terminalFooterHint:`影响 Pi 命令行界面的页脚;已打开的 Pi 界面在下次启动或配置应用后更新。`,detailDisplay_full:`完整`,detailDisplay_compact:`紧凑`,sessionSettings:`会话`,currentModel:`当前`,useThisModel:`使用此模型`,model:`模型`,modelConnection:`模型连接`,provider:`服务商`,modelId:`模型 ID`,providerStatusUnavailable:`此服务商不在当前有界认证快照中。`,providerSettings:`服务商凭据`,providerSettingsIntro:`查看当前 Web 会话可通过哪些 Pi 服务商完成认证。`,openRuntimeDetails:`打开运行详情`,currentWorkspace:`当前工作区`,providerAuth_api_key:`API 密钥`,providerAuth_oauth:`OAuth`,providerAuthUnknown:`未报告认证方式`,authentication:`认证方式`,accessType:`访问方式`,providerAccessSubscription:`订阅账户`,providerAccessStandard:`服务商凭据`,configurationOwner:`配置归属`,providerLoading:`正在加载服务商状态…`,providerLoadFailed:`无法加载服务商状态。`,providerReadOnly:`由 Pi 管理`,selectProvider:`选择服务商`,gitReviewBaselineUnavailable:`未保留可用的会话基线,可能超出了捕获限额。请切换到未暂存、已暂存或分支查看 Git 变更,也可打开本会话文件记录。`,modelsIntro:`登录账户或添加 API 密钥。已有的 Pi 连接也会显示在这里。`,accountLoginMethod:`连接方式`,accountLoginTab:`账户登录`,accountLoginChatGPT:`ChatGPT 账户`,accountLoginClaude:`Claude 账户`,accountLoginKeyTab:`API 密钥`,accountLoginConfigured:`账户已登录`,accountLoginIntro:`在浏览器中完成授权,无需填写 API 密钥。`,accountLoginExisting:`账户凭据已保存在 Pi 中。`,accountLoginStart:`登录`,accountLoginAgain:`重新登录`,accountLoginUnsaved:`请先保存或放弃其他修改,再登录账户。`,accountLoginStarting:`正在准备登录…`,accountLoginWaiting:`等待账户授权`,accountLoginChoose:`选择登录方式`,accountLoginCancelling:`正在取消登录…`,accountLoginBrowser:`在浏览器中继续`,accountLoginDevice:`使用设备码登录`,accountLoginBrowserOption:`在当前电脑上登录,完成后自动返回。`,accountLoginDeviceOption:`适合远程服务器,或无法自动返回的情况。`,accountLoginBrowserHelp:`打开登录页并完成授权,这里会自动更新。`,accountLoginDeviceHelp:`打开授权页并输入下方代码,请保持此页面打开。`,accountLoginOpen:`打开登录页`,accountLoginCopyCode:`复制设备码`,accountLoginPaste:`授权码或回调地址`,accountLoginContinue:`继续`,accountLoginFallback:`已登录,但这里没有更新?`,accountLoginRemoteHelp:`如果无法自动返回,请复制浏览器最后的回调地址,并粘贴到下方。`,accountLoginCancel:`取消登录`,accountLogin_failed:`登录未完成,请重试或选择其他登录方式。`,accountLogin_expired:`登录已过期,请重新开始获取新的授权链接。`,accountLogin_cancelled:`已取消登录。`,accountLoginRequestFailed:`请求未完成,请先刷新状态再重试。`,accountLoginStatusUnknown:`暂时无法查询登录状态,账户授权可能仍在进行。`,accountLoginRefreshRequired:`凭据已保存,但 Pi 未能更新模型列表。请重载 Pi 后使用此连接。`,accountLogout:`退出登录`,accountLogoutRefreshRequired:`已移除保存的凭据,但 Pi 未能更新模型列表。请重载 Pi 刷新状态。`,accountLogoutTitle:`退出 {{provider}}?`,accountLogoutDetail:`将移除此电脑上 Pi 保存的该服务凭据,其他使用它的 Pi 会话也需要重新登录。环境凭据不受影响。`,providerInputTypes:`输入类型`,providerInputText:`文本`,providerInputImage:`图片`,providerCustomTag:`自定义`,providerEdit:`编辑`,providerRemove:`删除`,providerSave:`保存`,editProvider:`编辑 {{provider}}`,removeProvider:`删除 {{provider}}`,providerAdd:`添加模型提供商`,providerAddMode:`添加方式`,providerAddCatalog:`第三方模型提供商`,providerAddCustom:`自定义模型 API`,providerAccountHint:`使用已有账户连接模型,选择服务商后前往浏览器授权。`,providerCatalogHint:`从内置目录中选择提供商,填入其 API 密钥即可使用。`,providerCustomHint:`连接中转站、自部署服务或其他兼容 OpenAI / Anthropic 协议的接口,需填写 API 地址、协议和模型。`,providerKeyKeep:`已配置密钥,留空保持不变`,providerKeyOptional:`输入 API 密钥,或留空使用环境认证`,providerDisplayName:`提供商名称`,providerCustomSettings:`自定义设置`,providerSaved:`已保存 {{provider}}。`,modelDefaultTitle:`新会话默认模型`,modelDefaultChoose:`选择模型`,modelDefaultBadge:`默认`,modelCurrentBadge:`当前使用`,modelDefaultNotSet:`未设置 · 新会话启动时由 Pi 选择`,modelDefaultHint:`选择以后新会话使用的模型,已有会话保留自己的选择。此设置也会更新 Pi 的默认模型。`,modelDefaultReadFailed:`暂时无法读取默认模型。`,modelDefaultProjectOverride:`此工作区有 Pi 独立设置:{{model}}。`,modelDefaultSave:`保存默认模型`,modelMakeDefault:`同时设为新会话默认模型`,modelDefaultSaveFailed:`默认模型保存尚未确认,请刷新状态后重试。`,modelDefaultPartial:`当前模型已切换,但默认模型保存尚未确认,请刷新状态后再试。`,modelConnectionNextHint:`从此连接选择一个模型,用于当前会话。`,modelConnectionSearch:`搜索模型…`,modelConnectionChooseProvider:`选择 {{provider}} 的模型`,modelConnectionUse:`用于当前会话`,modelConnectionUseFailed:`模型切换尚未确认,请刷新模型列表后重试。`,modelConnectionLoadFailed:`暂时无法读取模型列表。`,modelConnectionNoModels:`暂无可选模型,请检查连接或添加模型定义。`,modelConnectionNoMatch:`没有匹配的模型。`,modelConnectionMore:`还有 {{count}} 个模型,可搜索缩小范围。`,providerModelsEmpty:`还没有模型,获取可用模型或手动添加。`,providerModelsInherited:`使用提供商的内置模型目录。`,providerModelsReadOnly:`此提供商包含当前页面未支持的模型设置,请在 Pi 配置文件中编辑。`,providerModelId:`模型 {{number}} ID`,providerModelName:`模型 {{number}} 名称`,providerModelDetails:`模型参数:{{model}}`,providerRemoveModel:`删除模型:{{model}}`,providerIdInvalid:`请使用未被占用的提供商 ID,仅包含字母、数字、连字符、点或下划线。`,providerNativeAuth:`此提供商使用 Pi 原生登录。`,providerConfigurationFailed:`保存失败,请检查填写内容,并在会话空闲时重试。`,providerProfileSavedKeyFailed:`提供商配置已保存,但密钥保存失败。重试将只保存密钥。`,providerReload:`放弃草稿并重新加载`,providerCurrentRemoval:`请先切换当前使用的模型,再删除。`,providerRemoveDetail:`删除此提供商的配置和自定义模型?由 Pi 管理的凭据将保留。`,providerPickerIntro:`以下是模型提供商的可用模型,勾选要添加的模型。`,providerPickerSelected:`已选 {{count}} 个`,providerApiKey:`API 密钥`,providerKeyPlaceholder:`粘贴密钥以添加或替换`,saveProviderKey:`保存密钥`,savingSettings:`正在保存…`,keepEditing:`继续编辑`,discardAndContinue:`放弃更改并继续`,unsavedSettingsTitle:`放弃未保存的更改?`,unsavedSettingsDetail:`未保存的模型和凭据修改将被丢弃。`,unsavedCredentialTitle:`放弃未保存的凭据?`,unsavedCredentialDetail:`新密钥尚未保存,继续后将清空。`,modelSelectionBusy:`当前会话忙碌,暂不能切换模型。`,providerKeySaved:`已保存到 Pi 凭据存储。已有密钥不会回显。`,providerSaveFailed:`密钥保存未完成。请等待会话空闲,刷新状态后重试;部分服务商需要额外认证信息。`,providerWriteDetail:`在这里直接保存到 Pi 凭据存储,密钥不会进入模型对话。OAuth 或需要额外字段的认证请使用 Pi 原生登录。`,editModelConfiguration:`添加或编辑自定义模型`,modelConfigurationDetail:`先设置提供商连接,再获取模型列表或手动添加。保存配置不会调用模型。`,configuredModels:`自定义模型配置`,addModel:`添加模型`,modelConfig_provider:`服务商 ID`,modelConfig_id:`模型 ID`,modelConfig_name:`显示名称`,modelConfig_baseUrl:`API 地址`,modelConfig_api:`API 格式`,modelConfig_contextWindow:`上下文窗口`,modelConfig_maxTokens:`最大输出 token 数`,providerCapacityLabel:`{{field}} {{number}}`,providerModelOptions:`模型选项`,providerModelInvalid:`模型 {{number}}:模型 ID 不能为空或重复;容量需为正数,例如 128K 或 1M,留空使用默认值。`,modelConfig_reasoning:`支持推理`,saveModelConfiguration:`保存模型`,reloadModelConfiguration:`放弃草稿并载入最新配置`,retryModelConfiguration:`重试读取`,discardModelDraftTitle:`放弃这份模型草稿?`,discardModelDraftDetail:`最新配置将替换这份未保存的草稿。`,discardAndReload:`放弃并重新载入`,modelConfigurationUnsaved:`未保存的更改`,modelConfigurationConflict:`模型配置已在别处更改,当前草稿已保留。`,modelConfigurationLoadFailed:`无法读取模型配置,草稿已保留。`,modelConfigurationSaved:`已保存到 Pi models.json。配置服务商密钥后即可选择此模型。`,modelConfigurationFailed:`模型保存未完成,草稿已保留。`,setupConfigurationRequest:`配置需求`,configureViaSetup:`通过 OpenPI setup 应用`,setupFormDetail:`统一走 /openpi-setup。请在对话中查看进度及必要的确认;提交成功不等于配置已保存。`,setupSkillsPlaceholder:`填写要添加或调整的技能,以及来源或本地路径`,setupPluginsPlaceholder:`填写要配置的 Pi 插件,以及准确的包名或本地路径`,enableSkillInvocation:`允许模型调用`,disableSkillInvocation:`改为仅显式调用`,setupSkillInvocationRequest:`配置这个 Pi 技能:{{path}}。将原生 disable-model-invocation 字段设为 {{disabled}},保留其余内容,并说明何时生效。`,setupRoleFormRequest:`将 OpenPI 的 {{role}} 角色配置为使用 {{model}},工作流并发设为 {{concurrency}}。推理级别继承父会话,校验选择有效性,并保留其他配置。`,providerReadOnlyDetail:`此页面只读且不会接收凭据内容。请通过 Pi 配置服务商认证,然后刷新此状态。`,openProviderSettings:`打开服务商设置`,credentialConfigured:`已配置`,credentialMissing:`未配置`,authNotVerified:`凭据已配置不代表模型请求一定成功。`,configurationViaPi:`此处为只读状态。模型凭据与信任由 Pi 管理,OpenPI 选项通过 /openpi-setup 配置。`,noSkillsFound:`当前会话没有加载技能。`,addSkill:`添加技能`,addPlugin:`添加插件`,searchResources:`搜索名称或来源`,filterResourceScope:`资源范围`,allResourceScopes:`全部范围`,noMatchingResources:`没有匹配的资源`,resourceBulkTooLarge:`请进一步筛选列表后,再提交批量配置请求。`,resourceManagement:`Pi 资源`,resourceSourceAuto:`Pi 自动发现`,resourceSourceLocal:`本地资源`,resourcePackageSource:`软件包、仓库或本地路径`,resourcePackageSourcePlaceholder:`npm:包名@版本 · git:owner/repo · /path/to/skill`,resourceInstallIntro:`选择来源和范围,在对话中通过 OpenPI setup 审查并应用。`,resourceInstallReview:`请在对话中确认准确来源和权限。提交请求不代表已安装或已加载。`,resourceRequestSubmitted:`请求已提交。请在对话中查看进度和确认,完成后刷新此目录。`,browseSkills:`浏览 skills.sh 技能`,resourceSessionState:`应用到当前会话`,resourcesReloadNote:`刷新只读取目录;重新加载才会将已保存的资源应用到空闲会话。配置变更不会自动重新加载。`,reloadResources:`重新加载资源`,resourceReloadReview:`将已保存的 Pi 技能与插件配置应用到当前会话,并重新启动扩展?请先等待运行中的工作结束。`,resourceReloaded:`资源已重新加载,请查看更新后的目录和诊断。`,resourceReloadFailed:`无法重新加载资源。请等待当前会话空闲,刷新后重试。`,advancedResourceConfiguration:`高级配置`,resourceDiagnostics:`Pi 报告了 {{extensionErrors}} 项扩展诊断与 {{skillErrors}} 项技能诊断。`,resourceConfigurationDiagnostics:`{{count}} 项设置读取失败,请检查 Pi 配置诊断。`,resourceCatalogTruncated:`此目录有数量上限,部分资源未展示。`,resourceTargetTruncated:`此来源或路径已截断,请通过高级配置确认完整目标后再进行管理。`,updateResource:`检查更新`,removeResource:`审查移除`,skillsEmptyTitle:`添加你的第一个技能`,skillsEmptyIntro:`技能为 Pi 提供可复用的指引。可以添加软件包、仓库或本地技能;项目技能遵循 Pi 的项目信任。`,pluginsEmptyTitle:`用插件扩展 Pi`,pluginsEmptyIntro:`软件包可以包含扩展、技能、提示词和主题。添加来源后,通过 OpenPI setup 审查安装。`,pluginCount:`{{count}} 个插件来源`,installedVersion:`已安装版本`,configuredVersion:`配置版本`,resourceVersionUnpinned:`未固定版本 / 本地来源`,pluginState_loaded:`本会话资源已加载`,pluginState_installed:`已安装 · 未加载`,pluginState_disabled:`配置已禁用`,pluginState_missing:`软件包缺失`,pluginState_error:`加载诊断`,pluginState_notLoaded:`未加载`,pluginLoadedResources:`当前会话目录包含 {{count}} 项资源。配置变更需要明确重新加载后才会应用。`,pluginAction_enable:`审查启用`,pluginAction_disable:`审查禁用`,pluginAction_update:`检查更新`,pluginAction_remove:`审查移除`,enableVisibleSkills:`允许模型使用(当前 {{count}} 项)`,disableVisibleSkills:`仅显式调用(当前 {{count}} 项)`,enableVisiblePlugins:`启用当前 {{count}} 个软件包`,disableVisiblePlugins:`禁用当前 {{count}} 个软件包`,setupResourceInstallRequest:`添加 Pi {{kind}},来源为 {{source}},范围为 {{scope}}。先检查来源并确定固定的软件包身份,通过 ask_user 与我确认安装权限,再使用 Pi 原生的软件包或技能配置。添加技能时保留其他扩展和资源。保留现有偏好与项目信任,不要自动重新加载当前会话。分别报告已保存的配置与仍需执行的操作,不要改动无关的 OpenPI 设置。`,setupPluginOperationRequest:`审查 Pi 软件包操作 {{action}},只针对配置来源 {{source}}、原生安装目录 {{path}}、范围 {{scope}}。相对来源应以该范围的原生设置目录解析。使用 Pi 原生包管理;更新时检查可用版本,通过 ask_user 与我确认固定的目标身份和安装权限。保留资源过滤器及所有无关偏好;如果切换会破坏过滤器,停止并说明。移除时不得删除本地来源目录。不要自动重新加载,分别报告已持久化与当前会话状态,不要改动无关的 OpenPI 设置。`,setupSkillManageRequest:`审查 Pi 技能操作 {{action}},只针对文件 {{path}}、来源 {{source}}、范围 {{scope}}。先检查原生资源归属,通过 ask_user 与我确认更新或移除及所需权限。保留无关技能与软件包资源,不要为了移除一个技能删除整个共享软件包。保留项目信任,不要自动重新加载,也不要改动无关的 OpenPI 设置。`,setupSkillsBulkRequest:`只针对当前展示的 Pi 技能文件 {{paths}},将原生 disable-model-invocation 设为 {{disabled}}。检查资源归属,保留其余内容和偏好,与我审查必要变更,报告无法安全修改的文件。显式 /skill 调用仍应可用。不要自动重新加载,也不要改动无关的 OpenPI 设置。`,setupPluginsBulkRequest:`只针对当前展示的 Pi 软件包 {{packages}},通过 Pi 原生配置将 disabled 设为 {{disabled}}。保留其他偏好与资源过滤器;无法保留过滤器的条目应跳过并报告。遵循范围与项目信任,与我审查必要变更,不要自动重新加载,也不要改动无关的 OpenPI 设置。`,resourceRequestFinished:`配置回合已结束。请刷新并查看 Pi 原生配置与会话资源,确认实际变更。`,skillCount_one:`{{count}} 个技能`,skillCount_other:`{{count}} 个技能`,skill:`技能`,copySkillInvocation:`复制调用命令`,source:`来源`,scope:`范围`,invocation:`调用方式`,modelInvocation:`模型调用`,resourceScope_user:`全局`,resourceScope_project:`项目`,resourceScope_temporary:`临时`,explicitOnly:`仅允许明确调用`,availableToModel:`模型可按需使用`,skillFile:`技能文件`,selectSkill:`选择一个技能`,subagentConfiguration:`Pi 原生子代理角色`,subagentConfigurationIntro:`未在 OpenPI 配置中指定模型时,角色继承父会话模型。`,subagentActiveCount_one:`{{count}} 个运行中`,subagentActiveCount_other:`{{count}} 个运行中`,subagentCompletedCount_one:`{{count}} 条记录`,subagentCompletedCount_other:`{{count}} 条记录`,subagentConcurrency:`上限 {{count}}`,builtInRoles:`内置角色`,subagentRole_explorer:`探索者`,subagentRole_implementer:`实现者`,subagentRole_reviewer:`审查者`,subagentRole_advisor:`顾问`,subagentRoleShort_explorer:`只读调查`,subagentRoleShort_implementer:`聚焦实现`,subagentRoleShort_reviewer:`正确性审查`,subagentRoleShort_advisor:`技术分析`,subagentRoleDescription_explorer:`调查代码库并报告证据,不修改文件。`,subagentRoleDescription_implementer:`实现边界明确的改动并运行相关仓库检查。`,subagentRoleDescription_reviewer:`审查正确性、安全性、回归风险和缺失验证。`,subagentRoleDescription_advisor:`分析困难技术问题并提出具体下一步建议。`,configureRoles:`配置角色`,builtInRole:`内置角色`,builtIn:`内置`,modelAssignment:`模型分配`,inheritParentModel:`继承父会话模型`,effectiveModel:`实际模型`,workflowConcurrencyLabel:`并行 Agent`,workflowCallLimit:`Agent 总调用数`,runtimeBoundaries:`运行时边界`,subagentAuthorityNote:`子会话权限是父会话与角色能力的故障关闭交集,不会静默扩大权限。`,subagentModelNote:`不会硬编码服务商;未分配的角色继承父会话模型和思考等级。`,resourceCount_one:`{{count}} 项资源`,resourceCount_other:`{{count}} 项资源`,noPluginsFound:`Pi 未报告已加载的插件来源。`,pluginCatalogTotals:`{{extensions}} 扩展 · {{skills}} 技能 · {{prompts}} 提示词 · {{themes}} 主题`,loaded:`已加载`,resourceOrigin:`来源类型`,resourceOrigin_package:`软件包`,resourceOrigin_topLevel:`顶层资源`,resources:`资源`,baseDirectory:`基础目录`,notReported:`未报告`,extensions:`扩展`,extensionSurfaceCount:`{{tools}} 个工具 · {{commands}} 个命令`,prompts:`提示词`,themes:`主题`,pluginResourceSummary:`{{extensions}} 扩展 · {{skills}} 技能 · {{prompts}} 提示词 · {{themes}} 主题`,pluginsManagedByPi:`这些资源由 Pi 加载。可通过上方 setup 表单提交变更;软件包操作沿用原生确认,并通过 Pi 的重新加载流程生效。`,selectPlugin:`选择一个插件来源`,statusCaptured:`采集于 {{time}} · 刷新查看最新状态`,conversationViews:`会话视图`,currentConversations:`当前`,archivedConversations:`已归档`,refreshArchives:`刷新归档会话`,loadingArchives:`正在加载归档会话...`,moreArchives:`加载更多归档会话`,retryArchives:`重试读取归档会话`,archiveLoadFailed:`无法加载归档会话。`,archiveCursorStale:`归档会话已变化,请刷新后继续。`,archiveScanBounded:`还有 {{count}} 条更早记录未扫描。`,noArchivedSessions:`没有归档会话。`,noScannedArchives:`已扫描历史中没有归档会话。`,noMatchingScannedArchives:`已扫描历史中没有匹配的归档会话。`,draftLimit:`草稿暂存已满,请先发送或清空已有草稿。`,restoreConversation:`恢复会话`,restoringConversation:`正在恢复…`,loadedArchives:`已加载历史中的归档会话`,loadedHistoryBounded:`另有 {{sessions}} 个会话和 {{workspaces}} 个工作区摘要未加载。搜索仅覆盖已加载列表。`,noLoadedArchives:`已加载列表中没有归档会话。`,restoreFailed:`暂时无法确认恢复结果,请刷新后重试。`,execution_running:`运行中`,execution_done:`已完成`,execution_killed:`已停止`,execution_timed_out:`已超时`,execution_failed:`失败`,execution_uncertain:`状态不确定`,activeOnlyHint:`只有当前 Web 会话可以接收消息。`,stopTurn:`停止当前轮次`,stoppingTurn:`正在停止当前轮次…`,stoppedTurn:`当前轮次已停止。`,pendingFollowUpsHint:`{{count}} 条消息正在排队`,sendNextTurn:`下一轮发送`,steerCurrentTurn:`当前执行纠偏`,steeringHint:`在当前工具步骤结束后加入这条指示。`,pendingSteeringHint:`已接收 {{count}} 条纠偏指示,等待当前工具步骤结束`,steeringMessagesTitle:`当前轮次待处理的纠偏指示`,steerStaleTurn:`目标轮次已结束或变化。草稿已保留,请重新选择发送方式。`,sourceFeedbackNew:`{{path}} · 新版本第 {{line}} 行`,sourceFeedbackOld:`{{path}} · 旧版本第 {{line}} 行`,forkMessage:`从此处分叉`,forkMessageHint:`从此消息创建新聊天,保留原聊天;不会自动发送消息。`,forkSessionPending:`正在创建分叉会话…`,forkSessionCreated:`已创建分叉会话,原会话保留在侧栏。`,forkSessionCancelled:`分叉已取消,原会话已保留。`,forkSessionUncertain:`无法确认分叉结果。请先刷新并检查会话列表,再决定是否重试。`,forkSessionUnavailable:`切换到此会话并等待当前执行和排队消息结束后,可以从这里创建新会话。`,reviewQuoteLine:`引用此行`,reviewSelectOldLine:`选择旧版本第 {{line}} 行`,reviewSelectNewLine:`选择新版本第 {{line}} 行`,queuedMore:`还有 {{count}} 条排队消息`,queuedImage:`图片附件`,queuedMessageExpand:`展开排队消息`,queuedMessageCollapse:`收起排队消息`,backgroundSessionRunning:`此会话正在后台运行…`,observedSessionTools:`{{count}} 个正在执行的工具`,toolsRequireCurrentSession:`切换到此会话后可使用交互工具。`,activateViewedSession:`切换到此会话`,activateViewedSessionHint:`发送消息即可继续此会话。`,acceptedHint:`OpenPI Web 已接收消息。`,promptAdmissionUnknown:`无法确认上次发送的消息是否已被接收。`,promptAdmissionUnknownDetail:`请先核对已刷新的会话历史和运行状态,再决定下一步。作为新消息发送可能产生重复消息。`,promptAdmissionCheckingDetail:`正在核对最新的会话历史和运行状态,核对完成前不能作为新消息发送。`,promptAdmissionVerificationFailedDetail:`暂时无法刷新最新的会话历史和运行状态。请重新核对后再决定是否作为新消息发送。`,abandonAdmission:`暂不重新发送`,retryAdmissionCheck:`重新核对`,retryOriginalAdmission:`重试原消息`,promptTooLong:`文本超出发送上限({{count}} / {{limit}})。`,sendAsNew:`作为新消息发送`,sendingAsNew:`正在发送…`,addWorkspace:`添加工作区`,addWorkspaceMenu:`添加工作区...`,archiveConversation:`归档会话`,pinnedConversations:`置顶`,sidebarOptions:`侧栏选项`,sidebarProjectOptions:`项目侧栏选项`,sidebarRecentOptions:`会话侧栏选项`,sidebarActivityOptions:`动态视图选项`,sidebarShow:`显示`,sidebarGroupBy:`会话分组`,sidebarByProject:`按项目分组`,sidebarFlatList:`所有会话`,sidebarChatSort:`会话排序`,sidebarRecent:`最近`,sidebarProjectsInRecents:`在最近列表显示项目会话`,sidebarShowMore:`展开显示`,sidebarShowLess:`收起显示`,sidebarFilterList:`筛选当前列表`,sidebarSaveFailed:`更改未能保存,请重试。`,pinWorkspace:`置顶项目`,unpinWorkspace:`取消置顶项目`,markConversationRead:`标记为已读`,markConversationUnread:`标记为未读`,sidebarState_unread:`未读会话`,sidebarActivity:`动态`,sidebarViewActivity:`查看动态`,sidebarViewChats:`查看会话`,sidebarPriority:`优先关注`,sidebarActivityEmpty:`没有需要关注的会话`,sidebarActivityEmptyHint:`已完成的工作和需要你处理的会话会显示在这里。`,sidebarMarkAllRead:`全部标记为已读`,sidebarClearRead:`清除优先关注中的已读会话`,sidebarReadFailed:`未能更新已读状态,请重试。`,sidebarToday:`今天`,sidebarYesterday:`昨天`,sidebarEarlier:`更早`,sidebarActivityCompleted:`已完成`,sidebarActivityFailed:`执行失败`,sidebarActivityRead:`已读`,modelAdvanced:`高级参数`,providerConnectionHeading:`提供商连接`,providerFetchModels:`获取可用模型`,providerFetchHint:`填写提供商和端点后,可一次选择多个模型。`,providerPickerTitle:`选择要添加的模型`,providerPickerAccess:`连接凭据`,providerPickerKey:`访问密钥(可选)`,providerPickerKeyHint:`留空使用此端点已保存的凭据。此处输入的密钥仅用于获取列表,不会保存。`,providerPickerSearch:`搜索模型`,providerPickerSelectAll:`全选`,providerPickerClear:`清空选择`,providerPickerLoading:`正在获取可用模型…`,providerPickerAdded:`已添加`,providerPickerNoMatch:`没有匹配的模型`,providerPickerEmpty:`提供商没有返回模型,仍可手动添加。`,providerPickerBounded:`当前显示前 500 个模型,其他模型可手动填写 ID。`,providerPickerError_load:`未能获取模型列表,请检查端点和凭据后重试,也可以手动添加。`,providerPickerError_save:`尚未确认保存成功。已保留你的选择,请检查连接后重试。`,providerPickerError_conflict:`配置已在其他地方更新,请关闭弹窗、重新读取配置后再保存。`,providerPickerDefaults:`新模型使用 {{context}} 上下文 / {{output}} 输出 token,添加后可逐个调整。`,providerPickerRetry:`刷新列表`,providerPickerCount:`已选 {{count}} 个 · 最多 100 个`,providerPickerSave:`添加所选`,sidebarState_running:`执行中`,sidebarState_compacting:`正在整理上下文`,sidebarState_waiting:`等待你的回复`,sidebarState_completed:`已完成 · 结果未读`,sidebarState_failed:`执行失败 · 打开会话查看详情`,pinnedOptions:`置顶选项`,pinConversation:`置顶会话`,unpinConversation:`取消置顶`,pinnedRecentlyUpdated:`最近更新`,pinnedManualOrder:`手动排序`,movePinUp:`上移`,movePinDown:`下移`,pinSaveFailed:`置顶设置未能保存,请重试。`,cancel:`取消`,chooseWorkspaceHint:`选择工作区并描述任务`,close:`关闭`,closeSearch:`关闭搜索`,collapseSidebar:`收起侧边栏`,confirmEdit:`保存并重新运行`,editMessageHint:`从这里创建新分支并重新运行;保留原对话、图片和文件引用。已有工作区改动会保留。`,regenerateMessage:`重新生成回答`,regenerateMessageHint:`在新分支重新运行这条问题,保留原附件和原对话。`,messageRerunStarted:`已在新分支接收重跑消息,原对话已保留。`,openOriginalConversation:`查看原对话`,messageRerunWorkspaceHint:`已有工作区改动会保留。`,modelRequestRecovered:`请求已恢复`,modelReconnecting:`正在重新连接`,modelReconnectUnknown:`重连状态待确认`,modelEarlierAttempts:`先前请求错误`,modelFailedAttempts:`失败尝试({{count}} 次)`,draftStorageUnavailable:`草稿未能保存到此设备,请保持页面打开或复制消息。`,draftStorageInvalid:`部分保存的草稿内容无法恢复,请检查消息和附件。`,draftStorageRetry:`重试保存草稿`,workbarBackToChat:`返回聊天`,workbarCollapseTools:`收起工具栏`,workbarEndTerminal:`关闭 {{name}} 并结束进程`,workbarNewTerminal:`新建终端`,workbarContinueInChat:`继续追问`,transcriptSearch:`搜索消息内容`,transcriptSearchPlaceholder:`搜索标题、项目或消息…`,transcriptSearchRecent:`最近会话`,transcriptSearchSessions:`会话`,transcriptSearchMessages:`消息内容`,transcriptSearchSessionResult:`打开会话 {{session}}`,transcriptSearchSessionOpenFailed:`暂时无法打开此会话,请重试。`,transcriptSearchIncludeArchived:`包含归档会话`,transcriptSearching:`正在搜索消息…`,transcriptSearchEmpty:`没有匹配的消息。`,transcriptSearchFailed:`暂时无法搜索消息,请重试。`,transcriptSearchRetry:`重试搜索`,transcriptSearchPartial:`部分历史未能搜索,结果可能不完整。`,transcriptSearchOpenFailed:`无法打开这条消息,它可能已移动或位于其他分支。`,transcriptSearchResult:`打开 {{session}} 中来自{{source}}的消息`,transcriptSearchSource_user:`你`,transcriptSearchSource_assistant:`助手`,transcriptSearchSource_tool_call:`工具调用`,transcriptSearchSource_tool_result:`工具结果`,connected:`已连接`,connecting:`正在连接`,conversationName:`会话名称`,conversationOptions:`会话选项`,sidebarRename:`重命名`,sidebarPin:`置顶`,sidebarUnpin:`取消置顶`,sidebarFork:`分叉`,sidebarForkLocal:`创建聊天分支`,sidebarForkSameWorktree:`在同一工作树中分叉`,archiveNoticeTitle:`聊天已归档`,archiveNoticeView:`查看`,archiveNoticeUndo:`撤销`,archiveNoticeFailed:`操作未完成,请重试。`,sidebarForkWorktree:`在新工作树中创建聊天分支`,sidebarForkCancelling:`正在请求取消…`,sidebarForkFinishing:`无法再取消,正在确认创建结果…`,sidebarForkCancelUnconfirmed:`无法确认取消,正在等待分叉结果。`,sidebarForkWorktreePreserved:`工作树已保留在 {{path}},请检查后再重试。`,sidebarForkWorktreePending:`正在创建工作树和聊天分支…`,sidebarForkOptionsLoading:`正在检查工作树是否可用…`,sidebarForkOptionsFailed:`无法检查工作树,请重新打开菜单重试。`,sidebarForkUnavailable:`发送消息后才能创建此聊天的分支。`,sidebarForkArchived:`请先恢复此会话,再创建分叉。`,sidebarForkFailed:`未能创建分叉,原会话已保留。`,sidebarCopy:`复制`,sidebarCopyLink:`复制会话链接`,sidebarCopyMarkdown:`复制为 Markdown`,sidebarCopyCwd:`复制工作目录`,sidebarCopied:`已复制`,sidebarCopyFailed:`复制失败,请重试。`,sidebarNewWindow:`在新窗口中打开`,sidebarOpenIn:`打开方式`,sidebarAppsLoading:`正在加载可用应用…`,sidebarAppsFailed:`无法加载应用,请重新打开菜单重试。`,sidebarOpenFailed:`无法在所选应用中打开此项目。`,sidebarArchive:`归档`,sidebarRestore:`恢复`,sidebarDelete:`永久删除`,managedWorktreeRecoveryFull:`请先核对先前未确认的移除请求,再开始新的请求。`,managedWorktreesChanged:`工作树列表已变化,请刷新后重新核对目标。`,managedWorktreesRefresh:`刷新工作树列表`,managedWorktreesBack:`返回工作树列表`,managedWorktreesRetry:`重试请求`,managedWorktrees:`保留的工作树`,managedWorktreesDescription:`删除会话会保留 OpenPI 创建的工作树。请核对准确路径后再请求移除。使用中、共享、有改动或无法确认归属的工作树会保留。`,managedWorktreeConfirm:`移除此工作树?服务端会重新核对归属、使用中的会话及本地改动后再操作。`,managedWorktreeRemoved:`工作树已移除。`,managedWorktreePreserved:`工作树已保留:`,managedWorktreeUncertainTerminal:`移除结果无法确认,不能自动重复移除。请先检查保留路径,再决定后续操作。`,managedWorktreeUncertain:`尚不能确认移除结果。重试会核对原请求。`,managedWorktreeRemoving:`正在核对并移除…`,managedWorktreeRemove:`移除工作树`,managedWorktreeReview:`核对移除`,managedWorktreesEmpty:`这一页没有找到托管工作树。`,managedWorktreesUnavailable:`有 {{count}} 条归属记录无法确认。`,managedWorktreesLoadFailed:`无法加载保留的工作树。请重试,目标不会改变。`,managedWorktreesMore:`加载更多工作树`,managedWorktreeRetainedAfterDelete:`会话已删除,工作树保留在 {{path}}。可从项目菜单核对保留的工作树。`,sidebarDeleteTitle:`删除会话?`,sidebarDeleteDescription:`确定永久删除“{{name}}”?此操作无法撤销。`,sidebarDeleteConfirm:`删除`,sidebarDeleting:`正在删除…`,sidebarDeleteFailed:`未能删除此会话,请重试或取消。`,sidebarActionRunning:`请等待当前工作和排队消息结束。`,sidebarActionDisconnected:`请先恢复连接,再修改此会话。`,sessionDeleteCancelled:`删除已取消`,sessionDeleteUncertain:`无法确认会话是否删除,请刷新后重试`,sessionDeleted:`会话已永久删除`,sessionDeleteMetadataPending:`会话已删除,但侧栏记录未清理完成`,sessionLinkUnavailable:`链接中的会话已不存在或身份已变化`,sidebarDropPin:`拖到此处置顶`,sidebarDropProjectLast:`将项目移到最后`,conversationTurns:`会话轮次`,conversationTurnPosition:`前往第 {{position}} 轮`,turnPreviewLoading:`正在加载预览…`,turnPreviewUnavailable:`暂时无法读取,请重试。`,commands:`斜杠命令`,addContext:`添加上下文`,fileReference:`引用工作区文件`,fileReferenceTitle:`引用工作区文件`,fileReferenceDetail:`将路径引用加入提示词,不上传文件内容。`,fileReferenceLabel:`工作区文件路径`,fileReferencePlaceholder:`src/app.tsx`,fileReferenceValidatedHint:`当前会话会验证该路径是可读取的工作区文件。`,fileReferenceDraftHint:`新会话启动后,Pi 会按其工具权限解析该路径。`,fileReferenceChecking:`正在检查…`,fileReferenceFailed:`无法验证该文件。`,fileReferenceDenied:`请选择当前会话工作区内的文件。`,fileReferenceMissing:`该工作区文件已不存在。`,fileReferenceUnsupported:`只能引用工作区中的普通文件。`,fileReferenceExpired:`活动会话已变化,请重新打开文件引用后再试。`,fileReferenceBusy:`文件校验正忙,请稍后重试。`,insertReference:`插入引用`,commandsSessionRequired:`会话启动后才能插入斜杠命令。`,commandsEmptyDraftOnly:`只能在空白草稿中插入斜杠命令。`,commandsLoading:`正在加载命令…`,commandsUnavailable:`暂时无法读取命令。`,commandsNoMatch:`没有匹配的命令。`,commandsNoAvailable:`已发现的命令均不能在 Web 中运行。输入具体命令名可查看其可用性。`,commandsBounded:`另有 {{count}} 个命令未显示。`,commandSessionRequired:`命令仅在已创建的 Web 会话中可用。`,commandUnsupported:`尚未适配 · 手动命令仍交给 Pi`,commandAcceptsArguments:`可输入参数`,commandSource_extension:`扩展命令`,commandSource_prompt:`提示词模板`,commandSource_skill:`技能`,copiedMessage:`已复制`,copyMessage:`复制消息`,copyFailed:`复制失败,请选中消息后手动复制。`,copiedCode:`代码已复制`,copyCode:`复制代码`,copyCodeFailed:`无法复制代码,请选中后手动复制。`,codeBlock:`代码块`,deleteWorkspace:`删除工作区`,describeTask:`描述任务`,editMessage:`修改并从这里重跑`,enterHint:`按 Enter 发送,Shift+Enter 换行。`,expandSidebar:`展开侧边栏`,importWorkspace:`导入工作区`,loadingModels:`正在加载模型...`,modelsTruncated:`当前显示 {{shown}} 个模型,还有 {{omitted}} 个可用;搜索即可查找。`,searchModels:`搜索可用模型`,searchModelsPlaceholder:`搜索服务商、模型名称或 ID...`,searchingModels:`正在搜索模型...`,noMatchingModels:`没有匹配的模型`,modelSearchFailed:`模型搜索失败,请重试。`,retryModelSearch:`重试模型搜索`,fileReferenceDraftChanged:`草稿已变化,请重新打开文件引用。`,modelSearchTruncated:`还有 {{omitted}} 个匹配模型未显示。`,modelPreparing:`正在准备任务...`,modelRetrying:`模型请求重试中...`,modelRunning:`正在运行...`,modelRequestFailed:`模型请求失败`,modelRequestStopped:`模型请求已停止`,modelFailureUnknown:`服务商没有返回具体失败原因。`,retryPrompt:`重试消息`,retryingPrompt:`正在重试…`,newSession:`新建会话`,noConversations:`暂无对话`,noMatching:`没有匹配的会话`,noMatchingLoaded:`已加载历史中没有匹配的会话`,noModels:`没有可用模型`,noOutput:`无输出`,noSessions:`暂无会话`,openSidebar:`打开侧边栏`,promptMessage:`发消息或创建任务,/ 调用指令`,promptReadonly:`非当前会话不能接收消息`,promptStart:`选择一个工作区开始`,promptTask:`描述你想要构建的任务`,landingTagline:`小骨架 · 净上下文 · 深扩展`,queuedHint:`当前回合结束后将发送消息。`,reconnecting:`正在重连`,removeWorkspace:`从侧边栏移除`,workspaceOptions:`工作区选项`,renameFailed:`无法保存名称,已保留你的修改。`,savingName:`正在保存...`,workspaceRemoveFailed:`无法移出工作区,请重试。`,removingWorkspace:`正在移出...`,renameConversation:`重命名会话`,renameWorkspace:`重命名工作区`,save:`保存`,searchConversations:`搜索会话`,searchPlaceholder:`筛选标题与工作目录…`,selectModel:`选择模型`,configureModels:`配置模型`,openModelSettings:`模型设置`,selectThinking:`选择思考等级`,resetThinking:`恢复打开时的等级({{level}})`,modelThinkingNotEnabled:`此模型未启用思考。如提供商支持,可在模型设置中开启「支持推理」。`,providerReasoningHint:`按提供商能力开启;可用档位由 Pi 提供,在聊天输入框调节强度。`,providerImageHint:`未勾选图片时,模型不会收到图片附件。`,selectWorkspace:`选择工作区`,send:`发送`,processDetails:`执行过程`,processRunning:`正在执行`,processThinkingCount:`{{count}} 段思考`,processToolCount:`{{count}} 次工具调用`,processActivityCount:`{{count}} 项 Agent 活动`,switchingSession:`正在切换会话...`,thinkingActive:`思考中...`,thinkingActiveLevel:`思考中({{level}})...`,thinkingDone:`思考过程`,thinkingLoadFull:`查看完整思考`,thinkingLoadingFull:`正在加载思考…`,thinkingLoadFailed:`思考加载失败,点击重试`,thinkingPartialText:`当前显示部分已保存的思考,可继续加载下方内容。`,thinkingPreviewOnly:`思考预览已达到显示上限,此消息保存后可查看完整内容。`,toolState_running:`执行中`,toolState_returned:`已返回`,toolState_failed:`失败`,toolState_cancelled:`已停止`,toolState_timed_out:`超时`,toolState_unknown:`未确认`,toolSnapshotMissingResult:`分叉时尚无结果`,toolActivity_running:`正在{{action}}`,toolActivity_failed:`{{action}}失败`,toolActivity_cancelled:`{{action}}已停止`,toolActivity_timed_out:`{{action}}超时`,toolActivity_unknown:`{{action}}`,toolAction_read:`读取`,toolAction_write:`写入文件`,toolAction_edit:`编辑文件`,toolAction_command:`运行`,toolAction_search:`搜索`,toolAction_list:`列出文件`,toolAction_web:`浏览网页`,toolAction_agent:`使用子代理`,toolAction_workflow:`调用工作流`,toolAction_plan:`准备计划`,toolAction_task:`处理任务`,toolAction_goal:`处理目标`,toolAction_git:`查看变更`,toolAction_call:`调用工具`,toolActionDone_read:`已读取`,toolActionDone_write:`已写入`,toolActionDone_edit:`已编辑`,toolActionDone_command:`已运行`,toolActionDone_search:`已搜索`,toolActionDone_list:`已列出的文件`,toolActionDone_web:`已浏览网页`,toolActionDone_agent:`子代理工具已返回`,toolActionDone_workflow:`工作流工具已返回`,toolActionDone_plan:`计划工具已返回`,toolActionDone_task:`任务工具已返回`,toolActionDone_goal:`目标工具已返回`,toolActionDone_git:`已查看变更`,toolActionDone_call:`已调用工具`,toolActionGroup_read:`读取文件`,toolActionGroup_write:`写入文件`,toolActionGroup_edit:`编辑文件`,toolActionGroup_command:`运行命令`,toolActionGroup_search:`搜索`,toolActionGroup_list:`列出文件`,toolActionGroup_web:`浏览网页`,toolActionGroup_agent:`子代理活动`,toolActionGroup_workflow:`工作流活动`,toolActionGroup_plan:`准备计划`,toolActionGroup_task:`处理任务`,toolActionGroup_goal:`处理目标`,toolActionGroup_git:`查看变更`,toolActionGroup_call:`调用工具`,toolGroup_done:`已{{actions}}`,toolGroup_running:`正在{{actions}}`,toolGroup_unknown:`{{actions}}`,toolGroupSeparator:`、`,toolSearchTarget:`“{{pattern}}” · {{path}}`,toolDiffStatsHelp:`当前显示差异中的新增和删除行数`,toolRequestedFile:`文件:`,toolWorkspace:`工作区`,toolRawEvidence:`参数与原始结果`,toolCodemodeDetails:`脚本与原始结果`,toolNestedOutputMissing:`会话记录保留了调用和状态,未保存此子工具的输出。`,toolNestedArgumentsMissing:`会话记录未保留完整参数和此子工具的输出。`,toolNestedIncomplete:`子调用记录不完整,部分调用、参数或最终状态不可用。`,toolPartialEvidence:`输出未完整显示:已达到字节、行数或条目上限。原始结果也可能被截断。`,toolFileChange_created:`已创建文件`,toolFileChange_unchanged:`文件内容未改变`,toolFileChange_overwritten:`已覆盖文件`,toolChangeUnavailable:`此工具结果未提供修改对比。`,toolTestResults:`测试结果摘要 · {{format}}`,toolTestCounts:`{{tests}} 项测试 · {{passed}} 通过 · {{failed}} 失败 · {{cancelled}} 取消`,toolTestCountsHelp:`数量来自命令输出,执行状态单独显示。`,toolReadMore:`可使用文件路径和 offset 继续读取,具体方式见原始结果。`,toolFullOutputReference:`完整输出:`,subagentBackgroundResult:`后台子代理结果 · {{count}}`,thinkingDraftHint:`请先选择工作区并创建会话。`,thinkingInactiveHint:`只有当前会话可以更改思考等级。`,thinkingLevelMismatch:`当前确认的思考等级不在此模型支持范围内;选择其它等级即可修正。`,thinkingLockedRunning:`请先停止当前轮次,再更改思考等级。`,thinkingModelPendingHint:`请等待模型切换完成。`,thinkingNotConfirmed:`思考等级未获确认,请重试。`,thinkingPendingHint:`正在应用思考等级...`,thinkingUnsupported:`暂不支持思考`,thinkingUnsupportedHint:`尚未选择模型,或当前模型不支持思考。`,unavailable:`不可用`,ungrouped:`未分组`,untitledSession:`新会话`,workspaceDeleteConfirm:`文件夹与会话记录会保留,其中的会话会被放到“未分组”;再次打开此目录时将是一个干净的工作区。`,workspaceName:`工作区名称`,workspaces:`工作区`,sidebarProjects:`项目`}}},mJ=navigator.language?.toLowerCase().startsWith(`zh`)?`zh`:`en`;In.use(tr).init({fallbackLng:`en`,initAsync:!1,interpolation:{escapeValue:!1},lng:mJ,resources:pJ}),document.documentElement.lang=mJ===`zh`?`zh-CN`:`en`;var hJ=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},gJ=10,_J=13,vJ=32,yJ=6;function bJ(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{maxBufferSize:t,onComment:n,onError:r,onEvent:i,onId:a,onRetry:o}=e,s=[],c=0,l=!0,u,d=``,f=0,p,m=!1,h=!1,g=!1;function _(e){if(m)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(l&&(l=!1,e.charCodeAt(0)===65279?e=e.slice(1):e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),(h||g)&&(e=v(e),!e))return;if(!s.length){let t=S(e);t!==``&&y(t),x();return}if(e.indexOf(` +`)===-1&&e.indexOf(`\r`)===-1){if(c0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0,t=n+1,n=e.indexOf(` -`,t);continue}let r=e.charCodeAt(t);if(gJ(e,t,r)){let r=e.charCodeAt(t+5)===pJ?t+6:t+5,o=e.slice(r,n);if(f===0&&e.charCodeAt(n+1)===dJ){u!==void 0&&a?.(u),i?.({id:u,event:p,data:o}),u=void 0,d=``,p=void 0,t=n+2,n=e.indexOf(` -`,t);continue}d=f===0?o:`${d}\n${o}`,f++}else _J(e,t,r)?p=e.slice(e.charCodeAt(t+6)===pJ?t+7:t+6,n)||void 0:C(e,t,n);t=n+1,n=e.indexOf(` +`,t);continue}let r=e.charCodeAt(t);if(xJ(e,t,r)){let r=e.charCodeAt(t+5)===vJ?t+6:t+5,o=e.slice(r,n);if(f===0&&e.charCodeAt(n+1)===gJ){u!==void 0&&a?.(u),i?.({id:u,event:p,data:o}),u=void 0,d=``,p=void 0,t=n+2,n=e.indexOf(` +`,t);continue}d=f===0?o:`${d}\n${o}`,f++}else SJ(e,t,r)?p=e.slice(e.charCodeAt(t+6)===vJ?t+7:t+6,n)||void 0:C(e,t,n);t=n+1,n=e.indexOf(` `,t)}return e.slice(t)}for(;t20?`${e.slice(0,20)}…`:e}"`,{type:`unknown-field`,field:e,value:t,line:n}))}}function T(){u!==void 0&&a?.(u),f>0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0}function E(e={}){if(e.consume&&s.length>0){let e=s.join(``);C(e,0,e.length)}l=!0,u=void 0,d=``,f=0,p=void 0,s.length=0,c=0,m=!1,h=!1,g=!1}return{feed:_,reset:E}}function gJ(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function _J(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}function vJ(e,t){let n=1;for(;nt.abort();e.signal.addEventListener(`abort`,n,{once:!0}),e.signal.aborted&&n();let r=window.setTimeout(n,45e3),i=await fetch(`/events?cursor=${e.cursor}`,{headers:await e.client.headers(),signal:t.signal}).finally(()=>{window.clearTimeout(r),e.signal.removeEventListener(`abort`,n)});if(i.status===409)throw new yJ(`event replay expired`);if(!i.ok||!i.body)throw Error(`event connection failed`);e.onConnected();let a=e.cursor,o=0,s=hJ({onComment(t){t.trim()===`heartbeat`&&++o>=4&&(o=0,e.onHeartbeat?.())},onEvent(t){let n=JSON.parse(t.data);if(!Number.isSafeInteger(n.sequence))throw new yJ(`invalid event cursor`);if(!(n.sequence<=a)){if(n.sequence!==a+1)throw new yJ(`event cursor gap`);if(a=n.sequence,n.type===`state_invalidated`)throw new yJ(`state invalidated`);e.onEvent(n)}}}),c=i.body.getReader(),l=new TextDecoder;try{for(;!e.signal.aborted;){let t,n,r=c.read(),i=new Promise((r,i)=>{n=()=>i(Error(`event stream aborted`)),e.signal.addEventListener(`abort`,n,{once:!0}),window.addEventListener(`offline`,n,{once:!0}),(e.signal.aborted||navigator.onLine===!1)&&n(),t=window.setTimeout(()=>i(Error(`event stream stalled`)),45e3)}),{done:a,value:o}=await Promise.race([r,i]).finally(()=>{window.clearTimeout(t),n&&(e.signal.removeEventListener(`abort`,n),window.removeEventListener(`offline`,n))});if(a)throw Error(`event connection closed`);s.feed(l.decode(o,{stream:!0}))}}finally{await c.cancel().catch(()=>void 0)}}var xJ=`openpi.collapsed-workspaces`,SJ=`openpi.sidebar-collapsed`,CJ=new Set(`agent_start.turn_started.turn_settled.agent_settled.prompt_settled.message_end.tool_execution_end.session_start.session_switched.session_progress.queue_update.prompt_failed.prompt_discarded.model_select.settings_changed.workspace_imported.workspace_removed.workspace_renamed.session_renamed.session_archived.session_unarchived.session_pins_changed.sidebar_pins_changed.workspace_order_changed.session_order_changed.session_read_state_changed.session_created.session_forked.session_deleted.prompt_accepted.runtime_changed.questions_changed.command_feedback.command_submitted.plan_mode_changed`.split(`.`));function wJ(e){try{let t=JSON.parse(window.sessionStorage.getItem(e)||`[]`);return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}catch{return new Set}}function TJ(e){try{return window.sessionStorage.getItem(e)===`true`}catch{return!1}}function EJ(e,t){try{window.sessionStorage.setItem(e,JSON.stringify(t))}catch{}}function DJ(e){let t=8,n=[];for(let r=e.length-1;r>=0;r--){let i=e[r];(i.optimistic||t-->0)&&n.push(i)}return n.reverse()}var OJ=1e3,kJ=new Set,AJ=new WeakMap;function jJ(e){if(e){if(e.role===`toolResult`&&e.toolCallId)return`tool-result-${e.toolCallId}`;if(e.timestamp!==void 0)return`message-${e.role}-${e.timestamp}`}}function MJ(e){return e?.parts?.some(e=>e.type===`thinking`)===!0}function NJ(e){if(!e)return kJ;let t=AJ.get(e);if(t)return t;let n=new Set;for(let t of e){if(!MJ(t.message))continue;n.add(t.id);let e=jJ(t.message);e&&n.add(e)}return AJ.set(e,n),n}function PJ(e,t){for(let n of Object.keys(e))if(!t.has(n)){let n={};for(let r of Object.keys(e))t.has(r)&&(n[r]=e[r]);return n}return e}function FJ(e,t){if(e.length!==t.length)return!1;for(let n=0;ne.optimistic?.sessionId===t?.id&&e.optimistic?.sessionPath===t?.path&&e.optimistic!==void 0)}function LJ(e,t,n,r){return e.map(e=>e.optimistic?.sessionId===t&&e.optimistic.sessionPath===n&&e.optimistic.commandId===r&&!e.optimistic.admitted?{...e,optimistic:{...e.optimistic,admitted:!0}}:e)}function RJ(e,t){return t.aborted?Promise.resolve():new Promise(n=>{let r=()=>{window.clearTimeout(i),t.removeEventListener(`abort`,r),n()},i=window.setTimeout(r,e);t.addEventListener(`abort`,r,{once:!0})})}function zJ(e){return/^\/(?![\\/])/u.test(e)||/^[a-z]:[\\/]/iu.test(e)||/^\\\\(?![?.]\\)[^\\/]+\\[^\\/]+\\/u.test(e)||/^\/\/[^\\/]+\/[^\\/]+\//u.test(e)}function BJ(e=new rf,t={}){let n=t.consumeEvents??bJ,r=new URLSearchParams(window.location.search),i=r.get(`sessionPath`),a=r.get(`sessionId`),o=i!==null||a!==null,s=i&&zJ(i)&&i.length<=4096&&a&&a.length<=128&&!/[\u0000-\u001f\u007f]/u.test(i+a)&&r.getAll(`sessionPath`).length===1&&r.getAll(`sessionId`).length===1?{path:i,id:a}:null,c=0,l=0,u=null,d=!1,f=new Map,p=0,m=0,h=null,g=0,_=null,v=null,y=null,b=null,x=Promise.resolve(),S=null,C=null,w=!1,T=!1,E=null,D=null,O=0,k=null,A=0,j=!1,M=0,N=0,P=null,F=-1,I=null,L=0,R=0,ee=new Set,z=new Set,B=[],V=(e,t)=>{if(typeof t==`string`)for(e.add(t);e.size>32;){let t=e.values().next().value;t&&e.delete(t)}},H=()=>(R++,B=[],{planSelectionPending:!1,activeTurn:null,turnCancellationPending:!1,turnTerminalStatus:null,pendingFollowUpsReceipt:null,pendingSteeringReceipt:null,liveMessages:[],liveRunning:!1,livePhase:`idle`,liveRetry:null,thinkingStarts:{},thinkingDurations:{}}),te=e=>{let t=B.indexOf(e);for(t>=0&&B.splice(t,1),B.push(e);B.length>OJ;)B.shift()},ne=(e,t,n,r)=>{let i=NJ(t);B.some(e=>i.has(e))&&(B=B.filter(e=>!i.has(e)));let a=new Set(i);for(let t of e){a.add(t.key);let e=jJ(t.message);e&&a.add(e)}for(let e of B)a.add(e);let o=PJ(n,a),s=PJ(r,a);return o===n&&s===r?null:{thinkingStarts:o,thinkingDurations:s}},re=()=>(O++,D?.abort(),D=null,{modelSearch:{query:``,status:`idle`,models:[],totalMatches:0,matchesOmitted:0,error:null}}),ie=()=>({sessionId:null,status:`idle`,commands:[],totalAvailable:0,commandsOmitted:0,error:null}),ae=(e,t)=>({liveRunning:t===`running`||!e,livePhase:t===`running`?`running`:e?`idle`:`preparing`});return dr((t,r)=>{let i=e=>{h=null,t({notice:e instanceof Error?e.message:String(e)})},a=e=>{let t=r().snapshot;return e.epoch===c&&r().selectedWorkspace===e.workspacePath&&t?.currentSessionId===e.sessionId&&rj(t)&&t.selectedSession?.id===e.sessionId&&r().selectedPath===t.selectedSession.path&&t.selectedSession.cwd===e.workspacePath&&(!e.sessionPath||t.selectedSession.path===e.sessionPath)},B=()=>{L++,I?.abort(),I=null,t({commandDiscovery:ie()})},U=async(n,a,o,s)=>{if(r().modelSelectionPending)return!1;t({modelSelectionPending:!0});try{let i=await e.selectModel(n.provider,n.id,o,s);if(a!==c||s!==r().selectedPath||o!==r().snapshot?.selectedSession?.id)return!1;if(i.provider!==n.provider||i.id!==n.id||!i.current)throw Error(`Model selection was not confirmed. Please select a model again.`);if(!await r().actions.refreshSnapshot({epoch:a})||a!==c||s!==r().selectedPath||o!==r().snapshot?.selectedSession?.id)return!1;let l=r().snapshot?.models.find(e=>e.current);if(l?.provider!==n.provider||l.id!==n.id)throw Error(`The Session model changed. Please select a model again.`);return t({draftModel:null,notice:null}),!0}catch(e){return a===c&&s===r().selectedPath&&o===r().snapshot?.selectedSession?.id&&i(e),!1}finally{a===c&&t({modelSelectionPending:!1})}},oe=(e=160)=>{if(w){T=!0;return}C===null&&(C=window.setTimeout(async()=>{C=null,w=!0;try{await r().actions.refreshSnapshot()}finally{w=!1,T&&(T=!1,oe())}},e))},se=()=>{P=null,N=0,F=-1},ce=()=>{let e=r().snapshot;if(!e)return;P&&F!==c&&se();let n=e.thinking;if(n){if(!P||n.revision>=N){P=n,N=n.revision,F=c;return}n!==P&&t({snapshot:{...e,thinking:P}})}},le=e=>{P&&F!==c&&se(),e&&e.revision>=N&&(P=e,N=e.revision,F=c),ce()},ue=()=>{k=null,A++,j=!1,t({thinkingPendingLevel:null})},de=async()=>{let t=c,n=r().snapshot?.selectedSession?.id,i=r().selectedPath;if(n)try{let a=await e.thinking(n,new AbortController().signal);if(t!==c||i!==r().selectedPath||n!==r().snapshot?.selectedSession?.id)return;le(a)}catch{}},fe=async()=>{if(j)return;j=!0;let n=++M;try{for(;k!==null;){let n=k,a=A,o=c,s=r().snapshot?.selectedSession?.id,l=r().selectedPath;if(!s||!l||s!==r().snapshot?.currentSessionId||l!==r().snapshot?.selectedSession?.path||r().modelSelectionPending){ue();return}if(r().snapshot?.thinking?.level===n){a===A&&(k=null,t({thinkingPendingLevel:null}));continue}let u;try{u=await e.setThinkingLevel(s,n,l)}catch(e){if(o!==c||l!==r().selectedPath)return;if(a!==A)continue;ue(),i(e),de();return}if(o!==c||l!==r().selectedPath||s!==r().snapshot?.selectedSession?.id)return;if(a===A){if(u.level!==n){ue(),i(Error(In.t(`thinkingNotConfirmed`)));return}le(u),k=null,t({thinkingPendingLevel:null}),oe();return}}}finally{n===M&&(j=!1)}},pe=e=>{let n=r(),i=e.detail??{},a=i.sessionId,o=[`session_start`,`session_switched`,`session_created`].includes(e.type);if(n.cursor!==null&&e.sequence<=n.cursor)return;t({cursor:e.sequence});let s=n.promptAdmissionRecovery,l=s?.commandId,u=n.snapshot?.selectedSession,d=u?.id===a&&u?.path===n.selectedPath&&(i.sessionPath===void 0||i.sessionPath===u?.path);if(d&&s?.sessionId===u?.id&&s?.sessionPath===u?.path&&typeof i.commandId==`string`&&i.commandId===l&&[`prompt_accepted`,`prompt_failed`,`prompt_settled`,`turn_started`,`turn_settled`].includes(e.type)){let r=e.type!==`prompt_failed`;t({promptAdmissionRecovery:null,promptAdmissionResolution:s?{sessionId:s.sessionId,sessionPath:s.sessionPath,commandId:s.commandId,content:s.content,images:s.images}:n.promptAdmissionResolution,liveMessages:r&&s&&!s.delivery?.retryEntryId&&!n.liveMessages.some(e=>e.key===s.optimisticKey)?DJ([...n.liveMessages,{key:s.optimisticKey,timestamp:s.timestamp??e.timestamp,optimistic:{sessionId:s.sessionId,sessionPath:s.sessionPath,commandId:s.commandId,afterEntryId:s.afterEntryId??null,admitted:e.type===`prompt_accepted`},message:{role:`user`,content:s.content}}]):n.liveMessages})}if(e.type===`prompt_accepted`&&d&&u&&typeof i.commandId==`string`&&t({liveMessages:LJ(r().liveMessages,u.id,u.path,i.commandId)}),n=r(),(e.type===`runtime_changed`||e.type===`settings_changed`)&&t(re()),e.type===`runtime_changed`&&B(),n.sessionSwitching&&!o){oe();return}if(typeof a==`string`&&a!==n.snapshot?.currentSessionId&&!o){oe();return}if([`auto_retry_start`,`auto_retry_end`].includes(e.type)&&typeof i.sessionPath==`string`&&i.sessionPath!==(n.snapshot?.currentSessionPath??n.snapshot?.selectedSession?.path)){oe();return}if(!o&&(i.message||e.type.startsWith(`tool_execution_`))&&!rj(n.snapshot)){CJ.has(e.type)&&oe();return}if(n.snapshot){let r=n.snapshot.runtime.liveTools??[],a=sJ(r,e.type,i);a!==r&&t({snapshot:{...n.snapshot,runtime:{...n.snapshot.runtime,liveTools:a}}})}if(o){let o=i.commandId;if(typeof o==`string`&&z.has(o)){oe();return}let s=i.sessionPath,l=n.snapshot?.sessions.some(e=>e.path===s),u=!1;if(y?.kind===`select`?u=y.expectedPath===s:(y?.kind===`create`&&y.commandId===o&&e.type===`session_switched`&&typeof a==`string`&&(!y.expectedSessionId||y.expectedSessionId===a)&&(typeof s!=`string`||!l)||y?.kind===`create`&&y.commandId===o&&e.type===`session_created`&&typeof a==`string`&&(!y.expectedSessionId||a===y.expectedSessionId))&&(u=!0),u&&y?.epoch!==c)return;if(u)t({...H(),liveMessages:IJ(n.liveMessages,n.snapshot?.selectedSession)});else{if(!y&&n.selectedPath&&n.snapshot?.selectedSession?.path===n.selectedPath){B(),ue(),t({...H(),liveMessages:IJ(n.liveMessages,n.snapshot.selectedSession),snapshot:{...n.snapshot,currentSessionId:void 0,currentSessionPath:void 0},modelSelectionPending:!1});let e=c;r().actions.refreshSnapshot({epoch:e});return}B();let e=++c;ue(),_=null,v=null,t({...H(),promptAdmissionPending:!1,promptAdmissionRecovery:null,selectedPath:typeof s==`string`?s:null,draftModel:n.workspaceDraft?n.draftModel:null,modelSelectionPending:!1,sessionSwitching:!0}),r().actions.refreshSnapshot({epoch:e}).then(n=>{e===c&&t({selectedPath:n?r().selectedPath:null,sessionSwitching:!1})})}}else if(e.type===`prompt_accepted`){let e=ee.has(String(i.commandId??``));t({...ae(e,n.livePhase),liveRetry:null,pendingFollowUpsReceipt:Number.isInteger(i.pendingFollowUps)?Number(i.pendingFollowUps):n.pendingFollowUpsReceipt,pendingSteeringReceipt:Number.isInteger(i.pendingSteering)?Number(i.pendingSteering):n.pendingSteeringReceipt})}else if(e.type===`turn_started`)m=e.sequence,t({activeTurn:{sessionId:String(i.sessionId),commandId:String(i.commandId),epoch:Number(i.epoch),...typeof i.sessionPath==`string`?{sessionPath:i.sessionPath}:{},...typeof i.promptEntryId==`string`?{promptEntryId:i.promptEntryId}:{},...typeof i.startedAt==`number`?{startedAt:i.startedAt}:{},...typeof i.elapsedMs==`number`?{elapsedMs:i.elapsedMs}:{}},liveRunning:!0,livePhase:`running`,liveRetry:null,turnTerminalStatus:null});else if(e.type===`agent_start`)m=e.sequence,t({...i.activeTurn?{activeTurn:i.activeTurn}:{},liveRunning:!0,livePhase:`running`,liveRetry:null});else if(e.type===`turn_settled`){V(ee,i.commandId);let r=n.activeTurn;r?.sessionId===i.sessionId&&r?.commandId===i.commandId&&r?.epoch===i.epoch&&(m=e.sequence,t({activeTurn:null,liveRunning:!1,livePhase:`idle`,liveRetry:null,turnTerminalStatus:typeof i.outcome==`string`?i.outcome:null}))}else if(e.type===`agent_settled`)n.activeTurn||(m=e.sequence),t({pendingFollowUpsReceipt:null,pendingSteeringReceipt:null,...n.activeTurn?{}:{liveRunning:!1,livePhase:`idle`,liveRetry:null}});else if(e.type===`prompt_settled`)V(ee,i.commandId),n.livePhase!==`running`&&t({liveRunning:!1,livePhase:`idle`,liveRetry:null});else if(i.message&&typeof i.message==`object`){let r=i.message,a=n.liveMessages,o=typeof i.messageKey==`string`?i.messageKey:`${r.role||`message`}-${e.sequence}`,s={key:o,message:r},c=a.findIndex(e=>e.key===o);a=c>=0?a.map((e,t)=>t===c?s:e):DJ([...a,s]);let l=!FJ(n.liveMessages,a),u=n.thinkingStarts,d=n.thinkingDurations,f=!1;if(r.parts?.some(e=>e.type===`thinking`)&&(u[o]===void 0&&(u={...u,[o]:Date.now()},f=!0),e.type===`message_end`)){let e=jJ(r),t=Date.now()-u[o];d={...d,[o]:t},e&&(d[e]=t),te(e??o),f=!0}if(f||l){let e=ne(a,n.snapshot?.selectedSession?.entries,u,d);e&&(u=e.thinkingStarts,d=e.thinkingDurations,f=!0)}t({liveMessages:a,...f?{thinkingStarts:u,thinkingDurations:d}:{}})}if(e.type===`prompt_discarded`&&typeof i.commandId==`string`&&(V(ee,i.commandId),t({liveMessages:r().liveMessages.filter(e=>e.optimistic?.commandId!==i.commandId)})),e.type===`prompt_failed`){V(ee,i.commandId);let e=typeof i.commandId==`string`&&n.activeTurn?.commandId===i.commandId;t({liveMessages:r().liveMessages.filter(e=>!e.optimistic||e.optimistic.commandId!==i.commandId),...e||n.livePhase!==`running`?{liveRunning:!1,livePhase:`idle`,liveRetry:null}:{},notice:typeof i.error==`string`?i.error:`Prompt failed`})}if(e.type===`auto_retry_start`&&t({liveRunning:!0,livePhase:`running`,liveRetry:{attempt:Number(i.attempt)||0,maxAttempts:Number(i.maxAttempts)||0}}),e.type===`auto_retry_end`&&t({liveRetry:null}),e.type===`thinking_level_changed`){let t=r().snapshot?.thinking;t&&typeof i.level==`string`&&le({...t,level:i.level,revision:e.sequence})}CJ.has(e.type)&&oe()},me=async i=>{let a=500,o=!1;for(;!i.aborted;){let s=!1;try{if(r().cursor===null){if(s=!0,!await r().actions.refreshSnapshot({resetCursor:!0}))throw Error(`snapshot unavailable`);s=!1}if(i.aborted)return;await n({client:e,cursor:r().cursor??0,onConnected:()=>{a=500,t({connection:`connected`}),o&&(o=!1,oe(0))},onEvent:pe,onHeartbeat:()=>oe(0),signal:i})}catch(e){if(i.aborted)return;t({connection:`reconnecting`});let n=!s&&await r().actions.refreshSnapshot({resetCursor:!0});o=!n,n||t(H()),await RJ(a,i),a=Math.min(a*2,5e3),e instanceof SyntaxError&&t({notice:`Invalid event data`})}}},W={rememberPromptProjection(e,n,i){let a=r(),o=a.snapshot?.selectedSession;if(a.selectedPath!==n||o?.id!==e||o.path!==n)return;let s=new Set(o.entries.map(e=>e.id)),c=new Set(a.liveMessages.flatMap(t=>t.optimistic?.sessionId===e&&t.optimistic.sessionPath===n&&t.optimistic.projectedEntryId?[t.optimistic.projectedEntryId]:[])),l=new Map(i.map(e=>[e.key,e.entryId])),u=!1,d=a.liveMessages.map(t=>{let r=l.get(t.key);return!r||!s.has(r)||c.has(r)||t.optimistic?.sessionId!==e||t.optimistic.sessionPath!==n||!t.optimistic.admitted||t.optimistic.projectedEntryId?t:(u=!0,c.add(r),{...t,optimistic:{...t.optimistic,projectedEntryId:r},message:{role:`user`,content:``}})});u&&t({liveMessages:d})},setHistoryAnchor(e){let n=r().snapshot?.selectedSession;if(e&&(n?.id!==e.sessionId||n.path!==e.sessionPath))return;let i=r().historyAnchor;(i?.entryId!==e?.entryId||i?.sessionId!==e?.sessionId||i?.sessionPath!==e?.sessionPath)&&t({historyAnchor:e})},start(){E||(E=new AbortController,me(E.signal))},stop(){E?.abort(),E=null,C!==null&&window.clearTimeout(C),C=null,ue(),B()},async refreshSnapshot(n={}){let a=n.epoch??c,o=++p,l=r().selectedPath;try{let i=r().historyAnchor,u=s?.path===l?s:null,d=u?await e.snapshot(l,void 0,u.id):i&&i.sessionPath===l?await e.snapshot(l,i):await e.snapshot(l);if(a!==c||o!==p)return!1;if(u&&(d.selectedSession?.id!==u.id||d.selectedSession.path!==u.path))throw new tf(In.t(`sessionLinkUnavailable`),409,`SESSION_CONFLICT`);u&&(s=null);let f=typeof d.currentSessionId==`string`,g=f?d.sessions.find(e=>rj(d,e)):void 0,_=f?rj(d):d.selectedSession===void 0,y=d.selectedSession?d.sessions.some(e=>e.id===d.selectedSession.id&&e.path===d.selectedSession.path):!f,b=!l||d.sessions.some(e=>e.path===l),x=!l||d.selectedSession?.path===l;if(!b||!x||!y||!l&&!_)return t({selectedPath:null}),!n.canonicalRetry&&W.refreshSnapshot({...n,canonicalRetry:!0,epoch:a});let S=d.selectedSession?.cwd,C=d.workspaces.find(e=>e.current)?.path,w=d.workspaces.some(e=>e.path===r().selectedWorkspace)?r().selectedWorkspace:void 0,T=r().workspaceDraft?r().selectedWorkspace:S??C??w??null,E=n.resetCursor;r().snapshot?.selectedSession?.path!==d.selectedSession?.path&&(ue(),se()),E&&se();let D=r().snapshot?.currentSessionId,O=r().snapshot?.sessions.find(e=>rj(r().snapshot,e)),k=D!==d.currentSessionId||O?.path!==g?.path,A=r().snapshot?.selectedSession?.id!==d.selectedSession?.id||r().snapshot?.selectedSession?.path!==d.selectedSession?.path,j=r().collapsed;if(A&&!r().workspaceDraft&&d.selectedSession){let e=d.sessions.find(e=>e.id===d.selectedSession.id&&e.path===d.selectedSession.path),t=e?.workspacePath??d.selectedSession.cwd;!e?.archived&&!e?.ungrouped&&j.has(t)&&(j=new Set(j),j.delete(t),EJ(xJ,[...j]))}let M=r().snapshot,N=E||k||A||M?.currentSessionPath!==d.currentSessionPath||JSON.stringify(M?.models)!==JSON.stringify(d.models)||M?.truncation.modelsOmitted!==d.truncation.modelsOmitted;k&&(B(),ue(),se());let P=h!==null&&r().notice===h;h=null,(E||k||A)&&(m=0);let F=m>d.cursor;if(t({...P?{notice:null}:{},...E||k||A?{...H(),liveMessages:IJ(r().liveMessages,d.selectedSession)}:{},connection:r().connection===`connecting`?`connecting`:r().connection,cursor:E||r().cursor===null?d.cursor:Math.max(r().cursor??0,d.cursor),activeTurn:F?r().activeTurn:d.runtime.activeTurn??null,livePhase:F?r().livePhase:d.runtime.status===`running`?`running`:!r().promptAdmissionPending&&!v?`idle`:r().livePhase,liveRetry:!F&&d.runtime.status!==`running`&&!r().promptAdmissionPending&&!v?null:r().liveRetry,liveRunning:F?r().liveRunning:d.runtime.status===`running`?!0:!r().promptAdmissionPending&&!v?!1:r().liveRunning,selectedPath:d.selectedSession?.path??null,selectedWorkspace:T,collapsed:j,snapshot:d,...N?re():{}}),!(E||k||A)){let e=ne(r().liveMessages,d.selectedSession?.entries,r().thinkingStarts,r().thinkingDurations);e&&t(e)}return le(),!0}catch(e){if(a!==c||o!==p)return!1;if(s?.path===l&&e instanceof tf&&[400,404,409].includes(e.status)){s=null,t({selectedPath:null,workspaceDraft:!0});let e=await W.refreshSnapshot({...n,epoch:a});return a===c&&t({notice:In.t(`sessionLinkUnavailable`)}),e}t({connection:`unavailable`}),i(e);let u=r().notice;return h=typeof u==`string`?u:null,!1}},async chooseWorkspace(){let t=c;try{let n=await e.chooseWorkspace();if(t!==c||n.cancelled||!n.path)return;W.setWorkspace(n.path),await W.refreshSnapshot()}catch(e){t===c&&i(e)}},setWorkspace(e){let n=r();e===n.selectedWorkspace&&!n.sessionSwitching||(++c,b=null,ue(),B(),_=null,v=null,t({...H(),...re(),selectedWorkspace:e,createdSession:null,workspaceDraft:!0,sessionSwitching:!1,modelSelectionPending:!1,promptAdmissionPending:!1,promptAdmissionRecovery:null,notice:null}))},async renameWorkspace(t,n){try{await e.renameWorkspace(t,n),await W.refreshSnapshot()}catch(e){throw i(e),e}},async removeWorkspace(n){try{return await e.removeWorkspace(n),r().selectedWorkspace===n&&B(),r().workspaceDraft&&r().selectedWorkspace===n&&t({selectedWorkspace:null}),await W.refreshSnapshot(),!0}catch(e){return i(e),!1}},async prepareSession(){if(r().sessionSwitching||r().modelSelectionPending)return null;r().selectedWorkspace||await W.chooseWorkspace();let e=r(),t=e.selectedWorkspace;if(!t||e.sessionSwitching||e.modelSelectionPending)return null;let n=e.snapshot?.selectedSession;if(!e.workspaceDraft&&n){if(e.selectedPath!==n.path||n.cwd!==t)return null;let r={epoch:c,sessionId:n.id,sessionPath:n.path,workspacePath:t};return!rj(e.snapshot)&&!await W.selectSession(n.path,n.id)?null:a(r)?r:null}return W.createSession(t)},async createSession(n){if(!n||r().modelSelectionPending)return null;let o=++c;ue(),B();let s=(b?.workspacePath===n?b.commandId:void 0)??globalThis.crypto?.randomUUID?.()??`web-create-${Date.now()}-${o}`;b={workspacePath:n,commandId:s},_=null,v=null,t({...H(),...re(),mobileSidebarOpen:!1,promptAdmissionPending:!1,promptAdmissionRecovery:null,selectedPath:null,selectedWorkspace:n,createdSession:null,workspaceDraft:!0,sessionSwitching:!0});let l=null,u=x.then(async()=>{if(o===c){y={commandId:s,epoch:o,expectedPath:null,kind:`create`};try{let u=await e.createSession(n,s);if(o!==c)return;if(u.cancelled||u.commandId!==s||typeof u.sessionId!=`string`||!u.sessionId||u.sessionId.length>128||u.sessionPath!==void 0&&!u.sessionPath)throw Error(`Session creation did not return a valid target identity.`);let d={epoch:o,sessionId:u.sessionId,sessionPath:u.sessionPath??null,workspacePath:n};y?.epoch===o&&(y.expectedSessionId=d.sessionId,y.expectedPath=d.sessionPath),t({selectedPath:d.sessionPath});let f=await W.refreshSnapshot({epoch:o});if(!f&&o===c&&(f=await W.refreshSnapshot({epoch:o})),o!==c)return;if(!f)throw Error(`The created Session could not be confirmed. Please try again.`);if(!a(d)){b=null,i(Error(`The created Session is no longer active in the selected workspace. Please try again.`));return}let p=r().selectedPath;if(!p)return;d.sessionPath=p,t({workspaceDraft:!1,createdSession:d,notice:null});let m=r().draftModel;if(m&&!await U(m,o,d.sessionId,p))return;if(r().workspaceDraft||!a(d)){b=null,i(Error(`The created Session is no longer active in the selected workspace. Please try again.`));return}l=d,b=null}catch(e){if(o!==c)return;t({selectedPath:null}),i(e),await W.refreshSnapshot({epoch:o})}finally{V(z,s),y?.epoch===o&&(y=null),o===c&&t({sessionSwitching:!1})}}});return x=u.catch(()=>void 0),await u,o===c?l:null},async selectSession(n,a){if(!n)return!1;let o=r();if(S?.path===n&&S.epoch===c){let e=S;t({mobileSidebarOpen:!1});let i=await e.promise,o=r();return i&&e.epoch===c&&o.selectedPath===n&&o.snapshot?.selectedSession?.path===n&&(!a||o.snapshot.selectedSession.id===a)&&!o.workspaceDraft&&rj(o.snapshot)}if(!o.workspaceDraft&&!o.sessionSwitching&&o.selectedPath===n&&o.snapshot?.selectedSession?.path===n&&(!a||o.snapshot.selectedSession.id===a)&&rj(o.snapshot))return t({mobileSidebarOpen:!1}),!0;b=null;let s=!o.workspaceDraft&&o.selectedPath===n&&o.snapshot?.selectedSession?.path===n;B(),t({...re(),workspaceDraft:!1,...s?{}:{draftModel:null,createdSession:null},modelSelectionPending:!1});let l=s?c:++c;ue(),s||(_=null,v=null),t({...H(),liveMessages:s?IJ(o.liveMessages,o.snapshot?.selectedSession):[],mobileSidebarOpen:!1,promptAdmissionPending:s?o.promptAdmissionPending:!1,promptAdmissionRecovery:s?o.promptAdmissionRecovery:null,selectedPath:n,sessionSwitching:!0});let u=x.then(async()=>{if(l!==c)return!1;y={epoch:l,expectedPath:n,kind:`select`};try{let i=await(a?e.selectSession(n,a):e.selectSession(n));if(l!==c)return!1;if(i.cancelled)return s||t({selectedPath:null}),await W.refreshSnapshot({epoch:l}),!1;let o=await W.refreshSnapshot({epoch:l});return l===c&&(!o&&!s&&t({selectedPath:null}),o&&r().selectedPath===n&&r().snapshot?.selectedSession?.path===n&&(!a||r().snapshot?.selectedSession?.id===a)&&!r().workspaceDraft&&rj(r().snapshot))}catch(e){return l===c&&(s||t({selectedPath:null}),i(e),await W.refreshSnapshot({epoch:l}),!1)}finally{y?.epoch===l&&(y=null),l===c&&t({sessionSwitching:!1})}});x=u.then(()=>void 0,()=>void 0),S={path:n,epoch:l,promise:u};try{return await u}finally{S?.promise===u&&(S=null)}},async navigateToMessage(n,i){let a=++l;try{if(i?.aborted||await W.selectSession(n.sessionPath)===!1)return!1;let o=c,s=r().snapshot?.selectedSession;if(i?.aborted||a!==l||r().sessionSwitching||s?.id!==n.sessionId||s.path!==n.sessionPath)return!1;let u=await e.sessionMessageWindow(n,i);if(i?.aborted||a!==l||o!==c)return!1;let d=r().snapshot?.selectedSession;return d?.id!==n.sessionId||d.path!==n.sessionPath||u.id!==n.sessionId||u.path!==n.sessionPath||u.history?.anchorEntryId!==n.entryId||u.history.anchorOnBranch!==!0||!u.entries.some(e=>e.id===n.entryId)?!1:(t({historyNavigation:{...n,session:u,revision:(r().historyNavigation?.revision??0)+1}}),!0)}catch{return!1}},async editMessage(e,t){return W.forkMessage(e,{mode:`edit`,content:t})},async regenerateMessage(e){return W.forkMessage(e,{mode:`regenerate`})},acknowledgeRestoredPromptDraft(e){r().restoredPromptDraft?.commandId===e&&t({restoredPromptDraft:null})},async cancelSessionFork(){let n=u;if(!n||n.scope!==`conversation`||!r().sessionForkPending||r().sessionForkCancellation)return;let a=c;t({sessionForkCancellation:`requesting`});try{let i=await e.cancelSessionFork({commandId:n.commandId,sessionId:n.sessionId,sessionPath:n.sessionPath});u===n&&r().sessionForkPending&&(t({sessionForkCancellation:i.state===`not-found`?null:i.state}),i.state===`not-found`&&t({notice:In.t(`sidebarForkCancelUnconfirmed`)}))}catch(e){a===c&&r().sessionForkPending&&(t({sessionForkCancellation:null}),i(e))}},async forkConversation(e,t,n=`local`){return r().sessionForkPending||r().sessionSwitching||d||!await W.selectSession(e,t)?!1:W.forkMessage({scope:`conversation`,sessionPath:e,sessionId:t,environment:n})},async forkMessage(n,i){let a=`scope`in n&&n.scope===`conversation`;if(a&&i||i?.mode===`edit`&&(!i.content.trim()||i.content.length>12e3))return!1;let o=r(),s=o.snapshot?.selectedSession;if(o.sessionForkPending||d)return!1;if(!s||o.workspaceDraft||o.sessionSwitching||o.promptAdmissionPending||o.promptAdmissionRecovery||!a&&(o.liveRunning||o.activeTurn||o.snapshot?.runtime.status!==`idle`)||o.modelSelectionPending||!rj(o.snapshot)||s.id!==n.sessionId||s.path!==n.sessionPath||o.selectedPath!==n.sessionPath||s.path.startsWith(`current:`))return t({notice:In.t(`forkSessionUnavailable`)}),!1;let f=`entryId`in n?n.entryId:void 0,p=u?.sessionId===n.sessionId&&u.sessionPath===n.sessionPath&&u.entryId===f&&u.scope===`conversation`===a&&(!a||u.scope===`conversation`&&(u.environment??`local`)===(n.environment??`local`))&&JSON.stringify(u.rerun)===JSON.stringify(i)?u:{sessionId:n.sessionId,sessionPath:n.sessionPath,...a?{scope:`conversation`,...n.environment===`worktree`?{environment:`worktree`}:{}}:{entryId:f,...i?{rerun:i}:{}},commandId:globalThis.crypto?.randomUUID?.()??`web-fork-${Date.now()}-${++l}`};u=p;let m=c,h=m;t({sessionForkPending:!0,sessionForkCancellation:null,sessionForkEnvironment:a?n.environment??`local`:void 0,notice:null});try{let o=await e.forkSession(p);if(m!==c||r().selectedPath!==n.sessionPath)return!1;if(o.commandId!==p.commandId||o.source.sessionId!==n.sessionId||o.source.sessionPath!==n.sessionPath||!a&&o.source.entryId!==f||!o.source.entryId)throw Error(In.t(`forkSessionUncertain`));if(o.state!==`forked`)return t({notice:[In.t(o.state===`cancelled`?`forkSessionCancelled`:`forkSessionUncertain`),o.reason,o.preservedWorktreePath?In.t(`sidebarForkWorktreePreserved`,{path:o.preservedWorktreePath}):void 0].filter(Boolean).join(` `)}),o.state===`cancelled`?u=null:await W.refreshSnapshot({epoch:m}),!1;if(!o.sessionId||!o.sessionPath||o.sessionId===n.sessionId||o.sessionPath===n.sessionPath)throw Error(In.t(`forkSessionUncertain`));let s=++c;h=s,v=null,_=null,ue(),B(),t({...H(),...re(),selectedPath:o.sessionPath,historyAnchor:null,historyNavigation:null,createdSession:null,draftModel:null,sessionSwitching:!0});let l=await W.refreshSnapshot({epoch:s});if(!l&&s===c&&r().selectedPath===o.sessionPath&&(l=await W.refreshSnapshot({epoch:s})),s!==c)return!1;let d=r().snapshot;if(o.replayed&&l&&d?.selectedSession?.id===o.sessionId&&d.selectedSession.path===o.sessionPath&&!rj(d)){if(l=await W.selectSession(o.sessionPath,o.sessionId)===!0,s!==c)return!1;d=r().snapshot}if(!l||r().selectedPath!==o.sessionPath||d?.selectedSession?.id!==o.sessionId||d.selectedSession.path!==o.sessionPath||!rj(d))return t({notice:In.t(`forkSessionUncertain`)}),!1;if(u=null,i){let e=o.prompt;if(!e||typeof e.content!=`string`||!Array.isArray(e.images))throw Error(In.t(`forkSessionUncertain`));t({sessionForkPending:!1,sessionSwitching:!1});let n=W.sendPrompt(e.content,e.images,void 0,void 0,{epoch:s,sessionId:o.sessionId,sessionPath:o.sessionPath,workspacePath:d.selectedSession.cwd}),i=[...r().liveMessages].reverse().find(e=>e.optimistic?.sessionId===o.sessionId&&e.optimistic?.sessionPath===o.sessionPath)?.optimistic?.commandId??p.commandId,a=await n;return s!==c||r().selectedPath!==o.sessionPath?!1:a?(t({notice:{kind:`success`,message:In.t(`messageRerunStarted`)}}),!0):(r().promptAdmissionRecovery||t({restoredPromptDraft:{sessionId:o.sessionId,sessionPath:o.sessionPath,commandId:i,content:e.content,images:e.images}}),!1)}return t({notice:{kind:`success`,message:In.t(`forkSessionCreated`)}}),!0}catch(e){return h===c&&(e instanceof tf&&[`SESSION_CONFLICT`,`SESSION_FORK_UNAVAILABLE`,`SESSION_FORK_CAPACITY`].includes(e.code??``)?(u=null,t({notice:a?e.message:In.t(`forkSessionUnavailable`)})):t({notice:In.t(`forkSessionUncertain`)})),!1}finally{t({sessionForkPending:!1,sessionForkCancellation:null,sessionForkEnvironment:void 0}),c===h&&h!==m&&r().sessionSwitching&&t({sessionSwitching:!1})}},async savePreferences(t){try{await e.savePreferences(t),await W.refreshSnapshot()}catch(e){throw i(e),e}},async renameSession(t,n){try{await e.renameSession(t,n),await W.refreshSnapshot()}catch(e){throw i(e),e}},async releaseSessionWorktree(t){let n=JSON.stringify([t.sessionId,t.sessionPath,t.worktreePath]),r=f.get(n);if(r?.pending)return r.pending;if(!r&&f.size>=128){let e=[...f].find(([,e])=>e.state===`preserved`&&!e.pending);if(e)f.delete(e[0]);else throw Error(In.t(`managedWorktreeRecoveryFull`))}let i={commandId:r?.state===`uncertain`?r.commandId:crypto.randomUUID(),state:`uncertain`,pending:void 0};return f.set(n,i),i.pending=(async()=>{try{let r=await e.releaseSessionWorktree({...t,commandId:i.commandId});if(r.commandId!==i.commandId||r.sessionId!==t.sessionId||r.sessionPath!==t.sessionPath||r.worktreePath!==t.worktreePath||![`removed`,`preserved`,`uncertain`].includes(r.state))throw Error(In.t(`managedWorktreeUncertain`));return r.state===`removed`?f.delete(n):i.state=r.state,r}finally{i.pending=void 0}})(),i.pending},async deleteSession(n,a,o){if(d||r().sessionForkPending||r().sessionSwitching)return!1;d=!0;let s=c;try{let i=await e.deleteSession({sessionPath:n,sessionId:a,commandId:o});if(i.commandId!==o||i.sessionId!==a||i.sessionPath!==n)throw Error(In.t(`sessionDeleteUncertain`));return i.state===`deleted`?(s===c&&r().selectedPath===n&&(++c,ue(),B(),_=null,v=null,t({...H(),...re(),selectedPath:null,historyAnchor:null,historyNavigation:null,workspaceDraft:!0,createdSession:null})),await W.refreshSnapshot(),t({notice:i.worktreeReleaseTarget?{kind:`success`,message:In.t(`managedWorktreeRetainedAfterDelete`,{path:i.worktreeReleaseTarget.worktreePath})}:i.metadataCleanupPending?In.t(`sessionDeleteMetadataPending`):{kind:`success`,message:In.t(`sessionDeleted`)}}),!0):(s===c&&(await W.refreshSnapshot({epoch:s}),t({notice:In.t(i.state===`cancelled`?`sessionDeleteCancelled`:`sessionDeleteUncertain`)})),!1)}catch(e){return s===c&&i(e),!1}finally{d=!1}},async setSessionPin(t,n,r,a){try{await e.setSessionPin(t,n,r,a),await W.refreshSnapshot()}catch(e){throw i(e),e}},async archiveSession(n){let a=r().snapshot?.sessions.find(e=>e.path===n);try{await e.archiveSession(n);let r={key:crypto.randomUUID(),path:n,sessionId:a?.id,title:ZA(a??{},In.t(`untitledSession`))};t(e=>({archiveNotices:[r,...e.archiveNotices.filter(e=>e.path!==n)].slice(0,3)})),await W.refreshSnapshot()}catch(e){i(e)}},dismissArchiveNotice(e){t(t=>({archiveNotices:t.archiveNotices.filter(t=>t.key!==e)}))},async setSidebarPin(t,n,r){try{await e.setSidebarPin(t,n,r),await W.refreshSnapshot()}catch(e){throw i(e),e}},async setWorkspaceOrder(t,n){try{await e.setWorkspaceOrder(t,n),await W.refreshSnapshot()}catch(e){throw e instanceof tf&&e.code===`WORKSPACE_ORDER_CHANGED`&&await W.refreshSnapshot(),i(e),e}},async setSessionOrder(t,n,r){try{await e.setSessionOrder(t,n,r),await W.refreshSnapshot()}catch(e){throw i(e),e}},async setSessionRead(t,n,r,a){try{await e.setSessionRead(t,n,r,a),await W.refreshSnapshot()}catch(e){throw e instanceof tf&&e.code===`SESSION_READ_STATE_CHANGED`?await W.refreshSnapshot():i(e),e}},async unarchiveSession(n){let r=c;try{if(await e.unarchiveSession(n),t(e=>({archiveNotices:e.archiveNotices.filter(e=>e.path!==n)})),r!==c)return!0;let i=p,a=await W.refreshSnapshot({epoch:r});return!a&&r===c&&p>i+1&&(a=await W.refreshSnapshot({epoch:r})),r!==c||a}catch(e){return r===c&&i(e),!1}},async selectModel(e){let[n,...i]=e.split(`/`),a=i.join(`/`),o=r();if(!n||!a||o.sessionSwitching||o.modelSelectionPending||o.promptAdmissionPending||!o.workspaceDraft&&(o.liveRunning||o.snapshot?.runtime.status===`running`))return!1;let s=o.snapshot?.selectedSession?.id;if(o.workspaceDraft||!s&&!o.snapshot?.currentSessionId){let e=[...o.snapshot?.models??[],...o.modelSearch.models].find(e=>e.provider===n&&e.id===a);return e&&t({draftModel:e,notice:null}),!!e}return!s||!o.selectedPath||!rj(o.snapshot)||s!==o.snapshot?.currentSessionId||o.selectedPath!==o.snapshot?.selectedSession?.path?!1:(ue(),U({provider:n,id:a},c,s,o.selectedPath))},async searchModels(n){let i=n.trim();if(!i){t(re());return}D?.abort();let a=new AbortController;D=a;let o=++O,s=c,l=r().snapshot?.currentSessionId;t({modelSearch:{query:i,status:`loading`,models:[],totalMatches:0,matchesOmitted:0,error:null}});try{let n=await e.searchModels(i,l,a.signal);if(a.signal.aborted||s!==c||o!==O)return;t({modelSearch:{query:i,status:`ready`,models:n.models,totalMatches:n.totalMatches,matchesOmitted:n.truncation.matchesOmitted,error:null}})}catch(e){if(a.signal.aborted||s!==c||o!==O)return;t({modelSearch:{query:i,status:`error`,models:[],totalMatches:0,matchesOmitted:0,error:e instanceof Error?e.message:String(e)}})}finally{D===a&&(D=null)}},clearModelSearch(){t(re())},selectThinking(e){let n=r(),i=n.snapshot?.thinking,a=n.snapshot?.selectedSession?.id;!e||!i?.supported||n.sessionSwitching||n.modelSelectionPending||n.workspaceDraft||!a||!rj(n.snapshot)||a!==n.snapshot?.currentSessionId||n.selectedPath!==n.snapshot?.selectedSession?.path||n.liveRunning||n.snapshot?.runtime.status===`running`||e!==(n.thinkingPendingLevel??i.level)&&(k=e,A++,t({thinkingPendingLevel:e}),fe())},async selectPlanMode(n){let a=r(),o=a.snapshot,s=o?.selectedSession;if(!o||!s||!rj(o,s)||a.workspaceDraft||a.sessionSwitching||a.planSelectionPending||a.promptAdmissionPending||a.promptAdmissionRecovery||a.liveRunning||o.runtime.status!==`idle`||o.runtime.planRevision===void 0)return;let l=c,u=++R;t({planSelectionPending:!0});try{if(await e.setPlanMode(s.id,s.path,n,o.runtime.planRevision),l===c&&u===R&&!await W.refreshSnapshot({epoch:l}))throw Error(In.t(`planModeUnconfirmed`))}catch(e){l===c&&u===R&&(await W.refreshSnapshot({epoch:l}),l===c&&u===R&&i(e))}finally{l===c&&u===R&&t({planSelectionPending:!1})}},async preparePlanImplementation(){let n=r(),a=n.snapshot,o=a?.selectedSession,s=o?.id;if(!s||!rj(a,o)||s!==a?.currentSessionId||!o?.path||n.selectedPath!==o.path||n.workspaceDraft||n.sessionSwitching||n.planSelectionPending||n.promptAdmissionPending||n.promptAdmissionRecovery||n.liveRunning||a.runtime.status!==`idle`||a.runtime.plan!==`ready`||typeof a.runtime.planRevision!=`string`)return null;let l=c,u=++R,d=o.path,f=a.runtime.planRevision;t({planSelectionPending:!0});try{let t;try{t=await e.preparePlanImplementation(s,d,f)}catch(e){if(l===c&&u===R){try{await W.refreshSnapshot({epoch:l})}catch{}l===c&&u===R&&i(e)}return null}let n=r();return l!==c||u!==R||!rj(n.snapshot)||n.snapshot?.currentSessionId!==s||n.snapshot.selectedSession?.path!==d||n.selectedPath!==d?null:t.sessionId!==s||t.status!==`ready`||t.revision!==f||n.snapshot?.runtime.plan!==`ready`||n.snapshot.runtime.planRevision!==f?(i(Error(In.t(`planModeUnconfirmed`))),null):{prompt:t.prompt,sessionId:s,sessionPath:d,planRevision:f}}finally{l===c&&u===R&&t({planSelectionPending:!1})}},async cancelActiveTurn(){let n=r().activeTurn??r().snapshot?.runtime.activeTurn;if(!n||!rj(r().snapshot)||r().turnCancellationPending||r().sessionSwitching)return;let a=c;t({turnCancellationPending:!0});try{await e.cancelActiveTurn(n)}catch(e){if(a!==c)return;await W.refreshSnapshot({epoch:a}),a===c&&i(e)}finally{a===c&&t({turnCancellationPending:!1})}},async sendPrompt(n,o=[],s,l,u){if(r().sessionForkPending||r().planSelectionPending)return!1;let d=n.trim();if(d.length>12e3)return t({notice:In.t(`promptTooLong`,{count:d.length,limit:Hd})}),!1;let f=o.map(({data:e,mimeType:t,name:n})=>({data:e,mimeType:t,...n===void 0?{}:{name:n}})),p=JSON.stringify(f.map(({data:e,mimeType:t,name:n})=>[t,n??``,e])),m=r();if(u&&(u.epoch!==c||!a(u)||m.workspaceDraft))return!1;let h=m.promptAdmissionRecovery,y=h?.phase===`submitting`?h:null,b=m.activeTurn??m.snapshot?.runtime.activeTurn;if(l?.streamingBehavior===`steer`&&!y&&(s||m.turnCancellationPending||!b||b.commandId!==l.expectedTurnCommandId||m.workspaceDraft))return t({notice:In.t(`steerStaleTurn`)}),!1;let x=m.selectedWorkspace;if(!x||!d&&f.length===0&&!l?.retryEntryId||m.sessionSwitching||m.promptAdmissionPending||h&&!y||m.promptAdmissionResolution||m.modelSelectionPending||m.thinkingPendingLevel!==null)return!1;let S=r().workspaceDraft||!r().snapshot?.selectedSession?.id;if(s&&S)return!1;let C=S?await W.createSession(x):null;if(S&&!C)return r().notice||t({notice:`The active Session changed before the first message was sent. Your message was not sent.`}),!1;if(S&&r().draftModel)return!1;let w=r().snapshot?.selectedSession,T=C??(w?{epoch:c,sessionId:w.id,sessionPath:w.path,workspacePath:x}:null);if(!T||r().workspaceDraft||!a(T)||r().sessionSwitching||r().promptAdmissionPending||y&&(r().promptAdmissionRecovery?.commandId!==y.commandId||r().promptAdmissionRecovery?.phase!==`submitting`))return!1;let{epoch:E,sessionId:D,sessionPath:O}=T;if(!O||s&&(s.sessionId!==D||s.sessionPath!==O||!s.planRevision))return!1;let k=r().draftModel;if(k&&!await U(k,E,D,O)||r().workspaceDraft||!a(T)||y&&(r().promptAdmissionRecovery?.commandId!==y.commandId||r().promptAdmissionRecovery?.phase!==`submitting`))return!1;let A=++g,j=v?.sessionId===D&&v.sessionPath===O&&v.content===d&&v.imageSignature===p&&v.planRevision===s?.planRevision&&(v.delivery?.streamingBehavior??`followUp`)===(l?.streamingBehavior??`followUp`)&&v.delivery?.expectedTurnCommandId===l?.expectedTurnCommandId&&v.delivery?.retryEntryId===l?.retryEntryId,M=j?v.commandId:globalThis.crypto?.randomUUID?.()??`web-prompt-${Date.now()}-${A}`,N=j?v.optimisticKey:`optimistic-${M}`,P=j?v.timestamp:new Date().toISOString(),F=j?v.afterEntryId:r().snapshot?.selectedSession?.history?.leafEntryId??r().snapshot?.selectedSession?.entries.at(-1)?.id??null;v={sessionId:D,sessionPath:O,content:d,imageSignature:p,images:f,commandId:M,optimisticKey:N,timestamp:P,afterEntryId:F,...s?{planRevision:s.planRevision}:{},...l?{delivery:l}:{}},_=A,t({liveMessages:j||l?.retryEntryId?r().liveMessages:DJ([...r().liveMessages,{key:N,timestamp:P,optimistic:{sessionId:D,sessionPath:O,commandId:M,afterEntryId:F,admitted:!1},message:{role:`user`,content:d,...f.length>0?{parts:f.map(e=>({type:`image`,mimeType:e.mimeType,...e.name?{name:e.name}:{},previewUrl:`data:${e.mimeType};base64,${e.data}`}))}:{}}}]),notice:null,pendingFollowUpsReceipt:null,pendingSteeringReceipt:null,turnTerminalStatus:null,promptAdmissionPending:!0,scrollToBottom:r().scrollToBottom+1});try{let n=l?await e.prompt(D,d,M,O,j,f,s?.planRevision,l):s?await e.prompt(D,d,M,O,j,f,s.planRevision):await e.prompt(D,d,M,O,j,f);if(E!==c||O!==r().selectedPath||D!==r().snapshot?.selectedSession?.id||_!==A)return!1;let i=ee.has(n.id);return v?.commandId===M&&(v=null),t({liveMessages:n.accepted&&n.id===M?LJ(r().liveMessages,D,O,M):r().liveMessages,...rj(r().snapshot)?ae(i,r().livePhase):{},pendingFollowUpsReceipt:rj(r().snapshot)?n.pendingFollowUps??null:null,pendingSteeringReceipt:rj(r().snapshot)?n.pendingSteering??null:null,...y&&r().promptAdmissionRecovery?.commandId===y.commandId?{promptAdmissionRecovery:null,...j?{promptAdmissionResolution:{sessionId:y.sessionId,sessionPath:y.sessionPath,commandId:y.commandId,content:y.content,images:y.images}}:{}}:{}}),oe(120),!0}catch(e){if(E!==c||O!==r().selectedPath||D!==r().snapshot?.selectedSession?.id||_!==A)return!1;let n=e instanceof tf&&[`PLAN_BUSY`,`PLAN_CONFLICT`,`PLAN_CONTROL_UNAVAILABLE`].includes(e.code??``),a=n||e instanceof tf&&[`WORKSPACE_REQUIRED`,`SESSION_CONFLICT`,`TURN_CONFLICT`,`PROMPT_REJECTED`,`COMMAND_CONFLICT`,`PROMPT_ADMISSION_CAPACITY`,`INVALID_PROMPT`,`INVALID_PROMPT_IMAGES`].includes(e.code??``),o=ee.has(M)||r().liveMessages.some(e=>e.optimistic?.sessionId===D&&e.optimistic.sessionPath===O&&e.optimistic.commandId===M&&e.optimistic.admitted)||r().activeTurn?.sessionId===D&&r().activeTurn?.commandId===M;if(!a&&o)return v?.commandId===M&&(v=null),y&&r().promptAdmissionRecovery?.commandId===y.commandId&&t({promptAdmissionRecovery:null,...j?{promptAdmissionResolution:{sessionId:y.sessionId,sessionPath:y.sessionPath,commandId:y.commandId,content:y.content,images:y.images}}:{}}),!0;if(!a&&v?.commandId===M){let n=v;v=null,t({notice:null,promptAdmissionPending:!1,promptAdmissionRecovery:{...n,retryable:!(e instanceof tf)||e.code!==`COMMAND_ADMISSION_UNKNOWN`,phase:`checking`}});let i=await W.refreshSnapshot({resetCursor:!0,epoch:E}),a=r().promptAdmissionRecovery;if(a?.commandId===M){if(r().activeTurn?.sessionId===D&&r().activeTurn?.commandId===M&&r().selectedPath===O&&r().snapshot?.selectedSession?.path===O&&rj(r().snapshot))return t({promptAdmissionRecovery:null,promptAdmissionResolution:{sessionId:a.sessionId,sessionPath:a.sessionPath,commandId:a.commandId,content:a.content,images:a.images}}),!0;t({promptAdmissionRecovery:{...a,phase:i?`ready`:`verification-failed`}})}return!1}return a?(v?.commandId===M&&(v=null),t({liveMessages:r().liveMessages.filter(e=>e.key!==N),...j&&y&&e instanceof tf&&e.code===`PROMPT_REJECTED`?{promptAdmissionRecovery:null}:{}}),n&&(await W.refreshSnapshot({epoch:E}),E!==c||O!==r().selectedPath||_!==A)||i(e),!1):(i(e),!1)}finally{E===c&&_===A&&(_=null,t({promptAdmissionPending:!1}))}},async checkPromptAdmissionRecovery(){let e=r().promptAdmissionRecovery;if(!e||e.phase!==`verification-failed`)return;let n=c;t({notice:null,promptAdmissionRecovery:{...e,phase:`checking`}});let i=await W.refreshSnapshot({resetCursor:!0,epoch:n}),a=r().promptAdmissionRecovery;a?.commandId===e.commandId&&a.phase===`checking`&&t({promptAdmissionRecovery:{...a,phase:i?`ready`:`verification-failed`}})},async retryPromptAdmission(){let e=r().promptAdmissionRecovery;if(!e?.retryable||e.phase!==`ready`||e.sessionPath!==r().selectedPath||e.sessionPath!==r().snapshot?.selectedSession?.path||e.sessionId!==r().snapshot?.selectedSession?.id)return!1;let n=e.images??[];v={...e,images:n,imageSignature:JSON.stringify(n.map(({data:e,mimeType:t,name:n})=>[t,n??``,e])),afterEntryId:e.afterEntryId??null,timestamp:e.timestamp??new Date().toISOString()},t({promptAdmissionRecovery:{...e,phase:`submitting`},notice:null});try{return await W.sendPrompt(e.content,n,e.planRevision?{sessionId:e.sessionId,sessionPath:e.sessionPath,planRevision:e.planRevision}:void 0,e.delivery)}finally{let n=r().promptAdmissionRecovery;n?.commandId===e.commandId&&n.phase===`submitting`&&t({promptAdmissionRecovery:{...n,phase:`ready`}})}},async sendPromptAsNew(e,n,i,a,o){let s=r().promptAdmissionRecovery;if(!s||s.phase!==`ready`||s.sessionPath!==r().selectedPath||s.sessionPath!==r().snapshot?.selectedSession?.path||s.sessionId!==r().snapshot?.selectedSession?.id)return!1;let c=e.trim(),l=n??s.images??[];if(!c&&l.length===0)return!1;v=null,t({promptAdmissionRecovery:{...s,phase:`submitting`},notice:null});let u=!1;try{let e=s.planRevision?{sessionId:s.sessionId,sessionPath:s.sessionPath,planRevision:s.planRevision}:i;return u=e?await W.sendPrompt(c,l,e,void 0,o):await W.sendPrompt(c,l,void 0,void 0,o),u}finally{let e=r().promptAdmissionRecovery;e?.commandId===s.commandId&&e.phase===`submitting`&&t({promptAdmissionRecovery:u?null:{...e,phase:`ready`}})}},abandonPromptAdmission(){let e=r().promptAdmissionRecovery;!e||e.phase===`submitting`||(v?.commandId===e.commandId&&(v=null),t({liveMessages:r().liveMessages.filter(t=>t.key!==e.optimisticKey),notice:null,promptAdmissionRecovery:null}))},acknowledgePromptAdmissionResolution(e){r().promptAdmissionResolution?.commandId===e&&t({promptAdmissionResolution:null})},async discoverCommands(){let n=r(),i=n.snapshot?.selectedSession?.id;if(n.workspaceDraft||!i||!rj(n.snapshot)||i!==n.snapshot?.currentSessionId||n.selectedPath!==n.snapshot?.selectedSession?.path||n.sessionSwitching){B();return}if(n.commandDiscovery.sessionId===i&&(n.commandDiscovery.status===`loading`||n.commandDiscovery.status===`ready`))return;let a=c,o=++L;I?.abort();let s=new AbortController;I=s,t({commandDiscovery:{sessionId:i,status:`loading`,commands:[],totalAvailable:0,commandsOmitted:0,error:null}});try{let n=await e.commands(i,s.signal);if(s.signal.aborted||a!==c||o!==L||i!==r().snapshot?.currentSessionId)return;t({commandDiscovery:{sessionId:i,status:`ready`,commands:n.commands,totalAvailable:n.totalAvailable,commandsOmitted:n.truncation.commandsOmitted,error:null}})}catch(e){if(s.signal.aborted||a!==c||o!==L)return;t({commandDiscovery:{sessionId:i,status:`error`,commands:[],totalAvailable:0,commandsOmitted:0,error:e instanceof Error?e.message:String(e)}})}finally{I===s&&(I=null)}},clearCommandDiscovery:B,setQuery(e){t({query:e})},setSearchOpen(e){t({searchOpen:e,...e?{}:{query:``}})},toggleWorkspace(e){let n=new Set(r().collapsed);n.has(e)?n.delete(e):n.add(e),EJ(xJ,[...n]),t({collapsed:n})},toggleSidebar(e){if(e){t({mobileSidebarOpen:!r().mobileSidebarOpen});return}let n=!r().sidebarCollapsed;try{window.sessionStorage.setItem(SJ,String(n))}catch{}t({sidebarCollapsed:n})},closeMobileSidebar(){t({mobileSidebarOpen:!1})},clearNotice(){t({notice:null})}};return{planSelectionPending:!1,activeTurn:null,turnCancellationPending:!1,turnTerminalStatus:null,pendingFollowUpsReceipt:null,pendingSteeringReceipt:null,snapshot:null,historyAnchor:null,historyNavigation:null,sessionForkPending:!1,sessionForkCancellation:null,cursor:null,selectedPath:s?.path??null,selectedWorkspace:null,workspaceDraft:o&&!s,draftModel:null,createdSession:null,modelSelectionPending:!1,modelSearch:{query:``,status:`idle`,models:[],totalMatches:0,matchesOmitted:0,error:null},collapsed:wJ(xJ),sidebarCollapsed:TJ(SJ),mobileSidebarOpen:!1,query:``,searchOpen:!1,connection:`connecting`,archiveNotices:[],notice:o&&!s?In.t(`sessionLinkUnavailable`):null,liveMessages:[],liveRunning:!1,livePhase:`idle`,liveRetry:null,thinkingStarts:{},thinkingDurations:{},promptAdmissionPending:!1,promptAdmissionRecovery:null,promptAdmissionResolution:null,restoredPromptDraft:null,sessionSwitching:!1,scrollToBottom:0,thinkingPendingLevel:null,commandDiscovery:ie(),actions:W}})}var VJ=BJ(),HJ=340,UJ=220,WJ=520,GJ=190,KJ=520,qJ=360,JJ=720,YJ=320,XJ=440,ZJ=1100;function QJ(e,t,n){return Math.min(n,Math.max(t,e))}function $J(){UR();let e=pr(VJ),{t}=cr(),{actions:n}=e,r=(0,_.useRef)(null),i=(0,_.useRef)(null),a=(0,_.useRef)(!1),o=(0,_.useRef)(null),s=(0,_.useRef)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(void 0),d=(0,_.useCallback)(e=>{u.current=e},[]),f=(0,_.useMemo)(gL,[]),p=(0,_.useRef)(new Set),[,m]=(0,_.useState)(0),[h,g]=(0,_.useState)(null),v=(0,_.useMemo)(()=>new Map,[]),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(),[C,w]=(0,_.useState)(!1),[T,E]=(0,_.useState)(!1),[D,O]=(0,_.useState)(()=>window.innerWidth),[k,A]=(0,_.useState)({sidebar:HJ,auxiliary:KJ}),[j,M]=(0,_.useState)(!1),N=!!e.snapshot,P=e.snapshot?.preferences.sidebarWidth,F=e.snapshot?.preferences.auxiliaryWidth;(0,_.useEffect)(()=>{!N||j||C||A({sidebar:P??HJ,auxiliary:F??KJ})},[P,F,N,j,C]),(0,_.useEffect)(()=>{if(!j||C)return;let e=window.setTimeout(()=>{n.savePreferences({sidebarWidth:k.sidebar,auxiliaryWidth:k.auxiliary}).catch(()=>void 0)},200);return()=>window.clearTimeout(e)},[n,k,j,C]);let I=(e,t)=>{M(!0),A(n=>({...n,[e]:t}))},[L,R]=(0,_.useState)(()=>window.matchMedia?.(`(max-width: 760px)`).matches??!1),ee=L&&e.mobileSidebarOpen;(0,_.useEffect)(()=>{let e=window.matchMedia?.(`(max-width: 760px)`);if(!e)return;let t=()=>{R(e.matches),e.matches||n.closeMobileSidebar()};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[n]),(0,_.useEffect)(()=>{let e=()=>O(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let[z,B]=(0,_.useState)(`chat`),[V,H]=(0,_.useState)(null),[te,ne]=(0,_.useState)(null),[re,ie]=(0,_.useState)(aJ);(0,_.useEffect)(()=>{let e=()=>oJ(re);e(),window.addEventListener(`pagehide`,e);let t=()=>{document.visibilityState===`hidden`&&e()};return document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,t),e()}},[re]);let ae=e.workspaceDraft?void 0:e.snapshot?.selectedSession,U=re.find(e=>e.sessionId===ae?.id&&e.sessionPath===ae?.path),oe=U?.open??!1,se=U?.reviewTurn,ce=(0,_.useCallback)(e=>{let t=VJ.getState().snapshot?.selectedSession;t&&ie(n=>n.map(n=>n.sessionId===t.id&&n.sessionPath===t.path?e(n):n))},[]),le=(0,_.useCallback)(e=>ce(t=>({...t,open:e})),[ce]),ue=e=>ce(t=>({...t,reviewTurn:e??void 0})),[de,fe]=(0,_.useState)(null),[pe,me]=(0,_.useState)(ZI),W=(0,_.useCallback)((e,t)=>{let n=VJ.getState(),r=n.snapshot?.selectedSession;n.workspaceDraft||n.sessionSwitching||!r||!r.id||(a.current||(i.current=document.activeElement instanceof HTMLElement?document.activeElement:null),a.current=!0,c.current=null,le(!1),me(n=>({sessionId:r.id,sessionPath:r.path,id:e,kind:t,navigation:(n?.navigation??0)+1})))},[le]),he=pe&&!e.workspaceDraft&&!e.sessionSwitching&&pe.sessionId===e.snapshot?.selectedSession?.id&&pe.sessionPath===e.snapshot?.selectedSession?.path;(0,_.useEffect)(()=>{e.snapshot&&!e.sessionSwitching&&pe&&!he&&me(null)},[e.snapshot,e.sessionSwitching,pe,he]),(0,_.useEffect)(()=>QI(pe),[pe]),(0,_.useEffect)(()=>{if(he||!a.current)return;a.current=!1;let e=i.current;i.current=null,queueMicrotask(()=>{e?.isConnected&&e.checkVisibility()&&e.focus()})},[he]);let ge=e.snapshot?.models.find(e=>e.current),_e=JSON.stringify([ge?.provider,ge?.id]),ve=t=>{let n=e.snapshot,r=n?.selectedSession;e.workspaceDraft||!n||!r||e.sessionSwitching||!rj(n,r)||(c.current=null,le(!1),H({sessionId:r.id,sessionPath:r.path,cwd:r.cwd,model:ge?.label??``,modelKey:_e,terminalId:t}))},ye=V&&!e.workspaceDraft&&!e.sessionSwitching&&rj(e.snapshot,{id:V.sessionId,path:V.sessionPath})&&V.sessionPath===e.snapshot?.selectedSession?.path&&V.modelKey===_e;(0,_.useEffect)(()=>{V&&!ye&&H(null)},[V,ye]);let be=(0,_.useCallback)(()=>{H(null);let e=o.current;o.current=null,e&&requestAnimationFrame(()=>{e.isConnected&&e.checkVisibility()&&e.focus()})},[]),xe=te&&!e.workspaceDraft&&!e.sessionSwitching&&rj(e.snapshot,{id:te.sessionId,path:te.sessionPath})&&te.sessionPath===e.snapshot?.selectedSession?.path;(0,_.useEffect)(()=>{te&&!xe&&ne(null)},[te,xe]);let Se=async(e=`general`)=>{s.current=document.activeElement instanceof HTMLElement?document.activeElement:null;let t=await n.prepareSession();if(!t)return;let r=VJ.getState(),i=r.snapshot,a=i?.selectedSession;r.workspaceDraft||!a||r.sessionSwitching||!rj(i,a)||a.id!==t.sessionId||a.path!==t.sessionPath||(n.closeMobileSidebar(),H(null),me(null),c.current=null,le(!1),ne({sessionId:a.id,sessionPath:a.path,cwd:a.cwd,entry:e}))},Ce=(0,_.useCallback)(()=>{ne(null);let e=new URL(window.location.href);e.searchParams.delete(`settings`),window.history.replaceState(window.history.state,``,e),requestAnimationFrame(()=>{let e=s.current;s.current=null,e?.isConnected&&e.checkVisibility()?e.focus():document.querySelector(`[data-provider-settings-trigger]`)?.focus()})},[]),we=()=>{o.current=s.current??document.querySelector(`[data-provider-settings-trigger]`),ne(null),ve()},Te=async e=>{if(await n.sendPrompt(`/openpi-setup ${e}`))return!0;let r=VJ.getState();throw Error((typeof r.notice==`string`?r.notice:null)||t(r.promptAdmissionRecovery?`setupResolveAdmission`:r.liveRunning||r.activeTurn?`settingsSetupBusyHint`:`setupRequestFailed`))};(0,_.useEffect)(()=>(n.start(),n.stop),[n]);let G=e.workspaceDraft?void 0:e.snapshot?.selectedSession,Ee=_L(G),De=G?.id,Oe=G?.path,ke=!!(G&&!p.current.has(Ee)&&f.get(Ee)?.position?.key&&f.get(Ee)?.position?.pinned===!1);(0,_.useEffect)(()=>{let t=VJ.getState(),n=t.workspaceDraft?void 0:t.snapshot?.selectedSession;if(!n||n.id!==De||n.path!==Oe||e.sessionSwitching||p.current.has(Ee))return;let r=f.get(Ee)?.position,i=()=>{p.current.add(Ee),m(e=>e+1)};if(!r?.key||r.pinned||f.get(Ee)?.window||e.historyNavigation?.sessionId===n.id&&e.historyNavigation.sessionPath===n.path){i();return}let a={sessionId:n.id,sessionPath:n.path,entryId:r.entryId??r.key},o=new AbortController,s,c=e=>{let t=e.target;!(t instanceof Element)||!t.closest(`.conversation, .turn-rail, .jump-to-latest`)||e instanceof KeyboardEvent&&![`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(e.key)||(o.abort(),i(),g(e=>e?.sessionId===a.sessionId&&e.sessionPath===a.sessionPath?null:e))};for(let e of[`wheel`,`touchstart`,`pointerdown`,`keydown`])document.addEventListener(e,c,!0);let l=e=>{let t=VJ.getState();o.signal.aborted||p.current.has(Ee)||t.historyNavigation||t.sessionSwitching||t.workspaceDraft||t.selectedPath!==a.sessionPath||t.snapshot?.selectedSession?.id!==a.sessionId||t.snapshot.selectedSession.path!==a.sessionPath||f.get(Ee)?.position!==r||e.id!==a.sessionId||e.path!==a.sessionPath||e.history?.anchorEntryId!==a.entryId||e.history.anchorOnBranch!==!0||!e.entries.some(e=>e.id===a.entryId)||(g({...a,session:e,restorePosition:r,revision:-1}),i())};if(e.connection===`connected`)if(n.entries.some(e=>e.id===a.entryId))l({...n,history:{leafEntryId:n.history?.leafEntryId??null,beforeEntryId:n.history?.beforeEntryId??null,anchorEntryId:a.entryId,anchorOnBranch:!0}});else{let e=t=>{new rf().sessionMessageWindow(a,o.signal).then(l,()=>{!o.signal.aborted&&t===0&&(s=window.setTimeout(()=>e(1),500))})};e(0)}return()=>{o.abort(),window.clearTimeout(s);for(let e of[`wheel`,`touchstart`,`pointerdown`,`keydown`])document.removeEventListener(e,c,!0)}},[De,Oe,e.connection,e.sessionSwitching,e.historyNavigation,Ee,f]);let Ae=rj(e.snapshot,G),je=(0,_.useMemo)(()=>aj((G?.entries??[]).flatMap(e=>e.message?[e.message]:[])),[G?.entries]),Me=Ae?e.snapshot?.runtime.capabilities.subagents:void 0,Ne=(0,_.useMemo)(()=>oj(Me?.items??[],je,Ae?e.snapshot?.runtime.capabilities.workflows?.items:void 0,e.connection===`connected`),[Me?.items,je,Ae,e.snapshot?.runtime.capabilities.workflows?.items,e.connection]),Pe=e.snapshot?.selectedExecution,Fe=Pe?.sessionId===G?.id&&Pe?.sessionPath===G?.path?Pe:void 0,Ie=Ae&&(e.liveRunning||!!e.activeTurn||e.snapshot?.runtime.status===`running`)||Fe?.status===`running`,Le=qN(G,e.snapshot?.cursor,{active:oe&&de===`review`,running:Ie,initialSource:U?.reading.review?.scope.startsWith(`workspace:`)?U.reading.review.source:`unstaged`,initialBaseRef:U?.reading.review?.baseRef}),Re=!!(U&&G&&e.selectedPath===G.path&&U.sessionId===G.id&&U.sessionPath===G.path),ze=oe&&Re&&!e.sessionSwitching;(0,_.useEffect)(()=>{G?.id,G?.path,c.current=null},[G?.id,G?.path]),(0,_.useEffect)(()=>{!U||e.sessionSwitching||ie(e=>e.at(-1)===U?e:[...e.filter(e=>e!==U),U])},[U,e.sessionSwitching]);let Be=(t=`launcher`)=>{!G||e.sessionSwitching||(y&&l.current?.close({restoreFocus:!1}),ze||(c.current=document.activeElement instanceof HTMLElement?document.activeElement:null),H(null),me(null),ie(e=>{let n=e.find(e=>e.sessionId===G.id&&e.sessionPath===G.path),r={sessionId:G.id,sessionPath:G.path,tool:t,requestRevision:(n?.requestRevision??0)+1,open:!0,reading:n?.reading??{},reviewTurn:t===`review`?void 0:n?.reviewTurn};return[...e.filter(e=>e!==n),r].slice(-32)}))},Ve=()=>{E(!1),le(!1);let e=c.current;c.current=null,requestAnimationFrame(()=>{e?.isConnected&&e.checkVisibility()&&e.focus()})},He=!e.sessionSwitching&&!e.workspaceDraft&&rj(e.snapshot,G)?G:void 0;KR(He?.id,He?.path,async(e,t)=>{Be(`browser`);let n=Date.now()+5e3;for(;!u.current&&!t.aborted&&Date.now()setTimeout(e,40));return t.aborted?void 0:u.current?.(e)});let Ue=(0,_.useRef)(AI(new URLSearchParams(location.search).get(`settings`))),We=(0,_.useEffectEvent)(e=>{Se(e)});(0,_.useEffect)(()=>{if(!Ue.current||!e.snapshot||e.sessionSwitching)return;let t=Ue.current;Ue.current=void 0,We(t)},[e.snapshot,e.sessionSwitching]);let Ge=!!(he||ze||y);(0,_.useEffect)(()=>{(!Ge||D<=ZJ)&&E(!1)},[Ge,D]);let qe=Math.max(UJ,Math.min(WJ,D-XJ-(Ge&&!T?k.auxiliary:0))),Je=QJ(k.sidebar,UJ,qe),Ye=Math.max(qJ,Math.min(JJ,D-(e.sidebarCollapsed?56:Je)-XJ)),Xe=QJ(k.auxiliary,qJ,Ye),Ze={"--sidebar-width":`${Je}px`,"--auxiliary-width":`${Xe}px`},Qe=()=>{y?l.current?.close():ze?Ve():he&&me(null)},$e=!e.snapshot,et=e.sessionSwitching?e.snapshot?.sessions.find(t=>t.path===e.selectedPath)?.cwd:e.workspaceDraft?e.selectedWorkspace:G?.cwd??e.selectedWorkspace,rt=e.snapshot?.workspaces.find(e=>e.path===et),at=e.snapshot?.sessions.find(e=>e.path===G?.path&&e.id===G?.id),ot=e.sessionSwitching?e.snapshot?.sessions.find(t=>t.path===e.selectedPath):void 0,st=e.sessionSwitching?ot?ZA(ot,t(`untitledSession`)):t(`switchingSession`):G?ZA(at??{},t(`untitledSession`)):e.selectedWorkspace?t(`newSession`):`OpenPI`,ct=!!G?.rerun||G?.entries.some(e=>e.type===`message`&&e.message||e.type===`compaction`)||!!G?.history?.beforeEntryId||e.liveMessages.length>0,lt=!$e&&!e.sessionSwitching&&(!G||!ct&&!(e.snapshot?.selectedExecution?.sessionId===G.id&&e.snapshot.selectedExecution?.sessionPath===G.path&&e.snapshot.selectedExecution.compaction)),ut=(0,_.useCallback)((e,t)=>t?n.sendPrompt(``,[],void 0,{streamingBehavior:`followUp`,retryEntryId:t}):n.sendPrompt(e),[n]);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{inert:xe?!0:void 0,"aria-hidden":xe?!0:void 0,className:`app-shell ${e.sidebarCollapsed?`sidebar-collapsed`:``} ${e.mobileSidebarOpen?`sidebar-open`:``} ${he?`with-subagent-panel`:``} ${ze?`with-workbar-panel`:``} ${y?`with-artifact-panel`:``} ${T?`center-collapsed`:``} ${C?`is-resizing`:``} ${$e?`shell-loading`:``}`,style:Ze,children:(0,K.jsxs)(Bk,{ref:l,sessionId:G?.id,sessionPath:G?.path,disabled:!!(e.workspaceDraft||e.sessionSwitching||he||xe),onOpen:()=>{b(!0),me(null),le(!1),H(null)},onClose:()=>{b(!1)},children:[(0,K.jsx)(dP,{sessionViewVisible:z===`chat`&&!T&&!xe&&!e.sessionSwitching&&!e.workspaceDraft,connected:e.connection===`connected`,snapshot:e.snapshot,selectedPath:e.workspaceDraft?null:e.selectedPath,selectedWorkspace:e.selectedWorkspace,collapsed:e.collapsed,query:e.query,searchOpen:e.searchOpen,mobileOpen:ee,settingsDisabled:!!(e.sessionSwitching||e.modelSelectionPending||!e.snapshot),returnFocusRef:r,onOpenSettings:()=>void Se(`general`),actions:n}),e.sidebarCollapsed&&(0,K.jsx)(`button`,{className:`sidebar-expand`,type:`button`,"aria-label":t(`expandSidebar`),title:t(`expandSidebar`),onClick:()=>n.toggleSidebar(!1),children:(0,K.jsx)(nt,{})}),(0,K.jsxs)(`main`,{inert:ee,className:`conversation-shell ${G?`has-view`:``} ${lt&&(!G||z===`chat`)?`landing`:``}`,children:[(0,K.jsxs)(`header`,{className:`task-header`,children:[(0,K.jsx)(`button`,{className:`task-header-menu sidebar-shell-toggle`,ref:r,type:`button`,"aria-label":t(L?`openSidebar`:e.sidebarCollapsed?`expandSidebar`:`collapseSidebar`),"aria-controls":`session-sidebar`,"aria-expanded":L?ee:!e.sidebarCollapsed,onClick:()=>n.toggleSidebar(L),children:L?(0,K.jsx)(Ke,{}):(0,K.jsx)(tt,{})}),(0,K.jsxs)(`div`,{className:`task-identity`,children:[et&&(0,K.jsxs)(`span`,{className:`task-workspace`,title:et,children:[rt?.name||QA(et),(0,K.jsxs)(`span`,{className:`sr-only`,children:[` `,et]})]}),(0,K.jsx)(`h1`,{title:st,children:st})]}),(0,K.jsx)(qR,{usage:G&&!e.sessionSwitching?e.snapshot?.usage:void 0,workspace:rt?.name||G&&QA(G.cwd),sessionId:G?.id},G?`usage:${G.id}:${G.path}`:`usage:no-session`),G&&!e.sessionSwitching&&(0,K.jsx)(LI,{sessionId:G.id,workspace:rt?.name||QA(G.cwd),agents:Ne,omitted:(Me?.omitted??0)+(Ae?(e.snapshot?.runtime.capabilities.workflows?.items??[]).reduce((e,t)=>e+(t.children?.omitted??0),0):0),review:Le.result,reviewLoading:Le.loading,reviewError:Le.error,sessionPath:G.path,revision:G.history?.leafEntryId??void 0,onAddSources:Ae?()=>S(e=>({sessionId:G.id,path:G.path,revision:(e?.revision??0)+1})):void 0,onSubagents:()=>W(),onReview:()=>Be(`review`)},`overview:${G.id}:${G.path}`),(0,K.jsx)(`button`,{type:`button`,className:`task-tools-trigger`,"aria-label":t(`openTools`),title:t(`openTools`),disabled:!G||e.sessionSwitching,onClick:e=>{y&&l.current?.close({restoreFocus:!1}),c.current=e.currentTarget,Re&&!ze?le(!0):Be(`launcher`)},children:(0,K.jsx)(it,{"aria-hidden":`true`})}),(0,K.jsx)(`span`,{className:`connection-state ${e.connection}`,children:t(e.connection)})]}),G&&!e.sessionSwitching&&(0,K.jsx)(`div`,{className:`conversation-view-row`,children:(0,K.jsxs)(`fieldset`,{className:`conversation-view-switch`,"aria-label":t(`conversationView`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-pressed":z===`chat`,onClick:()=>B(`chat`),children:t(`chatView`)}),(0,K.jsx)(`button`,{type:`button`,"aria-pressed":z===`trajectory`,onClick:()=>B(`trajectory`),children:t(`trajectory`)})]})}),$e?(0,K.jsxs)(`section`,{className:`shell-state`,role:`status`,"aria-live":`polite`,children:[(0,K.jsx)(hr,{compact:!0}),(0,K.jsx)(`p`,{children:t(e.connection===`unavailable`?`unavailable`:`connecting`)}),e.connection===`unavailable`&&(0,K.jsxs)(`button`,{type:`button`,onClick:()=>void n.refreshSnapshot({resetCursor:!0}),children:[(0,K.jsx)(dt,{"aria-hidden":`true`}),` `,t(`retryAdmissionCheck`)]})]}):e.sessionSwitching?(0,K.jsx)(`div`,{className:`conversation switching`,role:`status`,children:(0,K.jsxs)(`div`,{className:`conversation-running`,children:[(0,K.jsx)(`span`,{className:`conversation-running-dot`}),(0,K.jsx)(`span`,{children:t(`switchingSession`)})]})}):z===`trajectory`&&G&&e.snapshot?(0,K.jsx)(mL,{snapshot:e.snapshot,running:Ie},G.path):lt?(0,K.jsx)(`section`,{className:`conversation landing-conversation`,"aria-label":`Conversation`,children:(0,K.jsxs)(`div`,{className:`landing-welcome`,children:[(0,K.jsx)(hr,{animated:!0}),(0,K.jsx)(`p`,{className:`landing-tagline`,children:t(`landingTagline`)})]})}):e.snapshot?(0,K.jsx)(HR,{resultExposureEnabled:!T&&!xe&&!e.sessionSwitching&&!e.workspaceDraft&&z===`chat`,readingCache:f,readingRestorePending:ke,snapshot:e.snapshot,liveMessages:e.liveMessages,liveRunning:e.liveRunning,liveActiveTurn:e.activeTurn,livePhase:e.livePhase,activityObserved:e.connection===`connected`,liveRetry:e.liveRetry,thinkingStarts:e.thinkingStarts,thinkingDurations:e.thinkingDurations,scrollToBottom:e.scrollToBottom,onResend:ut,onEdit:n.editMessage,onRegenerate:n.regenerateMessage,onOpenOriginal:n.navigateToMessage,onFork:n.forkMessage,forkPending:e.sessionForkPending,forkAvailable:Ae&&!Ie&&e.snapshot.runtime.status===`idle`&&!e.promptAdmissionPending&&!e.promptAdmissionRecovery&&!e.activeTurn&&!e.modelSelectionPending&&!e.sessionSwitching&&!G?.path.startsWith(`current:`)&&!(Fe?.pendingFollowUps||Fe?.pendingSteering||Fe?.compaction?.state===`running`),onInspectSubagent:W,onReviewTurn:(e,t)=>{Be(`review`),c.current=document.activeElement instanceof HTMLElement?document.activeElement:null,ue({promptEntryId:e,filePath:t,revision:(se?.revision??0)+1})},onHistoryAnchorChange:n.setHistoryAnchor,historyNavigation:e.historyNavigation??(h?.sessionId===G?.id&&h?.sessionPath===G?.path?h:null),onNavigateToMessage:n.navigateToMessage,onRefreshHistory:n.refreshSnapshot,onPromptProjection:n.rememberPromptProjection},`transcript:${JSON.stringify([G?.id,G?.path])}`):null,!xe&&G&&e.snapshot&&!e.sessionSwitching&&rj(e.snapshot,G)&&(0,K.jsx)(KN,{sessionId:G.id,sessionPath:G.path,workingCache:v,revision:e.snapshot.cursor,connected:e.connection===`connected`},JSON.stringify([G.id,G.path])),e.snapshot&&(0,K.jsxs)(`div`,{className:`workbar-chat-context`,hidden:!ze,children:[(0,K.jsx)(`span`,{className:`workbar-chat-title`,title:st,children:st}),(0,K.jsx)(`span`,{className:`workbar-chat-status`,role:`status`,children:t(Ie?`turnState_running`:e.connection)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{Ve(),requestAnimationFrame(()=>document.querySelector(`.composer textarea`)?.focus({preventScroll:!0}))},children:t(`workbarContinueInChat`)})]}),e.snapshot&&(0,K.jsx)(RN,{addSourcesRequest:x,planSelectionPending:e.planSelectionPending,workspaceDraft:e.workspaceDraft,draftModel:e.draftModel,createdSession:e.createdSession,modelSelectionPending:e.modelSelectionPending,modelSearch:e.modelSearch,thinkingPendingLevel:e.thinkingPendingLevel,onInspect:ve,onOpenProviders:()=>void Se(`credentials`),onCommandAction:e=>{let t=VJ.getState();return t.sessionSwitching||t.workspaceDraft||!G||t.snapshot?.selectedSession?.path!==G.path||t.snapshot.selectedSession.id!==G.id?!1:(e===`terminal`||e===`review`||e===`side-conversation`?Be(e):e===`subagents`?W():ve(),!0)},onInspectSubagent:W,activeTurn:e.activeTurn,activityObserved:e.connection===`connected`,turnCancellationPending:e.turnCancellationPending,turnTerminalStatus:e.turnTerminalStatus,pendingFollowUpsReceipt:e.pendingFollowUpsReceipt,pendingSteeringReceipt:e.pendingSteeringReceipt,commandDiscovery:e.commandDiscovery,snapshot:e.snapshot,selectedPath:e.selectedPath,selectedWorkspace:G?.cwd??e.selectedWorkspace,sessionSwitching:e.sessionSwitching||e.sessionForkPending,promptAdmissionPending:e.promptAdmissionPending,promptAdmissionRecovery:e.promptAdmissionRecovery,promptAdmissionResolution:e.promptAdmissionResolution,restoredPromptDraft:e.restoredPromptDraft,liveRunning:e.liveRunning,landing:lt,actions:n}),e.sessionForkPending&&(0,K.jsxs)(`div`,{className:`session-fork-progress`,role:`status`,children:[(0,K.jsx)(`span`,{className:`session-fork-progress-spinner`,"aria-hidden":`true`}),t(e.sessionForkCancellation===`too-late`?`sidebarForkFinishing`:e.sessionForkCancellation?`sidebarForkCancelling`:e.sessionForkEnvironment===`worktree`?`sidebarForkWorktreePending`:`forkSessionPending`),e.sessionForkEnvironment&&(0,K.jsx)(`button`,{type:`button`,disabled:e.sessionForkCancellation!==null,onClick:()=>void n.cancelSessionFork(),children:t(`cancel`)})]}),(0,K.jsx)(YN,{notices:e.archiveNotices,actions:n}),e.notice&&(0,K.jsxs)(`div`,{className:typeof e.notice==`string`?`notice`:`notice notice-success`,role:typeof e.notice==`string`?`alert`:`status`,children:[(0,K.jsx)(`span`,{children:typeof e.notice==`string`?e.notice:e.notice.message}),(0,K.jsx)(`button`,{type:`button`,"aria-label":t(`close`),onClick:n.clearNotice,children:(0,K.jsx)(Lt,{})})]})]}),ye&&(0,K.jsx)(zN,{target:V,onClose:be,onOpenProviders:()=>void Se(`credentials`)},`${V.sessionId}:${V.sessionPath}:${V.terminalId??`status`}`),he&&(0,K.jsx)(YI,{sessionId:pe.sessionId,initialId:pe.id,initialKind:pe.kind,observed:e.connection===`connected`,activity:rj(e.snapshot,{id:pe.sessionId,path:pe.sessionPath})?e.snapshot?.runtime.capabilities.subagents:void 0,records:je,workflows:Ae?e.snapshot?.runtime.capabilities.workflows:void 0,liveAvailable:rj(e.snapshot,{id:pe.sessionId,path:pe.sessionPath}),onClose:()=>me(null)},`${pe.sessionId}:${pe.navigation}`),ze&&G&&U&&(0,K.jsx)(Jq,{visible:ze,requestedTool:U.tool,requestRevision:U.requestRevision,sessionId:G.id,sessionPath:G.path,onBrowserReady:d,canControl:!e.sessionSwitching&&rj(e.snapshot,G),onActivateSession:()=>void n.selectSession(G.path),cwd:G.cwd,snapshot:e.snapshot??void 0,capabilities:rj(e.snapshot,G)?e.snapshot?.runtime.capabilities??{}:{},readingState:U.reading,onActiveToolChange:fe,review:Le,reviewTurn:se??void 0,onWorkspaceReview:()=>ue(null),onReferenceLine:e=>{let t=VJ.getState(),n=t.snapshot?.selectedSession;t.workspaceDraft||t.sessionSwitching||t.selectedPath!==G.path||n?.id!==G.id||n.path!==G.path||!rj(t.snapshot,n)||(B(`chat`),S(t=>({sessionId:G.id,path:G.path,revision:(t?.revision??0)+1,feedback:e})))},conversationCollapsed:T,onRestoreConversation:()=>E(!1),onExpandReview:()=>E(!0),onClose:Ve},`${G.id}:${G.path}`),(0,K.jsxs)(`section`,{"aria-label":t(`resizePanes`),style:{display:`contents`},children:[!e.sidebarCollapsed&&!L&&(!Ge||D>ZJ)&&(0,K.jsx)(_r,{side:`left`,value:Je,min:UJ,max:qe,defaultValue:HJ,collapseThreshold:GJ,onCollapse:()=>n.toggleSidebar(!1),onChange:e=>I(`sidebar`,e),onDraggingChange:w}),Ge&&!T&&D>ZJ&&(0,K.jsx)(_r,{side:`right`,value:Xe,min:qJ,max:Ye,defaultValue:KJ,collapseThreshold:YJ,onCollapse:Qe,onExpandPastMax:ze?()=>E(!0):void 0,onChange:e=>I(`auxiliary`,e),onDraggingChange:w})]}),(0,K.jsx)(`button`,{className:`sidebar-scrim`,type:`button`,tabIndex:-1,"aria-hidden":`true`,"aria-label":t(`close`),onClick:n.closeMobileSidebar})]})}),xe&&(0,K.jsx)(jI,{sessionId:te.sessionId,cwd:te.cwd,entry:te.entry,models:e.snapshot?.models??[],currentModel:ge,thinkingLevel:e.thinkingPendingLevel??e.snapshot?.thinking?.level??t(`unknownState`),theme:e.snapshot?.preferences.theme??`system`,preferences:e.snapshot?.preferences,workspaces:e.snapshot?.workspaces??[],onRestoreSession:e=>n.unarchiveSession(e),plan:e.snapshot?.runtime.plan,planSelectionPending:e.planSelectionPending,onExitPlan:()=>n.selectPlanMode(!1),setupOutcome:e.snapshot?.runtime.setup,capabilities:e.snapshot?.runtime.capabilities,setupBusy:e.liveRunning||e.promptAdmissionPending||!!e.activeTurn||e.modelSelectionPending||e.thinkingPendingLevel!==null||e.sessionSwitching,setupBlockedReason:e.promptAdmissionRecovery?t(`setupResolveAdmission`):void 0,modelSelectionPending:e.modelSelectionPending,sessionPath:te.sessionPath,onSelectModel:e=>n.selectModel(e),onConfigureOpenPi:Te,interaction:e.snapshot&&!e.sessionSwitching&&te.sessionId===e.snapshot.currentSessionId?(0,K.jsxs)(`div`,{className:`settings-interaction`,children:[(0,K.jsx)(KN,{sessionId:te.sessionId,sessionPath:te.sessionPath,workingCache:v,revision:e.snapshot.cursor,connected:e.connection===`connected`},JSON.stringify([te.sessionId,te.sessionPath])),(e.activeTurn||e.liveRunning)&&(0,K.jsx)(`button`,{type:`button`,disabled:e.turnCancellationPending,onClick:()=>void n.cancelActiveTurn(),children:t(`stopTurn`)})]}):void 0,onPreferencesChanged:()=>n.refreshSnapshot(),onOpenRuntimeStatus:we,onClose:Ce},`${te.sessionId}:${te.sessionPath}`)]})}var eY={size:`1em`,"aria-hidden":!0},tY={name:`neutral`,__built:!0,tokens:{"--font-size-4xs":`0.375rem`,"--font-size-3xs":`0.4375rem`,"--font-size-2xs":`0.5rem`,"--font-size-xs":`0.625rem`,"--font-size-sm":`0.75rem`,"--font-size-base":`0.875rem`,"--font-size-lg":`1.0625rem`,"--font-size-xl":`1.25rem`,"--font-size-2xl":`1.5rem`,"--font-size-3xl":`1.8125rem`,"--font-size-4xl":`2.1875rem`,"--font-size-5xl":`2.625rem`,"--text-heading-1-size":`var(--font-size-2xl)`,"--text-heading-1-weight":`var(--font-weight-semibold)`,"--text-heading-1-leading":`1.3333`,"--text-heading-2-size":`var(--font-size-xl)`,"--text-heading-2-weight":`var(--font-weight-semibold)`,"--text-heading-2-leading":`1.4`,"--text-heading-3-size":`var(--font-size-lg)`,"--text-heading-3-weight":`var(--font-weight-bold)`,"--text-heading-3-leading":`1.4118`,"--text-heading-4-size":`var(--font-size-base)`,"--text-heading-4-weight":`var(--font-weight-bold)`,"--text-heading-4-leading":`1.4286`,"--text-heading-5-size":`var(--font-size-sm)`,"--text-heading-5-weight":`var(--font-weight-semibold)`,"--text-heading-5-leading":`1.6667`,"--text-heading-6-size":`var(--font-size-xs)`,"--text-heading-6-weight":`var(--font-weight-semibold)`,"--text-heading-6-leading":`1.6`,"--text-body-size":`var(--font-size-base)`,"--text-body-weight":`var(--font-weight-normal)`,"--text-body-leading":`1.4286`,"--text-large-size":`var(--font-size-lg)`,"--text-large-weight":`var(--font-weight-semibold)`,"--text-large-leading":`1.4118`,"--text-label-size":`var(--font-size-base)`,"--text-label-weight":`var(--font-weight-medium)`,"--text-label-leading":`1.4286`,"--text-code-size":`var(--font-size-base)`,"--text-code-weight":`var(--font-weight-normal)`,"--text-code-leading":`1.4286`,"--text-supporting-size":`var(--font-size-sm)`,"--text-supporting-weight":`var(--font-weight-normal)`,"--text-supporting-leading":`1.6667`,"--text-display-1-size":`var(--font-size-5xl)`,"--text-display-1-weight":`var(--font-weight-normal)`,"--text-display-1-leading":`1.2381`,"--text-display-2-size":`var(--font-size-4xl)`,"--text-display-2-weight":`var(--font-weight-normal)`,"--text-display-2-leading":`1.2571`,"--text-display-3-size":`var(--font-size-3xl)`,"--text-display-3-weight":`var(--font-weight-normal)`,"--text-display-3-leading":`1.3793`,"--duration-fast-min":`95ms`,"--duration-fast":`125ms`,"--duration-fast-max":`165ms`,"--duration-medium-min":`225ms`,"--duration-medium":`300ms`,"--duration-medium-max":`400ms`,"--duration-slow-min":`525ms`,"--duration-slow":`700ms`,"--duration-slow-max":`935ms`,"--font-family-body":`Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,"--font-family-heading":`Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,"--font-family-code":`ui-monospace, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,"--color-syntax-keyword":`light-dark(#700084, #efa8ff)`,"--color-syntax-string":`light-dark(#005600, #a6d2a2)`,"--color-syntax-comment":`light-dark(#737373, #a3a3a3)`,"--color-syntax-number":`light-dark(#6e3500, #ffb37f)`,"--color-syntax-function":`light-dark(#00458c, #a0caff)`,"--color-syntax-type":`light-dark(#700084, #efa8ff)`,"--color-syntax-variable":`light-dark(#171717, #e5e5e5)`,"--color-syntax-operator":`light-dark(#737373, #a3a3a3)`,"--color-syntax-constant":`light-dark(#6e3500, #ffb37f)`,"--color-syntax-tag":`light-dark(#89001a, #ffaeaa)`,"--color-syntax-attribute":`light-dark(#584400, #eec12f)`,"--color-syntax-property":`light-dark(#005348, #83dac9)`,"--color-syntax-punctuation":`light-dark(#6e6e6e, #a0a0a0)`,"--color-syntax-background":`light-dark(#fafafa, #0a0a0a)`,"--color-background-surface":`light-dark(#ffffff, #262626)`,"--color-background-body":`light-dark(#f1f1f1, #1b1b1b)`,"--color-background-card":`light-dark(#ffffff, #1b1b1b)`,"--color-background-popover":`light-dark(#ffffff, #1b1b1b)`,"--color-background-muted":`light-dark(#f1f1f1, #1b1b1b)`,"--color-accent":`light-dark(#262626, #ebebeb)`,"--color-accent-muted":`light-dark(#f1f1f1, #262626)`,"--color-neutral":`light-dark(#0000000F, #FFFFFF1A)`,"--color-overlay":`light-dark(#00000080, #000000CC)`,"--color-overlay-hover":`light-dark(#0000000D, #FFFFFF0D)`,"--color-overlay-pressed":`light-dark(#0000001A, #FFFFFF1A)`,"--color-text-primary":`light-dark(#171717, #fafafa)`,"--color-text-secondary":`light-dark(#525252, #a3a3a3)`,"--color-text-disabled":`light-dark(#a3a3a3, #525252)`,"--color-text-accent":`light-dark(#262626, #ebebeb)`,"--color-on-dark":`#ffffff`,"--color-on-light":`#171717`,"--color-on-accent":`light-dark(#ffffff, #171717)`,"--color-on-success":`light-dark(#ffffff, #171717)`,"--color-on-error":`light-dark(#ffffff, #171717)`,"--color-on-warning":`#171717`,"--color-icon-accent":`light-dark(#262626, #ebebeb)`,"--color-icon-primary":`light-dark(#171717, #fafafa)`,"--color-icon-secondary":`light-dark(#737373, #a3a3a3)`,"--color-icon-disabled":`light-dark(#a3a3a3, #525252)`,"--color-success":`light-dark(#007004, #9fe59b)`,"--color-error":`light-dark(#a50c25, #ffc6c1)`,"--color-warning":`light-dark(#745b00, #fdcf4f)`,"--color-success-muted":`light-dark(#c5e5c0, #84c9803D)`,"--color-error-muted":`light-dark(#facecb, #ff9e973D)`,"--color-warning-muted":`light-dark(#f8da9d, #deb4333D)`,"--color-border":`light-dark(#00000014, #FFFFFF1A)`,"--color-border-emphasized":`light-dark(#d4d4d4, #525252)`,"--color-skeleton":`light-dark(#ebebeb, #525252)`,"--color-shadow":`light-dark(#0000001A, #0000004D)`,"--color-tint-hover":`light-dark(black, white)`,"--color-background-red":`light-dark(#facecb, #ff9e973D)`,"--color-border-red":`light-dark(#e6bab8, #ff6f6c)`,"--color-icon-red":`light-dark(#89001a, #ff9e97)`,"--color-text-red":`light-dark(#89001a, #ffc6c1)`,"--color-background-orange":`light-dark(#fad0b5, #ffa2583D)`,"--color-border-orange":`light-dark(#e6bda2, #e2883e)`,"--color-icon-orange":`light-dark(#6e3500, #ffa258)`,"--color-text-orange":`light-dark(#6e3500, #ffc9a2)`,"--color-background-yellow":`light-dark(#f8da9d, #deb4333D)`,"--color-border-yellow":`light-dark(#e4c279, #c0990e)`,"--color-icon-yellow":`light-dark(#584400, #deb433)`,"--color-text-yellow":`light-dark(#584400, #fdcf4f)`,"--color-background-green":`light-dark(#c5e5c0, #84c9803D)`,"--color-border-green":`light-dark(#b2d1ac, #69ad67)`,"--color-icon-green":`light-dark(#0c5700, #84c980)`,"--color-text-green":`light-dark(#0c5700, #9fe59b)`,"--color-background-teal":`light-dark(#a5e3d6, #7ec6b83D)`,"--color-border-teal":`light-dark(#94d6c8, #63ab9d)`,"--color-icon-teal":`light-dark(#005348, #7ec6b8)`,"--color-text-teal":`light-dark(#005348, #99e2d3)`,"--color-background-cyan":`light-dark(#a3e0ef, #83c2d43D)`,"--color-border-cyan":`light-dark(#91d3e3, #67a7b8)`,"--color-icon-cyan":`light-dark(#00505f, #83c2d4)`,"--color-text-cyan":`light-dark(#00505f, #9edef0)`,"--color-background-blue":`light-dark(#c4ddfb, #9eb7ff3D)`,"--color-border-blue":`light-dark(#b1c9e7, #6d9cfe)`,"--color-icon-blue":`light-dark(#00458c, #9eb7ff)`,"--color-text-blue":`light-dark(#00458c, #c7d3ff)`,"--color-background-purple":`light-dark(#eccef3, #f297ff3D)`,"--color-border-purple":`light-dark(#d8bbdf, #dd74f0)`,"--color-icon-purple":`light-dark(#700084, #f297ff)`,"--color-text-purple":`light-dark(#700084, #fac1ff)`,"--color-background-pink":`light-dark(#fccadc, #ff99c33D)`,"--color-border-pink":`light-dark(#e7b7c8, #f273aa)`,"--color-icon-pink":`light-dark(#83004b, #ff99c3)`,"--color-text-pink":`light-dark(#83004b, #ffc3da)`,"--color-background-gray":`light-dark(#e5e5e5, var(--color-neutral))`,"--color-border-gray":`light-dark(#d4d4d4, #262626)`,"--color-icon-gray":`light-dark(#525252, #a3a3a3)`,"--color-text-gray":`light-dark(#262626, #e5e5e5)`,"--radius-none":`0px`,"--radius-inner":`0.375rem`,"--radius-element":`0.625rem`,"--radius-container":`0.75rem`,"--radius-page":`1.75rem`,"--radius-full":`9999px`,"--shadow-low":`0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 25%)), 0 4px 8px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 40%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 8%))`,"--shadow-med":`0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 35%)), 0 4px 12px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 12%))`,"--shadow-high":`0 4px 6px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), 0 12px 24px light-dark(oklch(0 0 0 / 15%), oklch(0 0 0 / 70%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 15%))`,"--shadow-inset-hover":`inset 0px 0px 0px 2px #0074e24D`,"--shadow-inset-selected":`inset 0px 0px 0px 2px #0074e280`,"--shadow-inset-success":`inset 0px 0px 0px 2px #1981004D`,"--shadow-inset-warning":`inset 0px 0px 0px 2px #ffce2f4D`,"--shadow-inset-error":`inset 0px 0px 0px 2px #e33f4a4D`},components:{heading:{"level:1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-1-size)`,fontWeight:`var(--text-heading-1-weight)`,lineHeight:`var(--text-heading-1-leading)`},"level:2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-2-size)`,fontWeight:`var(--text-heading-2-weight)`,lineHeight:`var(--text-heading-2-leading)`},"level:3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-3-size)`,fontWeight:`var(--text-heading-3-weight)`,lineHeight:`var(--text-heading-3-leading)`},"level:4":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-4-size)`,fontWeight:`var(--text-heading-4-weight)`,lineHeight:`var(--text-heading-4-leading)`},"level:5":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-5-size)`,fontWeight:`var(--text-heading-5-weight)`,lineHeight:`var(--text-heading-5-leading)`},"level:6":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-6-size)`,fontWeight:`var(--text-heading-6-weight)`,lineHeight:`var(--text-heading-6-leading)`},"type:display-1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-1-size)`,lineHeight:`var(--text-display-1-leading)`},"type:display-2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-2-size)`,lineHeight:`var(--text-display-2-leading)`},"type:display-3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-3-size)`,lineHeight:`var(--text-display-3-leading)`}},text:{"type:body":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-body-size)`,lineHeight:`var(--text-body-leading)`},"type:large":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-large-size)`,lineHeight:`var(--text-large-leading)`},"type:label":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-label-size)`,lineHeight:`var(--text-label-leading)`},"type:code":{fontFamily:`var(--font-family-code)`,fontSize:`var(--text-code-size)`,lineHeight:`var(--text-code-leading)`},"type:supporting":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-supporting-size)`,lineHeight:`var(--text-supporting-leading)`},"type:display-1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-1-size)`,lineHeight:`var(--text-display-1-leading)`},"type:display-2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-2-size)`,lineHeight:`var(--text-display-2-leading)`},"type:display-3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-3-size)`,lineHeight:`var(--text-display-3-leading)`}},button:{"variant:destructive":{backgroundColor:`var(--color-error-muted)`,color:`var(--color-error)`}},badge:{"variant:info":{backgroundColor:`light-dark(#0074e2, #6d9cfe)`,color:`light-dark(#ffffff, #171717)`},"variant:neutral":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`},"variant:success":{backgroundColor:`light-dark(#198100, #64af4c)`,color:`light-dark(#ffffff, #171717)`},"variant:warning":{backgroundColor:`#ffce2f`,color:`#171717`},"variant:error":{backgroundColor:`light-dark(#c9303a, #ff705d)`,color:`light-dark(#ffffff, #171717)`},"variant:red":{backgroundColor:`var(--color-background-red)`,color:`var(--color-text-red)`},"variant:orange":{backgroundColor:`var(--color-background-orange)`,color:`var(--color-text-orange)`},"variant:yellow":{backgroundColor:`var(--color-background-yellow)`,color:`var(--color-text-yellow)`},"variant:green":{backgroundColor:`var(--color-background-green)`,color:`var(--color-text-green)`},"variant:teal":{backgroundColor:`var(--color-background-teal)`,color:`var(--color-text-teal)`},"variant:cyan":{backgroundColor:`var(--color-background-cyan)`,color:`var(--color-text-cyan)`},"variant:blue":{backgroundColor:`var(--color-background-blue)`,color:`var(--color-text-blue)`},"variant:purple":{backgroundColor:`var(--color-background-purple)`,color:`var(--color-text-purple)`},"variant:pink":{backgroundColor:`var(--color-background-pink)`,color:`var(--color-text-pink)`},"variant:gray":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`}},statusdot:{"variant:success":{backgroundColor:`light-dark(#198100, #64af4c)`},"variant:warning":{backgroundColor:`#ffce2f`},"variant:error":{backgroundColor:`light-dark(#c9303a, #ff705d)`},"variant:accent":{backgroundColor:`light-dark(#0074e2, #6d9cfe)`}},banner:{"status:info":{"--color-accent-muted":`var(--color-background-blue)`,"--color-text-primary":`var(--color-text-blue)`,"--color-text-secondary":`var(--color-text-blue)`,"--color-accent":`var(--color-text-blue)`},"status:success":{"--color-text-primary":`var(--color-text-green)`,"--color-text-secondary":`var(--color-text-green)`,"--color-success":`var(--color-text-green)`},"status:warning":{"--color-text-primary":`var(--color-text-yellow)`,"--color-text-secondary":`var(--color-text-yellow)`,"--color-warning":`var(--color-text-yellow)`},"status:error":{"--color-text-primary":`var(--color-text-red)`,"--color-text-secondary":`var(--color-text-red)`,"--color-error":`var(--color-text-red)`}},switch:{base:{"--color-background-gray":`var(--color-border-emphasized)`}},progressbar:{base:{"--color-background-muted":`var(--color-border-emphasized)`},"variant:accent":{"--color-accent":`#0074e2`},"variant:success":{"--color-success":`#198100`},"variant:warning":{"--color-warning":`#ffce2f`},"variant:error":{"--color-error":`#c9303a`}},card:{base:{padding:`var(--spacing-3)`}},section:{base:{padding:`var(--spacing-3)`}}},__onDark:{tokens:{"color-scheme":`dark`,"--color-text-primary":`var(--color-on-dark)`,"--color-icon-primary":`var(--color-on-dark)`,"--color-accent":`var(--color-on-dark)`}},__onLight:{tokens:{"color-scheme":`light`,"--color-text-primary":`var(--color-on-light)`,"--color-icon-primary":`var(--color-on-light)`,"--color-accent":`var(--color-on-light)`}},icons:{close:(0,K.jsx)(Lt,{...eY}),chevronDown:(0,K.jsx)(L,{...eY}),chevronLeft:(0,K.jsx)(R,{...eY}),chevronRight:(0,K.jsx)(ee,{...eY}),chevronsLeft:(0,K.jsx)(z,{...eY}),chevronsRight:(0,K.jsx)(B,{...eY}),check:(0,K.jsx)(I,{...eY}),success:(0,K.jsx)(H,{...eY}),error:(0,K.jsx)(ie,{...eY}),warning:(0,K.jsx)(At,{...eY}),info:(0,K.jsx)(Pe,{...eY}),calendar:(0,K.jsx)(P,{...eY}),clock:(0,K.jsx)(se,{...eY}),externalLink:(0,K.jsx)(he,{...eY}),menu:(0,K.jsx)(Ke,{...eY}),moreHorizontal:(0,K.jsx)(W,{...eY}),search:(0,K.jsx)(ht,{...eY}),arrowUp:(0,K.jsx)(k,{...eY}),arrowDown:(0,K.jsx)(w,{...eY}),arrowsUpDown:(0,K.jsx)(D,{...eY}),funnel:(0,K.jsx)(Oe,{...eY}),eyeSlash:(0,K.jsx)(ge,{...eY}),viewColumns:(0,K.jsx)(le,{...eY}),copy:(0,K.jsx)(ue,{...eY}),checkDouble:(0,K.jsx)(F,{...eY}),wrench:(0,K.jsx)(It,{...eY}),stop:(0,K.jsx)(Et,{...eY}),microphone:(0,K.jsx)(Ze,{...eY})}};function nY({children:e}){let t=pr(VJ,e=>e.snapshot?.preferences),n=t?.theme??`system`,r=t?.appearance??yI,i=xI(n,r),a=t?.chatWidth??820,o=t?.chatFontSize??14,[s,c]=(0,_.useState)(()=>window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1);(0,_.useEffect)(()=>{let e=window.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return;let t=()=>c(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let l=n===`system`?s?`dark`:`light`:n,u=l===`dark`||l===`pine`?`dark`:`light`;return(0,_.useEffect)(()=>{let e=document.documentElement;e.dataset.theme=l,e.dataset.palette=i,e.style.setProperty(`--conversation-content-width`,`${a}px`),e.style.setProperty(`--conversation-font-size`,`${o}px`);let t={};if(r.background&&(t[`--page`]=r.background),r.foreground&&(t[`--text`]=r.foreground),r.background||r.foreground)for(let[e,n]of Object.entries({sidebar:3,"sidebar-hover":7,"sidebar-active":10,border:12,"border-strong":22,muted:65,subtle:52,"settings-secondary-text":75}))t[`--${e}`]=`color-mix(in srgb, var(--text) ${n}%, var(--page))`;r.accent&&(t[`--accent`]=r.accent,t[`--focus`]=r.accent),e.style.setProperty(`--openpi-interface-font`,{codex:`var(--openpi-default-font)`,system:`var(--openpi-default-font)`,sans:`Arial, Helvetica, sans-serif`,serif:`Georgia, 'Times New Roman', serif`,mono:`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`}[r.font]);for(let n of[`page`,`text`,`sidebar`,`sidebar-hover`,`sidebar-active`,`border`,`border-strong`,`muted`,`subtle`,`settings-secondary-text`,`accent`,`focus`]){let r=t[`--${n}`];r?e.style.setProperty(`--${n}`,r):e.style.removeProperty(`--${n}`)}},[r,o,a,i,l]),(0,K.jsx)(lr,{i18n:In,children:(0,K.jsx)(ju,{theme:tY,mode:u,children:e})})}var rY=document.getElementById(`root`);if(!rY)throw Error(`OpenPI Web root is missing`);(0,zt.createRoot)(rY).render((0,K.jsx)(_.StrictMode,{children:(0,K.jsx)(nY,{children:(0,K.jsx)($J,{})})}));export{lt as a,Lt as i,Po as n,$e as o,cr as r,x as s,Lp as t}; \ No newline at end of file +`,t),i=-1;if(n!==-1&&r!==-1?i=n20?`${e.slice(0,20)}…`:e}"`,{type:`unknown-field`,field:e,value:t,line:n}))}}function T(){u!==void 0&&a?.(u),f>0&&i?.({id:u,event:p,data:d}),u=void 0,d=``,f=0,p=void 0}function E(e={}){if(e.consume&&s.length>0){let e=s.join(``);C(e,0,e.length)}l=!0,u=void 0,d=``,f=0,p=void 0,s.length=0,c=0,m=!1,h=!1,g=!1}return{feed:_,reset:E}}function xJ(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function SJ(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}function CJ(e,t){let n=1;for(;nt.abort();e.signal.addEventListener(`abort`,n,{once:!0}),e.signal.aborted&&n();let r=window.setTimeout(n,45e3),i=await fetch(`/events?cursor=${e.cursor}`,{headers:await e.client.headers(),signal:t.signal}).finally(()=>{window.clearTimeout(r),e.signal.removeEventListener(`abort`,n)});if(i.status===409)throw new wJ(`event replay expired`);if(!i.ok||!i.body)throw Error(`event connection failed`);e.onConnected();let a=e.cursor,o=0,s=bJ({onComment(t){t.trim()===`heartbeat`&&++o>=4&&(o=0,e.onHeartbeat?.())},onEvent(t){let n=JSON.parse(t.data);if(!Number.isSafeInteger(n.sequence))throw new wJ(`invalid event cursor`);if(!(n.sequence<=a)){if(n.sequence!==a+1)throw new wJ(`event cursor gap`);if(a=n.sequence,n.type===`state_invalidated`)throw new wJ(`state invalidated`);e.onEvent(n)}}}),c=i.body.getReader(),l=new TextDecoder;try{for(;!e.signal.aborted;){let t,n,r=c.read(),i=new Promise((r,i)=>{n=()=>i(Error(`event stream aborted`)),e.signal.addEventListener(`abort`,n,{once:!0}),window.addEventListener(`offline`,n,{once:!0}),(e.signal.aborted||navigator.onLine===!1)&&n(),t=window.setTimeout(()=>i(Error(`event stream stalled`)),45e3)}),{done:a,value:o}=await Promise.race([r,i]).finally(()=>{window.clearTimeout(t),n&&(e.signal.removeEventListener(`abort`,n),window.removeEventListener(`offline`,n))});if(a)throw Error(`event connection closed`);s.feed(l.decode(o,{stream:!0}))}}finally{await c.cancel().catch(()=>void 0)}}var EJ=`openpi.collapsed-workspaces`,DJ=`openpi.sidebar-collapsed`,OJ=new Set(`agent_start.turn_started.turn_settled.agent_settled.prompt_settled.message_end.tool_execution_end.session_start.session_switched.session_progress.queue_update.prompt_failed.prompt_discarded.model_select.settings_changed.workspace_imported.workspace_removed.workspace_renamed.session_renamed.session_archived.session_unarchived.session_pins_changed.sidebar_pins_changed.workspace_order_changed.session_order_changed.session_read_state_changed.session_created.session_forked.session_deleted.prompt_accepted.runtime_changed.questions_changed.command_feedback.command_submitted.plan_mode_changed`.split(`.`));function kJ(e){try{let t=JSON.parse(window.sessionStorage.getItem(e)||`[]`);return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`):[])}catch{return new Set}}function AJ(e){try{return window.sessionStorage.getItem(e)===`true`}catch{return!1}}function jJ(e,t){try{window.sessionStorage.setItem(e,JSON.stringify(t))}catch{}}function MJ(e){let t=8,n=[];for(let r=e.length-1;r>=0;r--){let i=e[r];(i.optimistic||t-->0)&&n.push(i)}return n.reverse()}var NJ=1e3,PJ=new Set,FJ=new WeakMap;function IJ(e){if(e){if(e.role===`toolResult`&&e.toolCallId)return`tool-result-${e.toolCallId}`;if(e.timestamp!==void 0)return`message-${e.role}-${e.timestamp}`}}function LJ(e){return e?.parts?.some(e=>e.type===`thinking`)===!0}function RJ(e){if(!e)return PJ;let t=FJ.get(e);if(t)return t;let n=new Set;for(let t of e){if(!LJ(t.message))continue;n.add(t.id);let e=IJ(t.message);e&&n.add(e)}return FJ.set(e,n),n}function zJ(e,t){for(let n of Object.keys(e))if(!t.has(n)){let n={};for(let r of Object.keys(e))t.has(r)&&(n[r]=e[r]);return n}return e}function BJ(e,t){if(e.length!==t.length)return!1;for(let n=0;ne.optimistic?.sessionId===t?.id&&e.optimistic?.sessionPath===t?.path&&e.optimistic!==void 0)}function HJ(e,t,n,r){return e.map(e=>e.optimistic?.sessionId===t&&e.optimistic.sessionPath===n&&e.optimistic.commandId===r&&!e.optimistic.admitted?{...e,optimistic:{...e.optimistic,admitted:!0}}:e)}function UJ(e,t){return t.aborted?Promise.resolve():new Promise(n=>{let r=()=>{window.clearTimeout(i),t.removeEventListener(`abort`,r),n()},i=window.setTimeout(r,e);t.addEventListener(`abort`,r,{once:!0})})}function WJ(e){return/^\/(?![\\/])/u.test(e)||/^[a-z]:[\\/]/iu.test(e)||/^\\\\(?![?.]\\)[^\\/]+\\[^\\/]+\\/u.test(e)||/^\/\/[^\\/]+\/[^\\/]+\//u.test(e)}function GJ(e=new lf,t={}){let n=t.consumeEvents??TJ,r=new URLSearchParams(window.location.search),i=r.get(`sessionPath`),a=r.get(`sessionId`),o=i!==null||a!==null,s=i&&WJ(i)&&i.length<=4096&&a&&a.length<=128&&!/[\u0000-\u001f\u007f]/u.test(i+a)&&r.getAll(`sessionPath`).length===1&&r.getAll(`sessionId`).length===1?{path:i,id:a}:null,c=0,l=0,u=null,d=!1,f=new Map,p=0,m=0,h=null,g=0,_=null,v=null,y=null,b=null,x=Promise.resolve(),S=null,C=null,w=!1,T=!1,E=null,D=null,O=0,k=null,A=0,j=!1,M=0,N=0,P=null,F=-1,I=null,L=0,R=0,ee=new Set,z=new Set,B=[],V=(e,t)=>{if(typeof t==`string`)for(e.add(t);e.size>32;){let t=e.values().next().value;t&&e.delete(t)}},H=()=>(R++,B=[],{planSelectionPending:!1,activeTurn:null,turnCancellationPending:!1,turnTerminalStatus:null,pendingFollowUpsReceipt:null,pendingSteeringReceipt:null,liveMessages:[],liveRunning:!1,livePhase:`idle`,liveRetry:null,thinkingStarts:{},thinkingDurations:{}}),te=e=>{let t=B.indexOf(e);for(t>=0&&B.splice(t,1),B.push(e);B.length>NJ;)B.shift()},ne=(e,t,n,r)=>{let i=RJ(t);B.some(e=>i.has(e))&&(B=B.filter(e=>!i.has(e)));let a=new Set(i);for(let t of e){a.add(t.key);let e=IJ(t.message);e&&a.add(e)}for(let e of B)a.add(e);let o=zJ(n,a),s=zJ(r,a);return o===n&&s===r?null:{thinkingStarts:o,thinkingDurations:s}},re=()=>(O++,D?.abort(),D=null,{modelSearch:{query:``,status:`idle`,models:[],totalMatches:0,matchesOmitted:0,error:null}}),ie=()=>({sessionId:null,status:`idle`,commands:[],totalAvailable:0,commandsOmitted:0,error:null}),ae=(e,t)=>({liveRunning:t===`running`||!e,livePhase:t===`running`?`running`:e?`idle`:`preparing`});return dr((t,r)=>{let i=e=>{h=null,t({notice:e instanceof Error?e.message:String(e)})},a=e=>{let t=r().snapshot;return e.epoch===c&&r().selectedWorkspace===e.workspacePath&&t?.currentSessionId===e.sessionId&&cj(t)&&t.selectedSession?.id===e.sessionId&&r().selectedPath===t.selectedSession.path&&t.selectedSession.cwd===e.workspacePath&&(!e.sessionPath||t.selectedSession.path===e.sessionPath)},B=()=>{L++,I?.abort(),I=null,t({commandDiscovery:ie()})},U=async(n,a,o,s)=>{if(r().modelSelectionPending)return!1;t({modelSelectionPending:!0});try{let i=await e.selectModel(n.provider,n.id,o,s);if(a!==c||s!==r().selectedPath||o!==r().snapshot?.selectedSession?.id)return!1;if(i.provider!==n.provider||i.id!==n.id||!i.current)throw Error(`Model selection was not confirmed. Please select a model again.`);if(!await r().actions.refreshSnapshot({epoch:a})||a!==c||s!==r().selectedPath||o!==r().snapshot?.selectedSession?.id)return!1;let l=r().snapshot?.models.find(e=>e.current);if(l?.provider!==n.provider||l.id!==n.id)throw Error(`The Session model changed. Please select a model again.`);return t({draftModel:null,notice:null}),!0}catch(e){return a===c&&s===r().selectedPath&&o===r().snapshot?.selectedSession?.id&&i(e),!1}finally{a===c&&t({modelSelectionPending:!1})}},oe=(e=160)=>{if(w){T=!0;return}C===null&&(C=window.setTimeout(async()=>{C=null,w=!0;try{await r().actions.refreshSnapshot()}finally{w=!1,T&&(T=!1,oe())}},e))},se=()=>{P=null,N=0,F=-1},ce=()=>{let e=r().snapshot;if(!e)return;P&&F!==c&&se();let n=e.thinking;if(n){if(!P||n.revision>=N){P=n,N=n.revision,F=c;return}n!==P&&t({snapshot:{...e,thinking:P}})}},le=e=>{P&&F!==c&&se(),e&&e.revision>=N&&(P=e,N=e.revision,F=c),ce()},ue=()=>{k=null,A++,j=!1,t({thinkingPendingLevel:null})},de=async()=>{let t=c,n=r().snapshot?.selectedSession?.id,i=r().selectedPath;if(n)try{let a=await e.thinking(n,new AbortController().signal);if(t!==c||i!==r().selectedPath||n!==r().snapshot?.selectedSession?.id)return;le(a)}catch{}},fe=async()=>{if(j)return;j=!0;let n=++M;try{for(;k!==null;){let n=k,a=A,o=c,s=r().snapshot?.selectedSession?.id,l=r().selectedPath;if(!s||!l||s!==r().snapshot?.currentSessionId||l!==r().snapshot?.selectedSession?.path||r().modelSelectionPending){ue();return}if(r().snapshot?.thinking?.level===n){a===A&&(k=null,t({thinkingPendingLevel:null}));continue}let u;try{u=await e.setThinkingLevel(s,n,l)}catch(e){if(o!==c||l!==r().selectedPath)return;if(a!==A)continue;ue(),i(e),de();return}if(o!==c||l!==r().selectedPath||s!==r().snapshot?.selectedSession?.id)return;if(a===A){if(u.level!==n){ue(),i(Error(In.t(`thinkingNotConfirmed`)));return}le(u),k=null,t({thinkingPendingLevel:null}),oe();return}}}finally{n===M&&(j=!1)}},pe=e=>{let n=r(),i=e.detail??{},a=i.sessionId,o=[`session_start`,`session_switched`,`session_created`].includes(e.type);if(n.cursor!==null&&e.sequence<=n.cursor)return;t({cursor:e.sequence});let s=n.promptAdmissionRecovery,l=s?.commandId,u=n.snapshot?.selectedSession,d=u?.id===a&&u?.path===n.selectedPath&&(i.sessionPath===void 0||i.sessionPath===u?.path);if(d&&s?.sessionId===u?.id&&s?.sessionPath===u?.path&&typeof i.commandId==`string`&&i.commandId===l&&[`prompt_accepted`,`prompt_failed`,`prompt_settled`,`turn_started`,`turn_settled`].includes(e.type)){let r=e.type!==`prompt_failed`;t({promptAdmissionRecovery:null,promptAdmissionResolution:s?{sessionId:s.sessionId,sessionPath:s.sessionPath,commandId:s.commandId,content:s.content,images:s.images}:n.promptAdmissionResolution,liveMessages:r&&s&&!s.delivery?.retryEntryId&&!n.liveMessages.some(e=>e.key===s.optimisticKey)?MJ([...n.liveMessages,{key:s.optimisticKey,timestamp:s.timestamp??e.timestamp,optimistic:{sessionId:s.sessionId,sessionPath:s.sessionPath,commandId:s.commandId,afterEntryId:s.afterEntryId??null,admitted:e.type===`prompt_accepted`},message:{role:`user`,content:s.content}}]):n.liveMessages})}if(e.type===`prompt_accepted`&&d&&u&&typeof i.commandId==`string`&&t({liveMessages:HJ(r().liveMessages,u.id,u.path,i.commandId)}),n=r(),(e.type===`runtime_changed`||e.type===`settings_changed`)&&t(re()),e.type===`runtime_changed`&&B(),n.sessionSwitching&&!o){oe();return}if(typeof a==`string`&&a!==n.snapshot?.currentSessionId&&!o){oe();return}if([`auto_retry_start`,`auto_retry_end`].includes(e.type)&&typeof i.sessionPath==`string`&&i.sessionPath!==(n.snapshot?.currentSessionPath??n.snapshot?.selectedSession?.path)){oe();return}if(!o&&(i.message||e.type.startsWith(`tool_execution_`))&&!cj(n.snapshot)){OJ.has(e.type)&&oe();return}if(n.snapshot){let r=n.snapshot.runtime.liveTools??[],a=fJ(r,e.type,i);a!==r&&t({snapshot:{...n.snapshot,runtime:{...n.snapshot.runtime,liveTools:a}}})}if(o){let o=i.commandId;if(typeof o==`string`&&z.has(o)){oe();return}let s=i.sessionPath,l=n.snapshot?.sessions.some(e=>e.path===s),u=!1;if(y?.kind===`select`?u=y.expectedPath===s:(y?.kind===`create`&&y.commandId===o&&e.type===`session_switched`&&typeof a==`string`&&(!y.expectedSessionId||y.expectedSessionId===a)&&(typeof s!=`string`||!l)||y?.kind===`create`&&y.commandId===o&&e.type===`session_created`&&typeof a==`string`&&(!y.expectedSessionId||a===y.expectedSessionId))&&(u=!0),u&&y?.epoch!==c)return;if(u)t({...H(),liveMessages:VJ(n.liveMessages,n.snapshot?.selectedSession)});else{if(!y&&n.selectedPath&&n.snapshot?.selectedSession?.path===n.selectedPath){B(),ue(),t({...H(),liveMessages:VJ(n.liveMessages,n.snapshot.selectedSession),snapshot:{...n.snapshot,currentSessionId:void 0,currentSessionPath:void 0},modelSelectionPending:!1});let e=c;r().actions.refreshSnapshot({epoch:e});return}B();let e=++c;ue(),_=null,v=null,t({...H(),promptAdmissionPending:!1,promptAdmissionRecovery:null,selectedPath:typeof s==`string`?s:null,draftModel:n.workspaceDraft?n.draftModel:null,modelSelectionPending:!1,sessionSwitching:!0}),r().actions.refreshSnapshot({epoch:e}).then(n=>{e===c&&t({selectedPath:n?r().selectedPath:null,sessionSwitching:!1})})}}else if(e.type===`prompt_accepted`){let e=ee.has(String(i.commandId??``));t({...ae(e,n.livePhase),liveRetry:null,pendingFollowUpsReceipt:Number.isInteger(i.pendingFollowUps)?Number(i.pendingFollowUps):n.pendingFollowUpsReceipt,pendingSteeringReceipt:Number.isInteger(i.pendingSteering)?Number(i.pendingSteering):n.pendingSteeringReceipt})}else if(e.type===`turn_started`)m=e.sequence,t({activeTurn:{sessionId:String(i.sessionId),commandId:String(i.commandId),epoch:Number(i.epoch),...typeof i.sessionPath==`string`?{sessionPath:i.sessionPath}:{},...typeof i.promptEntryId==`string`?{promptEntryId:i.promptEntryId}:{},...typeof i.startedAt==`number`?{startedAt:i.startedAt}:{},...typeof i.elapsedMs==`number`?{elapsedMs:i.elapsedMs}:{}},liveRunning:!0,livePhase:`running`,liveRetry:null,turnTerminalStatus:null});else if(e.type===`agent_start`)m=e.sequence,t({...i.activeTurn?{activeTurn:i.activeTurn}:{},liveRunning:!0,livePhase:`running`,liveRetry:null});else if(e.type===`turn_settled`){V(ee,i.commandId);let r=n.activeTurn;r?.sessionId===i.sessionId&&r?.commandId===i.commandId&&r?.epoch===i.epoch&&(m=e.sequence,t({activeTurn:null,liveRunning:!1,livePhase:`idle`,liveRetry:null,turnTerminalStatus:typeof i.outcome==`string`?i.outcome:null}))}else if(e.type===`agent_settled`)n.activeTurn||(m=e.sequence),t({pendingFollowUpsReceipt:null,pendingSteeringReceipt:null,...n.activeTurn?{}:{liveRunning:!1,livePhase:`idle`,liveRetry:null}});else if(e.type===`prompt_settled`)V(ee,i.commandId),n.livePhase!==`running`&&t({liveRunning:!1,livePhase:`idle`,liveRetry:null});else if(i.message&&typeof i.message==`object`){let r=i.message,a=n.liveMessages,o=typeof i.messageKey==`string`?i.messageKey:`${r.role||`message`}-${e.sequence}`,s={key:o,message:r},c=a.findIndex(e=>e.key===o);a=c>=0?a.map((e,t)=>t===c?s:e):MJ([...a,s]);let l=!BJ(n.liveMessages,a),u=n.thinkingStarts,d=n.thinkingDurations,f=!1;if(r.parts?.some(e=>e.type===`thinking`)&&(u[o]===void 0&&(u={...u,[o]:Date.now()},f=!0),e.type===`message_end`)){let e=IJ(r),t=Date.now()-u[o];d={...d,[o]:t},e&&(d[e]=t),te(e??o),f=!0}if(f||l){let e=ne(a,n.snapshot?.selectedSession?.entries,u,d);e&&(u=e.thinkingStarts,d=e.thinkingDurations,f=!0)}t({liveMessages:a,...f?{thinkingStarts:u,thinkingDurations:d}:{}})}if(e.type===`prompt_discarded`&&typeof i.commandId==`string`&&(V(ee,i.commandId),t({liveMessages:r().liveMessages.filter(e=>e.optimistic?.commandId!==i.commandId)})),e.type===`prompt_failed`){V(ee,i.commandId);let e=typeof i.commandId==`string`&&n.activeTurn?.commandId===i.commandId;t({liveMessages:r().liveMessages.filter(e=>!e.optimistic||e.optimistic.commandId!==i.commandId),...e||n.livePhase!==`running`?{liveRunning:!1,livePhase:`idle`,liveRetry:null}:{},notice:typeof i.error==`string`?i.error:`Prompt failed`})}if(e.type===`auto_retry_start`&&t({liveRunning:!0,livePhase:`running`,liveRetry:{attempt:Number(i.attempt)||0,maxAttempts:Number(i.maxAttempts)||0}}),e.type===`auto_retry_end`&&t({liveRetry:null}),e.type===`thinking_level_changed`){let t=r().snapshot?.thinking;t&&typeof i.level==`string`&&le({...t,level:i.level,revision:e.sequence})}OJ.has(e.type)&&oe()},me=async i=>{let a=500,o=!1;for(;!i.aborted;){let s=!1;try{if(r().cursor===null){if(s=!0,!await r().actions.refreshSnapshot({resetCursor:!0}))throw Error(`snapshot unavailable`);s=!1}if(i.aborted)return;await n({client:e,cursor:r().cursor??0,onConnected:()=>{a=500,t({connection:`connected`}),o&&(o=!1,oe(0))},onEvent:pe,onHeartbeat:()=>oe(0),signal:i})}catch(e){if(i.aborted)return;t({connection:`reconnecting`});let n=!s&&await r().actions.refreshSnapshot({resetCursor:!0});o=!n,n||t(H()),await UJ(a,i),a=Math.min(a*2,5e3),e instanceof SyntaxError&&t({notice:`Invalid event data`})}}},W={rememberPromptProjection(e,n,i){let a=r(),o=a.snapshot?.selectedSession;if(a.selectedPath!==n||o?.id!==e||o.path!==n)return;let s=new Set(o.entries.map(e=>e.id)),c=new Set(a.liveMessages.flatMap(t=>t.optimistic?.sessionId===e&&t.optimistic.sessionPath===n&&t.optimistic.projectedEntryId?[t.optimistic.projectedEntryId]:[])),l=new Map(i.map(e=>[e.key,e.entryId])),u=!1,d=a.liveMessages.map(t=>{let r=l.get(t.key);return!r||!s.has(r)||c.has(r)||t.optimistic?.sessionId!==e||t.optimistic.sessionPath!==n||!t.optimistic.admitted||t.optimistic.projectedEntryId?t:(u=!0,c.add(r),{...t,optimistic:{...t.optimistic,projectedEntryId:r},message:{role:`user`,content:``}})});u&&t({liveMessages:d})},setHistoryAnchor(e){let n=r().snapshot?.selectedSession;if(e&&(n?.id!==e.sessionId||n.path!==e.sessionPath))return;let i=r().historyAnchor;(i?.entryId!==e?.entryId||i?.sessionId!==e?.sessionId||i?.sessionPath!==e?.sessionPath)&&t({historyAnchor:e})},start(){E||(E=new AbortController,me(E.signal))},stop(){E?.abort(),E=null,C!==null&&window.clearTimeout(C),C=null,ue(),B()},async refreshSnapshot(n={}){let a=n.epoch??c,o=++p,l=r().selectedPath;try{let i=r().historyAnchor,u=s?.path===l?s:null,d=u?await e.snapshot(l,void 0,u.id):i&&i.sessionPath===l?await e.snapshot(l,i):await e.snapshot(l);if(a!==c||o!==p)return!1;if(u&&(d.selectedSession?.id!==u.id||d.selectedSession.path!==u.path))throw new sf(In.t(`sessionLinkUnavailable`),409,`SESSION_CONFLICT`);u&&(s=null);let f=typeof d.currentSessionId==`string`,g=f?d.sessions.find(e=>cj(d,e)):void 0,_=f?cj(d):d.selectedSession===void 0,y=d.selectedSession?d.sessions.some(e=>e.id===d.selectedSession.id&&e.path===d.selectedSession.path):!f,b=!l||d.sessions.some(e=>e.path===l),x=!l||d.selectedSession?.path===l;if(!b||!x||!y||!l&&!_)return t({selectedPath:null}),!n.canonicalRetry&&W.refreshSnapshot({...n,canonicalRetry:!0,epoch:a});let S=d.selectedSession?.cwd,C=d.workspaces.find(e=>e.current)?.path,w=d.workspaces.some(e=>e.path===r().selectedWorkspace)?r().selectedWorkspace:void 0,T=r().workspaceDraft?r().selectedWorkspace:S??C??w??null,E=n.resetCursor;r().snapshot?.selectedSession?.path!==d.selectedSession?.path&&(ue(),se()),E&&se();let D=r().snapshot?.currentSessionId,O=r().snapshot?.sessions.find(e=>cj(r().snapshot,e)),k=D!==d.currentSessionId||O?.path!==g?.path,A=r().snapshot?.selectedSession?.id!==d.selectedSession?.id||r().snapshot?.selectedSession?.path!==d.selectedSession?.path,j=r().collapsed;if(A&&!r().workspaceDraft&&d.selectedSession){let e=d.sessions.find(e=>e.id===d.selectedSession.id&&e.path===d.selectedSession.path),t=e?.workspacePath??d.selectedSession.cwd;!e?.archived&&!e?.ungrouped&&j.has(t)&&(j=new Set(j),j.delete(t),jJ(EJ,[...j]))}let M=r().snapshot,N=E||k||A||M?.currentSessionPath!==d.currentSessionPath||JSON.stringify(M?.models)!==JSON.stringify(d.models)||M?.truncation.modelsOmitted!==d.truncation.modelsOmitted;k&&(B(),ue(),se());let P=h!==null&&r().notice===h;h=null,(E||k||A)&&(m=0);let F=m>d.cursor;if(t({...P?{notice:null}:{},...E||k||A?{...H(),liveMessages:VJ(r().liveMessages,d.selectedSession)}:{},connection:r().connection===`connecting`?`connecting`:r().connection,cursor:E||r().cursor===null?d.cursor:Math.max(r().cursor??0,d.cursor),activeTurn:F?r().activeTurn:d.runtime.activeTurn??null,livePhase:F?r().livePhase:d.runtime.status===`running`?`running`:!r().promptAdmissionPending&&!v?`idle`:r().livePhase,liveRetry:!F&&d.runtime.status!==`running`&&!r().promptAdmissionPending&&!v?null:r().liveRetry,liveRunning:F?r().liveRunning:d.runtime.status===`running`?!0:!r().promptAdmissionPending&&!v?!1:r().liveRunning,selectedPath:d.selectedSession?.path??null,selectedWorkspace:T,collapsed:j,snapshot:d,...N?re():{}}),!(E||k||A)){let e=ne(r().liveMessages,d.selectedSession?.entries,r().thinkingStarts,r().thinkingDurations);e&&t(e)}return le(),!0}catch(e){if(a!==c||o!==p)return!1;if(s?.path===l&&e instanceof sf&&[400,404,409].includes(e.status)){s=null,t({selectedPath:null,workspaceDraft:!0});let e=await W.refreshSnapshot({...n,epoch:a});return a===c&&t({notice:In.t(`sessionLinkUnavailable`)}),e}t({connection:`unavailable`}),i(e);let u=r().notice;return h=typeof u==`string`?u:null,!1}},async chooseWorkspace(){let t=c;try{let n=await e.chooseWorkspace();if(t!==c||n.cancelled||!n.path)return;W.setWorkspace(n.path),await W.refreshSnapshot()}catch(e){t===c&&i(e)}},setWorkspace(e){let n=r();e===n.selectedWorkspace&&!n.sessionSwitching||(++c,b=null,ue(),B(),_=null,v=null,t({...H(),...re(),selectedWorkspace:e,createdSession:null,workspaceDraft:!0,sessionSwitching:!1,modelSelectionPending:!1,promptAdmissionPending:!1,promptAdmissionRecovery:null,notice:null}))},async renameWorkspace(t,n){try{await e.renameWorkspace(t,n),await W.refreshSnapshot()}catch(e){throw i(e),e}},async removeWorkspace(n){try{return await e.removeWorkspace(n),r().selectedWorkspace===n&&B(),r().workspaceDraft&&r().selectedWorkspace===n&&t({selectedWorkspace:null}),await W.refreshSnapshot(),!0}catch(e){return i(e),!1}},async prepareSession(){if(r().sessionSwitching||r().modelSelectionPending)return null;r().selectedWorkspace||await W.chooseWorkspace();let e=r(),t=e.selectedWorkspace;if(!t||e.sessionSwitching||e.modelSelectionPending)return null;let n=e.snapshot?.selectedSession;if(!e.workspaceDraft&&n){if(e.selectedPath!==n.path||n.cwd!==t)return null;let r={epoch:c,sessionId:n.id,sessionPath:n.path,workspacePath:t};return!cj(e.snapshot)&&!await W.selectSession(n.path,n.id)?null:a(r)?r:null}return W.createSession(t)},async createSession(n){if(!n||r().modelSelectionPending)return null;let o=++c;ue(),B();let s=(b?.workspacePath===n?b.commandId:void 0)??globalThis.crypto?.randomUUID?.()??`web-create-${Date.now()}-${o}`;b={workspacePath:n,commandId:s},_=null,v=null,t({...H(),...re(),mobileSidebarOpen:!1,promptAdmissionPending:!1,promptAdmissionRecovery:null,selectedPath:null,selectedWorkspace:n,createdSession:null,workspaceDraft:!0,sessionSwitching:!0});let l=null,u=x.then(async()=>{if(o===c){y={commandId:s,epoch:o,expectedPath:null,kind:`create`};try{let u=await e.createSession(n,s);if(o!==c)return;if(u.cancelled||u.commandId!==s||typeof u.sessionId!=`string`||!u.sessionId||u.sessionId.length>128||u.sessionPath!==void 0&&!u.sessionPath)throw Error(`Session creation did not return a valid target identity.`);let d={epoch:o,sessionId:u.sessionId,sessionPath:u.sessionPath??null,workspacePath:n};y?.epoch===o&&(y.expectedSessionId=d.sessionId,y.expectedPath=d.sessionPath),t({selectedPath:d.sessionPath});let f=await W.refreshSnapshot({epoch:o});if(!f&&o===c&&(f=await W.refreshSnapshot({epoch:o})),o!==c)return;if(!f)throw Error(`The created Session could not be confirmed. Please try again.`);if(!a(d)){b=null,i(Error(`The created Session is no longer active in the selected workspace. Please try again.`));return}let p=r().selectedPath;if(!p)return;d.sessionPath=p,t({workspaceDraft:!1,createdSession:d,notice:null});let m=r().draftModel;if(m&&!await U(m,o,d.sessionId,p))return;if(r().workspaceDraft||!a(d)){b=null,i(Error(`The created Session is no longer active in the selected workspace. Please try again.`));return}l=d,b=null}catch(e){if(o!==c)return;t({selectedPath:null}),i(e),await W.refreshSnapshot({epoch:o})}finally{V(z,s),y?.epoch===o&&(y=null),o===c&&t({sessionSwitching:!1})}}});return x=u.catch(()=>void 0),await u,o===c?l:null},async selectSession(n,a){if(!n)return!1;let o=r();if(S?.path===n&&S.epoch===c){let e=S;t({mobileSidebarOpen:!1});let i=await e.promise,o=r();return i&&e.epoch===c&&o.selectedPath===n&&o.snapshot?.selectedSession?.path===n&&(!a||o.snapshot.selectedSession.id===a)&&!o.workspaceDraft&&cj(o.snapshot)}if(!o.workspaceDraft&&!o.sessionSwitching&&o.selectedPath===n&&o.snapshot?.selectedSession?.path===n&&(!a||o.snapshot.selectedSession.id===a)&&cj(o.snapshot))return t({mobileSidebarOpen:!1}),!0;b=null;let s=!o.workspaceDraft&&o.selectedPath===n&&o.snapshot?.selectedSession?.path===n;B(),t({...re(),workspaceDraft:!1,...s?{}:{draftModel:null,createdSession:null},modelSelectionPending:!1});let l=s?c:++c;ue(),s||(_=null,v=null),t({...H(),liveMessages:s?VJ(o.liveMessages,o.snapshot?.selectedSession):[],mobileSidebarOpen:!1,promptAdmissionPending:s?o.promptAdmissionPending:!1,promptAdmissionRecovery:s?o.promptAdmissionRecovery:null,selectedPath:n,sessionSwitching:!0});let u=x.then(async()=>{if(l!==c)return!1;y={epoch:l,expectedPath:n,kind:`select`};try{let i=await(a?e.selectSession(n,a):e.selectSession(n));if(l!==c)return!1;if(i.cancelled)return s||t({selectedPath:null}),await W.refreshSnapshot({epoch:l}),!1;let o=await W.refreshSnapshot({epoch:l});return l===c&&(!o&&!s&&t({selectedPath:null}),o&&r().selectedPath===n&&r().snapshot?.selectedSession?.path===n&&(!a||r().snapshot?.selectedSession?.id===a)&&!r().workspaceDraft&&cj(r().snapshot))}catch(e){return l===c&&(s||t({selectedPath:null}),i(e),await W.refreshSnapshot({epoch:l}),!1)}finally{y?.epoch===l&&(y=null),l===c&&t({sessionSwitching:!1})}});x=u.then(()=>void 0,()=>void 0),S={path:n,epoch:l,promise:u};try{return await u}finally{S?.promise===u&&(S=null)}},async navigateToMessage(n,i){let a=++l;try{if(i?.aborted||await W.selectSession(n.sessionPath)===!1)return!1;let o=c,s=r().snapshot?.selectedSession;if(i?.aborted||a!==l||r().sessionSwitching||s?.id!==n.sessionId||s.path!==n.sessionPath)return!1;let u=await e.sessionMessageWindow(n,i);if(i?.aborted||a!==l||o!==c)return!1;let d=r().snapshot?.selectedSession;return d?.id!==n.sessionId||d.path!==n.sessionPath||u.id!==n.sessionId||u.path!==n.sessionPath||u.history?.anchorEntryId!==n.entryId||u.history.anchorOnBranch!==!0||!u.entries.some(e=>e.id===n.entryId)?!1:(t({historyNavigation:{...n,session:u,revision:(r().historyNavigation?.revision??0)+1}}),!0)}catch{return!1}},async editMessage(e,t){return W.forkMessage(e,{mode:`edit`,content:t})},async regenerateMessage(e){return W.forkMessage(e,{mode:`regenerate`})},acknowledgeRestoredPromptDraft(e){r().restoredPromptDraft?.commandId===e&&t({restoredPromptDraft:null})},async cancelSessionFork(){let n=u;if(!n||n.scope!==`conversation`||!r().sessionForkPending||r().sessionForkCancellation)return;let a=c;t({sessionForkCancellation:`requesting`});try{let i=await e.cancelSessionFork({commandId:n.commandId,sessionId:n.sessionId,sessionPath:n.sessionPath});u===n&&r().sessionForkPending&&(t({sessionForkCancellation:i.state===`not-found`?null:i.state}),i.state===`not-found`&&t({notice:In.t(`sidebarForkCancelUnconfirmed`)}))}catch(e){a===c&&r().sessionForkPending&&(t({sessionForkCancellation:null}),i(e))}},async forkConversation(e,t,n=`local`){return r().sessionForkPending||r().sessionSwitching||d||!await W.selectSession(e,t)?!1:W.forkMessage({scope:`conversation`,sessionPath:e,sessionId:t,environment:n})},async forkMessage(n,i){let a=`scope`in n&&n.scope===`conversation`;if(a&&i||i?.mode===`edit`&&(!i.content.trim()||i.content.length>12e3))return!1;let o=r(),s=o.snapshot?.selectedSession;if(o.sessionForkPending||d)return!1;if(!s||o.workspaceDraft||o.sessionSwitching||o.promptAdmissionPending||o.promptAdmissionRecovery||!a&&(o.liveRunning||o.activeTurn||o.snapshot?.runtime.status!==`idle`)||o.modelSelectionPending||!cj(o.snapshot)||s.id!==n.sessionId||s.path!==n.sessionPath||o.selectedPath!==n.sessionPath||s.path.startsWith(`current:`))return t({notice:In.t(`forkSessionUnavailable`)}),!1;let f=`entryId`in n?n.entryId:void 0,p=u?.sessionId===n.sessionId&&u.sessionPath===n.sessionPath&&u.entryId===f&&u.scope===`conversation`===a&&(!a||u.scope===`conversation`&&(u.environment??`local`)===(n.environment??`local`))&&JSON.stringify(u.rerun)===JSON.stringify(i)?u:{sessionId:n.sessionId,sessionPath:n.sessionPath,...a?{scope:`conversation`,...n.environment===`worktree`?{environment:`worktree`}:{}}:{entryId:f,...i?{rerun:i}:{}},commandId:globalThis.crypto?.randomUUID?.()??`web-fork-${Date.now()}-${++l}`};u=p;let m=c,h=m;t({sessionForkPending:!0,sessionForkCancellation:null,sessionForkEnvironment:a?n.environment??`local`:void 0,notice:null});try{let o=await e.forkSession(p);if(m!==c||r().selectedPath!==n.sessionPath)return!1;if(o.commandId!==p.commandId||o.source.sessionId!==n.sessionId||o.source.sessionPath!==n.sessionPath||!a&&o.source.entryId!==f||!o.source.entryId)throw Error(In.t(`forkSessionUncertain`));if(o.state!==`forked`)return t({notice:[In.t(o.state===`cancelled`?`forkSessionCancelled`:`forkSessionUncertain`),o.reason,o.preservedWorktreePath?In.t(`sidebarForkWorktreePreserved`,{path:o.preservedWorktreePath}):void 0].filter(Boolean).join(` `)}),o.state===`cancelled`?u=null:await W.refreshSnapshot({epoch:m}),!1;if(!o.sessionId||!o.sessionPath||o.sessionId===n.sessionId||o.sessionPath===n.sessionPath)throw Error(In.t(`forkSessionUncertain`));let s=++c;h=s,v=null,_=null,ue(),B(),t({...H(),...re(),selectedPath:o.sessionPath,historyAnchor:null,historyNavigation:null,createdSession:null,draftModel:null,sessionSwitching:!0});let l=await W.refreshSnapshot({epoch:s});if(!l&&s===c&&r().selectedPath===o.sessionPath&&(l=await W.refreshSnapshot({epoch:s})),s!==c)return!1;let d=r().snapshot;if(o.replayed&&l&&d?.selectedSession?.id===o.sessionId&&d.selectedSession.path===o.sessionPath&&!cj(d)){if(l=await W.selectSession(o.sessionPath,o.sessionId)===!0,s!==c)return!1;d=r().snapshot}if(!l||r().selectedPath!==o.sessionPath||d?.selectedSession?.id!==o.sessionId||d.selectedSession.path!==o.sessionPath||!cj(d))return t({notice:In.t(`forkSessionUncertain`)}),!1;if(u=null,i){let e=o.prompt;if(!e||typeof e.content!=`string`||!Array.isArray(e.images))throw Error(In.t(`forkSessionUncertain`));t({sessionForkPending:!1,sessionSwitching:!1});let n=W.sendPrompt(e.content,e.images,void 0,void 0,{epoch:s,sessionId:o.sessionId,sessionPath:o.sessionPath,workspacePath:d.selectedSession.cwd}),i=[...r().liveMessages].reverse().find(e=>e.optimistic?.sessionId===o.sessionId&&e.optimistic?.sessionPath===o.sessionPath)?.optimistic?.commandId??p.commandId,a=await n;return s!==c||r().selectedPath!==o.sessionPath?!1:a?(t({notice:{kind:`success`,message:In.t(`messageRerunStarted`)}}),!0):(r().promptAdmissionRecovery||t({restoredPromptDraft:{sessionId:o.sessionId,sessionPath:o.sessionPath,commandId:i,content:e.content,images:e.images}}),!1)}return t({notice:{kind:`success`,message:In.t(`forkSessionCreated`)}}),!0}catch(e){return h===c&&(e instanceof sf&&[`SESSION_CONFLICT`,`SESSION_FORK_UNAVAILABLE`,`SESSION_FORK_CAPACITY`].includes(e.code??``)?(u=null,t({notice:a?e.message:In.t(`forkSessionUnavailable`)})):t({notice:In.t(`forkSessionUncertain`)})),!1}finally{t({sessionForkPending:!1,sessionForkCancellation:null,sessionForkEnvironment:void 0}),c===h&&h!==m&&r().sessionSwitching&&t({sessionSwitching:!1})}},async savePreferences(t){try{await e.savePreferences(t),await W.refreshSnapshot()}catch(e){throw i(e),e}},async renameSession(t,n){try{await e.renameSession(t,n),await W.refreshSnapshot()}catch(e){throw i(e),e}},async releaseSessionWorktree(t){let n=JSON.stringify([t.sessionId,t.sessionPath,t.worktreePath]),r=f.get(n);if(r?.pending)return r.pending;if(!r&&f.size>=128){let e=[...f].find(([,e])=>e.state===`preserved`&&!e.pending);if(e)f.delete(e[0]);else throw Error(In.t(`managedWorktreeRecoveryFull`))}let i={commandId:r?.state===`uncertain`?r.commandId:crypto.randomUUID(),state:`uncertain`,pending:void 0};return f.set(n,i),i.pending=(async()=>{try{let r=await e.releaseSessionWorktree({...t,commandId:i.commandId});if(r.commandId!==i.commandId||r.sessionId!==t.sessionId||r.sessionPath!==t.sessionPath||r.worktreePath!==t.worktreePath||![`removed`,`preserved`,`uncertain`].includes(r.state))throw Error(In.t(`managedWorktreeUncertain`));return r.state===`removed`?f.delete(n):i.state=r.state,r}finally{i.pending=void 0}})(),i.pending},async deleteSession(n,a,o){if(d||r().sessionForkPending||r().sessionSwitching)return!1;d=!0;let s=c;try{let i=await e.deleteSession({sessionPath:n,sessionId:a,commandId:o});if(i.commandId!==o||i.sessionId!==a||i.sessionPath!==n)throw Error(In.t(`sessionDeleteUncertain`));return i.state===`deleted`?(s===c&&r().selectedPath===n&&(++c,ue(),B(),_=null,v=null,t({...H(),...re(),selectedPath:null,historyAnchor:null,historyNavigation:null,workspaceDraft:!0,createdSession:null})),await W.refreshSnapshot(),t({notice:i.worktreeReleaseTarget?{kind:`success`,message:In.t(`managedWorktreeRetainedAfterDelete`,{path:i.worktreeReleaseTarget.worktreePath})}:i.metadataCleanupPending?In.t(`sessionDeleteMetadataPending`):{kind:`success`,message:In.t(`sessionDeleted`)}}),!0):(s===c&&(await W.refreshSnapshot({epoch:s}),t({notice:In.t(i.state===`cancelled`?`sessionDeleteCancelled`:`sessionDeleteUncertain`)})),!1)}catch(e){return s===c&&i(e),!1}finally{d=!1}},async setSessionPin(t,n,r,a){try{await e.setSessionPin(t,n,r,a),await W.refreshSnapshot()}catch(e){throw i(e),e}},async archiveSession(n){let a=r().snapshot?.sessions.find(e=>e.path===n);try{await e.archiveSession(n);let r={key:crypto.randomUUID(),path:n,sessionId:a?.id,title:nj(a??{},In.t(`untitledSession`))};t(e=>({archiveNotices:[r,...e.archiveNotices.filter(e=>e.path!==n)].slice(0,3)})),await W.refreshSnapshot()}catch(e){i(e)}},dismissArchiveNotice(e){t(t=>({archiveNotices:t.archiveNotices.filter(t=>t.key!==e)}))},async setSidebarPin(t,n,r){try{await e.setSidebarPin(t,n,r),await W.refreshSnapshot()}catch(e){throw i(e),e}},async setWorkspaceOrder(t,n){try{await e.setWorkspaceOrder(t,n),await W.refreshSnapshot()}catch(e){throw e instanceof sf&&e.code===`WORKSPACE_ORDER_CHANGED`&&await W.refreshSnapshot(),i(e),e}},async setSessionOrder(t,n,r){try{await e.setSessionOrder(t,n,r),await W.refreshSnapshot()}catch(e){throw i(e),e}},async setSessionRead(t,n,r,a){try{await e.setSessionRead(t,n,r,a),await W.refreshSnapshot()}catch(e){throw e instanceof sf&&e.code===`SESSION_READ_STATE_CHANGED`?await W.refreshSnapshot():i(e),e}},async unarchiveSession(n){let r=c;try{if(await e.unarchiveSession(n),t(e=>({archiveNotices:e.archiveNotices.filter(e=>e.path!==n)})),r!==c)return!0;let i=p,a=await W.refreshSnapshot({epoch:r});return!a&&r===c&&p>i+1&&(a=await W.refreshSnapshot({epoch:r})),r!==c||a}catch(e){return r===c&&i(e),!1}},async selectModel(e){let[n,...i]=e.split(`/`),a=i.join(`/`),o=r();if(!n||!a||o.sessionSwitching||o.modelSelectionPending||o.promptAdmissionPending||!o.workspaceDraft&&(o.liveRunning||o.snapshot?.runtime.status===`running`))return!1;let s=o.snapshot?.selectedSession?.id;if(o.workspaceDraft||!s&&!o.snapshot?.currentSessionId){let e=[...o.snapshot?.models??[],...o.modelSearch.models].find(e=>e.provider===n&&e.id===a);return e&&t({draftModel:e,notice:null}),!!e}return!s||!o.selectedPath||!cj(o.snapshot)||s!==o.snapshot?.currentSessionId||o.selectedPath!==o.snapshot?.selectedSession?.path?!1:(ue(),U({provider:n,id:a},c,s,o.selectedPath))},async searchModels(n){let i=n.trim();if(!i){t(re());return}D?.abort();let a=new AbortController;D=a;let o=++O,s=c,l=r().snapshot?.currentSessionId;t({modelSearch:{query:i,status:`loading`,models:[],totalMatches:0,matchesOmitted:0,error:null}});try{let n=await e.searchModels(i,l,a.signal);if(a.signal.aborted||s!==c||o!==O)return;t({modelSearch:{query:i,status:`ready`,models:n.models,totalMatches:n.totalMatches,matchesOmitted:n.truncation.matchesOmitted,error:null}})}catch(e){if(a.signal.aborted||s!==c||o!==O)return;t({modelSearch:{query:i,status:`error`,models:[],totalMatches:0,matchesOmitted:0,error:e instanceof Error?e.message:String(e)}})}finally{D===a&&(D=null)}},clearModelSearch(){t(re())},selectThinking(e){let n=r(),i=n.snapshot?.thinking,a=n.snapshot?.selectedSession?.id;!e||!i?.supported||n.sessionSwitching||n.modelSelectionPending||n.workspaceDraft||!a||!cj(n.snapshot)||a!==n.snapshot?.currentSessionId||n.selectedPath!==n.snapshot?.selectedSession?.path||n.liveRunning||n.snapshot?.runtime.status===`running`||e!==(n.thinkingPendingLevel??i.level)&&(k=e,A++,t({thinkingPendingLevel:e}),fe())},async selectPlanMode(n){let a=r(),o=a.snapshot,s=o?.selectedSession;if(!o||!s||!cj(o,s)||a.workspaceDraft||a.sessionSwitching||a.planSelectionPending||a.promptAdmissionPending||a.promptAdmissionRecovery||a.liveRunning||o.runtime.status!==`idle`||o.runtime.planRevision===void 0)return;let l=c,u=++R;t({planSelectionPending:!0});try{if(await e.setPlanMode(s.id,s.path,n,o.runtime.planRevision),l===c&&u===R&&!await W.refreshSnapshot({epoch:l}))throw Error(In.t(`planModeUnconfirmed`))}catch(e){l===c&&u===R&&(await W.refreshSnapshot({epoch:l}),l===c&&u===R&&i(e))}finally{l===c&&u===R&&t({planSelectionPending:!1})}},async preparePlanImplementation(){let n=r(),a=n.snapshot,o=a?.selectedSession,s=o?.id;if(!s||!cj(a,o)||s!==a?.currentSessionId||!o?.path||n.selectedPath!==o.path||n.workspaceDraft||n.sessionSwitching||n.planSelectionPending||n.promptAdmissionPending||n.promptAdmissionRecovery||n.liveRunning||a.runtime.status!==`idle`||a.runtime.plan!==`ready`||typeof a.runtime.planRevision!=`string`)return null;let l=c,u=++R,d=o.path,f=a.runtime.planRevision;t({planSelectionPending:!0});try{let t;try{t=await e.preparePlanImplementation(s,d,f)}catch(e){if(l===c&&u===R){try{await W.refreshSnapshot({epoch:l})}catch{}l===c&&u===R&&i(e)}return null}let n=r();return l!==c||u!==R||!cj(n.snapshot)||n.snapshot?.currentSessionId!==s||n.snapshot.selectedSession?.path!==d||n.selectedPath!==d?null:t.sessionId!==s||t.status!==`ready`||t.revision!==f||n.snapshot?.runtime.plan!==`ready`||n.snapshot.runtime.planRevision!==f?(i(Error(In.t(`planModeUnconfirmed`))),null):{prompt:t.prompt,sessionId:s,sessionPath:d,planRevision:f}}finally{l===c&&u===R&&t({planSelectionPending:!1})}},async cancelActiveTurn(){let n=r().activeTurn??r().snapshot?.runtime.activeTurn;if(!n||!cj(r().snapshot)||r().turnCancellationPending||r().sessionSwitching)return;let a=c;t({turnCancellationPending:!0});try{await e.cancelActiveTurn(n)}catch(e){if(a!==c)return;await W.refreshSnapshot({epoch:a}),a===c&&i(e)}finally{a===c&&t({turnCancellationPending:!1})}},async sendPrompt(n,o=[],s,l,u){if(r().sessionForkPending||r().planSelectionPending)return!1;let d=n.trim();if(d.length>12e3)return t({notice:In.t(`promptTooLong`,{count:d.length,limit:qd})}),!1;let f=o.map(({data:e,mimeType:t,name:n})=>({data:e,mimeType:t,...n===void 0?{}:{name:n}})),p=JSON.stringify(f.map(({data:e,mimeType:t,name:n})=>[t,n??``,e])),m=r();if(u&&(u.epoch!==c||!a(u)||m.workspaceDraft))return!1;let h=m.promptAdmissionRecovery,y=h?.phase===`submitting`?h:null,b=m.activeTurn??m.snapshot?.runtime.activeTurn;if(l?.streamingBehavior===`steer`&&!y&&(s||m.turnCancellationPending||!b||b.commandId!==l.expectedTurnCommandId||m.workspaceDraft))return t({notice:In.t(`steerStaleTurn`)}),!1;let x=m.selectedWorkspace;if(!x||!d&&f.length===0&&!l?.retryEntryId||m.sessionSwitching||m.promptAdmissionPending||h&&!y||m.promptAdmissionResolution||m.modelSelectionPending||m.thinkingPendingLevel!==null)return!1;let S=r().workspaceDraft||!r().snapshot?.selectedSession?.id;if(s&&S)return!1;let C=S?await W.createSession(x):null;if(S&&!C)return r().notice||t({notice:`The active Session changed before the first message was sent. Your message was not sent.`}),!1;if(S&&r().draftModel)return!1;let w=r().snapshot?.selectedSession,T=C??(w?{epoch:c,sessionId:w.id,sessionPath:w.path,workspacePath:x}:null);if(!T||r().workspaceDraft||!a(T)||r().sessionSwitching||r().promptAdmissionPending||y&&(r().promptAdmissionRecovery?.commandId!==y.commandId||r().promptAdmissionRecovery?.phase!==`submitting`))return!1;let{epoch:E,sessionId:D,sessionPath:O}=T;if(!O||s&&(s.sessionId!==D||s.sessionPath!==O||!s.planRevision))return!1;let k=r().draftModel;if(k&&!await U(k,E,D,O)||r().workspaceDraft||!a(T)||y&&(r().promptAdmissionRecovery?.commandId!==y.commandId||r().promptAdmissionRecovery?.phase!==`submitting`))return!1;let A=++g,j=v?.sessionId===D&&v.sessionPath===O&&v.content===d&&v.imageSignature===p&&v.planRevision===s?.planRevision&&(v.delivery?.streamingBehavior??`followUp`)===(l?.streamingBehavior??`followUp`)&&v.delivery?.expectedTurnCommandId===l?.expectedTurnCommandId&&v.delivery?.retryEntryId===l?.retryEntryId,M=j?v.commandId:globalThis.crypto?.randomUUID?.()??`web-prompt-${Date.now()}-${A}`,N=j?v.optimisticKey:`optimistic-${M}`,P=j?v.timestamp:new Date().toISOString(),F=j?v.afterEntryId:r().snapshot?.selectedSession?.history?.leafEntryId??r().snapshot?.selectedSession?.entries.at(-1)?.id??null;v={sessionId:D,sessionPath:O,content:d,imageSignature:p,images:f,commandId:M,optimisticKey:N,timestamp:P,afterEntryId:F,...s?{planRevision:s.planRevision}:{},...l?{delivery:l}:{}},_=A,t({liveMessages:j||l?.retryEntryId?r().liveMessages:MJ([...r().liveMessages,{key:N,timestamp:P,optimistic:{sessionId:D,sessionPath:O,commandId:M,afterEntryId:F,admitted:!1},message:{role:`user`,content:d,...f.length>0?{parts:f.map(e=>({type:`image`,mimeType:e.mimeType,...e.name?{name:e.name}:{},previewUrl:`data:${e.mimeType};base64,${e.data}`}))}:{}}}]),notice:null,pendingFollowUpsReceipt:null,pendingSteeringReceipt:null,turnTerminalStatus:null,promptAdmissionPending:!0,scrollToBottom:r().scrollToBottom+1});try{let n=l?await e.prompt(D,d,M,O,j,f,s?.planRevision,l):s?await e.prompt(D,d,M,O,j,f,s.planRevision):await e.prompt(D,d,M,O,j,f);if(E!==c||O!==r().selectedPath||D!==r().snapshot?.selectedSession?.id||_!==A)return!1;let i=ee.has(n.id);return v?.commandId===M&&(v=null),t({liveMessages:n.accepted&&n.id===M?HJ(r().liveMessages,D,O,M):r().liveMessages,...cj(r().snapshot)?ae(i,r().livePhase):{},pendingFollowUpsReceipt:cj(r().snapshot)?n.pendingFollowUps??null:null,pendingSteeringReceipt:cj(r().snapshot)?n.pendingSteering??null:null,...y&&r().promptAdmissionRecovery?.commandId===y.commandId?{promptAdmissionRecovery:null,...j?{promptAdmissionResolution:{sessionId:y.sessionId,sessionPath:y.sessionPath,commandId:y.commandId,content:y.content,images:y.images}}:{}}:{}}),oe(120),!0}catch(e){if(E!==c||O!==r().selectedPath||D!==r().snapshot?.selectedSession?.id||_!==A)return!1;let n=e instanceof sf&&[`PLAN_BUSY`,`PLAN_CONFLICT`,`PLAN_CONTROL_UNAVAILABLE`].includes(e.code??``),a=n||e instanceof sf&&[`WORKSPACE_REQUIRED`,`SESSION_CONFLICT`,`TURN_CONFLICT`,`PROMPT_REJECTED`,`COMMAND_CONFLICT`,`PROMPT_ADMISSION_CAPACITY`,`INVALID_PROMPT`,`INVALID_PROMPT_IMAGES`].includes(e.code??``),o=ee.has(M)||r().liveMessages.some(e=>e.optimistic?.sessionId===D&&e.optimistic.sessionPath===O&&e.optimistic.commandId===M&&e.optimistic.admitted)||r().activeTurn?.sessionId===D&&r().activeTurn?.commandId===M;if(!a&&o)return v?.commandId===M&&(v=null),y&&r().promptAdmissionRecovery?.commandId===y.commandId&&t({promptAdmissionRecovery:null,...j?{promptAdmissionResolution:{sessionId:y.sessionId,sessionPath:y.sessionPath,commandId:y.commandId,content:y.content,images:y.images}}:{}}),!0;if(!a&&v?.commandId===M){let n=v;v=null,t({notice:null,promptAdmissionPending:!1,promptAdmissionRecovery:{...n,retryable:!(e instanceof sf)||e.code!==`COMMAND_ADMISSION_UNKNOWN`,phase:`checking`}});let i=await W.refreshSnapshot({resetCursor:!0,epoch:E}),a=r().promptAdmissionRecovery;if(a?.commandId===M){if(r().activeTurn?.sessionId===D&&r().activeTurn?.commandId===M&&r().selectedPath===O&&r().snapshot?.selectedSession?.path===O&&cj(r().snapshot))return t({promptAdmissionRecovery:null,promptAdmissionResolution:{sessionId:a.sessionId,sessionPath:a.sessionPath,commandId:a.commandId,content:a.content,images:a.images}}),!0;t({promptAdmissionRecovery:{...a,phase:i?`ready`:`verification-failed`}})}return!1}return a?(v?.commandId===M&&(v=null),t({liveMessages:r().liveMessages.filter(e=>e.key!==N),...j&&y&&e instanceof sf&&e.code===`PROMPT_REJECTED`?{promptAdmissionRecovery:null}:{}}),n&&(await W.refreshSnapshot({epoch:E}),E!==c||O!==r().selectedPath||_!==A)||i(e),!1):(i(e),!1)}finally{E===c&&_===A&&(_=null,t({promptAdmissionPending:!1}))}},async checkPromptAdmissionRecovery(){let e=r().promptAdmissionRecovery;if(!e||e.phase!==`verification-failed`)return;let n=c;t({notice:null,promptAdmissionRecovery:{...e,phase:`checking`}});let i=await W.refreshSnapshot({resetCursor:!0,epoch:n}),a=r().promptAdmissionRecovery;a?.commandId===e.commandId&&a.phase===`checking`&&t({promptAdmissionRecovery:{...a,phase:i?`ready`:`verification-failed`}})},async retryPromptAdmission(){let e=r().promptAdmissionRecovery;if(!e?.retryable||e.phase!==`ready`||e.sessionPath!==r().selectedPath||e.sessionPath!==r().snapshot?.selectedSession?.path||e.sessionId!==r().snapshot?.selectedSession?.id)return!1;let n=e.images??[];v={...e,images:n,imageSignature:JSON.stringify(n.map(({data:e,mimeType:t,name:n})=>[t,n??``,e])),afterEntryId:e.afterEntryId??null,timestamp:e.timestamp??new Date().toISOString()},t({promptAdmissionRecovery:{...e,phase:`submitting`},notice:null});try{return await W.sendPrompt(e.content,n,e.planRevision?{sessionId:e.sessionId,sessionPath:e.sessionPath,planRevision:e.planRevision}:void 0,e.delivery)}finally{let n=r().promptAdmissionRecovery;n?.commandId===e.commandId&&n.phase===`submitting`&&t({promptAdmissionRecovery:{...n,phase:`ready`}})}},async sendPromptAsNew(e,n,i,a,o){let s=r().promptAdmissionRecovery;if(!s||s.phase!==`ready`||s.sessionPath!==r().selectedPath||s.sessionPath!==r().snapshot?.selectedSession?.path||s.sessionId!==r().snapshot?.selectedSession?.id)return!1;let c=e.trim(),l=n??s.images??[];if(!c&&l.length===0)return!1;v=null,t({promptAdmissionRecovery:{...s,phase:`submitting`},notice:null});let u=!1;try{let e=s.planRevision?{sessionId:s.sessionId,sessionPath:s.sessionPath,planRevision:s.planRevision}:i;return u=e?await W.sendPrompt(c,l,e,void 0,o):await W.sendPrompt(c,l,void 0,void 0,o),u}finally{let e=r().promptAdmissionRecovery;e?.commandId===s.commandId&&e.phase===`submitting`&&t({promptAdmissionRecovery:u?null:{...e,phase:`ready`}})}},abandonPromptAdmission(){let e=r().promptAdmissionRecovery;!e||e.phase===`submitting`||(v?.commandId===e.commandId&&(v=null),t({liveMessages:r().liveMessages.filter(t=>t.key!==e.optimisticKey),notice:null,promptAdmissionRecovery:null}))},acknowledgePromptAdmissionResolution(e){r().promptAdmissionResolution?.commandId===e&&t({promptAdmissionResolution:null})},async discoverCommands(){let n=r(),i=n.snapshot?.selectedSession?.id;if(n.workspaceDraft||!i||!cj(n.snapshot)||i!==n.snapshot?.currentSessionId||n.selectedPath!==n.snapshot?.selectedSession?.path||n.sessionSwitching){B();return}if(n.commandDiscovery.sessionId===i&&(n.commandDiscovery.status===`loading`||n.commandDiscovery.status===`ready`))return;let a=c,o=++L;I?.abort();let s=new AbortController;I=s,t({commandDiscovery:{sessionId:i,status:`loading`,commands:[],totalAvailable:0,commandsOmitted:0,error:null}});try{let n=await e.commands(i,s.signal);if(s.signal.aborted||a!==c||o!==L||i!==r().snapshot?.currentSessionId)return;t({commandDiscovery:{sessionId:i,status:`ready`,commands:n.commands,totalAvailable:n.totalAvailable,commandsOmitted:n.truncation.commandsOmitted,error:null}})}catch(e){if(s.signal.aborted||a!==c||o!==L)return;t({commandDiscovery:{sessionId:i,status:`error`,commands:[],totalAvailable:0,commandsOmitted:0,error:e instanceof Error?e.message:String(e)}})}finally{I===s&&(I=null)}},clearCommandDiscovery:B,setQuery(e){t({query:e})},setSearchOpen(e){t({searchOpen:e,...e?{}:{query:``}})},toggleWorkspace(e){let n=new Set(r().collapsed);n.has(e)?n.delete(e):n.add(e),jJ(EJ,[...n]),t({collapsed:n})},toggleSidebar(e){if(e){t({mobileSidebarOpen:!r().mobileSidebarOpen});return}let n=!r().sidebarCollapsed;try{window.sessionStorage.setItem(DJ,String(n))}catch{}t({sidebarCollapsed:n})},closeMobileSidebar(){t({mobileSidebarOpen:!1})},clearNotice(){t({notice:null})}};return{planSelectionPending:!1,activeTurn:null,turnCancellationPending:!1,turnTerminalStatus:null,pendingFollowUpsReceipt:null,pendingSteeringReceipt:null,snapshot:null,historyAnchor:null,historyNavigation:null,sessionForkPending:!1,sessionForkCancellation:null,cursor:null,selectedPath:s?.path??null,selectedWorkspace:null,workspaceDraft:o&&!s,draftModel:null,createdSession:null,modelSelectionPending:!1,modelSearch:{query:``,status:`idle`,models:[],totalMatches:0,matchesOmitted:0,error:null},collapsed:kJ(EJ),sidebarCollapsed:AJ(DJ),mobileSidebarOpen:!1,query:``,searchOpen:!1,connection:`connecting`,archiveNotices:[],notice:o&&!s?In.t(`sessionLinkUnavailable`):null,liveMessages:[],liveRunning:!1,livePhase:`idle`,liveRetry:null,thinkingStarts:{},thinkingDurations:{},promptAdmissionPending:!1,promptAdmissionRecovery:null,promptAdmissionResolution:null,restoredPromptDraft:null,sessionSwitching:!1,scrollToBottom:0,thinkingPendingLevel:null,commandDiscovery:ie(),actions:W}})}var KJ=GJ(),qJ=340,JJ=220,YJ=520,XJ=190,ZJ=520,QJ=360,$J=720,eY=320,tY=440,nY=1100;function rY(e,t,n){return Math.min(n,Math.max(t,e))}function iY(){JR();let e=pr(KJ),{t}=cr(),{actions:n}=e,r=(0,_.useRef)(null),i=(0,_.useRef)(null),a=(0,_.useRef)(!1),o=(0,_.useRef)(null),s=(0,_.useRef)(null),c=(0,_.useRef)(null),l=(0,_.useRef)(null),u=(0,_.useRef)(void 0),d=(0,_.useCallback)(e=>{u.current=e},[]),f=(0,_.useMemo)(xL,[]),p=(0,_.useRef)(new Set),[,m]=(0,_.useState)(0),[h,g]=(0,_.useState)(null),v=(0,_.useMemo)(()=>new Map,[]),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(),[C,w]=(0,_.useState)(!1),[T,E]=(0,_.useState)(!1),[D,O]=(0,_.useState)(()=>window.innerWidth),[k,A]=(0,_.useState)({sidebar:qJ,auxiliary:ZJ}),[j,M]=(0,_.useState)(!1),N=!!e.snapshot,P=e.snapshot?.preferences.sidebarWidth,F=e.snapshot?.preferences.auxiliaryWidth;(0,_.useEffect)(()=>{!N||j||C||A({sidebar:P??qJ,auxiliary:F??ZJ})},[P,F,N,j,C]),(0,_.useEffect)(()=>{if(!j||C)return;let e=window.setTimeout(()=>{n.savePreferences({sidebarWidth:k.sidebar,auxiliaryWidth:k.auxiliary}).catch(()=>void 0)},200);return()=>window.clearTimeout(e)},[n,k,j,C]);let I=(e,t)=>{M(!0),A(n=>({...n,[e]:t}))},[L,R]=(0,_.useState)(()=>window.matchMedia?.(`(max-width: 760px)`).matches??!1),ee=L&&e.mobileSidebarOpen;(0,_.useEffect)(()=>{let e=window.matchMedia?.(`(max-width: 760px)`);if(!e)return;let t=()=>{R(e.matches),e.matches||n.closeMobileSidebar()};return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[n]),(0,_.useEffect)(()=>{let e=()=>O(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let[z,B]=(0,_.useState)(`chat`),[V,H]=(0,_.useState)(null),[te,ne]=(0,_.useState)(null),[re,ie]=(0,_.useState)(uJ);(0,_.useEffect)(()=>{let e=()=>dJ(re);e(),window.addEventListener(`pagehide`,e);let t=()=>{document.visibilityState===`hidden`&&e()};return document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`pagehide`,e),document.removeEventListener(`visibilitychange`,t),e()}},[re]);let ae=e.workspaceDraft?void 0:e.snapshot?.selectedSession,U=re.find(e=>e.sessionId===ae?.id&&e.sessionPath===ae?.path),oe=U?.open??!1,se=U?.reviewTurn,ce=(0,_.useCallback)(e=>{let t=KJ.getState().snapshot?.selectedSession;t&&ie(n=>n.map(n=>n.sessionId===t.id&&n.sessionPath===t.path?e(n):n))},[]),le=(0,_.useCallback)(e=>ce(t=>({...t,open:e})),[ce]),ue=e=>ce(t=>({...t,reviewTurn:e??void 0})),[de,fe]=(0,_.useState)(null),[pe,me]=(0,_.useState)(nL),W=(0,_.useCallback)((e,t)=>{let n=KJ.getState(),r=n.snapshot?.selectedSession;n.workspaceDraft||n.sessionSwitching||!r||!r.id||(a.current||(i.current=document.activeElement instanceof HTMLElement?document.activeElement:null),a.current=!0,c.current=null,le(!1),me(n=>({sessionId:r.id,sessionPath:r.path,id:e,kind:t,navigation:(n?.navigation??0)+1})))},[le]),he=pe&&!e.workspaceDraft&&!e.sessionSwitching&&pe.sessionId===e.snapshot?.selectedSession?.id&&pe.sessionPath===e.snapshot?.selectedSession?.path;(0,_.useEffect)(()=>{e.snapshot&&!e.sessionSwitching&&pe&&!he&&me(null)},[e.snapshot,e.sessionSwitching,pe,he]),(0,_.useEffect)(()=>rL(pe),[pe]),(0,_.useEffect)(()=>{if(he||!a.current)return;a.current=!1;let e=i.current;i.current=null,queueMicrotask(()=>{e?.isConnected&&e.checkVisibility()&&e.focus()})},[he]);let ge=e.snapshot?.models.find(e=>e.current),_e=JSON.stringify([ge?.provider,ge?.id]),ve=t=>{let n=e.snapshot,r=n?.selectedSession;e.workspaceDraft||!n||!r||e.sessionSwitching||!cj(n,r)||(c.current=null,le(!1),H({sessionId:r.id,sessionPath:r.path,cwd:r.cwd,model:ge?.label??``,modelKey:_e,terminalId:t}))},ye=V&&!e.workspaceDraft&&!e.sessionSwitching&&cj(e.snapshot,{id:V.sessionId,path:V.sessionPath})&&V.sessionPath===e.snapshot?.selectedSession?.path&&V.modelKey===_e;(0,_.useEffect)(()=>{V&&!ye&&H(null)},[V,ye]);let be=(0,_.useCallback)(()=>{H(null);let e=o.current;o.current=null,e&&requestAnimationFrame(()=>{e.isConnected&&e.checkVisibility()&&e.focus()})},[]),xe=te&&!e.workspaceDraft&&!e.sessionSwitching&&cj(e.snapshot,{id:te.sessionId,path:te.sessionPath})&&te.sessionPath===e.snapshot?.selectedSession?.path;(0,_.useEffect)(()=>{te&&!xe&&ne(null)},[te,xe]);let Se=async(e=`general`)=>{s.current=document.activeElement instanceof HTMLElement?document.activeElement:null;let t=await n.prepareSession();if(!t)return;let r=KJ.getState(),i=r.snapshot,a=i?.selectedSession;r.workspaceDraft||!a||r.sessionSwitching||!cj(i,a)||a.id!==t.sessionId||a.path!==t.sessionPath||(n.closeMobileSidebar(),H(null),me(null),c.current=null,le(!1),ne({sessionId:a.id,sessionPath:a.path,cwd:a.cwd,entry:e}))},Ce=(0,_.useCallback)(()=>{ne(null);let e=new URL(window.location.href);e.searchParams.delete(`settings`),window.history.replaceState(window.history.state,``,e),requestAnimationFrame(()=>{let e=s.current;s.current=null,e?.isConnected&&e.checkVisibility()?e.focus():document.querySelector(`[data-provider-settings-trigger]`)?.focus()})},[]),we=()=>{o.current=s.current??document.querySelector(`[data-provider-settings-trigger]`),ne(null),ve()},Te=async e=>{if(await n.sendPrompt(`/openpi-setup ${e}`))return!0;let r=KJ.getState();throw Error((typeof r.notice==`string`?r.notice:null)||t(r.promptAdmissionRecovery?`setupResolveAdmission`:r.liveRunning||r.activeTurn?`settingsSetupBusyHint`:`setupRequestFailed`))};(0,_.useEffect)(()=>(n.start(),n.stop),[n]);let G=e.workspaceDraft?void 0:e.snapshot?.selectedSession,Ee=SL(G),De=G?.id,Oe=G?.path,ke=!!(G&&!p.current.has(Ee)&&f.get(Ee)?.position?.key&&f.get(Ee)?.position?.pinned===!1);(0,_.useEffect)(()=>{let t=KJ.getState(),n=t.workspaceDraft?void 0:t.snapshot?.selectedSession;if(!n||n.id!==De||n.path!==Oe||e.sessionSwitching||p.current.has(Ee))return;let r=f.get(Ee)?.position,i=()=>{p.current.add(Ee),m(e=>e+1)};if(!r?.key||r.pinned||f.get(Ee)?.window||e.historyNavigation?.sessionId===n.id&&e.historyNavigation.sessionPath===n.path){i();return}let a={sessionId:n.id,sessionPath:n.path,entryId:r.entryId??r.key},o=new AbortController,s,c=e=>{let t=e.target;!(t instanceof Element)||!t.closest(`.conversation, .turn-rail, .jump-to-latest`)||e instanceof KeyboardEvent&&![`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(e.key)||(o.abort(),i(),g(e=>e?.sessionId===a.sessionId&&e.sessionPath===a.sessionPath?null:e))};for(let e of[`wheel`,`touchstart`,`pointerdown`,`keydown`])document.addEventListener(e,c,!0);let l=e=>{let t=KJ.getState();o.signal.aborted||p.current.has(Ee)||t.historyNavigation||t.sessionSwitching||t.workspaceDraft||t.selectedPath!==a.sessionPath||t.snapshot?.selectedSession?.id!==a.sessionId||t.snapshot.selectedSession.path!==a.sessionPath||f.get(Ee)?.position!==r||e.id!==a.sessionId||e.path!==a.sessionPath||e.history?.anchorEntryId!==a.entryId||e.history.anchorOnBranch!==!0||!e.entries.some(e=>e.id===a.entryId)||(g({...a,session:e,restorePosition:r,revision:-1}),i())};if(e.connection===`connected`)if(n.entries.some(e=>e.id===a.entryId))l({...n,history:{leafEntryId:n.history?.leafEntryId??null,beforeEntryId:n.history?.beforeEntryId??null,anchorEntryId:a.entryId,anchorOnBranch:!0}});else{let e=t=>{new lf().sessionMessageWindow(a,o.signal).then(l,()=>{!o.signal.aborted&&t===0&&(s=window.setTimeout(()=>e(1),500))})};e(0)}return()=>{o.abort(),window.clearTimeout(s);for(let e of[`wheel`,`touchstart`,`pointerdown`,`keydown`])document.removeEventListener(e,c,!0)}},[De,Oe,e.connection,e.sessionSwitching,e.historyNavigation,Ee,f]);let Ae=cj(e.snapshot,G),je=(0,_.useMemo)(()=>uj((G?.entries??[]).flatMap(e=>e.message?[e.message]:[])),[G?.entries]),Me=Ae?e.snapshot?.runtime.capabilities.subagents:void 0,Ne=(0,_.useMemo)(()=>dj(Me?.items??[],je,Ae?e.snapshot?.runtime.capabilities.workflows?.items:void 0,e.connection===`connected`),[Me?.items,je,Ae,e.snapshot?.runtime.capabilities.workflows?.items,e.connection]),Pe=e.snapshot?.selectedExecution,Fe=Pe?.sessionId===G?.id&&Pe?.sessionPath===G?.path?Pe:void 0,Ie=Ae&&(e.liveRunning||!!e.activeTurn||e.snapshot?.runtime.status===`running`)||Fe?.status===`running`,Le=QN(G,e.snapshot?.cursor,{active:oe&&de===`review`,running:Ie,initialSource:U?.reading.review?.scope.startsWith(`workspace:`)?U.reading.review.source:`unstaged`,initialBaseRef:U?.reading.review?.baseRef}),Re=!!(U&&G&&e.selectedPath===G.path&&U.sessionId===G.id&&U.sessionPath===G.path),ze=oe&&Re&&!e.sessionSwitching;(0,_.useEffect)(()=>{G?.id,G?.path,c.current=null},[G?.id,G?.path]),(0,_.useEffect)(()=>{!U||e.sessionSwitching||ie(e=>e.at(-1)===U?e:[...e.filter(e=>e!==U),U])},[U,e.sessionSwitching]);let Be=(t=`launcher`)=>{!G||e.sessionSwitching||(y&&l.current?.close({restoreFocus:!1}),ze||(c.current=document.activeElement instanceof HTMLElement?document.activeElement:null),H(null),me(null),ie(e=>{let n=e.find(e=>e.sessionId===G.id&&e.sessionPath===G.path),r={sessionId:G.id,sessionPath:G.path,tool:t,requestRevision:(n?.requestRevision??0)+1,open:!0,reading:n?.reading??{},reviewTurn:t===`review`?void 0:n?.reviewTurn};return[...e.filter(e=>e!==n),r].slice(-32)}))},Ve=()=>{E(!1),le(!1);let e=c.current;c.current=null,requestAnimationFrame(()=>{e?.isConnected&&e.checkVisibility()&&e.focus()})},He=!e.sessionSwitching&&!e.workspaceDraft&&cj(e.snapshot,G)?G:void 0;ZR(He?.id,He?.path,async(e,t)=>{Be(`browser`);let n=Date.now()+5e3;for(;!u.current&&!t.aborted&&Date.now()setTimeout(e,40));return t.aborted?void 0:u.current?.(e)});let Ue=(0,_.useRef)(FI(new URLSearchParams(location.search).get(`settings`))),We=(0,_.useEffectEvent)(e=>{Se(e)});(0,_.useEffect)(()=>{if(!Ue.current||!e.snapshot||e.sessionSwitching)return;let t=Ue.current;Ue.current=void 0,We(t)},[e.snapshot,e.sessionSwitching]);let Ge=!!(he||ze||y);(0,_.useEffect)(()=>{(!Ge||D<=nY)&&E(!1)},[Ge,D]);let qe=Math.max(JJ,Math.min(YJ,D-tY-(Ge&&!T?k.auxiliary:0))),Je=rY(k.sidebar,JJ,qe),Ye=Math.max(QJ,Math.min($J,D-(e.sidebarCollapsed?56:Je)-tY)),Xe=rY(k.auxiliary,QJ,Ye),Ze={"--sidebar-width":`${Je}px`,"--auxiliary-width":`${Xe}px`},Qe=()=>{y?l.current?.close():ze?Ve():he&&me(null)},$e=!e.snapshot,et=e.sessionSwitching?e.snapshot?.sessions.find(t=>t.path===e.selectedPath)?.cwd:e.workspaceDraft?e.selectedWorkspace:G?.cwd??e.selectedWorkspace,rt=e.snapshot?.workspaces.find(e=>e.path===et),at=e.snapshot?.sessions.find(e=>e.path===G?.path&&e.id===G?.id),ot=e.sessionSwitching?e.snapshot?.sessions.find(t=>t.path===e.selectedPath):void 0,st=e.sessionSwitching?ot?nj(ot,t(`untitledSession`)):t(`switchingSession`):G?nj(at??{},t(`untitledSession`)):e.selectedWorkspace?t(`newSession`):`OpenPI`,ct=!!G?.rerun||G?.entries.some(e=>e.type===`message`&&e.message||e.type===`compaction`)||!!G?.history?.beforeEntryId||e.liveMessages.length>0,lt=!$e&&!e.sessionSwitching&&(!G||!ct&&!(e.snapshot?.selectedExecution?.sessionId===G.id&&e.snapshot.selectedExecution?.sessionPath===G.path&&e.snapshot.selectedExecution.compaction)),ut=(0,_.useCallback)((e,t)=>t?n.sendPrompt(``,[],void 0,{streamingBehavior:`followUp`,retryEntryId:t}):n.sendPrompt(e),[n]);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`div`,{inert:xe?!0:void 0,"aria-hidden":xe?!0:void 0,className:`app-shell ${e.sidebarCollapsed?`sidebar-collapsed`:``} ${e.mobileSidebarOpen?`sidebar-open`:``} ${he?`with-subagent-panel`:``} ${ze?`with-workbar-panel`:``} ${y?`with-artifact-panel`:``} ${T?`center-collapsed`:``} ${C?`is-resizing`:``} ${$e?`shell-loading`:``}`,style:Ze,children:(0,K.jsxs)(Gk,{ref:l,sessionId:G?.id,sessionPath:G?.path,disabled:!!(e.workspaceDraft||e.sessionSwitching||he||xe),onOpen:()=>{b(!0),me(null),le(!1),H(null)},onClose:()=>{b(!1)},children:[(0,K.jsx)(gP,{sessionViewVisible:z===`chat`&&!T&&!xe&&!e.sessionSwitching&&!e.workspaceDraft,connected:e.connection===`connected`,snapshot:e.snapshot,selectedPath:e.workspaceDraft?null:e.selectedPath,selectedWorkspace:e.selectedWorkspace,collapsed:e.collapsed,query:e.query,searchOpen:e.searchOpen,mobileOpen:ee,settingsDisabled:!!(e.sessionSwitching||e.modelSelectionPending||!e.snapshot),returnFocusRef:r,onOpenSettings:()=>void Se(`general`),actions:n}),e.sidebarCollapsed&&(0,K.jsx)(`button`,{className:`sidebar-expand`,type:`button`,"aria-label":t(`expandSidebar`),title:t(`expandSidebar`),onClick:()=>n.toggleSidebar(!1),children:(0,K.jsx)(nt,{})}),(0,K.jsxs)(`main`,{inert:ee,className:`conversation-shell ${G?`has-view`:``} ${lt&&(!G||z===`chat`)?`landing`:``}`,children:[(0,K.jsxs)(`header`,{className:`task-header`,children:[(0,K.jsx)(`button`,{className:`task-header-menu sidebar-shell-toggle`,ref:r,type:`button`,"aria-label":t(L?`openSidebar`:e.sidebarCollapsed?`expandSidebar`:`collapseSidebar`),"aria-controls":`session-sidebar`,"aria-expanded":L?ee:!e.sidebarCollapsed,onClick:()=>n.toggleSidebar(L),children:L?(0,K.jsx)(Ke,{}):(0,K.jsx)(tt,{})}),(0,K.jsxs)(`div`,{className:`task-identity`,children:[et&&(0,K.jsxs)(`span`,{className:`task-workspace`,title:et,children:[rt?.name||rj(et),(0,K.jsxs)(`span`,{className:`sr-only`,children:[` `,et]})]}),(0,K.jsx)(`h1`,{title:st,children:st})]}),(0,K.jsx)(QR,{usage:G&&!e.sessionSwitching?e.snapshot?.usage:void 0,workspace:rt?.name||G&&rj(G.cwd),sessionId:G?.id},G?`usage:${G.id}:${G.path}`:`usage:no-session`),G&&!e.sessionSwitching&&(0,K.jsx)(HI,{sessionId:G.id,workspace:rt?.name||rj(G.cwd),agents:Ne,omitted:(Me?.omitted??0)+(Ae?(e.snapshot?.runtime.capabilities.workflows?.items??[]).reduce((e,t)=>e+(t.children?.omitted??0),0):0),review:Le.result,reviewLoading:Le.loading,reviewError:Le.error,sessionPath:G.path,revision:G.history?.leafEntryId??void 0,onAddSources:Ae?()=>S(e=>({sessionId:G.id,path:G.path,revision:(e?.revision??0)+1})):void 0,onSubagents:()=>W(),onReview:()=>Be(`review`)},`overview:${G.id}:${G.path}`),(0,K.jsx)(`button`,{type:`button`,className:`task-tools-trigger`,"aria-label":t(`openTools`),title:t(`openTools`),disabled:!G||e.sessionSwitching,onClick:e=>{y&&l.current?.close({restoreFocus:!1}),c.current=e.currentTarget,Re&&!ze?le(!0):Be(`launcher`)},children:(0,K.jsx)(it,{"aria-hidden":`true`})}),(0,K.jsx)(`span`,{className:`connection-state ${e.connection}`,children:t(e.connection)})]}),G&&!e.sessionSwitching&&(0,K.jsx)(`div`,{className:`conversation-view-row`,children:(0,K.jsxs)(`fieldset`,{className:`conversation-view-switch`,"aria-label":t(`conversationView`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-pressed":z===`chat`,onClick:()=>B(`chat`),children:t(`chatView`)}),(0,K.jsx)(`button`,{type:`button`,"aria-pressed":z===`trajectory`,onClick:()=>B(`trajectory`),children:t(`trajectory`)})]})}),$e?(0,K.jsxs)(`section`,{className:`shell-state`,role:`status`,"aria-live":`polite`,children:[(0,K.jsx)(hr,{compact:!0}),(0,K.jsx)(`p`,{children:t(e.connection===`unavailable`?`unavailable`:`connecting`)}),e.connection===`unavailable`&&(0,K.jsxs)(`button`,{type:`button`,onClick:()=>void n.refreshSnapshot({resetCursor:!0}),children:[(0,K.jsx)(dt,{"aria-hidden":`true`}),` `,t(`retryAdmissionCheck`)]})]}):e.sessionSwitching?(0,K.jsx)(`div`,{className:`conversation switching`,role:`status`,children:(0,K.jsxs)(`div`,{className:`conversation-running`,children:[(0,K.jsx)(`span`,{className:`conversation-running-dot`}),(0,K.jsx)(`span`,{children:t(`switchingSession`)})]})}):z===`trajectory`&&G&&e.snapshot?(0,K.jsx)(yL,{snapshot:e.snapshot,running:Ie},G.path):lt?(0,K.jsx)(`section`,{className:`conversation landing-conversation`,"aria-label":`Conversation`,children:(0,K.jsxs)(`div`,{className:`landing-welcome`,children:[(0,K.jsx)(hr,{animated:!0}),(0,K.jsx)(`p`,{className:`landing-tagline`,children:t(`landingTagline`)})]})}):e.snapshot?(0,K.jsx)(qR,{resultExposureEnabled:!T&&!xe&&!e.sessionSwitching&&!e.workspaceDraft&&z===`chat`,readingCache:f,readingRestorePending:ke,snapshot:e.snapshot,liveMessages:e.liveMessages,liveRunning:e.liveRunning,liveActiveTurn:e.activeTurn,livePhase:e.livePhase,activityObserved:e.connection===`connected`,liveRetry:e.liveRetry,thinkingStarts:e.thinkingStarts,thinkingDurations:e.thinkingDurations,scrollToBottom:e.scrollToBottom,onResend:ut,onEdit:n.editMessage,onRegenerate:n.regenerateMessage,onOpenOriginal:n.navigateToMessage,onFork:n.forkMessage,forkPending:e.sessionForkPending,forkAvailable:Ae&&!Ie&&e.snapshot.runtime.status===`idle`&&!e.promptAdmissionPending&&!e.promptAdmissionRecovery&&!e.activeTurn&&!e.modelSelectionPending&&!e.sessionSwitching&&!G?.path.startsWith(`current:`)&&!(Fe?.pendingFollowUps||Fe?.pendingSteering||Fe?.compaction?.state===`running`),onInspectSubagent:W,onReviewTurn:(e,t)=>{Be(`review`),c.current=document.activeElement instanceof HTMLElement?document.activeElement:null,ue({promptEntryId:e,filePath:t,revision:(se?.revision??0)+1})},onHistoryAnchorChange:n.setHistoryAnchor,historyNavigation:e.historyNavigation??(h?.sessionId===G?.id&&h?.sessionPath===G?.path?h:null),onNavigateToMessage:n.navigateToMessage,onRefreshHistory:n.refreshSnapshot,onPromptProjection:n.rememberPromptProjection},`transcript:${JSON.stringify([G?.id,G?.path])}`):null,!xe&&G&&e.snapshot&&!e.sessionSwitching&&cj(e.snapshot,G)&&(0,K.jsx)(ZN,{sessionId:G.id,sessionPath:G.path,workingCache:v,revision:e.snapshot.cursor,connected:e.connection===`connected`},JSON.stringify([G.id,G.path])),e.snapshot&&(0,K.jsxs)(`div`,{className:`workbar-chat-context`,hidden:!ze,children:[(0,K.jsx)(`span`,{className:`workbar-chat-title`,title:st,children:st}),(0,K.jsx)(`span`,{className:`workbar-chat-status`,role:`status`,children:t(Ie?`turnState_running`:e.connection)}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>{Ve(),requestAnimationFrame(()=>document.querySelector(`.composer textarea`)?.focus({preventScroll:!0}))},children:t(`workbarContinueInChat`)})]}),e.snapshot&&(0,K.jsx)(UN,{addSourcesRequest:x,planSelectionPending:e.planSelectionPending,workspaceDraft:e.workspaceDraft,draftModel:e.draftModel,createdSession:e.createdSession,modelSelectionPending:e.modelSelectionPending,modelSearch:e.modelSearch,thinkingPendingLevel:e.thinkingPendingLevel,onInspect:ve,onOpenProviders:()=>void Se(`credentials`),onCommandAction:e=>{let t=KJ.getState();return t.sessionSwitching||t.workspaceDraft||!G||t.snapshot?.selectedSession?.path!==G.path||t.snapshot.selectedSession.id!==G.id?!1:(e===`terminal`||e===`review`||e===`side-conversation`?Be(e):e===`subagents`?W():ve(),!0)},onInspectSubagent:W,activeTurn:e.activeTurn,activityObserved:e.connection===`connected`,turnCancellationPending:e.turnCancellationPending,turnTerminalStatus:e.turnTerminalStatus,pendingFollowUpsReceipt:e.pendingFollowUpsReceipt,pendingSteeringReceipt:e.pendingSteeringReceipt,commandDiscovery:e.commandDiscovery,snapshot:e.snapshot,selectedPath:e.selectedPath,selectedWorkspace:G?.cwd??e.selectedWorkspace,sessionSwitching:e.sessionSwitching||e.sessionForkPending,promptAdmissionPending:e.promptAdmissionPending,promptAdmissionRecovery:e.promptAdmissionRecovery,promptAdmissionResolution:e.promptAdmissionResolution,restoredPromptDraft:e.restoredPromptDraft,liveRunning:e.liveRunning,landing:lt,actions:n}),e.sessionForkPending&&(0,K.jsxs)(`div`,{className:`session-fork-progress`,role:`status`,children:[(0,K.jsx)(`span`,{className:`session-fork-progress-spinner`,"aria-hidden":`true`}),t(e.sessionForkCancellation===`too-late`?`sidebarForkFinishing`:e.sessionForkCancellation?`sidebarForkCancelling`:e.sessionForkEnvironment===`worktree`?`sidebarForkWorktreePending`:`forkSessionPending`),e.sessionForkEnvironment&&(0,K.jsx)(`button`,{type:`button`,disabled:e.sessionForkCancellation!==null,onClick:()=>void n.cancelSessionFork(),children:t(`cancel`)})]}),(0,K.jsx)(eP,{notices:e.archiveNotices,actions:n}),e.notice&&(0,K.jsxs)(`div`,{className:typeof e.notice==`string`?`notice`:`notice notice-success`,role:typeof e.notice==`string`?`alert`:`status`,children:[(0,K.jsx)(`span`,{children:typeof e.notice==`string`?e.notice:e.notice.message}),(0,K.jsx)(`button`,{type:`button`,"aria-label":t(`close`),onClick:n.clearNotice,children:(0,K.jsx)(Lt,{})})]})]}),ye&&(0,K.jsx)(WN,{target:V,onClose:be,onOpenProviders:()=>void Se(`credentials`)},`${V.sessionId}:${V.sessionPath}:${V.terminalId??`status`}`),he&&(0,K.jsx)(eL,{sessionId:pe.sessionId,initialId:pe.id,initialKind:pe.kind,observed:e.connection===`connected`,activity:cj(e.snapshot,{id:pe.sessionId,path:pe.sessionPath})?e.snapshot?.runtime.capabilities.subagents:void 0,records:je,workflows:Ae?e.snapshot?.runtime.capabilities.workflows:void 0,liveAvailable:cj(e.snapshot,{id:pe.sessionId,path:pe.sessionPath}),onClose:()=>me(null)},`${pe.sessionId}:${pe.navigation}`),ze&&G&&U&&(0,K.jsx)($q,{visible:ze,requestedTool:U.tool,requestRevision:U.requestRevision,sessionId:G.id,sessionPath:G.path,onBrowserReady:d,canControl:!e.sessionSwitching&&cj(e.snapshot,G),onActivateSession:()=>void n.selectSession(G.path),cwd:G.cwd,snapshot:e.snapshot??void 0,capabilities:cj(e.snapshot,G)?e.snapshot?.runtime.capabilities??{}:{},readingState:U.reading,onActiveToolChange:fe,review:Le,reviewTurn:se??void 0,onWorkspaceReview:()=>ue(null),onReferenceLine:e=>{let t=KJ.getState(),n=t.snapshot?.selectedSession;t.workspaceDraft||t.sessionSwitching||t.selectedPath!==G.path||n?.id!==G.id||n.path!==G.path||!cj(t.snapshot,n)||(B(`chat`),S(t=>({sessionId:G.id,path:G.path,revision:(t?.revision??0)+1,feedback:e})))},conversationCollapsed:T,onRestoreConversation:()=>E(!1),onExpandReview:()=>E(!0),onClose:Ve},`${G.id}:${G.path}`),(0,K.jsxs)(`section`,{"aria-label":t(`resizePanes`),style:{display:`contents`},children:[!e.sidebarCollapsed&&!L&&(!Ge||D>nY)&&(0,K.jsx)(_r,{side:`left`,value:Je,min:JJ,max:qe,defaultValue:qJ,collapseThreshold:XJ,onCollapse:()=>n.toggleSidebar(!1),onChange:e=>I(`sidebar`,e),onDraggingChange:w}),Ge&&!T&&D>nY&&(0,K.jsx)(_r,{side:`right`,value:Xe,min:QJ,max:Ye,defaultValue:ZJ,collapseThreshold:eY,onCollapse:Qe,onExpandPastMax:ze?()=>E(!0):void 0,onChange:e=>I(`auxiliary`,e),onDraggingChange:w})]}),(0,K.jsx)(`button`,{className:`sidebar-scrim`,type:`button`,tabIndex:-1,"aria-hidden":`true`,"aria-label":t(`close`),onClick:n.closeMobileSidebar})]})}),xe&&(0,K.jsx)(II,{sessionId:te.sessionId,cwd:te.cwd,entry:te.entry,models:e.snapshot?.models??[],currentModel:ge,thinkingLevel:e.thinkingPendingLevel??e.snapshot?.thinking?.level??t(`unknownState`),theme:e.snapshot?.preferences.theme??`system`,preferences:e.snapshot?.preferences,workspaces:e.snapshot?.workspaces??[],onRestoreSession:e=>n.unarchiveSession(e),plan:e.snapshot?.runtime.plan,planSelectionPending:e.planSelectionPending,onExitPlan:()=>n.selectPlanMode(!1),setupOutcome:e.snapshot?.runtime.setup,capabilities:e.snapshot?.runtime.capabilities,setupBusy:e.liveRunning||e.promptAdmissionPending||!!e.activeTurn||e.modelSelectionPending||e.thinkingPendingLevel!==null||e.sessionSwitching,setupBlockedReason:e.promptAdmissionRecovery?t(`setupResolveAdmission`):void 0,modelSelectionPending:e.modelSelectionPending,sessionPath:te.sessionPath,onSelectModel:e=>n.selectModel(e),onConfigureOpenPi:Te,interaction:e.snapshot&&!e.sessionSwitching&&te.sessionId===e.snapshot.currentSessionId?(0,K.jsxs)(`div`,{className:`settings-interaction`,children:[(0,K.jsx)(ZN,{sessionId:te.sessionId,sessionPath:te.sessionPath,workingCache:v,revision:e.snapshot.cursor,connected:e.connection===`connected`},JSON.stringify([te.sessionId,te.sessionPath])),(e.activeTurn||e.liveRunning)&&(0,K.jsx)(`button`,{type:`button`,disabled:e.turnCancellationPending,onClick:()=>void n.cancelActiveTurn(),children:t(`stopTurn`)})]}):void 0,onPreferencesChanged:()=>n.refreshSnapshot(),onOpenRuntimeStatus:we,onClose:Ce},`${te.sessionId}:${te.sessionPath}`)]})}var aY={size:`1em`,"aria-hidden":!0},oY={name:`neutral`,__built:!0,tokens:{"--font-size-4xs":`0.375rem`,"--font-size-3xs":`0.4375rem`,"--font-size-2xs":`0.5rem`,"--font-size-xs":`0.625rem`,"--font-size-sm":`0.75rem`,"--font-size-base":`0.875rem`,"--font-size-lg":`1.0625rem`,"--font-size-xl":`1.25rem`,"--font-size-2xl":`1.5rem`,"--font-size-3xl":`1.8125rem`,"--font-size-4xl":`2.1875rem`,"--font-size-5xl":`2.625rem`,"--text-heading-1-size":`var(--font-size-2xl)`,"--text-heading-1-weight":`var(--font-weight-semibold)`,"--text-heading-1-leading":`1.3333`,"--text-heading-2-size":`var(--font-size-xl)`,"--text-heading-2-weight":`var(--font-weight-semibold)`,"--text-heading-2-leading":`1.4`,"--text-heading-3-size":`var(--font-size-lg)`,"--text-heading-3-weight":`var(--font-weight-bold)`,"--text-heading-3-leading":`1.4118`,"--text-heading-4-size":`var(--font-size-base)`,"--text-heading-4-weight":`var(--font-weight-bold)`,"--text-heading-4-leading":`1.4286`,"--text-heading-5-size":`var(--font-size-sm)`,"--text-heading-5-weight":`var(--font-weight-semibold)`,"--text-heading-5-leading":`1.6667`,"--text-heading-6-size":`var(--font-size-xs)`,"--text-heading-6-weight":`var(--font-weight-semibold)`,"--text-heading-6-leading":`1.6`,"--text-body-size":`var(--font-size-base)`,"--text-body-weight":`var(--font-weight-normal)`,"--text-body-leading":`1.4286`,"--text-large-size":`var(--font-size-lg)`,"--text-large-weight":`var(--font-weight-semibold)`,"--text-large-leading":`1.4118`,"--text-label-size":`var(--font-size-base)`,"--text-label-weight":`var(--font-weight-medium)`,"--text-label-leading":`1.4286`,"--text-code-size":`var(--font-size-base)`,"--text-code-weight":`var(--font-weight-normal)`,"--text-code-leading":`1.4286`,"--text-supporting-size":`var(--font-size-sm)`,"--text-supporting-weight":`var(--font-weight-normal)`,"--text-supporting-leading":`1.6667`,"--text-display-1-size":`var(--font-size-5xl)`,"--text-display-1-weight":`var(--font-weight-normal)`,"--text-display-1-leading":`1.2381`,"--text-display-2-size":`var(--font-size-4xl)`,"--text-display-2-weight":`var(--font-weight-normal)`,"--text-display-2-leading":`1.2571`,"--text-display-3-size":`var(--font-size-3xl)`,"--text-display-3-weight":`var(--font-weight-normal)`,"--text-display-3-leading":`1.3793`,"--duration-fast-min":`95ms`,"--duration-fast":`125ms`,"--duration-fast-max":`165ms`,"--duration-medium-min":`225ms`,"--duration-medium":`300ms`,"--duration-medium-max":`400ms`,"--duration-slow-min":`525ms`,"--duration-slow":`700ms`,"--duration-slow-max":`935ms`,"--font-family-body":`Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,"--font-family-heading":`Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif`,"--font-family-code":`ui-monospace, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace`,"--color-syntax-keyword":`light-dark(#700084, #efa8ff)`,"--color-syntax-string":`light-dark(#005600, #a6d2a2)`,"--color-syntax-comment":`light-dark(#737373, #a3a3a3)`,"--color-syntax-number":`light-dark(#6e3500, #ffb37f)`,"--color-syntax-function":`light-dark(#00458c, #a0caff)`,"--color-syntax-type":`light-dark(#700084, #efa8ff)`,"--color-syntax-variable":`light-dark(#171717, #e5e5e5)`,"--color-syntax-operator":`light-dark(#737373, #a3a3a3)`,"--color-syntax-constant":`light-dark(#6e3500, #ffb37f)`,"--color-syntax-tag":`light-dark(#89001a, #ffaeaa)`,"--color-syntax-attribute":`light-dark(#584400, #eec12f)`,"--color-syntax-property":`light-dark(#005348, #83dac9)`,"--color-syntax-punctuation":`light-dark(#6e6e6e, #a0a0a0)`,"--color-syntax-background":`light-dark(#fafafa, #0a0a0a)`,"--color-background-surface":`light-dark(#ffffff, #262626)`,"--color-background-body":`light-dark(#f1f1f1, #1b1b1b)`,"--color-background-card":`light-dark(#ffffff, #1b1b1b)`,"--color-background-popover":`light-dark(#ffffff, #1b1b1b)`,"--color-background-muted":`light-dark(#f1f1f1, #1b1b1b)`,"--color-accent":`light-dark(#262626, #ebebeb)`,"--color-accent-muted":`light-dark(#f1f1f1, #262626)`,"--color-neutral":`light-dark(#0000000F, #FFFFFF1A)`,"--color-overlay":`light-dark(#00000080, #000000CC)`,"--color-overlay-hover":`light-dark(#0000000D, #FFFFFF0D)`,"--color-overlay-pressed":`light-dark(#0000001A, #FFFFFF1A)`,"--color-text-primary":`light-dark(#171717, #fafafa)`,"--color-text-secondary":`light-dark(#525252, #a3a3a3)`,"--color-text-disabled":`light-dark(#a3a3a3, #525252)`,"--color-text-accent":`light-dark(#262626, #ebebeb)`,"--color-on-dark":`#ffffff`,"--color-on-light":`#171717`,"--color-on-accent":`light-dark(#ffffff, #171717)`,"--color-on-success":`light-dark(#ffffff, #171717)`,"--color-on-error":`light-dark(#ffffff, #171717)`,"--color-on-warning":`#171717`,"--color-icon-accent":`light-dark(#262626, #ebebeb)`,"--color-icon-primary":`light-dark(#171717, #fafafa)`,"--color-icon-secondary":`light-dark(#737373, #a3a3a3)`,"--color-icon-disabled":`light-dark(#a3a3a3, #525252)`,"--color-success":`light-dark(#007004, #9fe59b)`,"--color-error":`light-dark(#a50c25, #ffc6c1)`,"--color-warning":`light-dark(#745b00, #fdcf4f)`,"--color-success-muted":`light-dark(#c5e5c0, #84c9803D)`,"--color-error-muted":`light-dark(#facecb, #ff9e973D)`,"--color-warning-muted":`light-dark(#f8da9d, #deb4333D)`,"--color-border":`light-dark(#00000014, #FFFFFF1A)`,"--color-border-emphasized":`light-dark(#d4d4d4, #525252)`,"--color-skeleton":`light-dark(#ebebeb, #525252)`,"--color-shadow":`light-dark(#0000001A, #0000004D)`,"--color-tint-hover":`light-dark(black, white)`,"--color-background-red":`light-dark(#facecb, #ff9e973D)`,"--color-border-red":`light-dark(#e6bab8, #ff6f6c)`,"--color-icon-red":`light-dark(#89001a, #ff9e97)`,"--color-text-red":`light-dark(#89001a, #ffc6c1)`,"--color-background-orange":`light-dark(#fad0b5, #ffa2583D)`,"--color-border-orange":`light-dark(#e6bda2, #e2883e)`,"--color-icon-orange":`light-dark(#6e3500, #ffa258)`,"--color-text-orange":`light-dark(#6e3500, #ffc9a2)`,"--color-background-yellow":`light-dark(#f8da9d, #deb4333D)`,"--color-border-yellow":`light-dark(#e4c279, #c0990e)`,"--color-icon-yellow":`light-dark(#584400, #deb433)`,"--color-text-yellow":`light-dark(#584400, #fdcf4f)`,"--color-background-green":`light-dark(#c5e5c0, #84c9803D)`,"--color-border-green":`light-dark(#b2d1ac, #69ad67)`,"--color-icon-green":`light-dark(#0c5700, #84c980)`,"--color-text-green":`light-dark(#0c5700, #9fe59b)`,"--color-background-teal":`light-dark(#a5e3d6, #7ec6b83D)`,"--color-border-teal":`light-dark(#94d6c8, #63ab9d)`,"--color-icon-teal":`light-dark(#005348, #7ec6b8)`,"--color-text-teal":`light-dark(#005348, #99e2d3)`,"--color-background-cyan":`light-dark(#a3e0ef, #83c2d43D)`,"--color-border-cyan":`light-dark(#91d3e3, #67a7b8)`,"--color-icon-cyan":`light-dark(#00505f, #83c2d4)`,"--color-text-cyan":`light-dark(#00505f, #9edef0)`,"--color-background-blue":`light-dark(#c4ddfb, #9eb7ff3D)`,"--color-border-blue":`light-dark(#b1c9e7, #6d9cfe)`,"--color-icon-blue":`light-dark(#00458c, #9eb7ff)`,"--color-text-blue":`light-dark(#00458c, #c7d3ff)`,"--color-background-purple":`light-dark(#eccef3, #f297ff3D)`,"--color-border-purple":`light-dark(#d8bbdf, #dd74f0)`,"--color-icon-purple":`light-dark(#700084, #f297ff)`,"--color-text-purple":`light-dark(#700084, #fac1ff)`,"--color-background-pink":`light-dark(#fccadc, #ff99c33D)`,"--color-border-pink":`light-dark(#e7b7c8, #f273aa)`,"--color-icon-pink":`light-dark(#83004b, #ff99c3)`,"--color-text-pink":`light-dark(#83004b, #ffc3da)`,"--color-background-gray":`light-dark(#e5e5e5, var(--color-neutral))`,"--color-border-gray":`light-dark(#d4d4d4, #262626)`,"--color-icon-gray":`light-dark(#525252, #a3a3a3)`,"--color-text-gray":`light-dark(#262626, #e5e5e5)`,"--radius-none":`0px`,"--radius-inner":`0.375rem`,"--radius-element":`0.625rem`,"--radius-container":`0.75rem`,"--radius-page":`1.75rem`,"--radius-full":`9999px`,"--shadow-low":`0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 25%)), 0 4px 8px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 40%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 8%))`,"--shadow-med":`0 2px 4px light-dark(oklch(0 0 0 / 5%), oklch(0 0 0 / 35%)), 0 4px 12px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 12%))`,"--shadow-high":`0 4px 6px light-dark(oklch(0 0 0 / 10%), oklch(0 0 0 / 50%)), 0 12px 24px light-dark(oklch(0 0 0 / 15%), oklch(0 0 0 / 70%)), inset 0 0 0 1px light-dark(transparent, oklch(1 0 0 / 15%))`,"--shadow-inset-hover":`inset 0px 0px 0px 2px #0074e24D`,"--shadow-inset-selected":`inset 0px 0px 0px 2px #0074e280`,"--shadow-inset-success":`inset 0px 0px 0px 2px #1981004D`,"--shadow-inset-warning":`inset 0px 0px 0px 2px #ffce2f4D`,"--shadow-inset-error":`inset 0px 0px 0px 2px #e33f4a4D`},components:{heading:{"level:1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-1-size)`,fontWeight:`var(--text-heading-1-weight)`,lineHeight:`var(--text-heading-1-leading)`},"level:2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-2-size)`,fontWeight:`var(--text-heading-2-weight)`,lineHeight:`var(--text-heading-2-leading)`},"level:3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-3-size)`,fontWeight:`var(--text-heading-3-weight)`,lineHeight:`var(--text-heading-3-leading)`},"level:4":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-4-size)`,fontWeight:`var(--text-heading-4-weight)`,lineHeight:`var(--text-heading-4-leading)`},"level:5":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-5-size)`,fontWeight:`var(--text-heading-5-weight)`,lineHeight:`var(--text-heading-5-leading)`},"level:6":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-heading-6-size)`,fontWeight:`var(--text-heading-6-weight)`,lineHeight:`var(--text-heading-6-leading)`},"type:display-1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-1-size)`,lineHeight:`var(--text-display-1-leading)`},"type:display-2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-2-size)`,lineHeight:`var(--text-display-2-leading)`},"type:display-3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-3-size)`,lineHeight:`var(--text-display-3-leading)`}},text:{"type:body":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-body-size)`,lineHeight:`var(--text-body-leading)`},"type:large":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-large-size)`,lineHeight:`var(--text-large-leading)`},"type:label":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-label-size)`,lineHeight:`var(--text-label-leading)`},"type:code":{fontFamily:`var(--font-family-code)`,fontSize:`var(--text-code-size)`,lineHeight:`var(--text-code-leading)`},"type:supporting":{fontFamily:`var(--font-family-body)`,fontSize:`var(--text-supporting-size)`,lineHeight:`var(--text-supporting-leading)`},"type:display-1":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-1-size)`,lineHeight:`var(--text-display-1-leading)`},"type:display-2":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-2-size)`,lineHeight:`var(--text-display-2-leading)`},"type:display-3":{fontFamily:`var(--font-family-heading)`,fontSize:`var(--text-display-3-size)`,lineHeight:`var(--text-display-3-leading)`}},button:{"variant:destructive":{backgroundColor:`var(--color-error-muted)`,color:`var(--color-error)`}},badge:{"variant:info":{backgroundColor:`light-dark(#0074e2, #6d9cfe)`,color:`light-dark(#ffffff, #171717)`},"variant:neutral":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`},"variant:success":{backgroundColor:`light-dark(#198100, #64af4c)`,color:`light-dark(#ffffff, #171717)`},"variant:warning":{backgroundColor:`#ffce2f`,color:`#171717`},"variant:error":{backgroundColor:`light-dark(#c9303a, #ff705d)`,color:`light-dark(#ffffff, #171717)`},"variant:red":{backgroundColor:`var(--color-background-red)`,color:`var(--color-text-red)`},"variant:orange":{backgroundColor:`var(--color-background-orange)`,color:`var(--color-text-orange)`},"variant:yellow":{backgroundColor:`var(--color-background-yellow)`,color:`var(--color-text-yellow)`},"variant:green":{backgroundColor:`var(--color-background-green)`,color:`var(--color-text-green)`},"variant:teal":{backgroundColor:`var(--color-background-teal)`,color:`var(--color-text-teal)`},"variant:cyan":{backgroundColor:`var(--color-background-cyan)`,color:`var(--color-text-cyan)`},"variant:blue":{backgroundColor:`var(--color-background-blue)`,color:`var(--color-text-blue)`},"variant:purple":{backgroundColor:`var(--color-background-purple)`,color:`var(--color-text-purple)`},"variant:pink":{backgroundColor:`var(--color-background-pink)`,color:`var(--color-text-pink)`},"variant:gray":{backgroundColor:`var(--color-background-gray)`,color:`var(--color-text-gray)`}},statusdot:{"variant:success":{backgroundColor:`light-dark(#198100, #64af4c)`},"variant:warning":{backgroundColor:`#ffce2f`},"variant:error":{backgroundColor:`light-dark(#c9303a, #ff705d)`},"variant:accent":{backgroundColor:`light-dark(#0074e2, #6d9cfe)`}},banner:{"status:info":{"--color-accent-muted":`var(--color-background-blue)`,"--color-text-primary":`var(--color-text-blue)`,"--color-text-secondary":`var(--color-text-blue)`,"--color-accent":`var(--color-text-blue)`},"status:success":{"--color-text-primary":`var(--color-text-green)`,"--color-text-secondary":`var(--color-text-green)`,"--color-success":`var(--color-text-green)`},"status:warning":{"--color-text-primary":`var(--color-text-yellow)`,"--color-text-secondary":`var(--color-text-yellow)`,"--color-warning":`var(--color-text-yellow)`},"status:error":{"--color-text-primary":`var(--color-text-red)`,"--color-text-secondary":`var(--color-text-red)`,"--color-error":`var(--color-text-red)`}},switch:{base:{"--color-background-gray":`var(--color-border-emphasized)`}},progressbar:{base:{"--color-background-muted":`var(--color-border-emphasized)`},"variant:accent":{"--color-accent":`#0074e2`},"variant:success":{"--color-success":`#198100`},"variant:warning":{"--color-warning":`#ffce2f`},"variant:error":{"--color-error":`#c9303a`}},card:{base:{padding:`var(--spacing-3)`}},section:{base:{padding:`var(--spacing-3)`}}},__onDark:{tokens:{"color-scheme":`dark`,"--color-text-primary":`var(--color-on-dark)`,"--color-icon-primary":`var(--color-on-dark)`,"--color-accent":`var(--color-on-dark)`}},__onLight:{tokens:{"color-scheme":`light`,"--color-text-primary":`var(--color-on-light)`,"--color-icon-primary":`var(--color-on-light)`,"--color-accent":`var(--color-on-light)`}},icons:{close:(0,K.jsx)(Lt,{...aY}),chevronDown:(0,K.jsx)(L,{...aY}),chevronLeft:(0,K.jsx)(R,{...aY}),chevronRight:(0,K.jsx)(ee,{...aY}),chevronsLeft:(0,K.jsx)(z,{...aY}),chevronsRight:(0,K.jsx)(B,{...aY}),check:(0,K.jsx)(I,{...aY}),success:(0,K.jsx)(H,{...aY}),error:(0,K.jsx)(ie,{...aY}),warning:(0,K.jsx)(At,{...aY}),info:(0,K.jsx)(Pe,{...aY}),calendar:(0,K.jsx)(P,{...aY}),clock:(0,K.jsx)(se,{...aY}),externalLink:(0,K.jsx)(he,{...aY}),menu:(0,K.jsx)(Ke,{...aY}),moreHorizontal:(0,K.jsx)(W,{...aY}),search:(0,K.jsx)(ht,{...aY}),arrowUp:(0,K.jsx)(k,{...aY}),arrowDown:(0,K.jsx)(w,{...aY}),arrowsUpDown:(0,K.jsx)(D,{...aY}),funnel:(0,K.jsx)(Oe,{...aY}),eyeSlash:(0,K.jsx)(ge,{...aY}),viewColumns:(0,K.jsx)(le,{...aY}),copy:(0,K.jsx)(ue,{...aY}),checkDouble:(0,K.jsx)(F,{...aY}),wrench:(0,K.jsx)(It,{...aY}),stop:(0,K.jsx)(Et,{...aY}),microphone:(0,K.jsx)(Ze,{...aY})}};function sY({children:e}){let t=pr(KJ,e=>e.snapshot?.preferences),n=t?.theme??`system`,r=t?.appearance??wI,i=EI(n,r),a=t?.chatWidth??820,o=t?.chatFontSize??14,[s,c]=(0,_.useState)(()=>window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1);(0,_.useEffect)(()=>{let e=window.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return;let t=()=>c(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let l=n===`system`?s?`dark`:`light`:n,u=l===`dark`||l===`pine`?`dark`:`light`;return(0,_.useEffect)(()=>{let e=document.documentElement;e.dataset.theme=l,e.dataset.palette=i,e.style.setProperty(`--conversation-content-width`,`${a}px`),e.style.setProperty(`--conversation-font-size`,`${o}px`);let t={};if(r.background&&(t[`--page`]=r.background),r.foreground&&(t[`--text`]=r.foreground),r.background||r.foreground)for(let[e,n]of Object.entries({sidebar:3,"sidebar-hover":7,"sidebar-active":10,border:12,"border-strong":22,muted:65,subtle:52,"settings-secondary-text":75}))t[`--${e}`]=`color-mix(in srgb, var(--text) ${n}%, var(--page))`;r.accent&&(t[`--accent`]=r.accent,t[`--focus`]=r.accent),e.style.setProperty(`--openpi-interface-font`,{codex:`var(--openpi-default-font)`,system:`var(--openpi-default-font)`,sans:`Arial, Helvetica, sans-serif`,serif:`Georgia, 'Times New Roman', serif`,mono:`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`}[r.font]);for(let n of[`page`,`text`,`sidebar`,`sidebar-hover`,`sidebar-active`,`border`,`border-strong`,`muted`,`subtle`,`settings-secondary-text`,`accent`,`focus`]){let r=t[`--${n}`];r?e.style.setProperty(`--${n}`,r):e.style.removeProperty(`--${n}`)}},[r,o,a,i,l]),(0,K.jsx)(lr,{i18n:In,children:(0,K.jsx)(ju,{theme:oY,mode:u,children:e})})}var cY=document.getElementById(`root`);if(!cY)throw Error(`OpenPI Web root is missing`);(0,zt.createRoot)(cY).render((0,K.jsx)(_.StrictMode,{children:(0,K.jsx)(sY,{children:(0,K.jsx)(iY,{})})}));export{lt as a,Lt as i,Po as n,$e as o,cr as r,x as s,Hp as t}; \ No newline at end of file diff --git a/web/protocol/evidence.ts b/web/protocol/evidence.ts index 158cf3df..f74f5d6a 100644 --- a/web/protocol/evidence.ts +++ b/web/protocol/evidence.ts @@ -1,7 +1,9 @@ import type { WebLiveMessage, WebMessagePart } from "./types.ts"; +import { sanitizeTerminalText } from "../../extensions/shared/terminal-text.ts"; export const EVIDENCE_MAX_BYTES = 12 * 1024; export const EVIDENCE_MAX_LINES = 300; +const EVIDENCE_PATH_MAX_BYTES = 4096; export const LIVE_TOOL_LIMIT = 32; export function evidenceRecord(value: unknown): Record { @@ -10,11 +12,29 @@ export function evidenceRecord(value: unknown): Record { : {}; } -export function projectEvidenceArguments(input: unknown) { +export function projectEvidenceArguments(input: unknown, projected = false) { const source = evidenceRecord(input); const result: Record = {}; - for (const key of ["path", "command", "offset", "limit", "id"]) { - const value = Object.getOwnPropertyDescriptor(source, key)?.value; + const own = (key: string) => Object.getOwnPropertyDescriptor(source, key)?.value; + let unavailable = projected && typeof own("pathUnavailable") === "string"; + for (const key of projected ? ["path", "resolvedPath"] : ["path"]) { + const value = own(key); + const displayKey = key === "path" ? "displayPath" : "displayResolvedPath"; + const display = typeof value === "string" ? value : projected ? own(displayKey) : undefined; + if (typeof display === "string") result[displayKey] = evidenceText(display).text; + if (typeof value !== "string") continue; + // Cheap rejection bounds the temporary UTF-8 buffer. Identity is admitted + // whole or omitted; display sanitization must never rewrite a file target. + if (value.length > EVIDENCE_PATH_MAX_BYTES || new TextEncoder().encode(value).length > EVIDENCE_PATH_MAX_BYTES) unavailable = true; + else result[key] = value; + } + if (unavailable) { + delete result.path; + delete result.resolvedPath; + result.pathUnavailable = "File reference exceeds the evidence byte limit."; + } + for (const key of ["command", "offset", "limit", "id"]) { + const value = own(key); if (typeof value === "string") result[key] = evidenceText(value).text; else if (typeof value === "number" && Number.isSafeInteger(value)) result[key] = value; } @@ -25,10 +45,7 @@ export function projectEvidenceArguments(input: unknown) { export function evidenceText(value: string, tail = false) { // Bound work before stripping terminal controls, including OSC hyperlinks. const candidate = tail ? value.slice(-EVIDENCE_MAX_BYTES * 2) : value.slice(0, EVIDENCE_MAX_BYTES * 2); - const clean = candidate - .replace(/\x1b\][^\x07\x1b]*(?:\x07|\x1b\\|$)/gu, "") - .replace(/(?:\x1b\[|\x9b)[0-?]*[ -/]*[@-~]/gu, "") - .replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/gu, ""); + const clean = sanitizeTerminalText(candidate); const lines = clean.split("\n"); const limited = (tail ? lines.slice(-EVIDENCE_MAX_LINES) : lines.slice(0, EVIDENCE_MAX_LINES)).join("\n"); const bytes = new TextEncoder().encode(limited); @@ -64,8 +81,8 @@ export function bashReceipt(content: unknown, isError: unknown) { } export function toolArguments(call: Extract) { - if (call.evidenceArguments) return call.evidenceArguments; - try { return evidenceRecord(JSON.parse(call.arguments)); } catch { return {}; } + if (call.evidenceArguments) return projectEvidenceArguments(call.evidenceArguments, true); + try { return projectEvidenceArguments(JSON.parse(call.arguments)); } catch { return {}; } } export function isEvidenceTool(name: string) { @@ -141,7 +158,7 @@ export function projectToolEvidence(call: Extract, resolvePath?: (path: s typeof typed.name === "string" ? typed.name : "tool", WEB_MAX_METADATA_TEXT, ); - const evidenceArguments = isEvidenceTool(name.value) ? projectEvidenceArguments(typed.arguments) : undefined; + let evidenceArguments = isEvidenceTool(name.value) ? projectEvidenceArguments(typed.arguments) : undefined; if (evidenceArguments && typeof evidenceArguments.path === "string" && !evidenceArguments.path.startsWith("~") && !evidenceArguments.path.startsWith("@")) { const path = resolvePath?.(evidenceArguments.path); - if (path && path.length <= 4096) evidenceArguments.resolvedPath = path; + if (path) evidenceArguments = projectEvidenceArguments({ ...evidenceArguments, resolvedPath: path }, true); } projected = { type: "toolCall", diff --git a/web/ui/src/features/transcript/ToolEvidence.tsx b/web/ui/src/features/transcript/ToolEvidence.tsx index 74114d92..9dd413a2 100644 --- a/web/ui/src/features/transcript/ToolEvidence.tsx +++ b/web/ui/src/features/transcript/ToolEvidence.tsx @@ -86,7 +86,9 @@ export function ToolEvidence({ ? t("toolSnapshotMissingResult") : t(`toolState_${state}`); const fileReference = view.resolvedPath ?? view.path; - const path = view.path ?? ""; + const fileLabel = + view.displayResolvedPath || view.displayPath || "File reference"; + const path = view.displayPath || view.path || ""; const separator = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")); const filename = path.slice(separator + 1) || path; const { Icon } = toolActivity(call.name); @@ -151,29 +153,33 @@ export function ToolEvidence({ {statusLabel}
- {view.path && !view.diff && ( -

- {t("toolRequestedFile")}{" "} - {artifacts && fileReference ? ( - - ) : ( - {fileReference} - )} - {cwd && ( - <> -
- - {t("toolWorkspace")}: {cwd} - - - )} -

+ {(fileReference || view.displayPath || view.pathUnavailable) && + !view.diff && ( +

+ {t("toolRequestedFile")}{" "} + {artifacts && fileReference ? ( + + ) : ( + {fileLabel} + )} + {cwd && ( + <> +
+ + {t("toolWorkspace")}: {cwd} + + + )} +

+ )} + {view.pathUnavailable && ( +

{view.pathUnavailable}

)} {shell && (