From 4965727f3901177101ecdae739e50483afd9f0ef Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 16 Jan 2026 09:18:53 +0000 Subject: [PATCH] chore: run format and fix sandbox browser timeouts --- .../Clawdbot/CronJobEditor+Helpers.swift | 4 +- src/agents/pi-embedded-helpers/bootstrap.ts | 4 +- ...ed-runner.google-sanitize-thinking.test.ts | 4 +- ...ed-runner.sanitize-session-history.test.ts | 8 +- src/agents/pi-embedded-runner/google.ts | 17 +- src/agents/pi-embedded-subscribe.types.ts | 5 +- src/agents/sandbox/browser.ts | 2 + src/browser/cdp.helpers.test.ts | 4 +- src/browser/cdp.helpers.ts | 31 +- src/browser/cdp.ts | 7 +- src/browser/chrome.default-browser.test.ts | 8 +- src/browser/chrome.executables.ts | 21 +- src/browser/pw-session.ts | 4 +- src/browser/server-context.ts | 17 +- src/canvas-host/a2ui/a2ui.bundle.js | 32685 +++++++++------- src/cli/config-cli.ts | 6 +- src/cli/daemon-cli.coverage.test.ts | 6 +- src/cli/pairing-cli.ts | 5 +- src/cli/plugins-cli.ts | 8 +- src/commands/gateway-status.ts | 4 +- src/commands/status-all.ts | 4 +- src/config/config.discord.test.ts | 24 +- src/config/schema.ts | 3 +- src/config/zod-schema.session.ts | 8 +- src/daemon/systemd-unit.test.ts | 2 +- src/gateway/auth.ts | 41 +- src/gateway/server-node-bridge.ts | 4 +- src/infra/bridge/server/start.ts | 3 +- src/infra/skills-remote.ts | 4 +- src/plugins/installs.ts | 5 +- src/telegram/bot-native-commands.ts | 8 +- src/telegram/bot.test.ts | 4 +- 32 files changed, 17548 insertions(+), 15412 deletions(-) diff --git a/apps/macos/Sources/Clawdbot/CronJobEditor+Helpers.swift b/apps/macos/Sources/Clawdbot/CronJobEditor+Helpers.swift index 855aadf2c..52a18df0d 100644 --- a/apps/macos/Sources/Clawdbot/CronJobEditor+Helpers.swift +++ b/apps/macos/Sources/Clawdbot/CronJobEditor+Helpers.swift @@ -191,8 +191,8 @@ extension CronJobEditor { func applyDeleteAfterRun( to root: inout [String: Any], scheduleKind: ScheduleKind? = nil, - deleteAfterRun: Bool? = nil - ) { + deleteAfterRun: Bool? = nil) + { let resolvedSchedule = scheduleKind ?? self.scheduleKind let resolvedDelete = deleteAfterRun ?? self.deleteAfterRun if resolvedSchedule == .at { diff --git a/src/agents/pi-embedded-helpers/bootstrap.ts b/src/agents/pi-embedded-helpers/bootstrap.ts index 8f49f612e..d47732cc1 100644 --- a/src/agents/pi-embedded-helpers/bootstrap.ts +++ b/src/agents/pi-embedded-helpers/bootstrap.ts @@ -58,9 +58,7 @@ export function stripThoughtSignatures( if (!block || typeof block !== "object") return block; const rec = block as ContentBlockWithSignature; const stripSnake = shouldStripSignature(rec.thought_signature); - const stripCamel = includeCamelCase - ? shouldStripSignature(rec.thoughtSignature) - : false; + const stripCamel = includeCamelCase ? shouldStripSignature(rec.thoughtSignature) : false; if (!stripSnake && !stripCamel) { return block; } diff --git a/src/agents/pi-embedded-runner.google-sanitize-thinking.test.ts b/src/agents/pi-embedded-runner.google-sanitize-thinking.test.ts index 0e3776f00..12b6db850 100644 --- a/src/agents/pi-embedded-runner.google-sanitize-thinking.test.ts +++ b/src/agents/pi-embedded-runner.google-sanitize-thinking.test.ts @@ -162,7 +162,7 @@ describe("sanitizeSessionHistory (google thinking)", () => { id: "call_1", name: "read", arguments: { path: "/tmp/foo" }, - thoughtSignature: "{\"id\":1}", + thoughtSignature: '{"id":1}', }, { type: "toolCall", @@ -192,7 +192,7 @@ describe("sanitizeSessionHistory (google thinking)", () => { { type: "text", text: "ok" }, { type: "text", - text: "[Tool Call: read (ID: call_1)]\nArguments: {\n \"path\": \"/tmp/foo\"\n}", + text: '[Tool Call: read (ID: call_1)]\nArguments: {\n "path": "/tmp/foo"\n}', }, { type: "toolCall", diff --git a/src/agents/pi-embedded-runner.sanitize-session-history.test.ts b/src/agents/pi-embedded-runner.sanitize-session-history.test.ts index f8fe98eee..6355deedb 100644 --- a/src/agents/pi-embedded-runner.sanitize-session-history.test.ts +++ b/src/agents/pi-embedded-runner.sanitize-session-history.test.ts @@ -11,9 +11,7 @@ vi.mock("./pi-embedded-helpers.js", async () => { ...actual, isGoogleModelApi: vi.fn(), downgradeGeminiHistory: vi.fn(), - sanitizeSessionMessagesImages: vi - .fn() - .mockImplementation(async (msgs) => msgs), + sanitizeSessionMessagesImages: vi.fn().mockImplementation(async (msgs) => msgs), }; }); @@ -30,9 +28,7 @@ describe("sanitizeSessionHistory", () => { beforeEach(() => { vi.resetAllMocks(); - vi.mocked(helpers.sanitizeSessionMessagesImages).mockImplementation( - async (msgs) => msgs, - ); + vi.mocked(helpers.sanitizeSessionMessagesImages).mockImplementation(async (msgs) => msgs); // Default mock implementation vi.mocked(helpers.downgradeGeminiHistory).mockImplementation((msgs) => { if (!msgs) return []; diff --git a/src/agents/pi-embedded-runner/google.ts b/src/agents/pi-embedded-runner/google.ts index 702a9c3fa..7ab4b42d2 100644 --- a/src/agents/pi-embedded-runner/google.ts +++ b/src/agents/pi-embedded-runner/google.ts @@ -82,12 +82,13 @@ function findUnsupportedSchemaKeywords(schema: unknown, path: string): string[] return violations; } -export function sanitizeToolsForGoogle( - params: { - tools: AgentTool[]; - provider: string; - }, -): AgentTool[] { +export function sanitizeToolsForGoogle< + TSchemaType extends TSchema = TSchema, + TResult = unknown, +>(params: { + tools: AgentTool[]; + provider: string; +}): AgentTool[] { if (params.provider !== "google-antigravity" && params.provider !== "google-gemini-cli") { return params.tools; } @@ -95,7 +96,9 @@ export function sanitizeToolsForGoogle) as TSchemaType, + parameters: cleanToolSchemaForGemini( + tool.parameters as Record, + ) as TSchemaType, }; }); } diff --git a/src/agents/pi-embedded-subscribe.types.ts b/src/agents/pi-embedded-subscribe.types.ts index 5cb8b5144..dbdaa8582 100644 --- a/src/agents/pi-embedded-subscribe.types.ts +++ b/src/agents/pi-embedded-subscribe.types.ts @@ -22,10 +22,7 @@ export type SubscribeEmbeddedPiSessionParams = { blockReplyChunking?: BlockReplyChunking; onPartialReply?: (payload: { text?: string; mediaUrls?: string[] }) => void | Promise; onAssistantMessageStart?: () => void | Promise; - onAgentEvent?: (evt: { - stream: string; - data: Record; - }) => void | Promise; + onAgentEvent?: (evt: { stream: string; data: Record }) => void | Promise; enforceFinalTag?: boolean; }; diff --git a/src/agents/sandbox/browser.ts b/src/agents/sandbox/browser.ts index e3975e9b5..dcfde8975 100644 --- a/src/agents/sandbox/browser.ts +++ b/src/agents/sandbox/browser.ts @@ -51,6 +51,8 @@ function buildSandboxBrowserResolvedConfig(params: { cdpProtocol: "http", cdpHost, cdpIsLoopback: true, + remoteCdpTimeoutMs: 1500, + remoteCdpHandshakeTimeoutMs: 3000, color: DEFAULT_CLAWD_BROWSER_COLOR, executablePath: undefined, headless: params.headless, diff --git a/src/browser/cdp.helpers.test.ts b/src/browser/cdp.helpers.test.ts index 0242d2ee6..e479c054b 100644 --- a/src/browser/cdp.helpers.test.ts +++ b/src/browser/cdp.helpers.test.ts @@ -15,9 +15,7 @@ describe("cdp.helpers", () => { it("adds basic auth headers when credentials are present", () => { const headers = getHeadersWithAuth("https://user:pass@example.com"); - expect(headers.Authorization).toBe( - `Basic ${Buffer.from("user:pass").toString("base64")}`, - ); + expect(headers.Authorization).toBe(`Basic ${Buffer.from("user:pass").toString("base64")}`); }); it("keeps preexisting authorization headers", () => { diff --git a/src/browser/cdp.helpers.ts b/src/browser/cdp.helpers.ts index c41f4c81d..7e1e7222e 100644 --- a/src/browser/cdp.helpers.ts +++ b/src/browser/cdp.helpers.ts @@ -28,15 +28,10 @@ export function isLoopbackHost(host: string) { ); } -export function getHeadersWithAuth( - url: string, - headers: Record = {}, -) { +export function getHeadersWithAuth(url: string, headers: Record = {}) { try { const parsed = new URL(url); - const hasAuthHeader = Object.keys(headers).some( - (key) => key.toLowerCase() === "authorization", - ); + const hasAuthHeader = Object.keys(headers).some((key) => key.toLowerCase() === "authorization"); if (hasAuthHeader) return headers; if (parsed.username || parsed.password) { const auth = Buffer.from(`${parsed.username}:${parsed.password}`).toString("base64"); @@ -103,18 +98,11 @@ function createCdpSender(ws: WebSocket) { return { send, closeWithError }; } -export async function fetchJson( - url: string, - timeoutMs = 1500, - init?: RequestInit, -): Promise { +export async function fetchJson(url: string, timeoutMs = 1500, init?: RequestInit): Promise { const ctrl = new AbortController(); const t = setTimeout(() => ctrl.abort(), timeoutMs); try { - const headers = getHeadersWithAuth( - url, - (init?.headers as Record) || {}, - ); + const headers = getHeadersWithAuth(url, (init?.headers as Record) || {}); const res = await fetch(url, { ...init, headers, signal: ctrl.signal }); if (!res.ok) throw new Error(`HTTP ${res.status}`); return (await res.json()) as T; @@ -123,18 +111,11 @@ export async function fetchJson( } } -export async function fetchOk( - url: string, - timeoutMs = 1500, - init?: RequestInit, -): Promise { +export async function fetchOk(url: string, timeoutMs = 1500, init?: RequestInit): Promise { const ctrl = new AbortController(); const t = setTimeout(() => ctrl.abort(), timeoutMs); try { - const headers = getHeadersWithAuth( - url, - (init?.headers as Record) || {}, - ); + const headers = getHeadersWithAuth(url, (init?.headers as Record) || {}); const res = await fetch(url, { ...init, headers, signal: ctrl.signal }); if (!res.ok) throw new Error(`HTTP ${res.status}`); } finally { diff --git a/src/browser/cdp.ts b/src/browser/cdp.ts index e78b49701..296285384 100644 --- a/src/browser/cdp.ts +++ b/src/browser/cdp.ts @@ -1,9 +1,4 @@ -import { - appendCdpPath, - fetchJson, - isLoopbackHost, - withCdpSocket, -} from "./cdp.helpers.js"; +import { appendCdpPath, fetchJson, isLoopbackHost, withCdpSocket } from "./cdp.helpers.js"; export { appendCdpPath, fetchJson, fetchOk, getHeadersWithAuth } from "./cdp.helpers.js"; diff --git a/src/browser/chrome.default-browser.test.ts b/src/browser/chrome.default-browser.test.ts index cfa1e2167..ab473f536 100644 --- a/src/browser/chrome.default-browser.test.ts +++ b/src/browser/chrome.default-browser.test.ts @@ -25,7 +25,9 @@ describe("browser default executable detection", () => { vi.mocked(execFileSync).mockImplementation((cmd, args) => { const argsStr = Array.isArray(args) ? args.join(" ") : ""; if (cmd === "/usr/bin/plutil" && argsStr.includes("LSHandlers")) { - return JSON.stringify([{ LSHandlerURLScheme: "http", LSHandlerRoleAll: "com.google.Chrome" }]); + return JSON.stringify([ + { LSHandlerURLScheme: "http", LSHandlerRoleAll: "com.google.Chrome" }, + ]); } if (cmd === "/usr/bin/osascript" && argsStr.includes("path to application id")) { return "/Applications/Google Chrome.app"; @@ -55,7 +57,9 @@ describe("browser default executable detection", () => { vi.mocked(execFileSync).mockImplementation((cmd, args) => { const argsStr = Array.isArray(args) ? args.join(" ") : ""; if (cmd === "/usr/bin/plutil" && argsStr.includes("LSHandlers")) { - return JSON.stringify([{ LSHandlerURLScheme: "http", LSHandlerRoleAll: "com.apple.Safari" }]); + return JSON.stringify([ + { LSHandlerURLScheme: "http", LSHandlerRoleAll: "com.apple.Safari" }, + ]); } return ""; }); diff --git a/src/browser/chrome.executables.ts b/src/browser/chrome.executables.ts index ddd863520..4c0d50427 100644 --- a/src/browser/chrome.executables.ts +++ b/src/browser/chrome.executables.ts @@ -119,7 +119,12 @@ function inferKindFromIdentifier(identifier: string): BrowserExecutable["kind"] if (id.includes("edge")) return "edge"; if (id.includes("chromium")) return "chromium"; if (id.includes("canary")) return "canary"; - if (id.includes("opera") || id.includes("vivaldi") || id.includes("yandex") || id.includes("thebrowser")) { + if ( + id.includes("opera") || + id.includes("vivaldi") || + id.includes("yandex") || + id.includes("thebrowser") + ) { return "chromium"; } return "chrome"; @@ -131,13 +136,12 @@ function inferKindFromExecutableName(name: string): BrowserExecutable["kind"] { if (lower.includes("edge") || lower.includes("msedge")) return "edge"; if (lower.includes("chromium")) return "chromium"; if (lower.includes("canary") || lower.includes("sxs")) return "canary"; - if (lower.includes("opera") || lower.includes("vivaldi") || lower.includes("yandex")) return "chromium"; + if (lower.includes("opera") || lower.includes("vivaldi") || lower.includes("yandex")) + return "chromium"; return "chrome"; } -function detectDefaultChromiumExecutable( - platform: NodeJS.Platform, -): BrowserExecutable | null { +function detectDefaultChromiumExecutable(platform: NodeJS.Platform): BrowserExecutable | null { if (platform === "darwin") return detectDefaultChromiumExecutableMac(); if (platform === "linux") return detectDefaultChromiumExecutableLinux(); if (platform === "win32") return detectDefaultChromiumExecutableWindows(); @@ -227,8 +231,7 @@ function detectDefaultChromiumExecutableLinux(): BrowserExecutable | null { function detectDefaultChromiumExecutableWindows(): BrowserExecutable | null { const progId = readWindowsProgId(); const command = - (progId ? readWindowsCommandForProgId(progId) : null) || - readWindowsCommandForProgId("http"); + (progId ? readWindowsCommandForProgId(progId) : null) || readWindowsCommandForProgId("http"); if (!command) return null; const expanded = expandWindowsEnvVars(command); const exePath = extractWindowsExecutablePath(expanded); @@ -285,7 +288,7 @@ function splitExecLine(line: string): string[] { let quoteChar = ""; for (let i = 0; i < line.length; i += 1) { const ch = line[i]; - if ((ch === "\"" || ch === "'") && (!inQuotes || ch === quoteChar)) { + if ((ch === '"' || ch === "'") && (!inQuotes || ch === quoteChar)) { if (inQuotes) { inQuotes = false; quoteChar = ""; @@ -342,7 +345,7 @@ function readWindowsCommandForProgId(progId: string): string | null { function expandWindowsEnvVars(value: string): string { return value.replace(/%([^%]+)%/g, (_match, name) => { const key = String(name ?? "").trim(); - return key ? process.env[key] ?? `%${key}%` : _match; + return key ? (process.env[key] ?? `%${key}%`) : _match; }); } diff --git a/src/browser/pw-session.ts b/src/browser/pw-session.ts index 119e1d315..df82b43c3 100644 --- a/src/browser/pw-session.ts +++ b/src/browser/pw-session.ts @@ -267,9 +267,7 @@ async function connectBrowser(cdpUrl: string): Promise { for (let attempt = 0; attempt < 3; attempt += 1) { try { const timeout = 5000 + attempt * 2000; - const wsUrl = await getChromeWebSocketUrl(normalized, timeout).catch( - () => null, - ); + const wsUrl = await getChromeWebSocketUrl(normalized, timeout).catch(() => null); const endpoint = wsUrl ?? normalized; const headers = getHeadersWithAuth(endpoint); const browser = await chromium.connectOverCDP(endpoint, { timeout, headers }); diff --git a/src/browser/server-context.ts b/src/browser/server-context.ts index 2b8375593..5d1543089 100644 --- a/src/browser/server-context.ts +++ b/src/browser/server-context.ts @@ -1,11 +1,6 @@ import fs from "node:fs"; -import { - appendCdpPath, - createTargetViaCdp, - getHeadersWithAuth, - normalizeCdpWsUrl, -} from "./cdp.js"; +import { appendCdpPath, createTargetViaCdp, getHeadersWithAuth, normalizeCdpWsUrl } from "./cdp.js"; import { isChromeCdpReady, isChromeReachable, @@ -55,10 +50,7 @@ async function fetchJson(url: string, timeoutMs = 1500, init?: RequestInit): const ctrl = new AbortController(); const t = setTimeout(() => ctrl.abort(), timeoutMs); try { - const headers = getHeadersWithAuth( - url, - (init?.headers as Record) || {}, - ); + const headers = getHeadersWithAuth(url, (init?.headers as Record) || {}); const res = await fetch(url, { ...init, headers, signal: ctrl.signal }); if (!res.ok) throw new Error(`HTTP ${res.status}`); return (await res.json()) as T; @@ -71,10 +63,7 @@ async function fetchOk(url: string, timeoutMs = 1500, init?: RequestInit): Promi const ctrl = new AbortController(); const t = setTimeout(() => ctrl.abort(), timeoutMs); try { - const headers = getHeadersWithAuth( - url, - (init?.headers as Record) || {}, - ); + const headers = getHeadersWithAuth(url, (init?.headers as Record) || {}); const res = await fetch(url, { ...init, headers, signal: ctrl.signal }); if (!res.ok) throw new Error(`HTTP ${res.status}`); } finally { diff --git a/src/canvas-host/a2ui/a2ui.bundle.js b/src/canvas-host/a2ui/a2ui.bundle.js index 3b20b5cba..19bf137e3 100644 --- a/src/canvas-host/a2ui/a2ui.bundle.js +++ b/src/canvas-host/a2ui/a2ui.bundle.js @@ -1,978 +1,1396 @@ var __defProp$1 = Object.defineProperty; var __exportAll = (all, symbols) => { - let target = {}; - for (var name in all) { - __defProp$1(target, name, { - get: all[name], - enumerable: true - }); - } - if (symbols) { - __defProp$1(target, Symbol.toStringTag, { value: "Module" }); - } - return target; + let target = {}; + for (var name in all) { + __defProp$1(target, name, { + get: all[name], + enumerable: true, + }); + } + if (symbols) { + __defProp$1(target, Symbol.toStringTag, { value: "Module" }); + } + return target; }; /** -* @license -* Copyright 2019 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ -const t$6 = globalThis, e$13 = t$6.ShadowRoot && (void 0 === t$6.ShadyCSS || t$6.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$8 = Symbol(), o$14 = new WeakMap(); + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t$6 = globalThis, + e$13 = + t$6.ShadowRoot && + (void 0 === t$6.ShadyCSS || t$6.ShadyCSS.nativeShadow) && + "adoptedStyleSheets" in Document.prototype && + "replace" in CSSStyleSheet.prototype, + s$8 = Symbol(), + o$14 = new WeakMap(); var n$12 = class { - constructor(t$7, e$14, o$15) { - if (this._$cssResult$ = !0, o$15 !== s$8) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); - this.cssText = t$7, this.t = e$14; - } - get styleSheet() { - let t$7 = this.o; - const s$9 = this.t; - if (e$13 && void 0 === t$7) { - const e$14 = void 0 !== s$9 && 1 === s$9.length; - e$14 && (t$7 = o$14.get(s$9)), void 0 === t$7 && ((this.o = t$7 = new CSSStyleSheet()).replaceSync(this.cssText), e$14 && o$14.set(s$9, t$7)); - } - return t$7; - } - toString() { - return this.cssText; - } + constructor(t$7, e$14, o$15) { + if (((this._$cssResult$ = !0), o$15 !== s$8)) + throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead."); + ((this.cssText = t$7), (this.t = e$14)); + } + get styleSheet() { + let t$7 = this.o; + const s$9 = this.t; + if (e$13 && void 0 === t$7) { + const e$14 = void 0 !== s$9 && 1 === s$9.length; + (e$14 && (t$7 = o$14.get(s$9)), + void 0 === t$7 && + ((this.o = t$7 = new CSSStyleSheet()).replaceSync(this.cssText), + e$14 && o$14.set(s$9, t$7))); + } + return t$7; + } + toString() { + return this.cssText; + } }; -const r$11 = (t$7) => new n$12("string" == typeof t$7 ? t$7 : t$7 + "", void 0, s$8), i$9 = (t$7, ...e$14) => { - const o$15 = 1 === t$7.length ? t$7[0] : e$14.reduce((e$15, s$9, o$16) => e$15 + ((t$8) => { - if (!0 === t$8._$cssResult$) return t$8.cssText; - if ("number" == typeof t$8) return t$8; - throw Error("Value passed to 'css' function must be a 'css' function result: " + t$8 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security."); - })(s$9) + t$7[o$16 + 1], t$7[0]); - return new n$12(o$15, t$7, s$8); -}, S$1 = (s$9, o$15) => { - if (e$13) s$9.adoptedStyleSheets = o$15.map((t$7) => t$7 instanceof CSSStyleSheet ? t$7 : t$7.styleSheet); - else for (const e$14 of o$15) { - const o$16 = document.createElement("style"), n$13 = t$6.litNonce; - void 0 !== n$13 && o$16.setAttribute("nonce", n$13), o$16.textContent = e$14.cssText, s$9.appendChild(o$16); - } -}, c$6 = e$13 ? (t$7) => t$7 : (t$7) => t$7 instanceof CSSStyleSheet ? ((t$8) => { - let e$14 = ""; - for (const s$9 of t$8.cssRules) e$14 += s$9.cssText; - return r$11(e$14); -})(t$7) : t$7; +const r$11 = (t$7) => new n$12("string" == typeof t$7 ? t$7 : t$7 + "", void 0, s$8), + i$9 = (t$7, ...e$14) => { + const o$15 = + 1 === t$7.length + ? t$7[0] + : e$14.reduce( + (e$15, s$9, o$16) => + e$15 + + ((t$8) => { + if (!0 === t$8._$cssResult$) return t$8.cssText; + if ("number" == typeof t$8) return t$8; + throw Error( + "Value passed to 'css' function must be a 'css' function result: " + + t$8 + + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.", + ); + })(s$9) + + t$7[o$16 + 1], + t$7[0], + ); + return new n$12(o$15, t$7, s$8); + }, + S$1 = (s$9, o$15) => { + if (e$13) + s$9.adoptedStyleSheets = o$15.map((t$7) => + t$7 instanceof CSSStyleSheet ? t$7 : t$7.styleSheet, + ); + else + for (const e$14 of o$15) { + const o$16 = document.createElement("style"), + n$13 = t$6.litNonce; + (void 0 !== n$13 && o$16.setAttribute("nonce", n$13), + (o$16.textContent = e$14.cssText), + s$9.appendChild(o$16)); + } + }, + c$6 = e$13 + ? (t$7) => t$7 + : (t$7) => + t$7 instanceof CSSStyleSheet + ? ((t$8) => { + let e$14 = ""; + for (const s$9 of t$8.cssRules) e$14 += s$9.cssText; + return r$11(e$14); + })(t$7) + : t$7; /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ const { is: i$8, defineProperty: e$12, getOwnPropertyDescriptor: h$6, getOwnPropertyNames: r$10, getOwnPropertySymbols: o$13, getPrototypeOf: n$11 } = Object, a$1 = globalThis, c$5 = a$1.trustedTypes, l$4 = c$5 ? c$5.emptyScript : "", p$2 = a$1.reactiveElementPolyfillSupport, d$2 = (t$7, s$9) => t$7, u$3 = { - toAttribute(t$7, s$9) { - switch (s$9) { - case Boolean: - t$7 = t$7 ? l$4 : null; - break; - case Object: - case Array: t$7 = null == t$7 ? t$7 : JSON.stringify(t$7); - } - return t$7; - }, - fromAttribute(t$7, s$9) { - let i$10 = t$7; - switch (s$9) { - case Boolean: - i$10 = null !== t$7; - break; - case Number: - i$10 = null === t$7 ? null : Number(t$7); - break; - case Object: - case Array: try { - i$10 = JSON.parse(t$7); - } catch (t$8) { - i$10 = null; - } - } - return i$10; - } -}, f$3 = (t$7, s$9) => !i$8(t$7, s$9), b$1 = { - attribute: !0, - type: String, - converter: u$3, - reflect: !1, - useDefault: !1, - hasChanged: f$3 -}; -Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= new WeakMap(); + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ const { + is: i$8, + defineProperty: e$12, + getOwnPropertyDescriptor: h$6, + getOwnPropertyNames: r$10, + getOwnPropertySymbols: o$13, + getPrototypeOf: n$11, + } = Object, + a$1 = globalThis, + c$5 = a$1.trustedTypes, + l$4 = c$5 ? c$5.emptyScript : "", + p$2 = a$1.reactiveElementPolyfillSupport, + d$2 = (t$7, s$9) => t$7, + u$3 = { + toAttribute(t$7, s$9) { + switch (s$9) { + case Boolean: + t$7 = t$7 ? l$4 : null; + break; + case Object: + case Array: + t$7 = null == t$7 ? t$7 : JSON.stringify(t$7); + } + return t$7; + }, + fromAttribute(t$7, s$9) { + let i$10 = t$7; + switch (s$9) { + case Boolean: + i$10 = null !== t$7; + break; + case Number: + i$10 = null === t$7 ? null : Number(t$7); + break; + case Object: + case Array: + try { + i$10 = JSON.parse(t$7); + } catch (t$8) { + i$10 = null; + } + } + return i$10; + }, + }, + f$3 = (t$7, s$9) => !i$8(t$7, s$9), + b$1 = { + attribute: !0, + type: String, + converter: u$3, + reflect: !1, + useDefault: !1, + hasChanged: f$3, + }; +((Symbol.metadata ??= Symbol("metadata")), (a$1.litPropertyMetadata ??= new WeakMap())); var y$1 = class extends HTMLElement { - static addInitializer(t$7) { - this._$Ei(), (this.l ??= []).push(t$7); - } - static get observedAttributes() { - return this.finalize(), this._$Eh && [...this._$Eh.keys()]; - } - static createProperty(t$7, s$9 = b$1) { - if (s$9.state && (s$9.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t$7) && ((s$9 = Object.create(s$9)).wrapped = !0), this.elementProperties.set(t$7, s$9), !s$9.noAccessor) { - const i$10 = Symbol(), h$7 = this.getPropertyDescriptor(t$7, i$10, s$9); - void 0 !== h$7 && e$12(this.prototype, t$7, h$7); - } - } - static getPropertyDescriptor(t$7, s$9, i$10) { - const { get: e$14, set: r$12 } = h$6(this.prototype, t$7) ?? { - get() { - return this[s$9]; - }, - set(t$8) { - this[s$9] = t$8; - } - }; - return { - get: e$14, - set(s$10) { - const h$7 = e$14?.call(this); - r$12?.call(this, s$10), this.requestUpdate(t$7, h$7, i$10); - }, - configurable: !0, - enumerable: !0 - }; - } - static getPropertyOptions(t$7) { - return this.elementProperties.get(t$7) ?? b$1; - } - static _$Ei() { - if (this.hasOwnProperty(d$2("elementProperties"))) return; - const t$7 = n$11(this); - t$7.finalize(), void 0 !== t$7.l && (this.l = [...t$7.l]), this.elementProperties = new Map(t$7.elementProperties); - } - static finalize() { - if (this.hasOwnProperty(d$2("finalized"))) return; - if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(d$2("properties"))) { - const t$8 = this.properties, s$9 = [...r$10(t$8), ...o$13(t$8)]; - for (const i$10 of s$9) this.createProperty(i$10, t$8[i$10]); - } - const t$7 = this[Symbol.metadata]; - if (null !== t$7) { - const s$9 = litPropertyMetadata.get(t$7); - if (void 0 !== s$9) for (const [t$8, i$10] of s$9) this.elementProperties.set(t$8, i$10); - } - this._$Eh = new Map(); - for (const [t$8, s$9] of this.elementProperties) { - const i$10 = this._$Eu(t$8, s$9); - void 0 !== i$10 && this._$Eh.set(i$10, t$8); - } - this.elementStyles = this.finalizeStyles(this.styles); - } - static finalizeStyles(s$9) { - const i$10 = []; - if (Array.isArray(s$9)) { - const e$14 = new Set(s$9.flat(1 / 0).reverse()); - for (const s$10 of e$14) i$10.unshift(c$6(s$10)); - } else void 0 !== s$9 && i$10.push(c$6(s$9)); - return i$10; - } - static _$Eu(t$7, s$9) { - const i$10 = s$9.attribute; - return !1 === i$10 ? void 0 : "string" == typeof i$10 ? i$10 : "string" == typeof t$7 ? t$7.toLowerCase() : void 0; - } - constructor() { - super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev(); - } - _$Ev() { - this._$ES = new Promise((t$7) => this.enableUpdating = t$7), this._$AL = new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t$7) => t$7(this)); - } - addController(t$7) { - (this._$EO ??= new Set()).add(t$7), void 0 !== this.renderRoot && this.isConnected && t$7.hostConnected?.(); - } - removeController(t$7) { - this._$EO?.delete(t$7); - } - _$E_() { - const t$7 = new Map(), s$9 = this.constructor.elementProperties; - for (const i$10 of s$9.keys()) this.hasOwnProperty(i$10) && (t$7.set(i$10, this[i$10]), delete this[i$10]); - t$7.size > 0 && (this._$Ep = t$7); - } - createRenderRoot() { - const t$7 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); - return S$1(t$7, this.constructor.elementStyles), t$7; - } - connectedCallback() { - this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach((t$7) => t$7.hostConnected?.()); - } - enableUpdating(t$7) {} - disconnectedCallback() { - this._$EO?.forEach((t$7) => t$7.hostDisconnected?.()); - } - attributeChangedCallback(t$7, s$9, i$10) { - this._$AK(t$7, i$10); - } - _$ET(t$7, s$9) { - const i$10 = this.constructor.elementProperties.get(t$7), e$14 = this.constructor._$Eu(t$7, i$10); - if (void 0 !== e$14 && !0 === i$10.reflect) { - const h$7 = (void 0 !== i$10.converter?.toAttribute ? i$10.converter : u$3).toAttribute(s$9, i$10.type); - this._$Em = t$7, null == h$7 ? this.removeAttribute(e$14) : this.setAttribute(e$14, h$7), this._$Em = null; - } - } - _$AK(t$7, s$9) { - const i$10 = this.constructor, e$14 = i$10._$Eh.get(t$7); - if (void 0 !== e$14 && this._$Em !== e$14) { - const t$8 = i$10.getPropertyOptions(e$14), h$7 = "function" == typeof t$8.converter ? { fromAttribute: t$8.converter } : void 0 !== t$8.converter?.fromAttribute ? t$8.converter : u$3; - this._$Em = e$14; - const r$12 = h$7.fromAttribute(s$9, t$8.type); - this[e$14] = r$12 ?? this._$Ej?.get(e$14) ?? r$12, this._$Em = null; - } - } - requestUpdate(t$7, s$9, i$10, e$14 = !1, h$7) { - if (void 0 !== t$7) { - const r$12 = this.constructor; - if (!1 === e$14 && (h$7 = this[t$7]), i$10 ??= r$12.getPropertyOptions(t$7), !((i$10.hasChanged ?? f$3)(h$7, s$9) || i$10.useDefault && i$10.reflect && h$7 === this._$Ej?.get(t$7) && !this.hasAttribute(r$12._$Eu(t$7, i$10)))) return; - this.C(t$7, s$9, i$10); - } - !1 === this.isUpdatePending && (this._$ES = this._$EP()); - } - C(t$7, s$9, { useDefault: i$10, reflect: e$14, wrapped: h$7 }, r$12) { - i$10 && !(this._$Ej ??= new Map()).has(t$7) && (this._$Ej.set(t$7, r$12 ?? s$9 ?? this[t$7]), !0 !== h$7 || void 0 !== r$12) || (this._$AL.has(t$7) || (this.hasUpdated || i$10 || (s$9 = void 0), this._$AL.set(t$7, s$9)), !0 === e$14 && this._$Em !== t$7 && (this._$Eq ??= new Set()).add(t$7)); - } - async _$EP() { - this.isUpdatePending = !0; - try { - await this._$ES; - } catch (t$8) { - Promise.reject(t$8); - } - const t$7 = this.scheduleUpdate(); - return null != t$7 && await t$7, !this.isUpdatePending; - } - scheduleUpdate() { - return this.performUpdate(); - } - performUpdate() { - if (!this.isUpdatePending) return; - if (!this.hasUpdated) { - if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) { - for (const [t$9, s$10] of this._$Ep) this[t$9] = s$10; - this._$Ep = void 0; - } - const t$8 = this.constructor.elementProperties; - if (t$8.size > 0) for (const [s$10, i$10] of t$8) { - const { wrapped: t$9 } = i$10, e$14 = this[s$10]; - !0 !== t$9 || this._$AL.has(s$10) || void 0 === e$14 || this.C(s$10, void 0, i$10, e$14); - } - } - let t$7 = !1; - const s$9 = this._$AL; - try { - t$7 = this.shouldUpdate(s$9), t$7 ? (this.willUpdate(s$9), this._$EO?.forEach((t$8) => t$8.hostUpdate?.()), this.update(s$9)) : this._$EM(); - } catch (s$10) { - throw t$7 = !1, this._$EM(), s$10; - } - t$7 && this._$AE(s$9); - } - willUpdate(t$7) {} - _$AE(t$7) { - this._$EO?.forEach((t$8) => t$8.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t$7)), this.updated(t$7); - } - _$EM() { - this._$AL = new Map(), this.isUpdatePending = !1; - } - get updateComplete() { - return this.getUpdateComplete(); - } - getUpdateComplete() { - return this._$ES; - } - shouldUpdate(t$7) { - return !0; - } - update(t$7) { - this._$Eq &&= this._$Eq.forEach((t$8) => this._$ET(t$8, this[t$8])), this._$EM(); - } - updated(t$7) {} - firstUpdated(t$7) {} + static addInitializer(t$7) { + (this._$Ei(), (this.l ??= []).push(t$7)); + } + static get observedAttributes() { + return (this.finalize(), this._$Eh && [...this._$Eh.keys()]); + } + static createProperty(t$7, s$9 = b$1) { + if ( + (s$9.state && (s$9.attribute = !1), + this._$Ei(), + this.prototype.hasOwnProperty(t$7) && ((s$9 = Object.create(s$9)).wrapped = !0), + this.elementProperties.set(t$7, s$9), + !s$9.noAccessor) + ) { + const i$10 = Symbol(), + h$7 = this.getPropertyDescriptor(t$7, i$10, s$9); + void 0 !== h$7 && e$12(this.prototype, t$7, h$7); + } + } + static getPropertyDescriptor(t$7, s$9, i$10) { + const { get: e$14, set: r$12 } = h$6(this.prototype, t$7) ?? { + get() { + return this[s$9]; + }, + set(t$8) { + this[s$9] = t$8; + }, + }; + return { + get: e$14, + set(s$10) { + const h$7 = e$14?.call(this); + (r$12?.call(this, s$10), this.requestUpdate(t$7, h$7, i$10)); + }, + configurable: !0, + enumerable: !0, + }; + } + static getPropertyOptions(t$7) { + return this.elementProperties.get(t$7) ?? b$1; + } + static _$Ei() { + if (this.hasOwnProperty(d$2("elementProperties"))) return; + const t$7 = n$11(this); + (t$7.finalize(), + void 0 !== t$7.l && (this.l = [...t$7.l]), + (this.elementProperties = new Map(t$7.elementProperties))); + } + static finalize() { + if (this.hasOwnProperty(d$2("finalized"))) return; + if (((this.finalized = !0), this._$Ei(), this.hasOwnProperty(d$2("properties")))) { + const t$8 = this.properties, + s$9 = [...r$10(t$8), ...o$13(t$8)]; + for (const i$10 of s$9) this.createProperty(i$10, t$8[i$10]); + } + const t$7 = this[Symbol.metadata]; + if (null !== t$7) { + const s$9 = litPropertyMetadata.get(t$7); + if (void 0 !== s$9) for (const [t$8, i$10] of s$9) this.elementProperties.set(t$8, i$10); + } + this._$Eh = new Map(); + for (const [t$8, s$9] of this.elementProperties) { + const i$10 = this._$Eu(t$8, s$9); + void 0 !== i$10 && this._$Eh.set(i$10, t$8); + } + this.elementStyles = this.finalizeStyles(this.styles); + } + static finalizeStyles(s$9) { + const i$10 = []; + if (Array.isArray(s$9)) { + const e$14 = new Set(s$9.flat(1 / 0).reverse()); + for (const s$10 of e$14) i$10.unshift(c$6(s$10)); + } else void 0 !== s$9 && i$10.push(c$6(s$9)); + return i$10; + } + static _$Eu(t$7, s$9) { + const i$10 = s$9.attribute; + return !1 === i$10 + ? void 0 + : "string" == typeof i$10 + ? i$10 + : "string" == typeof t$7 + ? t$7.toLowerCase() + : void 0; + } + constructor() { + (super(), + (this._$Ep = void 0), + (this.isUpdatePending = !1), + (this.hasUpdated = !1), + (this._$Em = null), + this._$Ev()); + } + _$Ev() { + ((this._$ES = new Promise((t$7) => (this.enableUpdating = t$7))), + (this._$AL = new Map()), + this._$E_(), + this.requestUpdate(), + this.constructor.l?.forEach((t$7) => t$7(this))); + } + addController(t$7) { + ((this._$EO ??= new Set()).add(t$7), + void 0 !== this.renderRoot && this.isConnected && t$7.hostConnected?.()); + } + removeController(t$7) { + this._$EO?.delete(t$7); + } + _$E_() { + const t$7 = new Map(), + s$9 = this.constructor.elementProperties; + for (const i$10 of s$9.keys()) + this.hasOwnProperty(i$10) && (t$7.set(i$10, this[i$10]), delete this[i$10]); + t$7.size > 0 && (this._$Ep = t$7); + } + createRenderRoot() { + const t$7 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions); + return (S$1(t$7, this.constructor.elementStyles), t$7); + } + connectedCallback() { + ((this.renderRoot ??= this.createRenderRoot()), + this.enableUpdating(!0), + this._$EO?.forEach((t$7) => t$7.hostConnected?.())); + } + enableUpdating(t$7) {} + disconnectedCallback() { + this._$EO?.forEach((t$7) => t$7.hostDisconnected?.()); + } + attributeChangedCallback(t$7, s$9, i$10) { + this._$AK(t$7, i$10); + } + _$ET(t$7, s$9) { + const i$10 = this.constructor.elementProperties.get(t$7), + e$14 = this.constructor._$Eu(t$7, i$10); + if (void 0 !== e$14 && !0 === i$10.reflect) { + const h$7 = (void 0 !== i$10.converter?.toAttribute ? i$10.converter : u$3).toAttribute( + s$9, + i$10.type, + ); + ((this._$Em = t$7), + null == h$7 ? this.removeAttribute(e$14) : this.setAttribute(e$14, h$7), + (this._$Em = null)); + } + } + _$AK(t$7, s$9) { + const i$10 = this.constructor, + e$14 = i$10._$Eh.get(t$7); + if (void 0 !== e$14 && this._$Em !== e$14) { + const t$8 = i$10.getPropertyOptions(e$14), + h$7 = + "function" == typeof t$8.converter + ? { fromAttribute: t$8.converter } + : void 0 !== t$8.converter?.fromAttribute + ? t$8.converter + : u$3; + this._$Em = e$14; + const r$12 = h$7.fromAttribute(s$9, t$8.type); + ((this[e$14] = r$12 ?? this._$Ej?.get(e$14) ?? r$12), (this._$Em = null)); + } + } + requestUpdate(t$7, s$9, i$10, e$14 = !1, h$7) { + if (void 0 !== t$7) { + const r$12 = this.constructor; + if ( + (!1 === e$14 && (h$7 = this[t$7]), + (i$10 ??= r$12.getPropertyOptions(t$7)), + !( + (i$10.hasChanged ?? f$3)(h$7, s$9) || + (i$10.useDefault && + i$10.reflect && + h$7 === this._$Ej?.get(t$7) && + !this.hasAttribute(r$12._$Eu(t$7, i$10))) + )) + ) + return; + this.C(t$7, s$9, i$10); + } + !1 === this.isUpdatePending && (this._$ES = this._$EP()); + } + C(t$7, s$9, { useDefault: i$10, reflect: e$14, wrapped: h$7 }, r$12) { + (i$10 && + !(this._$Ej ??= new Map()).has(t$7) && + (this._$Ej.set(t$7, r$12 ?? s$9 ?? this[t$7]), !0 !== h$7 || void 0 !== r$12)) || + (this._$AL.has(t$7) || (this.hasUpdated || i$10 || (s$9 = void 0), this._$AL.set(t$7, s$9)), + !0 === e$14 && this._$Em !== t$7 && (this._$Eq ??= new Set()).add(t$7)); + } + async _$EP() { + this.isUpdatePending = !0; + try { + await this._$ES; + } catch (t$8) { + Promise.reject(t$8); + } + const t$7 = this.scheduleUpdate(); + return (null != t$7 && (await t$7), !this.isUpdatePending); + } + scheduleUpdate() { + return this.performUpdate(); + } + performUpdate() { + if (!this.isUpdatePending) return; + if (!this.hasUpdated) { + if (((this.renderRoot ??= this.createRenderRoot()), this._$Ep)) { + for (const [t$9, s$10] of this._$Ep) this[t$9] = s$10; + this._$Ep = void 0; + } + const t$8 = this.constructor.elementProperties; + if (t$8.size > 0) + for (const [s$10, i$10] of t$8) { + const { wrapped: t$9 } = i$10, + e$14 = this[s$10]; + !0 !== t$9 || this._$AL.has(s$10) || void 0 === e$14 || this.C(s$10, void 0, i$10, e$14); + } + } + let t$7 = !1; + const s$9 = this._$AL; + try { + ((t$7 = this.shouldUpdate(s$9)), + t$7 + ? (this.willUpdate(s$9), + this._$EO?.forEach((t$8) => t$8.hostUpdate?.()), + this.update(s$9)) + : this._$EM()); + } catch (s$10) { + throw ((t$7 = !1), this._$EM(), s$10); + } + t$7 && this._$AE(s$9); + } + willUpdate(t$7) {} + _$AE(t$7) { + (this._$EO?.forEach((t$8) => t$8.hostUpdated?.()), + this.hasUpdated || ((this.hasUpdated = !0), this.firstUpdated(t$7)), + this.updated(t$7)); + } + _$EM() { + ((this._$AL = new Map()), (this.isUpdatePending = !1)); + } + get updateComplete() { + return this.getUpdateComplete(); + } + getUpdateComplete() { + return this._$ES; + } + shouldUpdate(t$7) { + return !0; + } + update(t$7) { + ((this._$Eq &&= this._$Eq.forEach((t$8) => this._$ET(t$8, this[t$8]))), this._$EM()); + } + updated(t$7) {} + firstUpdated(t$7) {} }; -y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$2("elementProperties")] = new Map(), y$1[d$2("finalized")] = new Map(), p$2?.({ ReactiveElement: y$1 }), (a$1.reactiveElementVersions ??= []).push("2.1.2"); +((y$1.elementStyles = []), + (y$1.shadowRootOptions = { mode: "open" }), + (y$1[d$2("elementProperties")] = new Map()), + (y$1[d$2("finalized")] = new Map()), + p$2?.({ ReactiveElement: y$1 }), + (a$1.reactiveElementVersions ??= []).push("2.1.2")); /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ -const t$5 = globalThis, i$7 = (t$7) => t$7, s$7 = t$5.trustedTypes, e$11 = s$7 ? s$7.createPolicy("lit-html", { createHTML: (t$7) => t$7 }) : void 0, h$5 = "$lit$", o$12 = `lit$${Math.random().toFixed(9).slice(2)}$`, n$10 = "?" + o$12, r$9 = `<${n$10}>`, l$3 = document, c$4 = () => l$3.createComment(""), a = (t$7) => null === t$7 || "object" != typeof t$7 && "function" != typeof t$7, u$2 = Array.isArray, d$1 = (t$7) => u$2(t$7) || "function" == typeof t$7?.[Symbol.iterator], f$2 = "[ \n\f\r]", v$1 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, _ = /-->/g, m$2 = />/g, p$1 = RegExp(`>|${f$2}(?:([^\\s"'>=/]+)(${f$2}*=${f$2}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), g = /'/g, $ = /"/g, y = /^(?:script|style|textarea|title)$/i, x = (t$7) => (i$10, ...s$9) => ({ - _$litType$: t$7, - strings: i$10, - values: s$9 -}), b = x(1), w = x(2), T = x(3), E = Symbol.for("lit-noChange"), A = Symbol.for("lit-nothing"), C = new WeakMap(), P = l$3.createTreeWalker(l$3, 129); + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const t$5 = globalThis, + i$7 = (t$7) => t$7, + s$7 = t$5.trustedTypes, + e$11 = s$7 ? s$7.createPolicy("lit-html", { createHTML: (t$7) => t$7 }) : void 0, + h$5 = "$lit$", + o$12 = `lit$${Math.random().toFixed(9).slice(2)}$`, + n$10 = "?" + o$12, + r$9 = `<${n$10}>`, + l$3 = document, + c$4 = () => l$3.createComment(""), + a = (t$7) => null === t$7 || ("object" != typeof t$7 && "function" != typeof t$7), + u$2 = Array.isArray, + d$1 = (t$7) => u$2(t$7) || "function" == typeof t$7?.[Symbol.iterator], + f$2 = "[ \n\f\r]", + v$1 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, + _ = /-->/g, + m$2 = />/g, + p$1 = RegExp(`>|${f$2}(?:([^\\s"'>=/]+)(${f$2}*=${f$2}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`, "g"), + g = /'/g, + $ = /"/g, + y = /^(?:script|style|textarea|title)$/i, + x = + (t$7) => + (i$10, ...s$9) => ({ + _$litType$: t$7, + strings: i$10, + values: s$9, + }), + b = x(1), + w = x(2), + T = x(3), + E = Symbol.for("lit-noChange"), + A = Symbol.for("lit-nothing"), + C = new WeakMap(), + P = l$3.createTreeWalker(l$3, 129); function V(t$7, i$10) { - if (!u$2(t$7) || !t$7.hasOwnProperty("raw")) throw Error("invalid template strings array"); - return void 0 !== e$11 ? e$11.createHTML(i$10) : i$10; + if (!u$2(t$7) || !t$7.hasOwnProperty("raw")) throw Error("invalid template strings array"); + return void 0 !== e$11 ? e$11.createHTML(i$10) : i$10; } const N = (t$7, i$10) => { - const s$9 = t$7.length - 1, e$14 = []; - let n$13, l$5 = 2 === i$10 ? "" : 3 === i$10 ? "" : "", c$7 = v$1; - for (let i$11 = 0; i$11 < s$9; i$11++) { - const s$10 = t$7[i$11]; - let a$2, u$4, d$3 = -1, f$4 = 0; - for (; f$4 < s$10.length && (c$7.lastIndex = f$4, u$4 = c$7.exec(s$10), null !== u$4);) f$4 = c$7.lastIndex, c$7 === v$1 ? "!--" === u$4[1] ? c$7 = _ : void 0 !== u$4[1] ? c$7 = m$2 : void 0 !== u$4[2] ? (y.test(u$4[2]) && (n$13 = RegExp("" === u$4[0] ? (c$7 = n$13 ?? v$1, d$3 = -1) : void 0 === u$4[1] ? d$3 = -2 : (d$3 = c$7.lastIndex - u$4[2].length, a$2 = u$4[1], c$7 = void 0 === u$4[3] ? p$1 : "\"" === u$4[3] ? $ : g) : c$7 === $ || c$7 === g ? c$7 = p$1 : c$7 === _ || c$7 === m$2 ? c$7 = v$1 : (c$7 = p$1, n$13 = void 0); - const x$1 = c$7 === p$1 && t$7[i$11 + 1].startsWith("/>") ? " " : ""; - l$5 += c$7 === v$1 ? s$10 + r$9 : d$3 >= 0 ? (e$14.push(a$2), s$10.slice(0, d$3) + h$5 + s$10.slice(d$3) + o$12 + x$1) : s$10 + o$12 + (-2 === d$3 ? i$11 : x$1); - } - return [V(t$7, l$5 + (t$7[s$9] || "") + (2 === i$10 ? "" : 3 === i$10 ? "" : "")), e$14]; + const s$9 = t$7.length - 1, + e$14 = []; + let n$13, + l$5 = 2 === i$10 ? "" : 3 === i$10 ? "" : "", + c$7 = v$1; + for (let i$11 = 0; i$11 < s$9; i$11++) { + const s$10 = t$7[i$11]; + let a$2, + u$4, + d$3 = -1, + f$4 = 0; + for (; f$4 < s$10.length && ((c$7.lastIndex = f$4), (u$4 = c$7.exec(s$10)), null !== u$4); ) + ((f$4 = c$7.lastIndex), + c$7 === v$1 + ? "!--" === u$4[1] + ? (c$7 = _) + : void 0 !== u$4[1] + ? (c$7 = m$2) + : void 0 !== u$4[2] + ? (y.test(u$4[2]) && (n$13 = RegExp("" === u$4[0] + ? ((c$7 = n$13 ?? v$1), (d$3 = -1)) + : void 0 === u$4[1] + ? (d$3 = -2) + : ((d$3 = c$7.lastIndex - u$4[2].length), + (a$2 = u$4[1]), + (c$7 = void 0 === u$4[3] ? p$1 : '"' === u$4[3] ? $ : g)) + : c$7 === $ || c$7 === g + ? (c$7 = p$1) + : c$7 === _ || c$7 === m$2 + ? (c$7 = v$1) + : ((c$7 = p$1), (n$13 = void 0))); + const x$1 = c$7 === p$1 && t$7[i$11 + 1].startsWith("/>") ? " " : ""; + l$5 += + c$7 === v$1 + ? s$10 + r$9 + : d$3 >= 0 + ? (e$14.push(a$2), s$10.slice(0, d$3) + h$5 + s$10.slice(d$3) + o$12 + x$1) + : s$10 + o$12 + (-2 === d$3 ? i$11 : x$1); + } + return [ + V(t$7, l$5 + (t$7[s$9] || "") + (2 === i$10 ? "" : 3 === i$10 ? "" : "")), + e$14, + ]; }; var S = class S { - constructor({ strings: t$7, _$litType$: i$10 }, e$14) { - let r$12; - this.parts = []; - let l$5 = 0, a$2 = 0; - const u$4 = t$7.length - 1, d$3 = this.parts, [f$4, v$2] = N(t$7, i$10); - if (this.el = S.createElement(f$4, e$14), P.currentNode = this.el.content, 2 === i$10 || 3 === i$10) { - const t$8 = this.el.content.firstChild; - t$8.replaceWith(...t$8.childNodes); - } - for (; null !== (r$12 = P.nextNode()) && d$3.length < u$4;) { - if (1 === r$12.nodeType) { - if (r$12.hasAttributes()) for (const t$8 of r$12.getAttributeNames()) if (t$8.endsWith(h$5)) { - const i$11 = v$2[a$2++], s$9 = r$12.getAttribute(t$8).split(o$12), e$15 = /([.?@])?(.*)/.exec(i$11); - d$3.push({ - type: 1, - index: l$5, - name: e$15[2], - strings: s$9, - ctor: "." === e$15[1] ? I : "?" === e$15[1] ? L : "@" === e$15[1] ? z : H - }), r$12.removeAttribute(t$8); - } else t$8.startsWith(o$12) && (d$3.push({ - type: 6, - index: l$5 - }), r$12.removeAttribute(t$8)); - if (y.test(r$12.tagName)) { - const t$8 = r$12.textContent.split(o$12), i$11 = t$8.length - 1; - if (i$11 > 0) { - r$12.textContent = s$7 ? s$7.emptyScript : ""; - for (let s$9 = 0; s$9 < i$11; s$9++) r$12.append(t$8[s$9], c$4()), P.nextNode(), d$3.push({ - type: 2, - index: ++l$5 - }); - r$12.append(t$8[i$11], c$4()); - } - } - } else if (8 === r$12.nodeType) if (r$12.data === n$10) d$3.push({ - type: 2, - index: l$5 - }); - else { - let t$8 = -1; - for (; -1 !== (t$8 = r$12.data.indexOf(o$12, t$8 + 1));) d$3.push({ - type: 7, - index: l$5 - }), t$8 += o$12.length - 1; - } - l$5++; - } - } - static createElement(t$7, i$10) { - const s$9 = l$3.createElement("template"); - return s$9.innerHTML = t$7, s$9; - } + constructor({ strings: t$7, _$litType$: i$10 }, e$14) { + let r$12; + this.parts = []; + let l$5 = 0, + a$2 = 0; + const u$4 = t$7.length - 1, + d$3 = this.parts, + [f$4, v$2] = N(t$7, i$10); + if ( + ((this.el = S.createElement(f$4, e$14)), + (P.currentNode = this.el.content), + 2 === i$10 || 3 === i$10) + ) { + const t$8 = this.el.content.firstChild; + t$8.replaceWith(...t$8.childNodes); + } + for (; null !== (r$12 = P.nextNode()) && d$3.length < u$4; ) { + if (1 === r$12.nodeType) { + if (r$12.hasAttributes()) + for (const t$8 of r$12.getAttributeNames()) + if (t$8.endsWith(h$5)) { + const i$11 = v$2[a$2++], + s$9 = r$12.getAttribute(t$8).split(o$12), + e$15 = /([.?@])?(.*)/.exec(i$11); + (d$3.push({ + type: 1, + index: l$5, + name: e$15[2], + strings: s$9, + ctor: "." === e$15[1] ? I : "?" === e$15[1] ? L : "@" === e$15[1] ? z : H, + }), + r$12.removeAttribute(t$8)); + } else + t$8.startsWith(o$12) && + (d$3.push({ + type: 6, + index: l$5, + }), + r$12.removeAttribute(t$8)); + if (y.test(r$12.tagName)) { + const t$8 = r$12.textContent.split(o$12), + i$11 = t$8.length - 1; + if (i$11 > 0) { + r$12.textContent = s$7 ? s$7.emptyScript : ""; + for (let s$9 = 0; s$9 < i$11; s$9++) + (r$12.append(t$8[s$9], c$4()), + P.nextNode(), + d$3.push({ + type: 2, + index: ++l$5, + })); + r$12.append(t$8[i$11], c$4()); + } + } + } else if (8 === r$12.nodeType) + if (r$12.data === n$10) + d$3.push({ + type: 2, + index: l$5, + }); + else { + let t$8 = -1; + for (; -1 !== (t$8 = r$12.data.indexOf(o$12, t$8 + 1)); ) + (d$3.push({ + type: 7, + index: l$5, + }), + (t$8 += o$12.length - 1)); + } + l$5++; + } + } + static createElement(t$7, i$10) { + const s$9 = l$3.createElement("template"); + return ((s$9.innerHTML = t$7), s$9); + } }; function M$1(t$7, i$10, s$9 = t$7, e$14) { - if (i$10 === E) return i$10; - let h$7 = void 0 !== e$14 ? s$9._$Co?.[e$14] : s$9._$Cl; - const o$15 = a(i$10) ? void 0 : i$10._$litDirective$; - return h$7?.constructor !== o$15 && (h$7?._$AO?.(!1), void 0 === o$15 ? h$7 = void 0 : (h$7 = new o$15(t$7), h$7._$AT(t$7, s$9, e$14)), void 0 !== e$14 ? (s$9._$Co ??= [])[e$14] = h$7 : s$9._$Cl = h$7), void 0 !== h$7 && (i$10 = M$1(t$7, h$7._$AS(t$7, i$10.values), h$7, e$14)), i$10; + if (i$10 === E) return i$10; + let h$7 = void 0 !== e$14 ? s$9._$Co?.[e$14] : s$9._$Cl; + const o$15 = a(i$10) ? void 0 : i$10._$litDirective$; + return ( + h$7?.constructor !== o$15 && + (h$7?._$AO?.(!1), + void 0 === o$15 ? (h$7 = void 0) : ((h$7 = new o$15(t$7)), h$7._$AT(t$7, s$9, e$14)), + void 0 !== e$14 ? ((s$9._$Co ??= [])[e$14] = h$7) : (s$9._$Cl = h$7)), + void 0 !== h$7 && (i$10 = M$1(t$7, h$7._$AS(t$7, i$10.values), h$7, e$14)), + i$10 + ); } var R = class { - constructor(t$7, i$10) { - this._$AV = [], this._$AN = void 0, this._$AD = t$7, this._$AM = i$10; - } - get parentNode() { - return this._$AM.parentNode; - } - get _$AU() { - return this._$AM._$AU; - } - u(t$7) { - const { el: { content: i$10 }, parts: s$9 } = this._$AD, e$14 = (t$7?.creationScope ?? l$3).importNode(i$10, !0); - P.currentNode = e$14; - let h$7 = P.nextNode(), o$15 = 0, n$13 = 0, r$12 = s$9[0]; - for (; void 0 !== r$12;) { - if (o$15 === r$12.index) { - let i$11; - 2 === r$12.type ? i$11 = new k(h$7, h$7.nextSibling, this, t$7) : 1 === r$12.type ? i$11 = new r$12.ctor(h$7, r$12.name, r$12.strings, this, t$7) : 6 === r$12.type && (i$11 = new Z(h$7, this, t$7)), this._$AV.push(i$11), r$12 = s$9[++n$13]; - } - o$15 !== r$12?.index && (h$7 = P.nextNode(), o$15++); - } - return P.currentNode = l$3, e$14; - } - p(t$7) { - let i$10 = 0; - for (const s$9 of this._$AV) void 0 !== s$9 && (void 0 !== s$9.strings ? (s$9._$AI(t$7, s$9, i$10), i$10 += s$9.strings.length - 2) : s$9._$AI(t$7[i$10])), i$10++; - } + constructor(t$7, i$10) { + ((this._$AV = []), (this._$AN = void 0), (this._$AD = t$7), (this._$AM = i$10)); + } + get parentNode() { + return this._$AM.parentNode; + } + get _$AU() { + return this._$AM._$AU; + } + u(t$7) { + const { + el: { content: i$10 }, + parts: s$9, + } = this._$AD, + e$14 = (t$7?.creationScope ?? l$3).importNode(i$10, !0); + P.currentNode = e$14; + let h$7 = P.nextNode(), + o$15 = 0, + n$13 = 0, + r$12 = s$9[0]; + for (; void 0 !== r$12; ) { + if (o$15 === r$12.index) { + let i$11; + (2 === r$12.type + ? (i$11 = new k(h$7, h$7.nextSibling, this, t$7)) + : 1 === r$12.type + ? (i$11 = new r$12.ctor(h$7, r$12.name, r$12.strings, this, t$7)) + : 6 === r$12.type && (i$11 = new Z(h$7, this, t$7)), + this._$AV.push(i$11), + (r$12 = s$9[++n$13])); + } + o$15 !== r$12?.index && ((h$7 = P.nextNode()), o$15++); + } + return ((P.currentNode = l$3), e$14); + } + p(t$7) { + let i$10 = 0; + for (const s$9 of this._$AV) + (void 0 !== s$9 && + (void 0 !== s$9.strings + ? (s$9._$AI(t$7, s$9, i$10), (i$10 += s$9.strings.length - 2)) + : s$9._$AI(t$7[i$10])), + i$10++); + } }; var k = class k { - get _$AU() { - return this._$AM?._$AU ?? this._$Cv; - } - constructor(t$7, i$10, s$9, e$14) { - this.type = 2, this._$AH = A, this._$AN = void 0, this._$AA = t$7, this._$AB = i$10, this._$AM = s$9, this.options = e$14, this._$Cv = e$14?.isConnected ?? !0; - } - get parentNode() { - let t$7 = this._$AA.parentNode; - const i$10 = this._$AM; - return void 0 !== i$10 && 11 === t$7?.nodeType && (t$7 = i$10.parentNode), t$7; - } - get startNode() { - return this._$AA; - } - get endNode() { - return this._$AB; - } - _$AI(t$7, i$10 = this) { - t$7 = M$1(this, t$7, i$10), a(t$7) ? t$7 === A || null == t$7 || "" === t$7 ? (this._$AH !== A && this._$AR(), this._$AH = A) : t$7 !== this._$AH && t$7 !== E && this._(t$7) : void 0 !== t$7._$litType$ ? this.$(t$7) : void 0 !== t$7.nodeType ? this.T(t$7) : d$1(t$7) ? this.k(t$7) : this._(t$7); - } - O(t$7) { - return this._$AA.parentNode.insertBefore(t$7, this._$AB); - } - T(t$7) { - this._$AH !== t$7 && (this._$AR(), this._$AH = this.O(t$7)); - } - _(t$7) { - this._$AH !== A && a(this._$AH) ? this._$AA.nextSibling.data = t$7 : this.T(l$3.createTextNode(t$7)), this._$AH = t$7; - } - $(t$7) { - const { values: i$10, _$litType$: s$9 } = t$7, e$14 = "number" == typeof s$9 ? this._$AC(t$7) : (void 0 === s$9.el && (s$9.el = S.createElement(V(s$9.h, s$9.h[0]), this.options)), s$9); - if (this._$AH?._$AD === e$14) this._$AH.p(i$10); - else { - const t$8 = new R(e$14, this), s$10 = t$8.u(this.options); - t$8.p(i$10), this.T(s$10), this._$AH = t$8; - } - } - _$AC(t$7) { - let i$10 = C.get(t$7.strings); - return void 0 === i$10 && C.set(t$7.strings, i$10 = new S(t$7)), i$10; - } - k(t$7) { - u$2(this._$AH) || (this._$AH = [], this._$AR()); - const i$10 = this._$AH; - let s$9, e$14 = 0; - for (const h$7 of t$7) e$14 === i$10.length ? i$10.push(s$9 = new k(this.O(c$4()), this.O(c$4()), this, this.options)) : s$9 = i$10[e$14], s$9._$AI(h$7), e$14++; - e$14 < i$10.length && (this._$AR(s$9 && s$9._$AB.nextSibling, e$14), i$10.length = e$14); - } - _$AR(t$7 = this._$AA.nextSibling, s$9) { - for (this._$AP?.(!1, !0, s$9); t$7 !== this._$AB;) { - const s$10 = i$7(t$7).nextSibling; - i$7(t$7).remove(), t$7 = s$10; - } - } - setConnected(t$7) { - void 0 === this._$AM && (this._$Cv = t$7, this._$AP?.(t$7)); - } + get _$AU() { + return this._$AM?._$AU ?? this._$Cv; + } + constructor(t$7, i$10, s$9, e$14) { + ((this.type = 2), + (this._$AH = A), + (this._$AN = void 0), + (this._$AA = t$7), + (this._$AB = i$10), + (this._$AM = s$9), + (this.options = e$14), + (this._$Cv = e$14?.isConnected ?? !0)); + } + get parentNode() { + let t$7 = this._$AA.parentNode; + const i$10 = this._$AM; + return (void 0 !== i$10 && 11 === t$7?.nodeType && (t$7 = i$10.parentNode), t$7); + } + get startNode() { + return this._$AA; + } + get endNode() { + return this._$AB; + } + _$AI(t$7, i$10 = this) { + ((t$7 = M$1(this, t$7, i$10)), + a(t$7) + ? t$7 === A || null == t$7 || "" === t$7 + ? (this._$AH !== A && this._$AR(), (this._$AH = A)) + : t$7 !== this._$AH && t$7 !== E && this._(t$7) + : void 0 !== t$7._$litType$ + ? this.$(t$7) + : void 0 !== t$7.nodeType + ? this.T(t$7) + : d$1(t$7) + ? this.k(t$7) + : this._(t$7)); + } + O(t$7) { + return this._$AA.parentNode.insertBefore(t$7, this._$AB); + } + T(t$7) { + this._$AH !== t$7 && (this._$AR(), (this._$AH = this.O(t$7))); + } + _(t$7) { + (this._$AH !== A && a(this._$AH) + ? (this._$AA.nextSibling.data = t$7) + : this.T(l$3.createTextNode(t$7)), + (this._$AH = t$7)); + } + $(t$7) { + const { values: i$10, _$litType$: s$9 } = t$7, + e$14 = + "number" == typeof s$9 + ? this._$AC(t$7) + : (void 0 === s$9.el && (s$9.el = S.createElement(V(s$9.h, s$9.h[0]), this.options)), + s$9); + if (this._$AH?._$AD === e$14) this._$AH.p(i$10); + else { + const t$8 = new R(e$14, this), + s$10 = t$8.u(this.options); + (t$8.p(i$10), this.T(s$10), (this._$AH = t$8)); + } + } + _$AC(t$7) { + let i$10 = C.get(t$7.strings); + return (void 0 === i$10 && C.set(t$7.strings, (i$10 = new S(t$7))), i$10); + } + k(t$7) { + u$2(this._$AH) || ((this._$AH = []), this._$AR()); + const i$10 = this._$AH; + let s$9, + e$14 = 0; + for (const h$7 of t$7) + (e$14 === i$10.length + ? i$10.push((s$9 = new k(this.O(c$4()), this.O(c$4()), this, this.options))) + : (s$9 = i$10[e$14]), + s$9._$AI(h$7), + e$14++); + e$14 < i$10.length && (this._$AR(s$9 && s$9._$AB.nextSibling, e$14), (i$10.length = e$14)); + } + _$AR(t$7 = this._$AA.nextSibling, s$9) { + for (this._$AP?.(!1, !0, s$9); t$7 !== this._$AB; ) { + const s$10 = i$7(t$7).nextSibling; + (i$7(t$7).remove(), (t$7 = s$10)); + } + } + setConnected(t$7) { + void 0 === this._$AM && ((this._$Cv = t$7), this._$AP?.(t$7)); + } }; var H = class { - get tagName() { - return this.element.tagName; - } - get _$AU() { - return this._$AM._$AU; - } - constructor(t$7, i$10, s$9, e$14, h$7) { - this.type = 1, this._$AH = A, this._$AN = void 0, this.element = t$7, this.name = i$10, this._$AM = e$14, this.options = h$7, s$9.length > 2 || "" !== s$9[0] || "" !== s$9[1] ? (this._$AH = Array(s$9.length - 1).fill(new String()), this.strings = s$9) : this._$AH = A; - } - _$AI(t$7, i$10 = this, s$9, e$14) { - const h$7 = this.strings; - let o$15 = !1; - if (void 0 === h$7) t$7 = M$1(this, t$7, i$10, 0), o$15 = !a(t$7) || t$7 !== this._$AH && t$7 !== E, o$15 && (this._$AH = t$7); - else { - const e$15 = t$7; - let n$13, r$12; - for (t$7 = h$7[0], n$13 = 0; n$13 < h$7.length - 1; n$13++) r$12 = M$1(this, e$15[s$9 + n$13], i$10, n$13), r$12 === E && (r$12 = this._$AH[n$13]), o$15 ||= !a(r$12) || r$12 !== this._$AH[n$13], r$12 === A ? t$7 = A : t$7 !== A && (t$7 += (r$12 ?? "") + h$7[n$13 + 1]), this._$AH[n$13] = r$12; - } - o$15 && !e$14 && this.j(t$7); - } - j(t$7) { - t$7 === A ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t$7 ?? ""); - } + get tagName() { + return this.element.tagName; + } + get _$AU() { + return this._$AM._$AU; + } + constructor(t$7, i$10, s$9, e$14, h$7) { + ((this.type = 1), + (this._$AH = A), + (this._$AN = void 0), + (this.element = t$7), + (this.name = i$10), + (this._$AM = e$14), + (this.options = h$7), + s$9.length > 2 || "" !== s$9[0] || "" !== s$9[1] + ? ((this._$AH = Array(s$9.length - 1).fill(new String())), (this.strings = s$9)) + : (this._$AH = A)); + } + _$AI(t$7, i$10 = this, s$9, e$14) { + const h$7 = this.strings; + let o$15 = !1; + if (void 0 === h$7) + ((t$7 = M$1(this, t$7, i$10, 0)), + (o$15 = !a(t$7) || (t$7 !== this._$AH && t$7 !== E)), + o$15 && (this._$AH = t$7)); + else { + const e$15 = t$7; + let n$13, r$12; + for (t$7 = h$7[0], n$13 = 0; n$13 < h$7.length - 1; n$13++) + ((r$12 = M$1(this, e$15[s$9 + n$13], i$10, n$13)), + r$12 === E && (r$12 = this._$AH[n$13]), + (o$15 ||= !a(r$12) || r$12 !== this._$AH[n$13]), + r$12 === A ? (t$7 = A) : t$7 !== A && (t$7 += (r$12 ?? "") + h$7[n$13 + 1]), + (this._$AH[n$13] = r$12)); + } + o$15 && !e$14 && this.j(t$7); + } + j(t$7) { + t$7 === A + ? this.element.removeAttribute(this.name) + : this.element.setAttribute(this.name, t$7 ?? ""); + } }; var I = class extends H { - constructor() { - super(...arguments), this.type = 3; - } - j(t$7) { - this.element[this.name] = t$7 === A ? void 0 : t$7; - } + constructor() { + (super(...arguments), (this.type = 3)); + } + j(t$7) { + this.element[this.name] = t$7 === A ? void 0 : t$7; + } }; var L = class extends H { - constructor() { - super(...arguments), this.type = 4; - } - j(t$7) { - this.element.toggleAttribute(this.name, !!t$7 && t$7 !== A); - } + constructor() { + (super(...arguments), (this.type = 4)); + } + j(t$7) { + this.element.toggleAttribute(this.name, !!t$7 && t$7 !== A); + } }; var z = class extends H { - constructor(t$7, i$10, s$9, e$14, h$7) { - super(t$7, i$10, s$9, e$14, h$7), this.type = 5; - } - _$AI(t$7, i$10 = this) { - if ((t$7 = M$1(this, t$7, i$10, 0) ?? A) === E) return; - const s$9 = this._$AH, e$14 = t$7 === A && s$9 !== A || t$7.capture !== s$9.capture || t$7.once !== s$9.once || t$7.passive !== s$9.passive, h$7 = t$7 !== A && (s$9 === A || e$14); - e$14 && this.element.removeEventListener(this.name, this, s$9), h$7 && this.element.addEventListener(this.name, this, t$7), this._$AH = t$7; - } - handleEvent(t$7) { - "function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t$7) : this._$AH.handleEvent(t$7); - } + constructor(t$7, i$10, s$9, e$14, h$7) { + (super(t$7, i$10, s$9, e$14, h$7), (this.type = 5)); + } + _$AI(t$7, i$10 = this) { + if ((t$7 = M$1(this, t$7, i$10, 0) ?? A) === E) return; + const s$9 = this._$AH, + e$14 = + (t$7 === A && s$9 !== A) || + t$7.capture !== s$9.capture || + t$7.once !== s$9.once || + t$7.passive !== s$9.passive, + h$7 = t$7 !== A && (s$9 === A || e$14); + (e$14 && this.element.removeEventListener(this.name, this, s$9), + h$7 && this.element.addEventListener(this.name, this, t$7), + (this._$AH = t$7)); + } + handleEvent(t$7) { + "function" == typeof this._$AH + ? this._$AH.call(this.options?.host ?? this.element, t$7) + : this._$AH.handleEvent(t$7); + } }; var Z = class { - constructor(t$7, i$10, s$9) { - this.element = t$7, this.type = 6, this._$AN = void 0, this._$AM = i$10, this.options = s$9; - } - get _$AU() { - return this._$AM._$AU; - } - _$AI(t$7) { - M$1(this, t$7); - } + constructor(t$7, i$10, s$9) { + ((this.element = t$7), + (this.type = 6), + (this._$AN = void 0), + (this._$AM = i$10), + (this.options = s$9)); + } + get _$AU() { + return this._$AM._$AU; + } + _$AI(t$7) { + M$1(this, t$7); + } }; const j$1 = { - M: h$5, - P: o$12, - A: n$10, - C: 1, - L: N, - R, - D: d$1, - V: M$1, - I: k, - H, - N: L, - U: z, - B: I, - F: Z -}, B = t$5.litHtmlPolyfillSupport; -B?.(S, k), (t$5.litHtmlVersions ??= []).push("3.3.2"); + M: h$5, + P: o$12, + A: n$10, + C: 1, + L: N, + R, + D: d$1, + V: M$1, + I: k, + H, + N: L, + U: z, + B: I, + F: Z, + }, + B = t$5.litHtmlPolyfillSupport; +(B?.(S, k), (t$5.litHtmlVersions ??= []).push("3.3.2")); const D = (t$7, i$10, s$9) => { - const e$14 = s$9?.renderBefore ?? i$10; - let h$7 = e$14._$litPart$; - if (void 0 === h$7) { - const t$8 = s$9?.renderBefore ?? null; - e$14._$litPart$ = h$7 = new k(i$10.insertBefore(c$4(), t$8), t$8, void 0, s$9 ?? {}); - } - return h$7._$AI(t$7), h$7; + const e$14 = s$9?.renderBefore ?? i$10; + let h$7 = e$14._$litPart$; + if (void 0 === h$7) { + const t$8 = s$9?.renderBefore ?? null; + e$14._$litPart$ = h$7 = new k(i$10.insertBefore(c$4(), t$8), t$8, void 0, s$9 ?? {}); + } + return (h$7._$AI(t$7), h$7); }; /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ const s$6 = globalThis; + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ const s$6 = globalThis; var i$6 = class extends y$1 { - constructor() { - super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0; - } - createRenderRoot() { - const t$7 = super.createRenderRoot(); - return this.renderOptions.renderBefore ??= t$7.firstChild, t$7; - } - update(t$7) { - const r$12 = this.render(); - this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t$7), this._$Do = D(r$12, this.renderRoot, this.renderOptions); - } - connectedCallback() { - super.connectedCallback(), this._$Do?.setConnected(!0); - } - disconnectedCallback() { - super.disconnectedCallback(), this._$Do?.setConnected(!1); - } - render() { - return E; - } + constructor() { + (super(...arguments), (this.renderOptions = { host: this }), (this._$Do = void 0)); + } + createRenderRoot() { + const t$7 = super.createRenderRoot(); + return ((this.renderOptions.renderBefore ??= t$7.firstChild), t$7); + } + update(t$7) { + const r$12 = this.render(); + (this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), + super.update(t$7), + (this._$Do = D(r$12, this.renderRoot, this.renderOptions))); + } + connectedCallback() { + (super.connectedCallback(), this._$Do?.setConnected(!0)); + } + disconnectedCallback() { + (super.disconnectedCallback(), this._$Do?.setConnected(!1)); + } + render() { + return E; + } }; -i$6._$litElement$ = !0, i$6["finalized"] = !0, s$6.litElementHydrateSupport?.({ LitElement: i$6 }); +((i$6._$litElement$ = !0), + (i$6["finalized"] = !0), + s$6.litElementHydrateSupport?.({ LitElement: i$6 })); const o$11 = s$6.litElementPolyfillSupport; o$11?.({ LitElement: i$6 }); const n$9 = { - _$AK: (t$7, e$14, r$12) => { - t$7._$AK(e$14, r$12); - }, - _$AL: (t$7) => t$7._$AL + _$AK: (t$7, e$14, r$12) => { + t$7._$AK(e$14, r$12); + }, + _$AL: (t$7) => t$7._$AL, }; (s$6.litElementVersions ??= []).push("4.2.2"); /** -* @license -* Copyright 2022 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ const o$10 = !1; /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ const t$4 = { - ATTRIBUTE: 1, - CHILD: 2, - PROPERTY: 3, - BOOLEAN_ATTRIBUTE: 4, - EVENT: 5, - ELEMENT: 6 -}, e$10 = (t$7) => (...e$14) => ({ - _$litDirective$: t$7, - values: e$14 -}); + ATTRIBUTE: 1, + CHILD: 2, + PROPERTY: 3, + BOOLEAN_ATTRIBUTE: 4, + EVENT: 5, + ELEMENT: 6, + }, + e$10 = + (t$7) => + (...e$14) => ({ + _$litDirective$: t$7, + values: e$14, + }); var i$5 = class { - constructor(t$7) {} - get _$AU() { - return this._$AM._$AU; - } - _$AT(t$7, e$14, i$10) { - this._$Ct = t$7, this._$AM = e$14, this._$Ci = i$10; - } - _$AS(t$7, e$14) { - return this.update(t$7, e$14); - } - update(t$7, e$14) { - return this.render(...e$14); - } + constructor(t$7) {} + get _$AU() { + return this._$AM._$AU; + } + _$AT(t$7, e$14, i$10) { + ((this._$Ct = t$7), (this._$AM = e$14), (this._$Ci = i$10)); + } + _$AS(t$7, e$14) { + return this.update(t$7, e$14); + } + update(t$7, e$14) { + return this.render(...e$14); + } }; /** -* @license -* Copyright 2020 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ const { I: t$3 } = j$1, i$4 = (o$15) => o$15, n$8 = (o$15) => null === o$15 || "object" != typeof o$15 && "function" != typeof o$15, e$9 = { - HTML: 1, - SVG: 2, - MATHML: 3 -}, l$2 = (o$15, t$7) => void 0 === t$7 ? void 0 !== o$15?._$litType$ : o$15?._$litType$ === t$7, d = (o$15) => null != o$15?._$litType$?.h, c$3 = (o$15) => void 0 !== o$15?._$litDirective$, f$1 = (o$15) => o$15?._$litDirective$, r$8 = (o$15) => void 0 === o$15.strings, s$5 = () => document.createComment(""), v = (o$15, n$13, e$14) => { - const l$5 = o$15._$AA.parentNode, d$3 = void 0 === n$13 ? o$15._$AB : n$13._$AA; - if (void 0 === e$14) { - const i$10 = l$5.insertBefore(s$5(), d$3), n$14 = l$5.insertBefore(s$5(), d$3); - e$14 = new t$3(i$10, n$14, o$15, o$15.options); - } else { - const t$7 = e$14._$AB.nextSibling, n$14 = e$14._$AM, c$7 = n$14 !== o$15; - if (c$7) { - let t$8; - e$14._$AQ?.(o$15), e$14._$AM = o$15, void 0 !== e$14._$AP && (t$8 = o$15._$AU) !== n$14._$AU && e$14._$AP(t$8); - } - if (t$7 !== d$3 || c$7) { - let o$16 = e$14._$AA; - for (; o$16 !== t$7;) { - const t$8 = i$4(o$16).nextSibling; - i$4(l$5).insertBefore(o$16, d$3), o$16 = t$8; - } - } - } - return e$14; -}, u$1 = (o$15, t$7, i$10 = o$15) => (o$15._$AI(t$7, i$10), o$15), m$1 = {}, p = (o$15, t$7 = m$1) => o$15._$AH = t$7, M = (o$15) => o$15._$AH, h$4 = (o$15) => { - o$15._$AR(), o$15._$AA.remove(); -}, j = (o$15) => { - o$15._$AR(); -}; + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ const { I: t$3 } = j$1, + i$4 = (o$15) => o$15, + n$8 = (o$15) => null === o$15 || ("object" != typeof o$15 && "function" != typeof o$15), + e$9 = { + HTML: 1, + SVG: 2, + MATHML: 3, + }, + l$2 = (o$15, t$7) => (void 0 === t$7 ? void 0 !== o$15?._$litType$ : o$15?._$litType$ === t$7), + d = (o$15) => null != o$15?._$litType$?.h, + c$3 = (o$15) => void 0 !== o$15?._$litDirective$, + f$1 = (o$15) => o$15?._$litDirective$, + r$8 = (o$15) => void 0 === o$15.strings, + s$5 = () => document.createComment(""), + v = (o$15, n$13, e$14) => { + const l$5 = o$15._$AA.parentNode, + d$3 = void 0 === n$13 ? o$15._$AB : n$13._$AA; + if (void 0 === e$14) { + const i$10 = l$5.insertBefore(s$5(), d$3), + n$14 = l$5.insertBefore(s$5(), d$3); + e$14 = new t$3(i$10, n$14, o$15, o$15.options); + } else { + const t$7 = e$14._$AB.nextSibling, + n$14 = e$14._$AM, + c$7 = n$14 !== o$15; + if (c$7) { + let t$8; + (e$14._$AQ?.(o$15), + (e$14._$AM = o$15), + void 0 !== e$14._$AP && (t$8 = o$15._$AU) !== n$14._$AU && e$14._$AP(t$8)); + } + if (t$7 !== d$3 || c$7) { + let o$16 = e$14._$AA; + for (; o$16 !== t$7; ) { + const t$8 = i$4(o$16).nextSibling; + (i$4(l$5).insertBefore(o$16, d$3), (o$16 = t$8)); + } + } + } + return e$14; + }, + u$1 = (o$15, t$7, i$10 = o$15) => (o$15._$AI(t$7, i$10), o$15), + m$1 = {}, + p = (o$15, t$7 = m$1) => (o$15._$AH = t$7), + M = (o$15) => o$15._$AH, + h$4 = (o$15) => { + (o$15._$AR(), o$15._$AA.remove()); + }, + j = (o$15) => { + o$15._$AR(); + }; /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ const u = (e$14, s$9, t$7) => { - const r$12 = new Map(); - for (let l$5 = s$9; l$5 <= t$7; l$5++) r$12.set(e$14[l$5], l$5); - return r$12; -}, c$2 = e$10(class extends i$5 { - constructor(e$14) { - if (super(e$14), e$14.type !== t$4.CHILD) throw Error("repeat() can only be used in text expressions"); - } - dt(e$14, s$9, t$7) { - let r$12; - void 0 === t$7 ? t$7 = s$9 : void 0 !== s$9 && (r$12 = s$9); - const l$5 = [], o$15 = []; - let i$10 = 0; - for (const s$10 of e$14) l$5[i$10] = r$12 ? r$12(s$10, i$10) : i$10, o$15[i$10] = t$7(s$10, i$10), i$10++; - return { - values: o$15, - keys: l$5 - }; - } - render(e$14, s$9, t$7) { - return this.dt(e$14, s$9, t$7).values; - } - update(s$9, [t$7, r$12, c$7]) { - const d$3 = M(s$9), { values: p$3, keys: a$2 } = this.dt(t$7, r$12, c$7); - if (!Array.isArray(d$3)) return this.ut = a$2, p$3; - const h$7 = this.ut ??= [], v$2 = []; - let m$3, y$2, x$1 = 0, j$2 = d$3.length - 1, k$1 = 0, w$1 = p$3.length - 1; - for (; x$1 <= j$2 && k$1 <= w$1;) if (null === d$3[x$1]) x$1++; - else if (null === d$3[j$2]) j$2--; - else if (h$7[x$1] === a$2[k$1]) v$2[k$1] = u$1(d$3[x$1], p$3[k$1]), x$1++, k$1++; - else if (h$7[j$2] === a$2[w$1]) v$2[w$1] = u$1(d$3[j$2], p$3[w$1]), j$2--, w$1--; - else if (h$7[x$1] === a$2[w$1]) v$2[w$1] = u$1(d$3[x$1], p$3[w$1]), v(s$9, v$2[w$1 + 1], d$3[x$1]), x$1++, w$1--; - else if (h$7[j$2] === a$2[k$1]) v$2[k$1] = u$1(d$3[j$2], p$3[k$1]), v(s$9, d$3[x$1], d$3[j$2]), j$2--, k$1++; - else if (void 0 === m$3 && (m$3 = u(a$2, k$1, w$1), y$2 = u(h$7, x$1, j$2)), m$3.has(h$7[x$1])) if (m$3.has(h$7[j$2])) { - const e$14 = y$2.get(a$2[k$1]), t$8 = void 0 !== e$14 ? d$3[e$14] : null; - if (null === t$8) { - const e$15 = v(s$9, d$3[x$1]); - u$1(e$15, p$3[k$1]), v$2[k$1] = e$15; - } else v$2[k$1] = u$1(t$8, p$3[k$1]), v(s$9, d$3[x$1], t$8), d$3[e$14] = null; - k$1++; - } else h$4(d$3[j$2]), j$2--; - else h$4(d$3[x$1]), x$1++; - for (; k$1 <= w$1;) { - const e$14 = v(s$9, v$2[w$1 + 1]); - u$1(e$14, p$3[k$1]), v$2[k$1++] = e$14; - } - for (; x$1 <= j$2;) { - const e$14 = d$3[x$1++]; - null !== e$14 && h$4(e$14); - } - return this.ut = a$2, p(s$9, v$2), E; - } -}); + const r$12 = new Map(); + for (let l$5 = s$9; l$5 <= t$7; l$5++) r$12.set(e$14[l$5], l$5); + return r$12; + }, + c$2 = e$10( + class extends i$5 { + constructor(e$14) { + if ((super(e$14), e$14.type !== t$4.CHILD)) + throw Error("repeat() can only be used in text expressions"); + } + dt(e$14, s$9, t$7) { + let r$12; + void 0 === t$7 ? (t$7 = s$9) : void 0 !== s$9 && (r$12 = s$9); + const l$5 = [], + o$15 = []; + let i$10 = 0; + for (const s$10 of e$14) + ((l$5[i$10] = r$12 ? r$12(s$10, i$10) : i$10), (o$15[i$10] = t$7(s$10, i$10)), i$10++); + return { + values: o$15, + keys: l$5, + }; + } + render(e$14, s$9, t$7) { + return this.dt(e$14, s$9, t$7).values; + } + update(s$9, [t$7, r$12, c$7]) { + const d$3 = M(s$9), + { values: p$3, keys: a$2 } = this.dt(t$7, r$12, c$7); + if (!Array.isArray(d$3)) return ((this.ut = a$2), p$3); + const h$7 = (this.ut ??= []), + v$2 = []; + let m$3, + y$2, + x$1 = 0, + j$2 = d$3.length - 1, + k$1 = 0, + w$1 = p$3.length - 1; + for (; x$1 <= j$2 && k$1 <= w$1; ) + if (null === d$3[x$1]) x$1++; + else if (null === d$3[j$2]) j$2--; + else if (h$7[x$1] === a$2[k$1]) ((v$2[k$1] = u$1(d$3[x$1], p$3[k$1])), x$1++, k$1++); + else if (h$7[j$2] === a$2[w$1]) ((v$2[w$1] = u$1(d$3[j$2], p$3[w$1])), j$2--, w$1--); + else if (h$7[x$1] === a$2[w$1]) + ((v$2[w$1] = u$1(d$3[x$1], p$3[w$1])), v(s$9, v$2[w$1 + 1], d$3[x$1]), x$1++, w$1--); + else if (h$7[j$2] === a$2[k$1]) + ((v$2[k$1] = u$1(d$3[j$2], p$3[k$1])), v(s$9, d$3[x$1], d$3[j$2]), j$2--, k$1++); + else if ( + (void 0 === m$3 && ((m$3 = u(a$2, k$1, w$1)), (y$2 = u(h$7, x$1, j$2))), + m$3.has(h$7[x$1])) + ) + if (m$3.has(h$7[j$2])) { + const e$14 = y$2.get(a$2[k$1]), + t$8 = void 0 !== e$14 ? d$3[e$14] : null; + if (null === t$8) { + const e$15 = v(s$9, d$3[x$1]); + (u$1(e$15, p$3[k$1]), (v$2[k$1] = e$15)); + } else ((v$2[k$1] = u$1(t$8, p$3[k$1])), v(s$9, d$3[x$1], t$8), (d$3[e$14] = null)); + k$1++; + } else (h$4(d$3[j$2]), j$2--); + else (h$4(d$3[x$1]), x$1++); + for (; k$1 <= w$1; ) { + const e$14 = v(s$9, v$2[w$1 + 1]); + (u$1(e$14, p$3[k$1]), (v$2[k$1++] = e$14)); + } + for (; x$1 <= j$2; ) { + const e$14 = d$3[x$1++]; + null !== e$14 && h$4(e$14); + } + return ((this.ut = a$2), p(s$9, v$2), E); + } + }, + ); /** -* @license -* Copyright 2021 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ var s$4 = class extends Event { - constructor(s$9, t$7, e$14, o$15) { - super("context-request", { - bubbles: !0, - composed: !0 - }), this.context = s$9, this.contextTarget = t$7, this.callback = e$14, this.subscribe = o$15 ?? !1; - } + constructor(s$9, t$7, e$14, o$15) { + (super("context-request", { + bubbles: !0, + composed: !0, + }), + (this.context = s$9), + (this.contextTarget = t$7), + (this.callback = e$14), + (this.subscribe = o$15 ?? !1)); + } }; /** -* @license -* Copyright 2021 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ function n$7(n$13) { - return n$13; + return n$13; } /** -* @license -* Copyright 2021 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ var s$3 = class { - constructor(t$7, s$9, i$10, h$7) { - if (this.subscribe = !1, this.provided = !1, this.value = void 0, this.t = (t$8, s$10) => { - this.unsubscribe && (this.unsubscribe !== s$10 && (this.provided = !1, this.unsubscribe()), this.subscribe || this.unsubscribe()), this.value = t$8, this.host.requestUpdate(), this.provided && !this.subscribe || (this.provided = !0, this.callback && this.callback(t$8, s$10)), this.unsubscribe = s$10; - }, this.host = t$7, void 0 !== s$9.context) { - const t$8 = s$9; - this.context = t$8.context, this.callback = t$8.callback, this.subscribe = t$8.subscribe ?? !1; - } else this.context = s$9, this.callback = i$10, this.subscribe = h$7 ?? !1; - this.host.addController(this); - } - hostConnected() { - this.dispatchRequest(); - } - hostDisconnected() { - this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0); - } - dispatchRequest() { - this.host.dispatchEvent(new s$4(this.context, this.host, this.t, this.subscribe)); - } + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ var s$3 = class { + constructor(t$7, s$9, i$10, h$7) { + if ( + ((this.subscribe = !1), + (this.provided = !1), + (this.value = void 0), + (this.t = (t$8, s$10) => { + (this.unsubscribe && + (this.unsubscribe !== s$10 && ((this.provided = !1), this.unsubscribe()), + this.subscribe || this.unsubscribe()), + (this.value = t$8), + this.host.requestUpdate(), + (this.provided && !this.subscribe) || + ((this.provided = !0), this.callback && this.callback(t$8, s$10)), + (this.unsubscribe = s$10)); + }), + (this.host = t$7), + void 0 !== s$9.context) + ) { + const t$8 = s$9; + ((this.context = t$8.context), + (this.callback = t$8.callback), + (this.subscribe = t$8.subscribe ?? !1)); + } else ((this.context = s$9), (this.callback = i$10), (this.subscribe = h$7 ?? !1)); + this.host.addController(this); + } + hostConnected() { + this.dispatchRequest(); + } + hostDisconnected() { + this.unsubscribe && (this.unsubscribe(), (this.unsubscribe = void 0)); + } + dispatchRequest() { + this.host.dispatchEvent(new s$4(this.context, this.host, this.t, this.subscribe)); + } }; /** -* @license -* Copyright 2021 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ var s$2 = class { - get value() { - return this.o; - } - set value(s$9) { - this.setValue(s$9); - } - setValue(s$9, t$7 = !1) { - const i$10 = t$7 || !Object.is(s$9, this.o); - this.o = s$9, i$10 && this.updateObservers(); - } - constructor(s$9) { - this.subscriptions = new Map(), this.updateObservers = () => { - for (const [s$10, { disposer: t$7 }] of this.subscriptions) s$10(this.o, t$7); - }, void 0 !== s$9 && (this.value = s$9); - } - addCallback(s$9, t$7, i$10) { - if (!i$10) return void s$9(this.value); - this.subscriptions.has(s$9) || this.subscriptions.set(s$9, { - disposer: () => { - this.subscriptions.delete(s$9); - }, - consumerHost: t$7 - }); - const { disposer: h$7 } = this.subscriptions.get(s$9); - s$9(this.value, h$7); - } - clearCallbacks() { - this.subscriptions.clear(); - } + get value() { + return this.o; + } + set value(s$9) { + this.setValue(s$9); + } + setValue(s$9, t$7 = !1) { + const i$10 = t$7 || !Object.is(s$9, this.o); + ((this.o = s$9), i$10 && this.updateObservers()); + } + constructor(s$9) { + ((this.subscriptions = new Map()), + (this.updateObservers = () => { + for (const [s$10, { disposer: t$7 }] of this.subscriptions) s$10(this.o, t$7); + }), + void 0 !== s$9 && (this.value = s$9)); + } + addCallback(s$9, t$7, i$10) { + if (!i$10) return void s$9(this.value); + this.subscriptions.has(s$9) || + this.subscriptions.set(s$9, { + disposer: () => { + this.subscriptions.delete(s$9); + }, + consumerHost: t$7, + }); + const { disposer: h$7 } = this.subscriptions.get(s$9); + s$9(this.value, h$7); + } + clearCallbacks() { + this.subscriptions.clear(); + } }; /** -* @license -* Copyright 2021 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ var e$8 = class extends Event { - constructor(t$7, s$9) { - super("context-provider", { - bubbles: !0, - composed: !0 - }), this.context = t$7, this.contextTarget = s$9; - } + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ var e$8 = class extends Event { + constructor(t$7, s$9) { + (super("context-provider", { + bubbles: !0, + composed: !0, + }), + (this.context = t$7), + (this.contextTarget = s$9)); + } }; var i$3 = class extends s$2 { - constructor(s$9, e$14, i$10) { - super(void 0 !== e$14.context ? e$14.initialValue : i$10), this.onContextRequest = (t$7) => { - if (t$7.context !== this.context) return; - const s$10 = t$7.contextTarget ?? t$7.composedPath()[0]; - s$10 !== this.host && (t$7.stopPropagation(), this.addCallback(t$7.callback, s$10, t$7.subscribe)); - }, this.onProviderRequest = (s$10) => { - if (s$10.context !== this.context) return; - if ((s$10.contextTarget ?? s$10.composedPath()[0]) === this.host) return; - const e$15 = new Set(); - for (const [s$11, { consumerHost: i$11 }] of this.subscriptions) e$15.has(s$11) || (e$15.add(s$11), i$11.dispatchEvent(new s$4(this.context, i$11, s$11, !0))); - s$10.stopPropagation(); - }, this.host = s$9, void 0 !== e$14.context ? this.context = e$14.context : this.context = e$14, this.attachListeners(), this.host.addController?.(this); - } - attachListeners() { - this.host.addEventListener("context-request", this.onContextRequest), this.host.addEventListener("context-provider", this.onProviderRequest); - } - hostConnected() { - this.host.dispatchEvent(new e$8(this.context, this.host)); - } + constructor(s$9, e$14, i$10) { + (super(void 0 !== e$14.context ? e$14.initialValue : i$10), + (this.onContextRequest = (t$7) => { + if (t$7.context !== this.context) return; + const s$10 = t$7.contextTarget ?? t$7.composedPath()[0]; + s$10 !== this.host && + (t$7.stopPropagation(), this.addCallback(t$7.callback, s$10, t$7.subscribe)); + }), + (this.onProviderRequest = (s$10) => { + if (s$10.context !== this.context) return; + if ((s$10.contextTarget ?? s$10.composedPath()[0]) === this.host) return; + const e$15 = new Set(); + for (const [s$11, { consumerHost: i$11 }] of this.subscriptions) + e$15.has(s$11) || + (e$15.add(s$11), i$11.dispatchEvent(new s$4(this.context, i$11, s$11, !0))); + s$10.stopPropagation(); + }), + (this.host = s$9), + void 0 !== e$14.context ? (this.context = e$14.context) : (this.context = e$14), + this.attachListeners(), + this.host.addController?.(this)); + } + attachListeners() { + (this.host.addEventListener("context-request", this.onContextRequest), + this.host.addEventListener("context-provider", this.onProviderRequest)); + } + hostConnected() { + this.host.dispatchEvent(new e$8(this.context, this.host)); + } }; /** -* @license -* Copyright 2021 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ var t$2 = class { - constructor() { - this.pendingContextRequests = new Map(), this.onContextProvider = (t$7) => { - const s$9 = this.pendingContextRequests.get(t$7.context); - if (void 0 === s$9) return; - this.pendingContextRequests.delete(t$7.context); - const { requests: o$15 } = s$9; - for (const { elementRef: s$10, callbackRef: n$13 } of o$15) { - const o$16 = s$10.deref(), c$7 = n$13.deref(); - void 0 === o$16 || void 0 === c$7 || o$16.dispatchEvent(new s$4(t$7.context, o$16, c$7, !0)); - } - }, this.onContextRequest = (e$14) => { - if (!0 !== e$14.subscribe) return; - const t$7 = e$14.contextTarget ?? e$14.composedPath()[0], s$9 = e$14.callback; - let o$15 = this.pendingContextRequests.get(e$14.context); - void 0 === o$15 && this.pendingContextRequests.set(e$14.context, o$15 = { - callbacks: new WeakMap(), - requests: [] - }); - let n$13 = o$15.callbacks.get(t$7); - void 0 === n$13 && o$15.callbacks.set(t$7, n$13 = new WeakSet()), n$13.has(s$9) || (n$13.add(s$9), o$15.requests.push({ - elementRef: new WeakRef(t$7), - callbackRef: new WeakRef(s$9) - })); - }; - } - attach(e$14) { - e$14.addEventListener("context-request", this.onContextRequest), e$14.addEventListener("context-provider", this.onContextProvider); - } - detach(e$14) { - e$14.removeEventListener("context-request", this.onContextRequest), e$14.removeEventListener("context-provider", this.onContextProvider); - } + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ var t$2 = class { + constructor() { + ((this.pendingContextRequests = new Map()), + (this.onContextProvider = (t$7) => { + const s$9 = this.pendingContextRequests.get(t$7.context); + if (void 0 === s$9) return; + this.pendingContextRequests.delete(t$7.context); + const { requests: o$15 } = s$9; + for (const { elementRef: s$10, callbackRef: n$13 } of o$15) { + const o$16 = s$10.deref(), + c$7 = n$13.deref(); + void 0 === o$16 || + void 0 === c$7 || + o$16.dispatchEvent(new s$4(t$7.context, o$16, c$7, !0)); + } + }), + (this.onContextRequest = (e$14) => { + if (!0 !== e$14.subscribe) return; + const t$7 = e$14.contextTarget ?? e$14.composedPath()[0], + s$9 = e$14.callback; + let o$15 = this.pendingContextRequests.get(e$14.context); + void 0 === o$15 && + this.pendingContextRequests.set( + e$14.context, + (o$15 = { + callbacks: new WeakMap(), + requests: [], + }), + ); + let n$13 = o$15.callbacks.get(t$7); + (void 0 === n$13 && o$15.callbacks.set(t$7, (n$13 = new WeakSet())), + n$13.has(s$9) || + (n$13.add(s$9), + o$15.requests.push({ + elementRef: new WeakRef(t$7), + callbackRef: new WeakRef(s$9), + }))); + })); + } + attach(e$14) { + (e$14.addEventListener("context-request", this.onContextRequest), + e$14.addEventListener("context-provider", this.onContextProvider)); + } + detach(e$14) { + (e$14.removeEventListener("context-request", this.onContextRequest), + e$14.removeEventListener("context-provider", this.onContextProvider)); + } }; /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ function e$7({ context: e$14 }) { - return (n$13, i$10) => { - const r$12 = new WeakMap(); - if ("object" == typeof i$10) return { - get() { - return n$13.get.call(this); - }, - set(t$7) { - return r$12.get(this).setValue(t$7), n$13.set.call(this, t$7); - }, - init(n$14) { - return r$12.set(this, new i$3(this, { - context: e$14, - initialValue: n$14 - })), n$14; - } - }; - { - n$13.constructor.addInitializer(((n$14) => { - r$12.set(n$14, new i$3(n$14, { context: e$14 })); - })); - const o$15 = Object.getOwnPropertyDescriptor(n$13, i$10); - let s$9; - if (void 0 === o$15) { - const t$7 = new WeakMap(); - s$9 = { - get() { - return t$7.get(this); - }, - set(e$15) { - r$12.get(this).setValue(e$15), t$7.set(this, e$15); - }, - configurable: !0, - enumerable: !0 - }; - } else { - const t$7 = o$15.set; - s$9 = { - ...o$15, - set(e$15) { - r$12.get(this).setValue(e$15), t$7?.call(this, e$15); - } - }; - } - return void Object.defineProperty(n$13, i$10, s$9); - } - }; + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ function e$7({ context: e$14 }) { + return (n$13, i$10) => { + const r$12 = new WeakMap(); + if ("object" == typeof i$10) + return { + get() { + return n$13.get.call(this); + }, + set(t$7) { + return (r$12.get(this).setValue(t$7), n$13.set.call(this, t$7)); + }, + init(n$14) { + return ( + r$12.set( + this, + new i$3(this, { + context: e$14, + initialValue: n$14, + }), + ), + n$14 + ); + }, + }; + { + n$13.constructor.addInitializer((n$14) => { + r$12.set(n$14, new i$3(n$14, { context: e$14 })); + }); + const o$15 = Object.getOwnPropertyDescriptor(n$13, i$10); + let s$9; + if (void 0 === o$15) { + const t$7 = new WeakMap(); + s$9 = { + get() { + return t$7.get(this); + }, + set(e$15) { + (r$12.get(this).setValue(e$15), t$7.set(this, e$15)); + }, + configurable: !0, + enumerable: !0, + }; + } else { + const t$7 = o$15.set; + s$9 = { + ...o$15, + set(e$15) { + (r$12.get(this).setValue(e$15), t$7?.call(this, e$15)); + }, + }; + } + return void Object.defineProperty(n$13, i$10, s$9); + } + }; } /** -* @license -* Copyright 2022 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ function c$1({ context: c$7, subscribe: e$14 }) { - return (o$15, n$13) => { - "object" == typeof n$13 ? n$13.addInitializer((function() { - new s$3(this, { - context: c$7, - callback: (t$7) => { - o$15.set.call(this, t$7); - }, - subscribe: e$14 - }); - })) : o$15.constructor.addInitializer(((o$16) => { - new s$3(o$16, { - context: c$7, - callback: (t$7) => { - o$16[n$13] = t$7; - }, - subscribe: e$14 - }); - })); - }; + * @license + * Copyright 2022 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ function c$1({ context: c$7, subscribe: e$14 }) { + return (o$15, n$13) => { + "object" == typeof n$13 + ? n$13.addInitializer(function () { + new s$3(this, { + context: c$7, + callback: (t$7) => { + o$15.set.call(this, t$7); + }, + subscribe: e$14, + }); + }) + : o$15.constructor.addInitializer((o$16) => { + new s$3(o$16, { + context: c$7, + callback: (t$7) => { + o$16[n$13] = t$7; + }, + subscribe: e$14, + }); + }); + }; } const eventInit = { - bubbles: true, - cancelable: true, - composed: true + bubbles: true, + cancelable: true, + composed: true, }; var StateEvent = class StateEvent extends CustomEvent { - static { - this.eventName = "a2uiaction"; - } - constructor(payload) { - super(StateEvent.eventName, { - detail: payload, - ...eventInit - }); - this.payload = payload; - } + static { + this.eventName = "a2uiaction"; + } + constructor(payload) { + super(StateEvent.eventName, { + detail: payload, + ...eventInit, + }); + this.payload = payload; + } }; const opacityBehavior = ` @@ -987,12 +1405,15 @@ const opacityBehavior = ` } }`; const behavior = ` - ${new Array(21).fill(0).map((_$1, idx) => { - return `.behavior-ho-${idx * 5} { + ${new Array(21) + .fill(0) + .map((_$1, idx) => { + return `.behavior-ho-${idx * 5} { --opacity: ${idx / 20}; ${opacityBehavior} }`; -}).join("\n")} + }) + .join("\n")} .behavior-o-s { overflow: scroll; @@ -1014,8 +1435,10 @@ const behavior = ` const grid = 4; const border = ` - ${new Array(25).fill(0).map((_$1, idx) => { - return ` + ${new Array(25) + .fill(0) + .map((_$1, idx) => { + return ` .border-bw-${idx} { border-width: ${idx}px; } .border-btw-${idx} { border-top-width: ${idx}px; } .border-bbw-${idx} { border-bottom-width: ${idx}px; } @@ -1024,7 +1447,8 @@ const border = ` .border-ow-${idx} { outline-width: ${idx}px; } .border-br-${idx} { border-radius: ${idx * grid}px; overflow: hidden;}`; -}).join("\n")} + }) + .join("\n")} .border-br-50pc { border-radius: 50%; @@ -1035,125 +1459,117 @@ const border = ` } `; -const shades = [ - 0, - 5, - 10, - 15, - 20, - 25, - 30, - 35, - 40, - 50, - 60, - 70, - 80, - 90, - 95, - 98, - 99, - 100 -]; +const shades = [0, 5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 70, 80, 90, 95, 98, 99, 100]; function merge(...classes) { - const styles = {}; - for (const clazz of classes) { - for (const [key, val] of Object.entries(clazz)) { - const prefix = key.split("-").with(-1, "").join("-"); - const existingKeys = Object.keys(styles).filter((key$1) => key$1.startsWith(prefix)); - for (const existingKey of existingKeys) { - delete styles[existingKey]; - } - styles[key] = val; - } - } - return styles; + const styles = {}; + for (const clazz of classes) { + for (const [key, val] of Object.entries(clazz)) { + const prefix = key.split("-").with(-1, "").join("-"); + const existingKeys = Object.keys(styles).filter((key$1) => key$1.startsWith(prefix)); + for (const existingKey of existingKeys) { + delete styles[existingKey]; + } + styles[key] = val; + } + } + return styles; } function appendToAll(target, exclusions, ...classes) { - const updatedTarget = structuredClone(target); - for (const clazz of classes) { - for (const key of Object.keys(clazz)) { - const prefix = key.split("-").with(-1, "").join("-"); - for (const [tagName, classesToAdd] of Object.entries(updatedTarget)) { - if (exclusions.includes(tagName)) { - continue; - } - let found = false; - for (let t$7 = 0; t$7 < classesToAdd.length; t$7++) { - if (classesToAdd[t$7].startsWith(prefix)) { - found = true; - classesToAdd[t$7] = key; - } - } - if (!found) { - classesToAdd.push(key); - } - } - } - } - return updatedTarget; + const updatedTarget = structuredClone(target); + for (const clazz of classes) { + for (const key of Object.keys(clazz)) { + const prefix = key.split("-").with(-1, "").join("-"); + for (const [tagName, classesToAdd] of Object.entries(updatedTarget)) { + if (exclusions.includes(tagName)) { + continue; + } + let found = false; + for (let t$7 = 0; t$7 < classesToAdd.length; t$7++) { + if (classesToAdd[t$7].startsWith(prefix)) { + found = true; + classesToAdd[t$7] = key; + } + } + if (!found) { + classesToAdd.push(key); + } + } + } + } + return updatedTarget; } function createThemeStyles(palettes) { - const styles = {}; - for (const palette of Object.values(palettes)) { - for (const [key, val] of Object.entries(palette)) { - const prop = toProp(key); - styles[prop] = val; - } - } - return styles; + const styles = {}; + for (const palette of Object.values(palettes)) { + for (const [key, val] of Object.entries(palette)) { + const prop = toProp(key); + styles[prop] = val; + } + } + return styles; } function toProp(key) { - if (key.startsWith("nv")) { - return `--nv-${key.slice(2)}`; - } - return `--${key[0]}-${key.slice(1)}`; + if (key.startsWith("nv")) { + return `--nv-${key.slice(2)}`; + } + return `--${key[0]}-${key.slice(1)}`; } const color = (src) => ` - ${src.map((key) => { - const inverseKey = getInverseKey(key); - return `.color-bc-${key} { border-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`; -}).join("\n")} + ${src + .map((key) => { + const inverseKey = getInverseKey(key); + return `.color-bc-${key} { border-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`; + }) + .join("\n")} - ${src.map((key) => { - const inverseKey = getInverseKey(key); - const vals = [`.color-bgc-${key} { background-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`, `.color-bbgc-${key}::backdrop { background-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`]; - for (let o$15 = .1; o$15 < 1; o$15 += .1) { - vals.push(`.color-bbgc-${key}_${(o$15 * 100).toFixed(0)}::backdrop { + ${src + .map((key) => { + const inverseKey = getInverseKey(key); + const vals = [ + `.color-bgc-${key} { background-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`, + `.color-bbgc-${key}::backdrop { background-color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`, + ]; + for (let o$15 = 0.1; o$15 < 1; o$15 += 0.1) { + vals.push(`.color-bbgc-${key}_${(o$15 * 100).toFixed(0)}::backdrop { background-color: light-dark(oklch(from var(${toProp(key)}) l c h / calc(alpha * ${o$15.toFixed(1)})), oklch(from var(${toProp(inverseKey)}) l c h / calc(alpha * ${o$15.toFixed(1)})) ); } `); - } - return vals.join("\n"); -}).join("\n")} + } + return vals.join("\n"); + }) + .join("\n")} - ${src.map((key) => { - const inverseKey = getInverseKey(key); - return `.color-c-${key} { color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`; -}).join("\n")} + ${src + .map((key) => { + const inverseKey = getInverseKey(key); + return `.color-c-${key} { color: light-dark(var(${toProp(key)}), var(${toProp(inverseKey)})); }`; + }) + .join("\n")} `; const getInverseKey = (key) => { - const match = key.match(/^([a-z]+)(\d+)$/); - if (!match) return key; - const [, prefix, shadeStr] = match; - const shade = parseInt(shadeStr, 10); - const target = 100 - shade; - const inverseShade = shades.reduce((prev, curr) => Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev); - return `${prefix}${inverseShade}`; + const match = key.match(/^([a-z]+)(\d+)$/); + if (!match) return key; + const [, prefix, shadeStr] = match; + const shade = parseInt(shadeStr, 10); + const target = 100 - shade; + const inverseShade = shades.reduce((prev, curr) => + Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev, + ); + return `${prefix}${inverseShade}`; }; const keyFactory = (prefix) => { - return shades.map((v$2) => `${prefix}${v$2}`); + return shades.map((v$2) => `${prefix}${v$2}`); }; const colors = [ - color(keyFactory("p")), - color(keyFactory("s")), - color(keyFactory("t")), - color(keyFactory("n")), - color(keyFactory("nv")), - color(keyFactory("e")), - ` + color(keyFactory("p")), + color(keyFactory("s")), + color(keyFactory("t")), + color(keyFactory("n")), + color(keyFactory("nv")), + color(keyFactory("e")), + ` .color-bgc-transparent { background-color: transparent; } @@ -1161,18 +1577,18 @@ const colors = [ :host { color-scheme: var(--color-scheme); } - ` + `, ]; /** -* CSS classes for Google Symbols. -* -* Usage: -* -* ```html -* pen_spark -* ``` -*/ + * CSS classes for Google Symbols. + * + * Usage: + * + * ```html + * pen_spark + * ``` + */ const icons = ` .g-icon { font-family: "Material Symbols Outlined", "Google Symbols"; @@ -1211,15 +1627,20 @@ const icons = ` const layout = ` :host { - ${new Array(16).fill(0).map((_$1, idx) => { - return `--g-${idx + 1}: ${(idx + 1) * grid}px;`; -}).join("\n")} + ${new Array(16) + .fill(0) + .map((_$1, idx) => { + return `--g-${idx + 1}: ${(idx + 1) * grid}px;`; + }) + .join("\n")} } - ${new Array(49).fill(0).map((_$1, index) => { - const idx = index - 24; - const lbl = idx < 0 ? `n${Math.abs(idx)}` : idx.toString(); - return ` + ${new Array(49) + .fill(0) + .map((_$1, index) => { + const idx = index - 24; + const lbl = idx < 0 ? `n${Math.abs(idx)}` : idx.toString(); + return ` .layout-p-${lbl} { --padding: ${idx * grid}px; padding: var(--padding); } .layout-pt-${lbl} { padding-top: ${idx * grid}px; } .layout-pr-${lbl} { padding-right: ${idx * grid}px; } @@ -1236,17 +1657,24 @@ const layout = ` .layout-r-${lbl} { right: ${idx * grid}px; } .layout-b-${lbl} { bottom: ${idx * grid}px; } .layout-l-${lbl} { left: ${idx * grid}px; }`; -}).join("\n")} + }) + .join("\n")} - ${new Array(25).fill(0).map((_$1, idx) => { - return ` + ${new Array(25) + .fill(0) + .map((_$1, idx) => { + return ` .layout-g-${idx} { gap: ${idx * grid}px; }`; -}).join("\n")} + }) + .join("\n")} - ${new Array(8).fill(0).map((_$1, idx) => { - return ` + ${new Array(8) + .fill(0) + .map((_$1, idx) => { + return ` .layout-grd-col${idx + 1} { grid-template-columns: ${"1fr ".repeat(idx + 1).trim()}; }`; -}).join("\n")} + }) + .join("\n")} .layout-pos-a { position: absolute; @@ -1356,27 +1784,39 @@ const layout = ` /** Widths **/ - ${new Array(10).fill(0).map((_$1, idx) => { - const weight = (idx + 1) * 10; - return `.layout-w-${weight} { width: ${weight}%; max-width: ${weight}%; }`; -}).join("\n")} + ${new Array(10) + .fill(0) + .map((_$1, idx) => { + const weight = (idx + 1) * 10; + return `.layout-w-${weight} { width: ${weight}%; max-width: ${weight}%; }`; + }) + .join("\n")} - ${new Array(16).fill(0).map((_$1, idx) => { - const weight = idx * grid; - return `.layout-wp-${idx} { width: ${weight}px; }`; -}).join("\n")} + ${new Array(16) + .fill(0) + .map((_$1, idx) => { + const weight = idx * grid; + return `.layout-wp-${idx} { width: ${weight}px; }`; + }) + .join("\n")} /** Heights **/ - ${new Array(10).fill(0).map((_$1, idx) => { - const height = (idx + 1) * 10; - return `.layout-h-${height} { height: ${height}%; }`; -}).join("\n")} + ${new Array(10) + .fill(0) + .map((_$1, idx) => { + const height = (idx + 1) * 10; + return `.layout-h-${height} { height: ${height}%; }`; + }) + .join("\n")} - ${new Array(16).fill(0).map((_$1, idx) => { - const height = idx * grid; - return `.layout-hp-${idx} { height: ${height}px; }`; -}).join("\n")} + ${new Array(16) + .fill(0) + .map((_$1, idx) => { + const height = idx * grid; + return `.layout-hp-${idx} { height: ${height}px; }`; + }) + .join("\n")} .layout-el-cv { & img, @@ -1400,9 +1840,12 @@ const layout = ` `; const opacity = ` - ${new Array(21).fill(0).map((_$1, idx) => { - return `.opacity-el-${idx * 5} { opacity: ${idx / 20}; }`; -}).join("\n")} + ${new Array(21) + .fill(0) + .map((_$1, idx) => { + return `.opacity-el-${idx * 5} { opacity: ${idx / 20}; }`; + }) + .join("\n")} `; const type$1 = ` @@ -1537,2749 +1980,3056 @@ const type$1 = ` /** Weights **/ - ${new Array(9).fill(0).map((_$1, idx) => { - const weight = (idx + 1) * 100; - return `.typography-w-${weight} { font-weight: ${weight}; }`; -}).join("\n")} + ${new Array(9) + .fill(0) + .map((_$1, idx) => { + const weight = (idx + 1) * 100; + return `.typography-w-${weight} { font-weight: ${weight}; }`; + }) + .join("\n")} `; -const structuralStyles$1 = [ - behavior, - border, - colors, - icons, - layout, - opacity, - type$1 -].flat(Infinity).join("\n"); +const structuralStyles$1 = [behavior, border, colors, icons, layout, opacity, type$1] + .flat(Infinity) + .join("\n"); var guards_exports = /* @__PURE__ */ __exportAll({ - isComponentArrayReference: () => isComponentArrayReference, - isObject: () => isObject$1, - isPath: () => isPath, - isResolvedAudioPlayer: () => isResolvedAudioPlayer, - isResolvedButton: () => isResolvedButton, - isResolvedCard: () => isResolvedCard, - isResolvedCheckbox: () => isResolvedCheckbox, - isResolvedColumn: () => isResolvedColumn, - isResolvedDateTimeInput: () => isResolvedDateTimeInput, - isResolvedDivider: () => isResolvedDivider, - isResolvedIcon: () => isResolvedIcon, - isResolvedImage: () => isResolvedImage, - isResolvedList: () => isResolvedList, - isResolvedModal: () => isResolvedModal, - isResolvedMultipleChoice: () => isResolvedMultipleChoice, - isResolvedRow: () => isResolvedRow, - isResolvedSlider: () => isResolvedSlider, - isResolvedTabs: () => isResolvedTabs, - isResolvedText: () => isResolvedText, - isResolvedTextField: () => isResolvedTextField, - isResolvedVideo: () => isResolvedVideo, - isValueMap: () => isValueMap + isComponentArrayReference: () => isComponentArrayReference, + isObject: () => isObject$1, + isPath: () => isPath, + isResolvedAudioPlayer: () => isResolvedAudioPlayer, + isResolvedButton: () => isResolvedButton, + isResolvedCard: () => isResolvedCard, + isResolvedCheckbox: () => isResolvedCheckbox, + isResolvedColumn: () => isResolvedColumn, + isResolvedDateTimeInput: () => isResolvedDateTimeInput, + isResolvedDivider: () => isResolvedDivider, + isResolvedIcon: () => isResolvedIcon, + isResolvedImage: () => isResolvedImage, + isResolvedList: () => isResolvedList, + isResolvedModal: () => isResolvedModal, + isResolvedMultipleChoice: () => isResolvedMultipleChoice, + isResolvedRow: () => isResolvedRow, + isResolvedSlider: () => isResolvedSlider, + isResolvedTabs: () => isResolvedTabs, + isResolvedText: () => isResolvedText, + isResolvedTextField: () => isResolvedTextField, + isResolvedVideo: () => isResolvedVideo, + isValueMap: () => isValueMap, }); function isValueMap(value) { - return isObject$1(value) && "key" in value; + return isObject$1(value) && "key" in value; } function isPath(key, value) { - return key === "path" && typeof value === "string"; + return key === "path" && typeof value === "string"; } function isObject$1(value) { - return typeof value === "object" && value !== null && !Array.isArray(value); + return typeof value === "object" && value !== null && !Array.isArray(value); } function isComponentArrayReference(value) { - if (!isObject$1(value)) return false; - return "explicitList" in value || "template" in value; + if (!isObject$1(value)) return false; + return "explicitList" in value || "template" in value; } function isStringValue(value) { - return isObject$1(value) && ("path" in value || "literal" in value && typeof value.literal === "string" || "literalString" in value); + return ( + isObject$1(value) && + ("path" in value || + ("literal" in value && typeof value.literal === "string") || + "literalString" in value) + ); } function isNumberValue(value) { - return isObject$1(value) && ("path" in value || "literal" in value && typeof value.literal === "number" || "literalNumber" in value); + return ( + isObject$1(value) && + ("path" in value || + ("literal" in value && typeof value.literal === "number") || + "literalNumber" in value) + ); } function isBooleanValue(value) { - return isObject$1(value) && ("path" in value || "literal" in value && typeof value.literal === "boolean" || "literalBoolean" in value); + return ( + isObject$1(value) && + ("path" in value || + ("literal" in value && typeof value.literal === "boolean") || + "literalBoolean" in value) + ); } function isAnyComponentNode(value) { - if (!isObject$1(value)) return false; - const hasBaseKeys = "id" in value && "type" in value && "properties" in value; - if (!hasBaseKeys) return false; - return true; + if (!isObject$1(value)) return false; + const hasBaseKeys = "id" in value && "type" in value && "properties" in value; + if (!hasBaseKeys) return false; + return true; } function isResolvedAudioPlayer(props) { - return isObject$1(props) && "url" in props && isStringValue(props.url); + return isObject$1(props) && "url" in props && isStringValue(props.url); } function isResolvedButton(props) { - return isObject$1(props) && "child" in props && isAnyComponentNode(props.child) && "action" in props; + return ( + isObject$1(props) && "child" in props && isAnyComponentNode(props.child) && "action" in props + ); } function isResolvedCard(props) { - if (!isObject$1(props)) return false; - if (!("child" in props)) { - if (!("children" in props)) { - return false; - } else { - return Array.isArray(props.children) && props.children.every(isAnyComponentNode); - } - } - return isAnyComponentNode(props.child); + if (!isObject$1(props)) return false; + if (!("child" in props)) { + if (!("children" in props)) { + return false; + } else { + return Array.isArray(props.children) && props.children.every(isAnyComponentNode); + } + } + return isAnyComponentNode(props.child); } function isResolvedCheckbox(props) { - return isObject$1(props) && "label" in props && isStringValue(props.label) && "value" in props && isBooleanValue(props.value); + return ( + isObject$1(props) && + "label" in props && + isStringValue(props.label) && + "value" in props && + isBooleanValue(props.value) + ); } function isResolvedColumn(props) { - return isObject$1(props) && "children" in props && Array.isArray(props.children) && props.children.every(isAnyComponentNode); + return ( + isObject$1(props) && + "children" in props && + Array.isArray(props.children) && + props.children.every(isAnyComponentNode) + ); } function isResolvedDateTimeInput(props) { - return isObject$1(props) && "value" in props && isStringValue(props.value); + return isObject$1(props) && "value" in props && isStringValue(props.value); } function isResolvedDivider(props) { - return isObject$1(props); + return isObject$1(props); } function isResolvedImage(props) { - return isObject$1(props) && "url" in props && isStringValue(props.url); + return isObject$1(props) && "url" in props && isStringValue(props.url); } function isResolvedIcon(props) { - return isObject$1(props) && "name" in props && isStringValue(props.name); + return isObject$1(props) && "name" in props && isStringValue(props.name); } function isResolvedList(props) { - return isObject$1(props) && "children" in props && Array.isArray(props.children) && props.children.every(isAnyComponentNode); + return ( + isObject$1(props) && + "children" in props && + Array.isArray(props.children) && + props.children.every(isAnyComponentNode) + ); } function isResolvedModal(props) { - return isObject$1(props) && "entryPointChild" in props && isAnyComponentNode(props.entryPointChild) && "contentChild" in props && isAnyComponentNode(props.contentChild); + return ( + isObject$1(props) && + "entryPointChild" in props && + isAnyComponentNode(props.entryPointChild) && + "contentChild" in props && + isAnyComponentNode(props.contentChild) + ); } function isResolvedMultipleChoice(props) { - return isObject$1(props) && "selections" in props; + return isObject$1(props) && "selections" in props; } function isResolvedRow(props) { - return isObject$1(props) && "children" in props && Array.isArray(props.children) && props.children.every(isAnyComponentNode); + return ( + isObject$1(props) && + "children" in props && + Array.isArray(props.children) && + props.children.every(isAnyComponentNode) + ); } function isResolvedSlider(props) { - return isObject$1(props) && "value" in props && isNumberValue(props.value); + return isObject$1(props) && "value" in props && isNumberValue(props.value); } function isResolvedTabItem(item) { - return isObject$1(item) && "title" in item && isStringValue(item.title) && "child" in item && isAnyComponentNode(item.child); + return ( + isObject$1(item) && + "title" in item && + isStringValue(item.title) && + "child" in item && + isAnyComponentNode(item.child) + ); } function isResolvedTabs(props) { - return isObject$1(props) && "tabItems" in props && Array.isArray(props.tabItems) && props.tabItems.every(isResolvedTabItem); + return ( + isObject$1(props) && + "tabItems" in props && + Array.isArray(props.tabItems) && + props.tabItems.every(isResolvedTabItem) + ); } function isResolvedText(props) { - return isObject$1(props) && "text" in props && isStringValue(props.text); + return isObject$1(props) && "text" in props && isStringValue(props.text); } function isResolvedTextField(props) { - return isObject$1(props) && "label" in props && isStringValue(props.label); + return isObject$1(props) && "label" in props && isStringValue(props.label); } function isResolvedVideo(props) { - return isObject$1(props) && "url" in props && isStringValue(props.url); + return isObject$1(props) && "url" in props && isStringValue(props.url); } /** -* Processes and consolidates A2UIProtocolMessage objects into a structured, -* hierarchical model of UI surfaces. -*/ + * Processes and consolidates A2UIProtocolMessage objects into a structured, + * hierarchical model of UI surfaces. + */ var A2uiMessageProcessor = class A2uiMessageProcessor { - static { - this.DEFAULT_SURFACE_ID = "@default"; - } - #mapCtor = Map; - #arrayCtor = Array; - #setCtor = Set; - #objCtor = Object; - #surfaces; - constructor(opts = { - mapCtor: Map, - arrayCtor: Array, - setCtor: Set, - objCtor: Object - }) { - this.opts = opts; - this.#arrayCtor = opts.arrayCtor; - this.#mapCtor = opts.mapCtor; - this.#setCtor = opts.setCtor; - this.#objCtor = opts.objCtor; - this.#surfaces = new opts.mapCtor(); - } - getSurfaces() { - return this.#surfaces; - } - clearSurfaces() { - this.#surfaces.clear(); - } - processMessages(messages) { - for (const message of messages) { - if (message.beginRendering) { - this.#handleBeginRendering(message.beginRendering, message.beginRendering.surfaceId); - } - if (message.surfaceUpdate) { - this.#handleSurfaceUpdate(message.surfaceUpdate, message.surfaceUpdate.surfaceId); - } - if (message.dataModelUpdate) { - this.#handleDataModelUpdate(message.dataModelUpdate, message.dataModelUpdate.surfaceId); - } - if (message.deleteSurface) { - this.#handleDeleteSurface(message.deleteSurface); - } - } - } - /** - * Retrieves the data for a given component node and a relative path string. - * This correctly handles the special `.` path, which refers to the node's - * own data context. - */ - getData(node, relativePath, surfaceId = A2uiMessageProcessor.DEFAULT_SURFACE_ID) { - const surface = this.#getOrCreateSurface(surfaceId); - if (!surface) return null; - let finalPath; - if (relativePath === "." || relativePath === "") { - finalPath = node.dataContextPath ?? "/"; - } else { - finalPath = this.resolvePath(relativePath, node.dataContextPath); - } - return this.#getDataByPath(surface.dataModel, finalPath); - } - setData(node, relativePath, value, surfaceId = A2uiMessageProcessor.DEFAULT_SURFACE_ID) { - if (!node) { - console.warn("No component node set"); - return; - } - const surface = this.#getOrCreateSurface(surfaceId); - if (!surface) return; - let finalPath; - if (relativePath === "." || relativePath === "") { - finalPath = node.dataContextPath ?? "/"; - } else { - finalPath = this.resolvePath(relativePath, node.dataContextPath); - } - this.#setDataByPath(surface.dataModel, finalPath, value); - } - resolvePath(path, dataContextPath) { - if (path.startsWith("/")) { - return path; - } - if (dataContextPath && dataContextPath !== "/") { - return dataContextPath.endsWith("/") ? `${dataContextPath}${path}` : `${dataContextPath}/${path}`; - } - return `/${path}`; - } - #parseIfJsonString(value) { - if (typeof value !== "string") { - return value; - } - const trimmedValue = value.trim(); - if (trimmedValue.startsWith("{") && trimmedValue.endsWith("}") || trimmedValue.startsWith("[") && trimmedValue.endsWith("]")) { - try { - return JSON.parse(value); - } catch (e$14) { - console.warn(`Failed to parse potential JSON string: "${value.substring(0, 50)}..."`, e$14); - return value; - } - } - return value; - } - /** - * Converts a specific array format [{key: "...", value_string: "..."}, ...] - * into a standard Map. It also attempts to parse any string values that - * appear to be stringified JSON. - */ - #convertKeyValueArrayToMap(arr) { - const map$1 = new this.#mapCtor(); - for (const item of arr) { - if (!isObject$1(item) || !("key" in item)) continue; - const key = item.key; - const valueKey = this.#findValueKey(item); - if (!valueKey) continue; - let value = item[valueKey]; - if (valueKey === "valueMap" && Array.isArray(value)) { - value = this.#convertKeyValueArrayToMap(value); - } else if (typeof value === "string") { - value = this.#parseIfJsonString(value); - } - this.#setDataByPath(map$1, key, value); - } - return map$1; - } - #setDataByPath(root, path, value) { - if (Array.isArray(value) && (value.length === 0 || isObject$1(value[0]) && "key" in value[0])) { - if (value.length === 1 && isObject$1(value[0]) && value[0].key === ".") { - const item = value[0]; - const valueKey = this.#findValueKey(item); - if (valueKey) { - value = item[valueKey]; - if (valueKey === "valueMap" && Array.isArray(value)) { - value = this.#convertKeyValueArrayToMap(value); - } else if (typeof value === "string") { - value = this.#parseIfJsonString(value); - } - } else { - value = this.#convertKeyValueArrayToMap(value); - } - } else { - value = this.#convertKeyValueArrayToMap(value); - } - } - const segments = this.#normalizePath(path).split("/").filter((s$9) => s$9); - if (segments.length === 0) { - if (value instanceof Map || isObject$1(value)) { - if (!(value instanceof Map) && isObject$1(value)) { - value = new this.#mapCtor(Object.entries(value)); - } - root.clear(); - for (const [key, v$2] of value.entries()) { - root.set(key, v$2); - } - } else { - console.error("Cannot set root of DataModel to a non-Map value."); - } - return; - } - let current = root; - for (let i$10 = 0; i$10 < segments.length - 1; i$10++) { - const segment = segments[i$10]; - let target; - if (current instanceof Map) { - target = current.get(segment); - } else if (Array.isArray(current) && /^\d+$/.test(segment)) { - target = current[parseInt(segment, 10)]; - } - if (target === undefined || typeof target !== "object" || target === null) { - target = new this.#mapCtor(); - if (current instanceof this.#mapCtor) { - current.set(segment, target); - } else if (Array.isArray(current)) { - current[parseInt(segment, 10)] = target; - } - } - current = target; - } - const finalSegment = segments[segments.length - 1]; - const storedValue = value; - if (current instanceof this.#mapCtor) { - current.set(finalSegment, storedValue); - } else if (Array.isArray(current) && /^\d+$/.test(finalSegment)) { - current[parseInt(finalSegment, 10)] = storedValue; - } - } - /** - * Normalizes a path string into a consistent, slash-delimited format. - * Converts bracket notation and dot notation in a two-pass. - * e.g., "bookRecommendations[0].title" -> "/bookRecommendations/0/title" - * e.g., "book.0.title" -> "/book/0/title" - */ - #normalizePath(path) { - const dotPath = path.replace(/\[(\d+)\]/g, ".$1"); - const segments = dotPath.split("."); - return "/" + segments.filter((s$9) => s$9.length > 0).join("/"); - } - #getDataByPath(root, path) { - const segments = this.#normalizePath(path).split("/").filter((s$9) => s$9); - let current = root; - for (const segment of segments) { - if (current === undefined || current === null) return null; - if (current instanceof Map) { - current = current.get(segment); - } else if (Array.isArray(current) && /^\d+$/.test(segment)) { - current = current[parseInt(segment, 10)]; - } else if (isObject$1(current)) { - current = current[segment]; - } else { - return null; - } - } - return current; - } - #getOrCreateSurface(surfaceId) { - let surface = this.#surfaces.get(surfaceId); - if (!surface) { - surface = new this.#objCtor({ - rootComponentId: null, - componentTree: null, - dataModel: new this.#mapCtor(), - components: new this.#mapCtor(), - styles: new this.#objCtor() - }); - this.#surfaces.set(surfaceId, surface); - } - return surface; - } - #handleBeginRendering(message, surfaceId) { - const surface = this.#getOrCreateSurface(surfaceId); - surface.rootComponentId = message.root; - surface.styles = message.styles ?? {}; - this.#rebuildComponentTree(surface); - } - #handleSurfaceUpdate(message, surfaceId) { - const surface = this.#getOrCreateSurface(surfaceId); - for (const component of message.components) { - surface.components.set(component.id, component); - } - this.#rebuildComponentTree(surface); - } - #handleDataModelUpdate(message, surfaceId) { - const surface = this.#getOrCreateSurface(surfaceId); - const path = message.path ?? "/"; - this.#setDataByPath(surface.dataModel, path, message.contents); - this.#rebuildComponentTree(surface); - } - #handleDeleteSurface(message) { - this.#surfaces.delete(message.surfaceId); - } - /** - * Starts at the root component of the surface and builds out the tree - * recursively. This process involves resolving all properties of the child - * components, and expanding on any explicit children lists or templates - * found in the structure. - * - * @param surface The surface to be built. - */ - #rebuildComponentTree(surface) { - if (!surface.rootComponentId) { - surface.componentTree = null; - return; - } - const visited = new this.#setCtor(); - surface.componentTree = this.#buildNodeRecursive(surface.rootComponentId, surface, visited, "/", ""); - } - /** Finds a value key in a map. */ - #findValueKey(value) { - return Object.keys(value).find((k$1) => k$1.startsWith("value")); - } - /** - * Builds out the nodes recursively. - */ - #buildNodeRecursive(baseComponentId, surface, visited, dataContextPath, idSuffix = "") { - const fullId = `${baseComponentId}${idSuffix}`; - const { components } = surface; - if (!components.has(baseComponentId)) { - return null; - } - if (visited.has(fullId)) { - throw new Error(`Circular dependency for component "${fullId}".`); - } - visited.add(fullId); - const componentData = components.get(baseComponentId); - const componentProps = componentData.component ?? {}; - const componentType = Object.keys(componentProps)[0]; - const unresolvedProperties = componentProps[componentType]; - const resolvedProperties = new this.#objCtor(); - if (isObject$1(unresolvedProperties)) { - for (const [key, value] of Object.entries(unresolvedProperties)) { - resolvedProperties[key] = this.#resolvePropertyValue(value, surface, visited, dataContextPath, idSuffix, key); - } - } - visited.delete(fullId); - const baseNode = { - id: fullId, - dataContextPath, - weight: componentData.weight ?? "initial" - }; - switch (componentType) { - case "Text": - if (!isResolvedText(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "Text", - properties: resolvedProperties - }); - case "Image": - if (!isResolvedImage(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "Image", - properties: resolvedProperties - }); - case "Icon": - if (!isResolvedIcon(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "Icon", - properties: resolvedProperties - }); - case "Video": - if (!isResolvedVideo(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "Video", - properties: resolvedProperties - }); - case "AudioPlayer": - if (!isResolvedAudioPlayer(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "AudioPlayer", - properties: resolvedProperties - }); - case "Row": - if (!isResolvedRow(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "Row", - properties: resolvedProperties - }); - case "Column": - if (!isResolvedColumn(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "Column", - properties: resolvedProperties - }); - case "List": - if (!isResolvedList(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "List", - properties: resolvedProperties - }); - case "Card": - if (!isResolvedCard(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "Card", - properties: resolvedProperties - }); - case "Tabs": - if (!isResolvedTabs(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "Tabs", - properties: resolvedProperties - }); - case "Divider": - if (!isResolvedDivider(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "Divider", - properties: resolvedProperties - }); - case "Modal": - if (!isResolvedModal(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "Modal", - properties: resolvedProperties - }); - case "Button": - if (!isResolvedButton(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "Button", - properties: resolvedProperties - }); - case "CheckBox": - if (!isResolvedCheckbox(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "CheckBox", - properties: resolvedProperties - }); - case "TextField": - if (!isResolvedTextField(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "TextField", - properties: resolvedProperties - }); - case "DateTimeInput": - if (!isResolvedDateTimeInput(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "DateTimeInput", - properties: resolvedProperties - }); - case "MultipleChoice": - if (!isResolvedMultipleChoice(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "MultipleChoice", - properties: resolvedProperties - }); - case "Slider": - if (!isResolvedSlider(resolvedProperties)) { - throw new Error(`Invalid data; expected ${componentType}`); - } - return new this.#objCtor({ - ...baseNode, - type: "Slider", - properties: resolvedProperties - }); - default: return new this.#objCtor({ - ...baseNode, - type: componentType, - properties: resolvedProperties - }); - } - } - /** - * Recursively resolves an individual property value. If a property indicates - * a child node (a string that matches a component ID), an explicitList of - * children, or a template, these will be built out here. - */ - #resolvePropertyValue(value, surface, visited, dataContextPath, idSuffix = "", propertyKey = null) { - const isComponentIdReferenceKey = (key) => key === "child" || key.endsWith("Child"); - if (typeof value === "string" && propertyKey && isComponentIdReferenceKey(propertyKey) && surface.components.has(value)) { - return this.#buildNodeRecursive(value, surface, visited, dataContextPath, idSuffix); - } - if (isComponentArrayReference(value)) { - if (value.explicitList) { - return value.explicitList.map((id) => this.#buildNodeRecursive(id, surface, visited, dataContextPath, idSuffix)); - } - if (value.template) { - const fullDataPath = this.resolvePath(value.template.dataBinding, dataContextPath); - const data = this.#getDataByPath(surface.dataModel, fullDataPath); - const template = value.template; - if (Array.isArray(data)) { - return data.map((_$1, index) => { - const parentIndices = dataContextPath.split("/").filter((segment) => /^\d+$/.test(segment)); - const newIndices = [...parentIndices, index]; - const newSuffix = `:${newIndices.join(":")}`; - const childDataContextPath = `${fullDataPath}/${index}`; - return this.#buildNodeRecursive(template.componentId, surface, visited, childDataContextPath, newSuffix); - }); - } - const mapCtor = this.#mapCtor; - if (data instanceof mapCtor) { - return Array.from(data.keys(), (key) => { - const newSuffix = `:${key}`; - const childDataContextPath = `${fullDataPath}/${key}`; - return this.#buildNodeRecursive(template.componentId, surface, visited, childDataContextPath, newSuffix); - }); - } - return new this.#arrayCtor(); - } - } - if (Array.isArray(value)) { - return value.map((item) => this.#resolvePropertyValue(item, surface, visited, dataContextPath, idSuffix, propertyKey)); - } - if (isObject$1(value)) { - const newObj = new this.#objCtor(); - for (const [key, propValue] of Object.entries(value)) { - let propertyValue = propValue; - if (isPath(key, propValue) && dataContextPath !== "/") { - propertyValue = propValue.replace(/^\.?\/item/, "").replace(/^\.?\/text/, "").replace(/^\.?\/label/, "").replace(/^\.?\//, ""); - newObj[key] = propertyValue; - continue; - } - newObj[key] = this.#resolvePropertyValue(propertyValue, surface, visited, dataContextPath, idSuffix, key); - } - return newObj; - } - return value; - } + static { + this.DEFAULT_SURFACE_ID = "@default"; + } + #mapCtor = Map; + #arrayCtor = Array; + #setCtor = Set; + #objCtor = Object; + #surfaces; + constructor( + opts = { + mapCtor: Map, + arrayCtor: Array, + setCtor: Set, + objCtor: Object, + }, + ) { + this.opts = opts; + this.#arrayCtor = opts.arrayCtor; + this.#mapCtor = opts.mapCtor; + this.#setCtor = opts.setCtor; + this.#objCtor = opts.objCtor; + this.#surfaces = new opts.mapCtor(); + } + getSurfaces() { + return this.#surfaces; + } + clearSurfaces() { + this.#surfaces.clear(); + } + processMessages(messages) { + for (const message of messages) { + if (message.beginRendering) { + this.#handleBeginRendering(message.beginRendering, message.beginRendering.surfaceId); + } + if (message.surfaceUpdate) { + this.#handleSurfaceUpdate(message.surfaceUpdate, message.surfaceUpdate.surfaceId); + } + if (message.dataModelUpdate) { + this.#handleDataModelUpdate(message.dataModelUpdate, message.dataModelUpdate.surfaceId); + } + if (message.deleteSurface) { + this.#handleDeleteSurface(message.deleteSurface); + } + } + } + /** + * Retrieves the data for a given component node and a relative path string. + * This correctly handles the special `.` path, which refers to the node's + * own data context. + */ + getData(node, relativePath, surfaceId = A2uiMessageProcessor.DEFAULT_SURFACE_ID) { + const surface = this.#getOrCreateSurface(surfaceId); + if (!surface) return null; + let finalPath; + if (relativePath === "." || relativePath === "") { + finalPath = node.dataContextPath ?? "/"; + } else { + finalPath = this.resolvePath(relativePath, node.dataContextPath); + } + return this.#getDataByPath(surface.dataModel, finalPath); + } + setData(node, relativePath, value, surfaceId = A2uiMessageProcessor.DEFAULT_SURFACE_ID) { + if (!node) { + console.warn("No component node set"); + return; + } + const surface = this.#getOrCreateSurface(surfaceId); + if (!surface) return; + let finalPath; + if (relativePath === "." || relativePath === "") { + finalPath = node.dataContextPath ?? "/"; + } else { + finalPath = this.resolvePath(relativePath, node.dataContextPath); + } + this.#setDataByPath(surface.dataModel, finalPath, value); + } + resolvePath(path, dataContextPath) { + if (path.startsWith("/")) { + return path; + } + if (dataContextPath && dataContextPath !== "/") { + return dataContextPath.endsWith("/") + ? `${dataContextPath}${path}` + : `${dataContextPath}/${path}`; + } + return `/${path}`; + } + #parseIfJsonString(value) { + if (typeof value !== "string") { + return value; + } + const trimmedValue = value.trim(); + if ( + (trimmedValue.startsWith("{") && trimmedValue.endsWith("}")) || + (trimmedValue.startsWith("[") && trimmedValue.endsWith("]")) + ) { + try { + return JSON.parse(value); + } catch (e$14) { + console.warn(`Failed to parse potential JSON string: "${value.substring(0, 50)}..."`, e$14); + return value; + } + } + return value; + } + /** + * Converts a specific array format [{key: "...", value_string: "..."}, ...] + * into a standard Map. It also attempts to parse any string values that + * appear to be stringified JSON. + */ + #convertKeyValueArrayToMap(arr) { + const map$1 = new this.#mapCtor(); + for (const item of arr) { + if (!isObject$1(item) || !("key" in item)) continue; + const key = item.key; + const valueKey = this.#findValueKey(item); + if (!valueKey) continue; + let value = item[valueKey]; + if (valueKey === "valueMap" && Array.isArray(value)) { + value = this.#convertKeyValueArrayToMap(value); + } else if (typeof value === "string") { + value = this.#parseIfJsonString(value); + } + this.#setDataByPath(map$1, key, value); + } + return map$1; + } + #setDataByPath(root, path, value) { + if ( + Array.isArray(value) && + (value.length === 0 || (isObject$1(value[0]) && "key" in value[0])) + ) { + if (value.length === 1 && isObject$1(value[0]) && value[0].key === ".") { + const item = value[0]; + const valueKey = this.#findValueKey(item); + if (valueKey) { + value = item[valueKey]; + if (valueKey === "valueMap" && Array.isArray(value)) { + value = this.#convertKeyValueArrayToMap(value); + } else if (typeof value === "string") { + value = this.#parseIfJsonString(value); + } + } else { + value = this.#convertKeyValueArrayToMap(value); + } + } else { + value = this.#convertKeyValueArrayToMap(value); + } + } + const segments = this.#normalizePath(path) + .split("/") + .filter((s$9) => s$9); + if (segments.length === 0) { + if (value instanceof Map || isObject$1(value)) { + if (!(value instanceof Map) && isObject$1(value)) { + value = new this.#mapCtor(Object.entries(value)); + } + root.clear(); + for (const [key, v$2] of value.entries()) { + root.set(key, v$2); + } + } else { + console.error("Cannot set root of DataModel to a non-Map value."); + } + return; + } + let current = root; + for (let i$10 = 0; i$10 < segments.length - 1; i$10++) { + const segment = segments[i$10]; + let target; + if (current instanceof Map) { + target = current.get(segment); + } else if (Array.isArray(current) && /^\d+$/.test(segment)) { + target = current[parseInt(segment, 10)]; + } + if (target === undefined || typeof target !== "object" || target === null) { + target = new this.#mapCtor(); + if (current instanceof this.#mapCtor) { + current.set(segment, target); + } else if (Array.isArray(current)) { + current[parseInt(segment, 10)] = target; + } + } + current = target; + } + const finalSegment = segments[segments.length - 1]; + const storedValue = value; + if (current instanceof this.#mapCtor) { + current.set(finalSegment, storedValue); + } else if (Array.isArray(current) && /^\d+$/.test(finalSegment)) { + current[parseInt(finalSegment, 10)] = storedValue; + } + } + /** + * Normalizes a path string into a consistent, slash-delimited format. + * Converts bracket notation and dot notation in a two-pass. + * e.g., "bookRecommendations[0].title" -> "/bookRecommendations/0/title" + * e.g., "book.0.title" -> "/book/0/title" + */ + #normalizePath(path) { + const dotPath = path.replace(/\[(\d+)\]/g, ".$1"); + const segments = dotPath.split("."); + return "/" + segments.filter((s$9) => s$9.length > 0).join("/"); + } + #getDataByPath(root, path) { + const segments = this.#normalizePath(path) + .split("/") + .filter((s$9) => s$9); + let current = root; + for (const segment of segments) { + if (current === undefined || current === null) return null; + if (current instanceof Map) { + current = current.get(segment); + } else if (Array.isArray(current) && /^\d+$/.test(segment)) { + current = current[parseInt(segment, 10)]; + } else if (isObject$1(current)) { + current = current[segment]; + } else { + return null; + } + } + return current; + } + #getOrCreateSurface(surfaceId) { + let surface = this.#surfaces.get(surfaceId); + if (!surface) { + surface = new this.#objCtor({ + rootComponentId: null, + componentTree: null, + dataModel: new this.#mapCtor(), + components: new this.#mapCtor(), + styles: new this.#objCtor(), + }); + this.#surfaces.set(surfaceId, surface); + } + return surface; + } + #handleBeginRendering(message, surfaceId) { + const surface = this.#getOrCreateSurface(surfaceId); + surface.rootComponentId = message.root; + surface.styles = message.styles ?? {}; + this.#rebuildComponentTree(surface); + } + #handleSurfaceUpdate(message, surfaceId) { + const surface = this.#getOrCreateSurface(surfaceId); + for (const component of message.components) { + surface.components.set(component.id, component); + } + this.#rebuildComponentTree(surface); + } + #handleDataModelUpdate(message, surfaceId) { + const surface = this.#getOrCreateSurface(surfaceId); + const path = message.path ?? "/"; + this.#setDataByPath(surface.dataModel, path, message.contents); + this.#rebuildComponentTree(surface); + } + #handleDeleteSurface(message) { + this.#surfaces.delete(message.surfaceId); + } + /** + * Starts at the root component of the surface and builds out the tree + * recursively. This process involves resolving all properties of the child + * components, and expanding on any explicit children lists or templates + * found in the structure. + * + * @param surface The surface to be built. + */ + #rebuildComponentTree(surface) { + if (!surface.rootComponentId) { + surface.componentTree = null; + return; + } + const visited = new this.#setCtor(); + surface.componentTree = this.#buildNodeRecursive( + surface.rootComponentId, + surface, + visited, + "/", + "", + ); + } + /** Finds a value key in a map. */ + #findValueKey(value) { + return Object.keys(value).find((k$1) => k$1.startsWith("value")); + } + /** + * Builds out the nodes recursively. + */ + #buildNodeRecursive(baseComponentId, surface, visited, dataContextPath, idSuffix = "") { + const fullId = `${baseComponentId}${idSuffix}`; + const { components } = surface; + if (!components.has(baseComponentId)) { + return null; + } + if (visited.has(fullId)) { + throw new Error(`Circular dependency for component "${fullId}".`); + } + visited.add(fullId); + const componentData = components.get(baseComponentId); + const componentProps = componentData.component ?? {}; + const componentType = Object.keys(componentProps)[0]; + const unresolvedProperties = componentProps[componentType]; + const resolvedProperties = new this.#objCtor(); + if (isObject$1(unresolvedProperties)) { + for (const [key, value] of Object.entries(unresolvedProperties)) { + resolvedProperties[key] = this.#resolvePropertyValue( + value, + surface, + visited, + dataContextPath, + idSuffix, + key, + ); + } + } + visited.delete(fullId); + const baseNode = { + id: fullId, + dataContextPath, + weight: componentData.weight ?? "initial", + }; + switch (componentType) { + case "Text": + if (!isResolvedText(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Text", + properties: resolvedProperties, + }); + case "Image": + if (!isResolvedImage(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Image", + properties: resolvedProperties, + }); + case "Icon": + if (!isResolvedIcon(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Icon", + properties: resolvedProperties, + }); + case "Video": + if (!isResolvedVideo(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Video", + properties: resolvedProperties, + }); + case "AudioPlayer": + if (!isResolvedAudioPlayer(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "AudioPlayer", + properties: resolvedProperties, + }); + case "Row": + if (!isResolvedRow(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Row", + properties: resolvedProperties, + }); + case "Column": + if (!isResolvedColumn(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Column", + properties: resolvedProperties, + }); + case "List": + if (!isResolvedList(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "List", + properties: resolvedProperties, + }); + case "Card": + if (!isResolvedCard(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Card", + properties: resolvedProperties, + }); + case "Tabs": + if (!isResolvedTabs(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Tabs", + properties: resolvedProperties, + }); + case "Divider": + if (!isResolvedDivider(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Divider", + properties: resolvedProperties, + }); + case "Modal": + if (!isResolvedModal(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Modal", + properties: resolvedProperties, + }); + case "Button": + if (!isResolvedButton(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Button", + properties: resolvedProperties, + }); + case "CheckBox": + if (!isResolvedCheckbox(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "CheckBox", + properties: resolvedProperties, + }); + case "TextField": + if (!isResolvedTextField(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "TextField", + properties: resolvedProperties, + }); + case "DateTimeInput": + if (!isResolvedDateTimeInput(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "DateTimeInput", + properties: resolvedProperties, + }); + case "MultipleChoice": + if (!isResolvedMultipleChoice(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "MultipleChoice", + properties: resolvedProperties, + }); + case "Slider": + if (!isResolvedSlider(resolvedProperties)) { + throw new Error(`Invalid data; expected ${componentType}`); + } + return new this.#objCtor({ + ...baseNode, + type: "Slider", + properties: resolvedProperties, + }); + default: + return new this.#objCtor({ + ...baseNode, + type: componentType, + properties: resolvedProperties, + }); + } + } + /** + * Recursively resolves an individual property value. If a property indicates + * a child node (a string that matches a component ID), an explicitList of + * children, or a template, these will be built out here. + */ + #resolvePropertyValue( + value, + surface, + visited, + dataContextPath, + idSuffix = "", + propertyKey = null, + ) { + const isComponentIdReferenceKey = (key) => key === "child" || key.endsWith("Child"); + if ( + typeof value === "string" && + propertyKey && + isComponentIdReferenceKey(propertyKey) && + surface.components.has(value) + ) { + return this.#buildNodeRecursive(value, surface, visited, dataContextPath, idSuffix); + } + if (isComponentArrayReference(value)) { + if (value.explicitList) { + return value.explicitList.map((id) => + this.#buildNodeRecursive(id, surface, visited, dataContextPath, idSuffix), + ); + } + if (value.template) { + const fullDataPath = this.resolvePath(value.template.dataBinding, dataContextPath); + const data = this.#getDataByPath(surface.dataModel, fullDataPath); + const template = value.template; + if (Array.isArray(data)) { + return data.map((_$1, index) => { + const parentIndices = dataContextPath + .split("/") + .filter((segment) => /^\d+$/.test(segment)); + const newIndices = [...parentIndices, index]; + const newSuffix = `:${newIndices.join(":")}`; + const childDataContextPath = `${fullDataPath}/${index}`; + return this.#buildNodeRecursive( + template.componentId, + surface, + visited, + childDataContextPath, + newSuffix, + ); + }); + } + const mapCtor = this.#mapCtor; + if (data instanceof mapCtor) { + return Array.from(data.keys(), (key) => { + const newSuffix = `:${key}`; + const childDataContextPath = `${fullDataPath}/${key}`; + return this.#buildNodeRecursive( + template.componentId, + surface, + visited, + childDataContextPath, + newSuffix, + ); + }); + } + return new this.#arrayCtor(); + } + } + if (Array.isArray(value)) { + return value.map((item) => + this.#resolvePropertyValue(item, surface, visited, dataContextPath, idSuffix, propertyKey), + ); + } + if (isObject$1(value)) { + const newObj = new this.#objCtor(); + for (const [key, propValue] of Object.entries(value)) { + let propertyValue = propValue; + if (isPath(key, propValue) && dataContextPath !== "/") { + propertyValue = propValue + .replace(/^\.?\/item/, "") + .replace(/^\.?\/text/, "") + .replace(/^\.?\/label/, "") + .replace(/^\.?\//, ""); + newObj[key] = propertyValue; + continue; + } + newObj[key] = this.#resolvePropertyValue( + propertyValue, + surface, + visited, + dataContextPath, + idSuffix, + key, + ); + } + return newObj; + } + return value; + } }; var __defProp = Object.defineProperty; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { - enumerable: true, - configurable: true, - writable: true, - value -}) : obj[key] = value; +var __defNormalProp = (obj, key, value) => + key in obj + ? __defProp(obj, key, { + enumerable: true, + configurable: true, + writable: true, + value, + }) + : (obj[key] = value); var __publicField = (obj, key, value) => { - __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); - return value; + __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); + return value; }; var __accessCheck = (obj, member, msg) => { - if (!member.has(obj)) throw TypeError("Cannot " + msg); + if (!member.has(obj)) throw TypeError("Cannot " + msg); }; var __privateIn = (member, obj) => { - if (Object(obj) !== obj) throw TypeError("Cannot use the \"in\" operator on this value"); - return member.has(obj); + if (Object(obj) !== obj) throw TypeError('Cannot use the "in" operator on this value'); + return member.has(obj); }; var __privateAdd = (obj, member, value) => { - if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); - member instanceof WeakSet ? member.add(obj) : member.set(obj, value); + if (member.has(obj)) throw TypeError("Cannot add the same private member more than once"); + member instanceof WeakSet ? member.add(obj) : member.set(obj, value); }; var __privateMethod = (obj, member, method) => { - __accessCheck(obj, member, "access private method"); - return method; + __accessCheck(obj, member, "access private method"); + return method; }; /** -* @license -* Copyright Google LLC All Rights Reserved. -* -* Use of this source code is governed by an MIT-style license that can be -* found in the LICENSE file at https://angular.io/license -*/ + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ function defaultEquals(a$2, b$2) { - return Object.is(a$2, b$2); + return Object.is(a$2, b$2); } /** -* @license -* Copyright Google LLC All Rights Reserved. -* -* Use of this source code is governed by an MIT-style license that can be -* found in the LICENSE file at https://angular.io/license -*/ + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ let activeConsumer = null; let inNotificationPhase = false; let epoch = 1; const SIGNAL = /* @__PURE__ */ Symbol("SIGNAL"); function setActiveConsumer(consumer) { - const prev = activeConsumer; - activeConsumer = consumer; - return prev; + const prev = activeConsumer; + activeConsumer = consumer; + return prev; } function getActiveConsumer() { - return activeConsumer; + return activeConsumer; } function isInNotificationPhase() { - return inNotificationPhase; + return inNotificationPhase; } const REACTIVE_NODE = { - version: 0, - lastCleanEpoch: 0, - dirty: false, - producerNode: void 0, - producerLastReadVersion: void 0, - producerIndexOfThis: void 0, - nextProducerIndex: 0, - liveConsumerNode: void 0, - liveConsumerIndexOfThis: void 0, - consumerAllowSignalWrites: false, - consumerIsAlwaysLive: false, - producerMustRecompute: () => false, - producerRecomputeValue: () => {}, - consumerMarkedDirty: () => {}, - consumerOnSignalRead: () => {} + version: 0, + lastCleanEpoch: 0, + dirty: false, + producerNode: void 0, + producerLastReadVersion: void 0, + producerIndexOfThis: void 0, + nextProducerIndex: 0, + liveConsumerNode: void 0, + liveConsumerIndexOfThis: void 0, + consumerAllowSignalWrites: false, + consumerIsAlwaysLive: false, + producerMustRecompute: () => false, + producerRecomputeValue: () => {}, + consumerMarkedDirty: () => {}, + consumerOnSignalRead: () => {}, }; function producerAccessed(node) { - if (inNotificationPhase) { - throw new Error(typeof ngDevMode !== "undefined" && ngDevMode ? `Assertion error: signal read during notification phase` : ""); - } - if (activeConsumer === null) { - return; - } - activeConsumer.consumerOnSignalRead(node); - const idx = activeConsumer.nextProducerIndex++; - assertConsumerNode(activeConsumer); - if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) { - if (consumerIsLive(activeConsumer)) { - const staleProducer = activeConsumer.producerNode[idx]; - producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]); - } - } - if (activeConsumer.producerNode[idx] !== node) { - activeConsumer.producerNode[idx] = node; - activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer) ? producerAddLiveConsumer(node, activeConsumer, idx) : 0; - } - activeConsumer.producerLastReadVersion[idx] = node.version; + if (inNotificationPhase) { + throw new Error( + typeof ngDevMode !== "undefined" && ngDevMode + ? `Assertion error: signal read during notification phase` + : "", + ); + } + if (activeConsumer === null) { + return; + } + activeConsumer.consumerOnSignalRead(node); + const idx = activeConsumer.nextProducerIndex++; + assertConsumerNode(activeConsumer); + if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) { + if (consumerIsLive(activeConsumer)) { + const staleProducer = activeConsumer.producerNode[idx]; + producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]); + } + } + if (activeConsumer.producerNode[idx] !== node) { + activeConsumer.producerNode[idx] = node; + activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer) + ? producerAddLiveConsumer(node, activeConsumer, idx) + : 0; + } + activeConsumer.producerLastReadVersion[idx] = node.version; } function producerIncrementEpoch() { - epoch++; + epoch++; } function producerUpdateValueVersion(node) { - if (!node.dirty && node.lastCleanEpoch === epoch) { - return; - } - if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) { - node.dirty = false; - node.lastCleanEpoch = epoch; - return; - } - node.producerRecomputeValue(node); - node.dirty = false; - node.lastCleanEpoch = epoch; + if (!node.dirty && node.lastCleanEpoch === epoch) { + return; + } + if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) { + node.dirty = false; + node.lastCleanEpoch = epoch; + return; + } + node.producerRecomputeValue(node); + node.dirty = false; + node.lastCleanEpoch = epoch; } function producerNotifyConsumers(node) { - if (node.liveConsumerNode === void 0) { - return; - } - const prev = inNotificationPhase; - inNotificationPhase = true; - try { - for (const consumer of node.liveConsumerNode) { - if (!consumer.dirty) { - consumerMarkDirty(consumer); - } - } - } finally { - inNotificationPhase = prev; - } + if (node.liveConsumerNode === void 0) { + return; + } + const prev = inNotificationPhase; + inNotificationPhase = true; + try { + for (const consumer of node.liveConsumerNode) { + if (!consumer.dirty) { + consumerMarkDirty(consumer); + } + } + } finally { + inNotificationPhase = prev; + } } function producerUpdatesAllowed() { - return (activeConsumer == null ? void 0 : activeConsumer.consumerAllowSignalWrites) !== false; + return (activeConsumer == null ? void 0 : activeConsumer.consumerAllowSignalWrites) !== false; } function consumerMarkDirty(node) { - var _a$1; - node.dirty = true; - producerNotifyConsumers(node); - (_a$1 = node.consumerMarkedDirty) == null ? void 0 : _a$1.call(node.wrapper ?? node); + var _a$1; + node.dirty = true; + producerNotifyConsumers(node); + (_a$1 = node.consumerMarkedDirty) == null ? void 0 : _a$1.call(node.wrapper ?? node); } function consumerBeforeComputation(node) { - node && (node.nextProducerIndex = 0); - return setActiveConsumer(node); + node && (node.nextProducerIndex = 0); + return setActiveConsumer(node); } function consumerAfterComputation(node, prevConsumer) { - setActiveConsumer(prevConsumer); - if (!node || node.producerNode === void 0 || node.producerIndexOfThis === void 0 || node.producerLastReadVersion === void 0) { - return; - } - if (consumerIsLive(node)) { - for (let i$10 = node.nextProducerIndex; i$10 < node.producerNode.length; i$10++) { - producerRemoveLiveConsumerAtIndex(node.producerNode[i$10], node.producerIndexOfThis[i$10]); - } - } - while (node.producerNode.length > node.nextProducerIndex) { - node.producerNode.pop(); - node.producerLastReadVersion.pop(); - node.producerIndexOfThis.pop(); - } + setActiveConsumer(prevConsumer); + if ( + !node || + node.producerNode === void 0 || + node.producerIndexOfThis === void 0 || + node.producerLastReadVersion === void 0 + ) { + return; + } + if (consumerIsLive(node)) { + for (let i$10 = node.nextProducerIndex; i$10 < node.producerNode.length; i$10++) { + producerRemoveLiveConsumerAtIndex(node.producerNode[i$10], node.producerIndexOfThis[i$10]); + } + } + while (node.producerNode.length > node.nextProducerIndex) { + node.producerNode.pop(); + node.producerLastReadVersion.pop(); + node.producerIndexOfThis.pop(); + } } function consumerPollProducersForChange(node) { - assertConsumerNode(node); - for (let i$10 = 0; i$10 < node.producerNode.length; i$10++) { - const producer = node.producerNode[i$10]; - const seenVersion = node.producerLastReadVersion[i$10]; - if (seenVersion !== producer.version) { - return true; - } - producerUpdateValueVersion(producer); - if (seenVersion !== producer.version) { - return true; - } - } - return false; + assertConsumerNode(node); + for (let i$10 = 0; i$10 < node.producerNode.length; i$10++) { + const producer = node.producerNode[i$10]; + const seenVersion = node.producerLastReadVersion[i$10]; + if (seenVersion !== producer.version) { + return true; + } + producerUpdateValueVersion(producer); + if (seenVersion !== producer.version) { + return true; + } + } + return false; } function producerAddLiveConsumer(node, consumer, indexOfThis) { - var _a$1; - assertProducerNode(node); - assertConsumerNode(node); - if (node.liveConsumerNode.length === 0) { - (_a$1 = node.watched) == null ? void 0 : _a$1.call(node.wrapper); - for (let i$10 = 0; i$10 < node.producerNode.length; i$10++) { - node.producerIndexOfThis[i$10] = producerAddLiveConsumer(node.producerNode[i$10], node, i$10); - } - } - node.liveConsumerIndexOfThis.push(indexOfThis); - return node.liveConsumerNode.push(consumer) - 1; + var _a$1; + assertProducerNode(node); + assertConsumerNode(node); + if (node.liveConsumerNode.length === 0) { + (_a$1 = node.watched) == null ? void 0 : _a$1.call(node.wrapper); + for (let i$10 = 0; i$10 < node.producerNode.length; i$10++) { + node.producerIndexOfThis[i$10] = producerAddLiveConsumer(node.producerNode[i$10], node, i$10); + } + } + node.liveConsumerIndexOfThis.push(indexOfThis); + return node.liveConsumerNode.push(consumer) - 1; } function producerRemoveLiveConsumerAtIndex(node, idx) { - var _a$1; - assertProducerNode(node); - assertConsumerNode(node); - if (typeof ngDevMode !== "undefined" && ngDevMode && idx >= node.liveConsumerNode.length) { - throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`); - } - if (node.liveConsumerNode.length === 1) { - (_a$1 = node.unwatched) == null ? void 0 : _a$1.call(node.wrapper); - for (let i$10 = 0; i$10 < node.producerNode.length; i$10++) { - producerRemoveLiveConsumerAtIndex(node.producerNode[i$10], node.producerIndexOfThis[i$10]); - } - } - const lastIdx = node.liveConsumerNode.length - 1; - node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx]; - node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx]; - node.liveConsumerNode.length--; - node.liveConsumerIndexOfThis.length--; - if (idx < node.liveConsumerNode.length) { - const idxProducer = node.liveConsumerIndexOfThis[idx]; - const consumer = node.liveConsumerNode[idx]; - assertConsumerNode(consumer); - consumer.producerIndexOfThis[idxProducer] = idx; - } + var _a$1; + assertProducerNode(node); + assertConsumerNode(node); + if (typeof ngDevMode !== "undefined" && ngDevMode && idx >= node.liveConsumerNode.length) { + throw new Error( + `Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`, + ); + } + if (node.liveConsumerNode.length === 1) { + (_a$1 = node.unwatched) == null ? void 0 : _a$1.call(node.wrapper); + for (let i$10 = 0; i$10 < node.producerNode.length; i$10++) { + producerRemoveLiveConsumerAtIndex(node.producerNode[i$10], node.producerIndexOfThis[i$10]); + } + } + const lastIdx = node.liveConsumerNode.length - 1; + node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx]; + node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx]; + node.liveConsumerNode.length--; + node.liveConsumerIndexOfThis.length--; + if (idx < node.liveConsumerNode.length) { + const idxProducer = node.liveConsumerIndexOfThis[idx]; + const consumer = node.liveConsumerNode[idx]; + assertConsumerNode(consumer); + consumer.producerIndexOfThis[idxProducer] = idx; + } } function consumerIsLive(node) { - var _a$1; - return node.consumerIsAlwaysLive || (((_a$1 = node == null ? void 0 : node.liveConsumerNode) == null ? void 0 : _a$1.length) ?? 0) > 0; + var _a$1; + return ( + node.consumerIsAlwaysLive || + (((_a$1 = node == null ? void 0 : node.liveConsumerNode) == null ? void 0 : _a$1.length) ?? 0) > + 0 + ); } function assertConsumerNode(node) { - node.producerNode ?? (node.producerNode = []); - node.producerIndexOfThis ?? (node.producerIndexOfThis = []); - node.producerLastReadVersion ?? (node.producerLastReadVersion = []); + node.producerNode ?? (node.producerNode = []); + node.producerIndexOfThis ?? (node.producerIndexOfThis = []); + node.producerLastReadVersion ?? (node.producerLastReadVersion = []); } function assertProducerNode(node) { - node.liveConsumerNode ?? (node.liveConsumerNode = []); - node.liveConsumerIndexOfThis ?? (node.liveConsumerIndexOfThis = []); + node.liveConsumerNode ?? (node.liveConsumerNode = []); + node.liveConsumerIndexOfThis ?? (node.liveConsumerIndexOfThis = []); } /** -* @license -* Copyright Google LLC All Rights Reserved. -* -* Use of this source code is governed by an MIT-style license that can be -* found in the LICENSE file at https://angular.io/license -*/ + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ function computedGet(node) { - producerUpdateValueVersion(node); - producerAccessed(node); - if (node.value === ERRORED) { - throw node.error; - } - return node.value; + producerUpdateValueVersion(node); + producerAccessed(node); + if (node.value === ERRORED) { + throw node.error; + } + return node.value; } function createComputed(computation) { - const node = Object.create(COMPUTED_NODE); - node.computation = computation; - const computed = () => computedGet(node); - computed[SIGNAL] = node; - return computed; + const node = Object.create(COMPUTED_NODE); + node.computation = computation; + const computed = () => computedGet(node); + computed[SIGNAL] = node; + return computed; } const UNSET = /* @__PURE__ */ Symbol("UNSET"); const COMPUTING = /* @__PURE__ */ Symbol("COMPUTING"); const ERRORED = /* @__PURE__ */ Symbol("ERRORED"); const COMPUTED_NODE = /* @__PURE__ */ (() => { - return { - ...REACTIVE_NODE, - value: UNSET, - dirty: true, - error: null, - equal: defaultEquals, - producerMustRecompute(node) { - return node.value === UNSET || node.value === COMPUTING; - }, - producerRecomputeValue(node) { - if (node.value === COMPUTING) { - throw new Error("Detected cycle in computations."); - } - const oldValue = node.value; - node.value = COMPUTING; - const prevConsumer = consumerBeforeComputation(node); - let newValue; - let wasEqual = false; - try { - newValue = node.computation.call(node.wrapper); - const oldOk = oldValue !== UNSET && oldValue !== ERRORED; - wasEqual = oldOk && node.equal.call(node.wrapper, oldValue, newValue); - } catch (err) { - newValue = ERRORED; - node.error = err; - } finally { - consumerAfterComputation(node, prevConsumer); - } - if (wasEqual) { - node.value = oldValue; - return; - } - node.value = newValue; - node.version++; - } - }; + return { + ...REACTIVE_NODE, + value: UNSET, + dirty: true, + error: null, + equal: defaultEquals, + producerMustRecompute(node) { + return node.value === UNSET || node.value === COMPUTING; + }, + producerRecomputeValue(node) { + if (node.value === COMPUTING) { + throw new Error("Detected cycle in computations."); + } + const oldValue = node.value; + node.value = COMPUTING; + const prevConsumer = consumerBeforeComputation(node); + let newValue; + let wasEqual = false; + try { + newValue = node.computation.call(node.wrapper); + const oldOk = oldValue !== UNSET && oldValue !== ERRORED; + wasEqual = oldOk && node.equal.call(node.wrapper, oldValue, newValue); + } catch (err) { + newValue = ERRORED; + node.error = err; + } finally { + consumerAfterComputation(node, prevConsumer); + } + if (wasEqual) { + node.value = oldValue; + return; + } + node.value = newValue; + node.version++; + }, + }; })(); /** -* @license -* Copyright Google LLC All Rights Reserved. -* -* Use of this source code is governed by an MIT-style license that can be -* found in the LICENSE file at https://angular.io/license -*/ + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ function defaultThrowError() { - throw new Error(); + throw new Error(); } let throwInvalidWriteToSignalErrorFn = defaultThrowError; function throwInvalidWriteToSignalError() { - throwInvalidWriteToSignalErrorFn(); + throwInvalidWriteToSignalErrorFn(); } /** -* @license -* Copyright Google LLC All Rights Reserved. -* -* Use of this source code is governed by an MIT-style license that can be -* found in the LICENSE file at https://angular.io/license -*/ + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ function createSignal(initialValue) { - const node = Object.create(SIGNAL_NODE); - node.value = initialValue; - const getter = () => { - producerAccessed(node); - return node.value; - }; - getter[SIGNAL] = node; - return getter; + const node = Object.create(SIGNAL_NODE); + node.value = initialValue; + const getter = () => { + producerAccessed(node); + return node.value; + }; + getter[SIGNAL] = node; + return getter; } function signalGetFn() { - producerAccessed(this); - return this.value; + producerAccessed(this); + return this.value; } function signalSetFn(node, newValue) { - if (!producerUpdatesAllowed()) { - throwInvalidWriteToSignalError(); - } - if (!node.equal.call(node.wrapper, node.value, newValue)) { - node.value = newValue; - signalValueChanged(node); - } + if (!producerUpdatesAllowed()) { + throwInvalidWriteToSignalError(); + } + if (!node.equal.call(node.wrapper, node.value, newValue)) { + node.value = newValue; + signalValueChanged(node); + } } const SIGNAL_NODE = /* @__PURE__ */ (() => { - return { - ...REACTIVE_NODE, - equal: defaultEquals, - value: void 0 - }; + return { + ...REACTIVE_NODE, + equal: defaultEquals, + value: void 0, + }; })(); function signalValueChanged(node) { - node.version++; - producerIncrementEpoch(); - producerNotifyConsumers(node); + node.version++; + producerIncrementEpoch(); + producerNotifyConsumers(node); } /** -* @license -* Copyright 2024 Bloomberg Finance L.P. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * @license + * Copyright 2024 Bloomberg Finance L.P. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ const NODE = Symbol("node"); var Signal; ((Signal2) => { - var _a$1, _brand, brand_fn, _b, _brand2, brand_fn2; - class State { - constructor(initialValue, options = {}) { - __privateAdd(this, _brand); - __publicField(this, _a$1); - const ref = createSignal(initialValue); - const node = ref[SIGNAL]; - this[NODE] = node; - node.wrapper = this; - if (options) { - const equals = options.equals; - if (equals) { - node.equal = equals; - } - node.watched = options[Signal2.subtle.watched]; - node.unwatched = options[Signal2.subtle.unwatched]; - } - } - get() { - if (!(0, Signal2.isState)(this)) throw new TypeError("Wrong receiver type for Signal.State.prototype.get"); - return signalGetFn.call(this[NODE]); - } - set(newValue) { - if (!(0, Signal2.isState)(this)) throw new TypeError("Wrong receiver type for Signal.State.prototype.set"); - if (isInNotificationPhase()) { - throw new Error("Writes to signals not permitted during Watcher callback"); - } - const ref = this[NODE]; - signalSetFn(ref, newValue); - } - } - _a$1 = NODE; - _brand = new WeakSet(); - brand_fn = function() {}; - Signal2.isState = (s$9) => typeof s$9 === "object" && __privateIn(_brand, s$9); - Signal2.State = State; - class Computed { - constructor(computation, options) { - __privateAdd(this, _brand2); - __publicField(this, _b); - const ref = createComputed(computation); - const node = ref[SIGNAL]; - node.consumerAllowSignalWrites = true; - this[NODE] = node; - node.wrapper = this; - if (options) { - const equals = options.equals; - if (equals) { - node.equal = equals; - } - node.watched = options[Signal2.subtle.watched]; - node.unwatched = options[Signal2.subtle.unwatched]; - } - } - get() { - if (!(0, Signal2.isComputed)(this)) throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get"); - return computedGet(this[NODE]); - } - } - _b = NODE; - _brand2 = new WeakSet(); - brand_fn2 = function() {}; - Signal2.isComputed = (c$7) => typeof c$7 === "object" && __privateIn(_brand2, c$7); - Signal2.Computed = Computed; - ((subtle2) => { - var _a2, _brand3, brand_fn3, _assertSignals, assertSignals_fn; - function untrack(cb) { - let output; - let prevActiveConsumer = null; - try { - prevActiveConsumer = setActiveConsumer(null); - output = cb(); - } finally { - setActiveConsumer(prevActiveConsumer); - } - return output; - } - subtle2.untrack = untrack; - function introspectSources(sink) { - var _a3; - if (!(0, Signal2.isComputed)(sink) && !(0, Signal2.isWatcher)(sink)) { - throw new TypeError("Called introspectSources without a Computed or Watcher argument"); - } - return ((_a3 = sink[NODE].producerNode) == null ? void 0 : _a3.map((n$13) => n$13.wrapper)) ?? []; - } - subtle2.introspectSources = introspectSources; - function introspectSinks(signal) { - var _a3; - if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) { - throw new TypeError("Called introspectSinks without a Signal argument"); - } - return ((_a3 = signal[NODE].liveConsumerNode) == null ? void 0 : _a3.map((n$13) => n$13.wrapper)) ?? []; - } - subtle2.introspectSinks = introspectSinks; - function hasSinks(signal) { - if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) { - throw new TypeError("Called hasSinks without a Signal argument"); - } - const liveConsumerNode = signal[NODE].liveConsumerNode; - if (!liveConsumerNode) return false; - return liveConsumerNode.length > 0; - } - subtle2.hasSinks = hasSinks; - function hasSources(signal) { - if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isWatcher)(signal)) { - throw new TypeError("Called hasSources without a Computed or Watcher argument"); - } - const producerNode = signal[NODE].producerNode; - if (!producerNode) return false; - return producerNode.length > 0; - } - subtle2.hasSources = hasSources; - class Watcher { - constructor(notify) { - __privateAdd(this, _brand3); - __privateAdd(this, _assertSignals); - __publicField(this, _a2); - let node = Object.create(REACTIVE_NODE); - node.wrapper = this; - node.consumerMarkedDirty = notify; - node.consumerIsAlwaysLive = true; - node.consumerAllowSignalWrites = false; - node.producerNode = []; - this[NODE] = node; - } - watch(...signals) { - if (!(0, Signal2.isWatcher)(this)) { - throw new TypeError("Called unwatch without Watcher receiver"); - } - __privateMethod(this, _assertSignals, assertSignals_fn).call(this, signals); - const node = this[NODE]; - node.dirty = false; - const prev = setActiveConsumer(node); - for (const signal of signals) { - producerAccessed(signal[NODE]); - } - setActiveConsumer(prev); - } - unwatch(...signals) { - if (!(0, Signal2.isWatcher)(this)) { - throw new TypeError("Called unwatch without Watcher receiver"); - } - __privateMethod(this, _assertSignals, assertSignals_fn).call(this, signals); - const node = this[NODE]; - assertConsumerNode(node); - for (let i$10 = node.producerNode.length - 1; i$10 >= 0; i$10--) { - if (signals.includes(node.producerNode[i$10].wrapper)) { - producerRemoveLiveConsumerAtIndex(node.producerNode[i$10], node.producerIndexOfThis[i$10]); - const lastIdx = node.producerNode.length - 1; - node.producerNode[i$10] = node.producerNode[lastIdx]; - node.producerIndexOfThis[i$10] = node.producerIndexOfThis[lastIdx]; - node.producerNode.length--; - node.producerIndexOfThis.length--; - node.nextProducerIndex--; - if (i$10 < node.producerNode.length) { - const idxConsumer = node.producerIndexOfThis[i$10]; - const producer = node.producerNode[i$10]; - assertProducerNode(producer); - producer.liveConsumerIndexOfThis[idxConsumer] = i$10; - } - } - } - } - getPending() { - if (!(0, Signal2.isWatcher)(this)) { - throw new TypeError("Called getPending without Watcher receiver"); - } - const node = this[NODE]; - return node.producerNode.filter((n$13) => n$13.dirty).map((n$13) => n$13.wrapper); - } - } - _a2 = NODE; - _brand3 = new WeakSet(); - brand_fn3 = function() {}; - _assertSignals = new WeakSet(); - assertSignals_fn = function(signals) { - for (const signal of signals) { - if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) { - throw new TypeError("Called watch/unwatch without a Computed or State argument"); - } - } - }; - Signal2.isWatcher = (w$1) => __privateIn(_brand3, w$1); - subtle2.Watcher = Watcher; - function currentComputed() { - var _a3; - return (_a3 = getActiveConsumer()) == null ? void 0 : _a3.wrapper; - } - subtle2.currentComputed = currentComputed; - subtle2.watched = Symbol("watched"); - subtle2.unwatched = Symbol("unwatched"); - })(Signal2.subtle || (Signal2.subtle = {})); + var _a$1, _brand, brand_fn, _b, _brand2, brand_fn2; + class State { + constructor(initialValue, options = {}) { + __privateAdd(this, _brand); + __publicField(this, _a$1); + const ref = createSignal(initialValue); + const node = ref[SIGNAL]; + this[NODE] = node; + node.wrapper = this; + if (options) { + const equals = options.equals; + if (equals) { + node.equal = equals; + } + node.watched = options[Signal2.subtle.watched]; + node.unwatched = options[Signal2.subtle.unwatched]; + } + } + get() { + if (!(0, Signal2.isState)(this)) + throw new TypeError("Wrong receiver type for Signal.State.prototype.get"); + return signalGetFn.call(this[NODE]); + } + set(newValue) { + if (!(0, Signal2.isState)(this)) + throw new TypeError("Wrong receiver type for Signal.State.prototype.set"); + if (isInNotificationPhase()) { + throw new Error("Writes to signals not permitted during Watcher callback"); + } + const ref = this[NODE]; + signalSetFn(ref, newValue); + } + } + _a$1 = NODE; + _brand = new WeakSet(); + brand_fn = function () {}; + Signal2.isState = (s$9) => typeof s$9 === "object" && __privateIn(_brand, s$9); + Signal2.State = State; + class Computed { + constructor(computation, options) { + __privateAdd(this, _brand2); + __publicField(this, _b); + const ref = createComputed(computation); + const node = ref[SIGNAL]; + node.consumerAllowSignalWrites = true; + this[NODE] = node; + node.wrapper = this; + if (options) { + const equals = options.equals; + if (equals) { + node.equal = equals; + } + node.watched = options[Signal2.subtle.watched]; + node.unwatched = options[Signal2.subtle.unwatched]; + } + } + get() { + if (!(0, Signal2.isComputed)(this)) + throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get"); + return computedGet(this[NODE]); + } + } + _b = NODE; + _brand2 = new WeakSet(); + brand_fn2 = function () {}; + Signal2.isComputed = (c$7) => typeof c$7 === "object" && __privateIn(_brand2, c$7); + Signal2.Computed = Computed; + ((subtle2) => { + var _a2, _brand3, brand_fn3, _assertSignals, assertSignals_fn; + function untrack(cb) { + let output; + let prevActiveConsumer = null; + try { + prevActiveConsumer = setActiveConsumer(null); + output = cb(); + } finally { + setActiveConsumer(prevActiveConsumer); + } + return output; + } + subtle2.untrack = untrack; + function introspectSources(sink) { + var _a3; + if (!(0, Signal2.isComputed)(sink) && !(0, Signal2.isWatcher)(sink)) { + throw new TypeError("Called introspectSources without a Computed or Watcher argument"); + } + return ( + ((_a3 = sink[NODE].producerNode) == null ? void 0 : _a3.map((n$13) => n$13.wrapper)) ?? [] + ); + } + subtle2.introspectSources = introspectSources; + function introspectSinks(signal) { + var _a3; + if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) { + throw new TypeError("Called introspectSinks without a Signal argument"); + } + return ( + ((_a3 = signal[NODE].liveConsumerNode) == null + ? void 0 + : _a3.map((n$13) => n$13.wrapper)) ?? [] + ); + } + subtle2.introspectSinks = introspectSinks; + function hasSinks(signal) { + if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) { + throw new TypeError("Called hasSinks without a Signal argument"); + } + const liveConsumerNode = signal[NODE].liveConsumerNode; + if (!liveConsumerNode) return false; + return liveConsumerNode.length > 0; + } + subtle2.hasSinks = hasSinks; + function hasSources(signal) { + if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isWatcher)(signal)) { + throw new TypeError("Called hasSources without a Computed or Watcher argument"); + } + const producerNode = signal[NODE].producerNode; + if (!producerNode) return false; + return producerNode.length > 0; + } + subtle2.hasSources = hasSources; + class Watcher { + constructor(notify) { + __privateAdd(this, _brand3); + __privateAdd(this, _assertSignals); + __publicField(this, _a2); + let node = Object.create(REACTIVE_NODE); + node.wrapper = this; + node.consumerMarkedDirty = notify; + node.consumerIsAlwaysLive = true; + node.consumerAllowSignalWrites = false; + node.producerNode = []; + this[NODE] = node; + } + watch(...signals) { + if (!(0, Signal2.isWatcher)(this)) { + throw new TypeError("Called unwatch without Watcher receiver"); + } + __privateMethod(this, _assertSignals, assertSignals_fn).call(this, signals); + const node = this[NODE]; + node.dirty = false; + const prev = setActiveConsumer(node); + for (const signal of signals) { + producerAccessed(signal[NODE]); + } + setActiveConsumer(prev); + } + unwatch(...signals) { + if (!(0, Signal2.isWatcher)(this)) { + throw new TypeError("Called unwatch without Watcher receiver"); + } + __privateMethod(this, _assertSignals, assertSignals_fn).call(this, signals); + const node = this[NODE]; + assertConsumerNode(node); + for (let i$10 = node.producerNode.length - 1; i$10 >= 0; i$10--) { + if (signals.includes(node.producerNode[i$10].wrapper)) { + producerRemoveLiveConsumerAtIndex( + node.producerNode[i$10], + node.producerIndexOfThis[i$10], + ); + const lastIdx = node.producerNode.length - 1; + node.producerNode[i$10] = node.producerNode[lastIdx]; + node.producerIndexOfThis[i$10] = node.producerIndexOfThis[lastIdx]; + node.producerNode.length--; + node.producerIndexOfThis.length--; + node.nextProducerIndex--; + if (i$10 < node.producerNode.length) { + const idxConsumer = node.producerIndexOfThis[i$10]; + const producer = node.producerNode[i$10]; + assertProducerNode(producer); + producer.liveConsumerIndexOfThis[idxConsumer] = i$10; + } + } + } + } + getPending() { + if (!(0, Signal2.isWatcher)(this)) { + throw new TypeError("Called getPending without Watcher receiver"); + } + const node = this[NODE]; + return node.producerNode.filter((n$13) => n$13.dirty).map((n$13) => n$13.wrapper); + } + } + _a2 = NODE; + _brand3 = new WeakSet(); + brand_fn3 = function () {}; + _assertSignals = new WeakSet(); + assertSignals_fn = function (signals) { + for (const signal of signals) { + if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) { + throw new TypeError("Called watch/unwatch without a Computed or State argument"); + } + } + }; + Signal2.isWatcher = (w$1) => __privateIn(_brand3, w$1); + subtle2.Watcher = Watcher; + function currentComputed() { + var _a3; + return (_a3 = getActiveConsumer()) == null ? void 0 : _a3.wrapper; + } + subtle2.currentComputed = currentComputed; + subtle2.watched = Symbol("watched"); + subtle2.unwatched = Symbol("unwatched"); + })(Signal2.subtle || (Signal2.subtle = {})); })(Signal || (Signal = {})); /** -* equality check here is always false so that we can dirty the storage -* via setting to _anything_ -* -* -* This is for a pattern where we don't *directly* use signals to back the values used in collections -* so that instanceof checks and getters and other native features "just work" without having -* to do nested proxying. -* -* (though, see deep.ts for nested / deep behavior) -*/ + * equality check here is always false so that we can dirty the storage + * via setting to _anything_ + * + * + * This is for a pattern where we don't *directly* use signals to back the values used in collections + * so that instanceof checks and getters and other native features "just work" without having + * to do nested proxying. + * + * (though, see deep.ts for nested / deep behavior) + */ const createStorage = (initial = null) => new Signal.State(initial, { equals: () => false }); /** -* Just an alias for brevity -*/ + * Just an alias for brevity + */ const BOUND_FUNS = new WeakMap(); function fnCacheFor(context) { - let fnCache = BOUND_FUNS.get(context); - if (!fnCache) { - fnCache = new Map(); - BOUND_FUNS.set(context, fnCache); - } - return fnCache; + let fnCache = BOUND_FUNS.get(context); + if (!fnCache) { + fnCache = new Map(); + BOUND_FUNS.set(context, fnCache); + } + return fnCache; } const ARRAY_GETTER_METHODS = new Set([ - Symbol.iterator, - "concat", - "entries", - "every", - "filter", - "find", - "findIndex", - "flat", - "flatMap", - "forEach", - "includes", - "indexOf", - "join", - "keys", - "lastIndexOf", - "map", - "reduce", - "reduceRight", - "slice", - "some", - "values" -]); -const ARRAY_WRITE_THEN_READ_METHODS = new Set([ - "fill", - "push", - "unshift" + Symbol.iterator, + "concat", + "entries", + "every", + "filter", + "find", + "findIndex", + "flat", + "flatMap", + "forEach", + "includes", + "indexOf", + "join", + "keys", + "lastIndexOf", + "map", + "reduce", + "reduceRight", + "slice", + "some", + "values", ]); +const ARRAY_WRITE_THEN_READ_METHODS = new Set(["fill", "push", "unshift"]); function convertToInt(prop) { - if (typeof prop === "symbol") return null; - const num = Number(prop); - if (isNaN(num)) return null; - return num % 1 === 0 ? num : null; + if (typeof prop === "symbol") return null; + const num = Number(prop); + if (isNaN(num)) return null; + return num % 1 === 0 ? num : null; } var SignalArray = class SignalArray { - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - */ - /** - * Creates an array from an iterable object. - * @param iterable An iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - static from(iterable, mapfn, thisArg) { - return mapfn ? new SignalArray(Array.from(iterable, mapfn, thisArg)) : new SignalArray(Array.from(iterable)); - } - static of(...arr) { - return new SignalArray(arr); - } - constructor(arr = []) { - let clone = arr.slice(); - let self = this; - let boundFns = new Map(); - /** + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + static from(iterable, mapfn, thisArg) { + return mapfn + ? new SignalArray(Array.from(iterable, mapfn, thisArg)) + : new SignalArray(Array.from(iterable)); + } + static of(...arr) { + return new SignalArray(arr); + } + constructor(arr = []) { + let clone = arr.slice(); + let self = this; + let boundFns = new Map(); + /** Flag to track whether we have *just* intercepted a call to `.push()` or `.unshift()`, since in those cases (and only those cases!) the `Array` itself checks `.length` to return from the function call. */ - let nativelyAccessingLengthFromPushOrUnshift = false; - return new Proxy(clone, { - get(target, prop) { - let index = convertToInt(prop); - if (index !== null) { - self.#readStorageFor(index); - self.#collection.get(); - return target[index]; - } - if (prop === "length") { - if (nativelyAccessingLengthFromPushOrUnshift) { - nativelyAccessingLengthFromPushOrUnshift = false; - } else { - self.#collection.get(); - } - return target[prop]; - } - if (ARRAY_WRITE_THEN_READ_METHODS.has(prop)) { - nativelyAccessingLengthFromPushOrUnshift = true; - } - if (ARRAY_GETTER_METHODS.has(prop)) { - let fn = boundFns.get(prop); - if (fn === undefined) { - fn = (...args) => { - self.#collection.get(); - return target[prop](...args); - }; - boundFns.set(prop, fn); - } - return fn; - } - return target[prop]; - }, - set(target, prop, value) { - target[prop] = value; - let index = convertToInt(prop); - if (index !== null) { - self.#dirtyStorageFor(index); - self.#collection.set(null); - } else if (prop === "length") { - self.#collection.set(null); - } - return true; - }, - getPrototypeOf() { - return SignalArray.prototype; - } - }); - } - #collection = createStorage(); - #storages = new Map(); - #readStorageFor(index) { - let storage = this.#storages.get(index); - if (storage === undefined) { - storage = createStorage(); - this.#storages.set(index, storage); - } - storage.get(); - } - #dirtyStorageFor(index) { - const storage = this.#storages.get(index); - if (storage) { - storage.set(null); - } - } + let nativelyAccessingLengthFromPushOrUnshift = false; + return new Proxy(clone, { + get(target, prop) { + let index = convertToInt(prop); + if (index !== null) { + self.#readStorageFor(index); + self.#collection.get(); + return target[index]; + } + if (prop === "length") { + if (nativelyAccessingLengthFromPushOrUnshift) { + nativelyAccessingLengthFromPushOrUnshift = false; + } else { + self.#collection.get(); + } + return target[prop]; + } + if (ARRAY_WRITE_THEN_READ_METHODS.has(prop)) { + nativelyAccessingLengthFromPushOrUnshift = true; + } + if (ARRAY_GETTER_METHODS.has(prop)) { + let fn = boundFns.get(prop); + if (fn === undefined) { + fn = (...args) => { + self.#collection.get(); + return target[prop](...args); + }; + boundFns.set(prop, fn); + } + return fn; + } + return target[prop]; + }, + set(target, prop, value) { + target[prop] = value; + let index = convertToInt(prop); + if (index !== null) { + self.#dirtyStorageFor(index); + self.#collection.set(null); + } else if (prop === "length") { + self.#collection.set(null); + } + return true; + }, + getPrototypeOf() { + return SignalArray.prototype; + }, + }); + } + #collection = createStorage(); + #storages = new Map(); + #readStorageFor(index) { + let storage = this.#storages.get(index); + if (storage === undefined) { + storage = createStorage(); + this.#storages.set(index, storage); + } + storage.get(); + } + #dirtyStorageFor(index) { + const storage = this.#storages.get(index); + if (storage) { + storage.set(null); + } + } }; Object.setPrototypeOf(SignalArray.prototype, Array.prototype); function signalArray(x$1) { - return new SignalArray(x$1); + return new SignalArray(x$1); } var SignalMap = class { - collection = createStorage(); - storages = new Map(); - vals; - readStorageFor(key) { - const { storages } = this; - let storage = storages.get(key); - if (storage === undefined) { - storage = createStorage(); - storages.set(key, storage); - } - storage.get(); - } - dirtyStorageFor(key) { - const storage = this.storages.get(key); - if (storage) { - storage.set(null); - } - } - constructor(existing) { - this.vals = existing ? new Map(existing) : new Map(); - } - get(key) { - this.readStorageFor(key); - return this.vals.get(key); - } - has(key) { - this.readStorageFor(key); - return this.vals.has(key); - } - entries() { - this.collection.get(); - return this.vals.entries(); - } - keys() { - this.collection.get(); - return this.vals.keys(); - } - values() { - this.collection.get(); - return this.vals.values(); - } - forEach(fn) { - this.collection.get(); - this.vals.forEach(fn); - } - get size() { - this.collection.get(); - return this.vals.size; - } - [Symbol.iterator]() { - this.collection.get(); - return this.vals[Symbol.iterator](); - } - get [Symbol.toStringTag]() { - return this.vals[Symbol.toStringTag]; - } - set(key, value) { - this.dirtyStorageFor(key); - this.collection.set(null); - this.vals.set(key, value); - return this; - } - delete(key) { - this.dirtyStorageFor(key); - this.collection.set(null); - return this.vals.delete(key); - } - clear() { - this.storages.forEach((s$9) => s$9.set(null)); - this.collection.set(null); - this.vals.clear(); - } + collection = createStorage(); + storages = new Map(); + vals; + readStorageFor(key) { + const { storages } = this; + let storage = storages.get(key); + if (storage === undefined) { + storage = createStorage(); + storages.set(key, storage); + } + storage.get(); + } + dirtyStorageFor(key) { + const storage = this.storages.get(key); + if (storage) { + storage.set(null); + } + } + constructor(existing) { + this.vals = existing ? new Map(existing) : new Map(); + } + get(key) { + this.readStorageFor(key); + return this.vals.get(key); + } + has(key) { + this.readStorageFor(key); + return this.vals.has(key); + } + entries() { + this.collection.get(); + return this.vals.entries(); + } + keys() { + this.collection.get(); + return this.vals.keys(); + } + values() { + this.collection.get(); + return this.vals.values(); + } + forEach(fn) { + this.collection.get(); + this.vals.forEach(fn); + } + get size() { + this.collection.get(); + return this.vals.size; + } + [Symbol.iterator]() { + this.collection.get(); + return this.vals[Symbol.iterator](); + } + get [Symbol.toStringTag]() { + return this.vals[Symbol.toStringTag]; + } + set(key, value) { + this.dirtyStorageFor(key); + this.collection.set(null); + this.vals.set(key, value); + return this; + } + delete(key) { + this.dirtyStorageFor(key); + this.collection.set(null); + return this.vals.delete(key); + } + clear() { + this.storages.forEach((s$9) => s$9.set(null)); + this.collection.set(null); + this.vals.clear(); + } }; Object.setPrototypeOf(SignalMap.prototype, Map.prototype); /** -* Implementation based of tracked-built-ins' TrackedObject -* https://github.com/tracked-tools/tracked-built-ins/blob/master/addon/src/-private/object.js -*/ + * Implementation based of tracked-built-ins' TrackedObject + * https://github.com/tracked-tools/tracked-built-ins/blob/master/addon/src/-private/object.js + */ var SignalObjectImpl = class SignalObjectImpl { - static fromEntries(entries) { - return new SignalObjectImpl(Object.fromEntries(entries)); - } - #storages = new Map(); - #collection = createStorage(); - constructor(obj = {}) { - let proto = Object.getPrototypeOf(obj); - let descs = Object.getOwnPropertyDescriptors(obj); - let clone = Object.create(proto); - for (let prop in descs) { - Object.defineProperty(clone, prop, descs[prop]); - } - let self = this; - return new Proxy(clone, { - get(target, prop, receiver) { - self.#readStorageFor(prop); - return Reflect.get(target, prop, receiver); - }, - has(target, prop) { - self.#readStorageFor(prop); - return prop in target; - }, - ownKeys(target) { - self.#collection.get(); - return Reflect.ownKeys(target); - }, - set(target, prop, value, receiver) { - let result = Reflect.set(target, prop, value, receiver); - self.#dirtyStorageFor(prop); - self.#dirtyCollection(); - return result; - }, - deleteProperty(target, prop) { - if (prop in target) { - delete target[prop]; - self.#dirtyStorageFor(prop); - self.#dirtyCollection(); - } - return true; - }, - getPrototypeOf() { - return SignalObjectImpl.prototype; - } - }); - } - #readStorageFor(key) { - let storage = this.#storages.get(key); - if (storage === undefined) { - storage = createStorage(); - this.#storages.set(key, storage); - } - storage.get(); - } - #dirtyStorageFor(key) { - const storage = this.#storages.get(key); - if (storage) { - storage.set(null); - } - } - #dirtyCollection() { - this.#collection.set(null); - } + static fromEntries(entries) { + return new SignalObjectImpl(Object.fromEntries(entries)); + } + #storages = new Map(); + #collection = createStorage(); + constructor(obj = {}) { + let proto = Object.getPrototypeOf(obj); + let descs = Object.getOwnPropertyDescriptors(obj); + let clone = Object.create(proto); + for (let prop in descs) { + Object.defineProperty(clone, prop, descs[prop]); + } + let self = this; + return new Proxy(clone, { + get(target, prop, receiver) { + self.#readStorageFor(prop); + return Reflect.get(target, prop, receiver); + }, + has(target, prop) { + self.#readStorageFor(prop); + return prop in target; + }, + ownKeys(target) { + self.#collection.get(); + return Reflect.ownKeys(target); + }, + set(target, prop, value, receiver) { + let result = Reflect.set(target, prop, value, receiver); + self.#dirtyStorageFor(prop); + self.#dirtyCollection(); + return result; + }, + deleteProperty(target, prop) { + if (prop in target) { + delete target[prop]; + self.#dirtyStorageFor(prop); + self.#dirtyCollection(); + } + return true; + }, + getPrototypeOf() { + return SignalObjectImpl.prototype; + }, + }); + } + #readStorageFor(key) { + let storage = this.#storages.get(key); + if (storage === undefined) { + storage = createStorage(); + this.#storages.set(key, storage); + } + storage.get(); + } + #dirtyStorageFor(key) { + const storage = this.#storages.get(key); + if (storage) { + storage.set(null); + } + } + #dirtyCollection() { + this.#collection.set(null); + } }; /** -* Create a reactive Object, backed by Signals, using a Proxy. -* This allows dynamic creation and deletion of signals using the object primitive -* APIs that most folks are familiar with -- the only difference is instantiation. -* ```js -* const obj = new SignalObject({ foo: 123 }); -* -* obj.foo // 123 -* obj.foo = 456 -* obj.foo // 456 -* obj.bar = 2 -* obj.bar // 2 -* ``` -*/ + * Create a reactive Object, backed by Signals, using a Proxy. + * This allows dynamic creation and deletion of signals using the object primitive + * APIs that most folks are familiar with -- the only difference is instantiation. + * ```js + * const obj = new SignalObject({ foo: 123 }); + * + * obj.foo // 123 + * obj.foo = 456 + * obj.foo // 456 + * obj.bar = 2 + * obj.bar // 2 + * ``` + */ const SignalObject = SignalObjectImpl; function signalObject(obj) { - return new SignalObject(obj); + return new SignalObject(obj); } var SignalSet = class { - collection = createStorage(); - storages = new Map(); - vals; - storageFor(key) { - const storages = this.storages; - let storage = storages.get(key); - if (storage === undefined) { - storage = createStorage(); - storages.set(key, storage); - } - return storage; - } - dirtyStorageFor(key) { - const storage = this.storages.get(key); - if (storage) { - storage.set(null); - } - } - constructor(existing) { - this.vals = new Set(existing); - } - has(value) { - this.storageFor(value).get(); - return this.vals.has(value); - } - entries() { - this.collection.get(); - return this.vals.entries(); - } - keys() { - this.collection.get(); - return this.vals.keys(); - } - values() { - this.collection.get(); - return this.vals.values(); - } - forEach(fn) { - this.collection.get(); - this.vals.forEach(fn); - } - get size() { - this.collection.get(); - return this.vals.size; - } - [Symbol.iterator]() { - this.collection.get(); - return this.vals[Symbol.iterator](); - } - get [Symbol.toStringTag]() { - return this.vals[Symbol.toStringTag]; - } - add(value) { - this.dirtyStorageFor(value); - this.collection.set(null); - this.vals.add(value); - return this; - } - delete(value) { - this.dirtyStorageFor(value); - this.collection.set(null); - return this.vals.delete(value); - } - clear() { - this.storages.forEach((s$9) => s$9.set(null)); - this.collection.set(null); - this.vals.clear(); - } + collection = createStorage(); + storages = new Map(); + vals; + storageFor(key) { + const storages = this.storages; + let storage = storages.get(key); + if (storage === undefined) { + storage = createStorage(); + storages.set(key, storage); + } + return storage; + } + dirtyStorageFor(key) { + const storage = this.storages.get(key); + if (storage) { + storage.set(null); + } + } + constructor(existing) { + this.vals = new Set(existing); + } + has(value) { + this.storageFor(value).get(); + return this.vals.has(value); + } + entries() { + this.collection.get(); + return this.vals.entries(); + } + keys() { + this.collection.get(); + return this.vals.keys(); + } + values() { + this.collection.get(); + return this.vals.values(); + } + forEach(fn) { + this.collection.get(); + this.vals.forEach(fn); + } + get size() { + this.collection.get(); + return this.vals.size; + } + [Symbol.iterator]() { + this.collection.get(); + return this.vals[Symbol.iterator](); + } + get [Symbol.toStringTag]() { + return this.vals[Symbol.toStringTag]; + } + add(value) { + this.dirtyStorageFor(value); + this.collection.set(null); + this.vals.add(value); + return this; + } + delete(value) { + this.dirtyStorageFor(value); + this.collection.set(null); + return this.vals.delete(value); + } + clear() { + this.storages.forEach((s$9) => s$9.set(null)); + this.collection.set(null); + this.vals.clear(); + } }; Object.setPrototypeOf(SignalSet.prototype, Set.prototype); function create() { - return new A2uiMessageProcessor({ - arrayCtor: SignalArray, - mapCtor: SignalMap, - objCtor: SignalObject, - setCtor: SignalSet - }); + return new A2uiMessageProcessor({ + arrayCtor: SignalArray, + mapCtor: SignalMap, + objCtor: SignalObject, + setCtor: SignalSet, + }); } var server_to_client_with_standard_catalog_default = { - title: "A2UI Message Schema", - description: "Describes a JSON payload for an A2UI (Agent to UI) message, which is used to dynamically construct and update user interfaces. A message MUST contain exactly ONE of the action properties: 'beginRendering', 'surfaceUpdate', 'dataModelUpdate', or 'deleteSurface'.", - type: "object", - additionalProperties: false, - properties: { - "beginRendering": { - "type": "object", - "description": "Signals the client to begin rendering a surface with a root component and specific styles.", - "additionalProperties": false, - "properties": { - "surfaceId": { - "type": "string", - "description": "The unique identifier for the UI surface to be rendered." - }, - "root": { - "type": "string", - "description": "The ID of the root component to render." - }, - "styles": { - "type": "object", - "description": "Styling information for the UI.", - "additionalProperties": false, - "properties": { - "font": { - "type": "string", - "description": "The primary font for the UI." - }, - "primaryColor": { - "type": "string", - "description": "The primary UI color as a hexadecimal code (e.g., '#00BFFF').", - "pattern": "^#[0-9a-fA-F]{6}$" - } - } - } - }, - "required": ["root", "surfaceId"] - }, - "surfaceUpdate": { - "type": "object", - "description": "Updates a surface with a new set of components.", - "additionalProperties": false, - "properties": { - "surfaceId": { - "type": "string", - "description": "The unique identifier for the UI surface to be updated. If you are adding a new surface this *must* be a new, unique identified that has never been used for any existing surfaces shown." - }, - "components": { - "type": "array", - "description": "A list containing all UI components for the surface.", - "minItems": 1, - "items": { - "type": "object", - "description": "Represents a *single* component in a UI widget tree. This component could be one of many supported types.", - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "description": "The unique identifier for this component." - }, - "weight": { - "type": "number", - "description": "The relative weight of this component within a Row or Column. This corresponds to the CSS 'flex-grow' property. Note: this may ONLY be set when the component is a direct descendant of a Row or Column." - }, - "component": { - "type": "object", - "description": "A wrapper object that MUST contain exactly one key, which is the name of the component type (e.g., 'Heading'). The value is an object containing the properties for that specific component.", - "additionalProperties": false, - "properties": { - "Text": { - "type": "object", - "additionalProperties": false, - "properties": { - "text": { - "type": "object", - "description": "The text content to display. This can be a literal string or a reference to a value in the data model ('path', e.g., '/doc/title'). While simple Markdown formatting is supported (i.e. without HTML, images, or links), utilizing dedicated UI components is generally preferred for a richer and more structured presentation.", - "additionalProperties": false, - "properties": { - "literalString": { "type": "string" }, - "path": { "type": "string" } - } - }, - "usageHint": { - "type": "string", - "description": "A hint for the base text style. One of:\n- `h1`: Largest heading.\n- `h2`: Second largest heading.\n- `h3`: Third largest heading.\n- `h4`: Fourth largest heading.\n- `h5`: Fifth largest heading.\n- `caption`: Small text for captions.\n- `body`: Standard body text.", - "enum": [ - "h1", - "h2", - "h3", - "h4", - "h5", - "caption", - "body" - ] - } - }, - "required": ["text"] - }, - "Image": { - "type": "object", - "additionalProperties": false, - "properties": { - "url": { - "type": "object", - "description": "The URL of the image to display. This can be a literal string ('literal') or a reference to a value in the data model ('path', e.g. '/thumbnail/url').", - "additionalProperties": false, - "properties": { - "literalString": { "type": "string" }, - "path": { "type": "string" } - } - }, - "fit": { - "type": "string", - "description": "Specifies how the image should be resized to fit its container. This corresponds to the CSS 'object-fit' property.", - "enum": [ - "contain", - "cover", - "fill", - "none", - "scale-down" - ] - }, - "usageHint": { - "type": "string", - "description": "A hint for the image size and style. One of:\n- `icon`: Small square icon.\n- `avatar`: Circular avatar image.\n- `smallFeature`: Small feature image.\n- `mediumFeature`: Medium feature image.\n- `largeFeature`: Large feature image.\n- `header`: Full-width, full bleed, header image.", - "enum": [ - "icon", - "avatar", - "smallFeature", - "mediumFeature", - "largeFeature", - "header" - ] - } - }, - "required": ["url"] - }, - "Icon": { - "type": "object", - "additionalProperties": false, - "properties": { "name": { - "type": "object", - "description": "The name of the icon to display. This can be a literal string or a reference to a value in the data model ('path', e.g. '/form/submit').", - "additionalProperties": false, - "properties": { - "literalString": { - "type": "string", - "enum": [ - "accountCircle", - "add", - "arrowBack", - "arrowForward", - "attachFile", - "calendarToday", - "call", - "camera", - "check", - "close", - "delete", - "download", - "edit", - "event", - "error", - "favorite", - "favoriteOff", - "folder", - "help", - "home", - "info", - "locationOn", - "lock", - "lockOpen", - "mail", - "menu", - "moreVert", - "moreHoriz", - "notificationsOff", - "notifications", - "payment", - "person", - "phone", - "photo", - "print", - "refresh", - "search", - "send", - "settings", - "share", - "shoppingCart", - "star", - "starHalf", - "starOff", - "upload", - "visibility", - "visibilityOff", - "warning" - ] - }, - "path": { "type": "string" } - } - } }, - "required": ["name"] - }, - "Video": { - "type": "object", - "additionalProperties": false, - "properties": { "url": { - "type": "object", - "description": "The URL of the video to display. This can be a literal string or a reference to a value in the data model ('path', e.g. '/video/url').", - "additionalProperties": false, - "properties": { - "literalString": { "type": "string" }, - "path": { "type": "string" } - } - } }, - "required": ["url"] - }, - "AudioPlayer": { - "type": "object", - "additionalProperties": false, - "properties": { - "url": { - "type": "object", - "description": "The URL of the audio to be played. This can be a literal string ('literal') or a reference to a value in the data model ('path', e.g. '/song/url').", - "additionalProperties": false, - "properties": { - "literalString": { "type": "string" }, - "path": { "type": "string" } - } - }, - "description": { - "type": "object", - "description": "A description of the audio, such as a title or summary. This can be a literal string or a reference to a value in the data model ('path', e.g. '/song/title').", - "additionalProperties": false, - "properties": { - "literalString": { "type": "string" }, - "path": { "type": "string" } - } - } - }, - "required": ["url"] - }, - "Row": { - "type": "object", - "additionalProperties": false, - "properties": { - "children": { - "type": "object", - "description": "Defines the children. Use 'explicitList' for a fixed set of children, or 'template' to generate children from a data list.", - "additionalProperties": false, - "properties": { - "explicitList": { - "type": "array", - "items": { "type": "string" } - }, - "template": { - "type": "object", - "description": "A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.", - "additionalProperties": false, - "properties": { - "componentId": { "type": "string" }, - "dataBinding": { "type": "string" } - }, - "required": ["componentId", "dataBinding"] - } - } - }, - "distribution": { - "type": "string", - "description": "Defines the arrangement of children along the main axis (horizontally). This corresponds to the CSS 'justify-content' property.", - "enum": [ - "center", - "end", - "spaceAround", - "spaceBetween", - "spaceEvenly", - "start" - ] - }, - "alignment": { - "type": "string", - "description": "Defines the alignment of children along the cross axis (vertically). This corresponds to the CSS 'align-items' property.", - "enum": [ - "start", - "center", - "end", - "stretch" - ] - } - }, - "required": ["children"] - }, - "Column": { - "type": "object", - "additionalProperties": false, - "properties": { - "children": { - "type": "object", - "description": "Defines the children. Use 'explicitList' for a fixed set of children, or 'template' to generate children from a data list.", - "additionalProperties": false, - "properties": { - "explicitList": { - "type": "array", - "items": { "type": "string" } - }, - "template": { - "type": "object", - "description": "A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.", - "additionalProperties": false, - "properties": { - "componentId": { "type": "string" }, - "dataBinding": { "type": "string" } - }, - "required": ["componentId", "dataBinding"] - } - } - }, - "distribution": { - "type": "string", - "description": "Defines the arrangement of children along the main axis (vertically). This corresponds to the CSS 'justify-content' property.", - "enum": [ - "start", - "center", - "end", - "spaceBetween", - "spaceAround", - "spaceEvenly" - ] - }, - "alignment": { - "type": "string", - "description": "Defines the alignment of children along the cross axis (horizontally). This corresponds to the CSS 'align-items' property.", - "enum": [ - "center", - "end", - "start", - "stretch" - ] - } - }, - "required": ["children"] - }, - "List": { - "type": "object", - "additionalProperties": false, - "properties": { - "children": { - "type": "object", - "description": "Defines the children. Use 'explicitList' for a fixed set of children, or 'template' to generate children from a data list.", - "additionalProperties": false, - "properties": { - "explicitList": { - "type": "array", - "items": { "type": "string" } - }, - "template": { - "type": "object", - "description": "A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.", - "additionalProperties": false, - "properties": { - "componentId": { "type": "string" }, - "dataBinding": { "type": "string" } - }, - "required": ["componentId", "dataBinding"] - } - } - }, - "direction": { - "type": "string", - "description": "The direction in which the list items are laid out.", - "enum": ["vertical", "horizontal"] - }, - "alignment": { - "type": "string", - "description": "Defines the alignment of children along the cross axis.", - "enum": [ - "start", - "center", - "end", - "stretch" - ] - } - }, - "required": ["children"] - }, - "Card": { - "type": "object", - "additionalProperties": false, - "properties": { "child": { - "type": "string", - "description": "The ID of the component to be rendered inside the card." - } }, - "required": ["child"] - }, - "Tabs": { - "type": "object", - "additionalProperties": false, - "properties": { "tabItems": { - "type": "array", - "description": "An array of objects, where each object defines a tab with a title and a child component.", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "title": { - "type": "object", - "description": "The tab title. Defines the value as either a literal value or a path to data model value (e.g. '/options/title').", - "additionalProperties": false, - "properties": { - "literalString": { "type": "string" }, - "path": { "type": "string" } - } - }, - "child": { "type": "string" } - }, - "required": ["title", "child"] - } - } }, - "required": ["tabItems"] - }, - "Divider": { - "type": "object", - "additionalProperties": false, - "properties": { "axis": { - "type": "string", - "description": "The orientation of the divider.", - "enum": ["horizontal", "vertical"] - } } - }, - "Modal": { - "type": "object", - "additionalProperties": false, - "properties": { - "entryPointChild": { - "type": "string", - "description": "The ID of the component that opens the modal when interacted with (e.g., a button)." - }, - "contentChild": { - "type": "string", - "description": "The ID of the component to be displayed inside the modal." - } - }, - "required": ["entryPointChild", "contentChild"] - }, - "Button": { - "type": "object", - "additionalProperties": false, - "properties": { - "child": { - "type": "string", - "description": "The ID of the component to display in the button, typically a Text component." - }, - "primary": { - "type": "boolean", - "description": "Indicates if this button should be styled as the primary action." - }, - "action": { - "type": "object", - "description": "The client-side action to be dispatched when the button is clicked. It includes the action's name and an optional context payload.", - "additionalProperties": false, - "properties": { - "name": { "type": "string" }, - "context": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "key": { "type": "string" }, - "value": { - "type": "object", - "description": "Defines the value to be included in the context as either a literal value or a path to a data model value (e.g. '/user/name').", - "additionalProperties": false, - "properties": { - "path": { "type": "string" }, - "literalString": { "type": "string" }, - "literalNumber": { "type": "number" }, - "literalBoolean": { "type": "boolean" } - } - } - }, - "required": ["key", "value"] - } - } - }, - "required": ["name"] - } - }, - "required": ["child", "action"] - }, - "CheckBox": { - "type": "object", - "additionalProperties": false, - "properties": { - "label": { - "type": "object", - "description": "The text to display next to the checkbox. Defines the value as either a literal value or a path to data model ('path', e.g. '/option/label').", - "additionalProperties": false, - "properties": { - "literalString": { "type": "string" }, - "path": { "type": "string" } - } - }, - "value": { - "type": "object", - "description": "The current state of the checkbox (true for checked, false for unchecked). This can be a literal boolean ('literalBoolean') or a reference to a value in the data model ('path', e.g. '/filter/open').", - "additionalProperties": false, - "properties": { - "literalBoolean": { "type": "boolean" }, - "path": { "type": "string" } - } - } - }, - "required": ["label", "value"] - }, - "TextField": { - "type": "object", - "additionalProperties": false, - "properties": { - "label": { - "type": "object", - "description": "The text label for the input field. This can be a literal string or a reference to a value in the data model ('path, e.g. '/user/name').", - "additionalProperties": false, - "properties": { - "literalString": { "type": "string" }, - "path": { "type": "string" } - } - }, - "text": { - "type": "object", - "description": "The value of the text field. This can be a literal string or a reference to a value in the data model ('path', e.g. '/user/name').", - "additionalProperties": false, - "properties": { - "literalString": { "type": "string" }, - "path": { "type": "string" } - } - }, - "textFieldType": { - "type": "string", - "description": "The type of input field to display.", - "enum": [ - "date", - "longText", - "number", - "shortText", - "obscured" - ] - }, - "validationRegexp": { - "type": "string", - "description": "A regular expression used for client-side validation of the input." - } - }, - "required": ["label"] - }, - "DateTimeInput": { - "type": "object", - "additionalProperties": false, - "properties": { - "value": { - "type": "object", - "description": "The selected date and/or time value. This can be a literal string ('literalString') or a reference to a value in the data model ('path', e.g. '/user/dob').", - "additionalProperties": false, - "properties": { - "literalString": { "type": "string" }, - "path": { "type": "string" } - } - }, - "enableDate": { - "type": "boolean", - "description": "If true, allows the user to select a date." - }, - "enableTime": { - "type": "boolean", - "description": "If true, allows the user to select a time." - }, - "outputFormat": { - "type": "string", - "description": "The desired format for the output string after a date or time is selected." - } - }, - "required": ["value"] - }, - "MultipleChoice": { - "type": "object", - "additionalProperties": false, - "properties": { - "selections": { - "type": "object", - "description": "The currently selected values for the component. This can be a literal array of strings or a path to an array in the data model('path', e.g. '/hotel/options').", - "additionalProperties": false, - "properties": { - "literalArray": { - "type": "array", - "items": { "type": "string" } - }, - "path": { "type": "string" } - } - }, - "options": { - "type": "array", - "description": "An array of available options for the user to choose from.", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "label": { - "type": "object", - "description": "The text to display for this option. This can be a literal string or a reference to a value in the data model (e.g. '/option/label').", - "additionalProperties": false, - "properties": { - "literalString": { "type": "string" }, - "path": { "type": "string" } - } - }, - "value": { - "type": "string", - "description": "The value to be associated with this option when selected." - } - }, - "required": ["label", "value"] - } - }, - "maxAllowedSelections": { - "type": "integer", - "description": "The maximum number of options that the user is allowed to select." - } - }, - "required": ["selections", "options"] - }, - "Slider": { - "type": "object", - "additionalProperties": false, - "properties": { - "value": { - "type": "object", - "description": "The current value of the slider. This can be a literal number ('literalNumber') or a reference to a value in the data model ('path', e.g. '/restaurant/cost').", - "additionalProperties": false, - "properties": { - "literalNumber": { "type": "number" }, - "path": { "type": "string" } - } - }, - "minValue": { - "type": "number", - "description": "The minimum value of the slider." - }, - "maxValue": { - "type": "number", - "description": "The maximum value of the slider." - } - }, - "required": ["value"] - } - } - } - }, - "required": ["id", "component"] - } - } - }, - "required": ["surfaceId", "components"] - }, - "dataModelUpdate": { - "type": "object", - "description": "Updates the data model for a surface.", - "additionalProperties": false, - "properties": { - "surfaceId": { - "type": "string", - "description": "The unique identifier for the UI surface this data model update applies to." - }, - "path": { - "type": "string", - "description": "An optional path to a location within the data model (e.g., '/user/name'). If omitted, or set to '/', the entire data model will be replaced." - }, - "contents": { - "type": "array", - "description": "An array of data entries. Each entry must contain a 'key' and exactly one corresponding typed 'value*' property.", - "items": { - "type": "object", - "description": "A single data entry. Exactly one 'value*' property should be provided alongside the key.", - "additionalProperties": false, - "properties": { - "key": { - "type": "string", - "description": "The key for this data entry." - }, - "valueString": { "type": "string" }, - "valueNumber": { "type": "number" }, - "valueBoolean": { "type": "boolean" }, - "valueMap": { - "description": "Represents a map as an adjacency list.", - "type": "array", - "items": { - "type": "object", - "description": "One entry in the map. Exactly one 'value*' property should be provided alongside the key.", - "additionalProperties": false, - "properties": { - "key": { "type": "string" }, - "valueString": { "type": "string" }, - "valueNumber": { "type": "number" }, - "valueBoolean": { "type": "boolean" } - }, - "required": ["key"] - } - } - }, - "required": ["key"] - } - } - }, - "required": ["contents", "surfaceId"] - }, - "deleteSurface": { - "type": "object", - "description": "Signals the client to delete the surface identified by 'surfaceId'.", - "additionalProperties": false, - "properties": { "surfaceId": { - "type": "string", - "description": "The unique identifier for the UI surface to be deleted." - } }, - "required": ["surfaceId"] - } - } + title: "A2UI Message Schema", + description: + "Describes a JSON payload for an A2UI (Agent to UI) message, which is used to dynamically construct and update user interfaces. A message MUST contain exactly ONE of the action properties: 'beginRendering', 'surfaceUpdate', 'dataModelUpdate', or 'deleteSurface'.", + type: "object", + additionalProperties: false, + properties: { + beginRendering: { + type: "object", + description: + "Signals the client to begin rendering a surface with a root component and specific styles.", + additionalProperties: false, + properties: { + surfaceId: { + type: "string", + description: "The unique identifier for the UI surface to be rendered.", + }, + root: { + type: "string", + description: "The ID of the root component to render.", + }, + styles: { + type: "object", + description: "Styling information for the UI.", + additionalProperties: false, + properties: { + font: { + type: "string", + description: "The primary font for the UI.", + }, + primaryColor: { + type: "string", + description: "The primary UI color as a hexadecimal code (e.g., '#00BFFF').", + pattern: "^#[0-9a-fA-F]{6}$", + }, + }, + }, + }, + required: ["root", "surfaceId"], + }, + surfaceUpdate: { + type: "object", + description: "Updates a surface with a new set of components.", + additionalProperties: false, + properties: { + surfaceId: { + type: "string", + description: + "The unique identifier for the UI surface to be updated. If you are adding a new surface this *must* be a new, unique identified that has never been used for any existing surfaces shown.", + }, + components: { + type: "array", + description: "A list containing all UI components for the surface.", + minItems: 1, + items: { + type: "object", + description: + "Represents a *single* component in a UI widget tree. This component could be one of many supported types.", + additionalProperties: false, + properties: { + id: { + type: "string", + description: "The unique identifier for this component.", + }, + weight: { + type: "number", + description: + "The relative weight of this component within a Row or Column. This corresponds to the CSS 'flex-grow' property. Note: this may ONLY be set when the component is a direct descendant of a Row or Column.", + }, + component: { + type: "object", + description: + "A wrapper object that MUST contain exactly one key, which is the name of the component type (e.g., 'Heading'). The value is an object containing the properties for that specific component.", + additionalProperties: false, + properties: { + Text: { + type: "object", + additionalProperties: false, + properties: { + text: { + type: "object", + description: + "The text content to display. This can be a literal string or a reference to a value in the data model ('path', e.g., '/doc/title'). While simple Markdown formatting is supported (i.e. without HTML, images, or links), utilizing dedicated UI components is generally preferred for a richer and more structured presentation.", + additionalProperties: false, + properties: { + literalString: { type: "string" }, + path: { type: "string" }, + }, + }, + usageHint: { + type: "string", + description: + "A hint for the base text style. One of:\n- `h1`: Largest heading.\n- `h2`: Second largest heading.\n- `h3`: Third largest heading.\n- `h4`: Fourth largest heading.\n- `h5`: Fifth largest heading.\n- `caption`: Small text for captions.\n- `body`: Standard body text.", + enum: ["h1", "h2", "h3", "h4", "h5", "caption", "body"], + }, + }, + required: ["text"], + }, + Image: { + type: "object", + additionalProperties: false, + properties: { + url: { + type: "object", + description: + "The URL of the image to display. This can be a literal string ('literal') or a reference to a value in the data model ('path', e.g. '/thumbnail/url').", + additionalProperties: false, + properties: { + literalString: { type: "string" }, + path: { type: "string" }, + }, + }, + fit: { + type: "string", + description: + "Specifies how the image should be resized to fit its container. This corresponds to the CSS 'object-fit' property.", + enum: ["contain", "cover", "fill", "none", "scale-down"], + }, + usageHint: { + type: "string", + description: + "A hint for the image size and style. One of:\n- `icon`: Small square icon.\n- `avatar`: Circular avatar image.\n- `smallFeature`: Small feature image.\n- `mediumFeature`: Medium feature image.\n- `largeFeature`: Large feature image.\n- `header`: Full-width, full bleed, header image.", + enum: [ + "icon", + "avatar", + "smallFeature", + "mediumFeature", + "largeFeature", + "header", + ], + }, + }, + required: ["url"], + }, + Icon: { + type: "object", + additionalProperties: false, + properties: { + name: { + type: "object", + description: + "The name of the icon to display. This can be a literal string or a reference to a value in the data model ('path', e.g. '/form/submit').", + additionalProperties: false, + properties: { + literalString: { + type: "string", + enum: [ + "accountCircle", + "add", + "arrowBack", + "arrowForward", + "attachFile", + "calendarToday", + "call", + "camera", + "check", + "close", + "delete", + "download", + "edit", + "event", + "error", + "favorite", + "favoriteOff", + "folder", + "help", + "home", + "info", + "locationOn", + "lock", + "lockOpen", + "mail", + "menu", + "moreVert", + "moreHoriz", + "notificationsOff", + "notifications", + "payment", + "person", + "phone", + "photo", + "print", + "refresh", + "search", + "send", + "settings", + "share", + "shoppingCart", + "star", + "starHalf", + "starOff", + "upload", + "visibility", + "visibilityOff", + "warning", + ], + }, + path: { type: "string" }, + }, + }, + }, + required: ["name"], + }, + Video: { + type: "object", + additionalProperties: false, + properties: { + url: { + type: "object", + description: + "The URL of the video to display. This can be a literal string or a reference to a value in the data model ('path', e.g. '/video/url').", + additionalProperties: false, + properties: { + literalString: { type: "string" }, + path: { type: "string" }, + }, + }, + }, + required: ["url"], + }, + AudioPlayer: { + type: "object", + additionalProperties: false, + properties: { + url: { + type: "object", + description: + "The URL of the audio to be played. This can be a literal string ('literal') or a reference to a value in the data model ('path', e.g. '/song/url').", + additionalProperties: false, + properties: { + literalString: { type: "string" }, + path: { type: "string" }, + }, + }, + description: { + type: "object", + description: + "A description of the audio, such as a title or summary. This can be a literal string or a reference to a value in the data model ('path', e.g. '/song/title').", + additionalProperties: false, + properties: { + literalString: { type: "string" }, + path: { type: "string" }, + }, + }, + }, + required: ["url"], + }, + Row: { + type: "object", + additionalProperties: false, + properties: { + children: { + type: "object", + description: + "Defines the children. Use 'explicitList' for a fixed set of children, or 'template' to generate children from a data list.", + additionalProperties: false, + properties: { + explicitList: { + type: "array", + items: { type: "string" }, + }, + template: { + type: "object", + description: + "A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.", + additionalProperties: false, + properties: { + componentId: { type: "string" }, + dataBinding: { type: "string" }, + }, + required: ["componentId", "dataBinding"], + }, + }, + }, + distribution: { + type: "string", + description: + "Defines the arrangement of children along the main axis (horizontally). This corresponds to the CSS 'justify-content' property.", + enum: [ + "center", + "end", + "spaceAround", + "spaceBetween", + "spaceEvenly", + "start", + ], + }, + alignment: { + type: "string", + description: + "Defines the alignment of children along the cross axis (vertically). This corresponds to the CSS 'align-items' property.", + enum: ["start", "center", "end", "stretch"], + }, + }, + required: ["children"], + }, + Column: { + type: "object", + additionalProperties: false, + properties: { + children: { + type: "object", + description: + "Defines the children. Use 'explicitList' for a fixed set of children, or 'template' to generate children from a data list.", + additionalProperties: false, + properties: { + explicitList: { + type: "array", + items: { type: "string" }, + }, + template: { + type: "object", + description: + "A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.", + additionalProperties: false, + properties: { + componentId: { type: "string" }, + dataBinding: { type: "string" }, + }, + required: ["componentId", "dataBinding"], + }, + }, + }, + distribution: { + type: "string", + description: + "Defines the arrangement of children along the main axis (vertically). This corresponds to the CSS 'justify-content' property.", + enum: [ + "start", + "center", + "end", + "spaceBetween", + "spaceAround", + "spaceEvenly", + ], + }, + alignment: { + type: "string", + description: + "Defines the alignment of children along the cross axis (horizontally). This corresponds to the CSS 'align-items' property.", + enum: ["center", "end", "start", "stretch"], + }, + }, + required: ["children"], + }, + List: { + type: "object", + additionalProperties: false, + properties: { + children: { + type: "object", + description: + "Defines the children. Use 'explicitList' for a fixed set of children, or 'template' to generate children from a data list.", + additionalProperties: false, + properties: { + explicitList: { + type: "array", + items: { type: "string" }, + }, + template: { + type: "object", + description: + "A template for generating a dynamic list of children from a data model list. `componentId` is the component to use as a template, and `dataBinding` is the path to the map of components in the data model. Values in the map will define the list of children.", + additionalProperties: false, + properties: { + componentId: { type: "string" }, + dataBinding: { type: "string" }, + }, + required: ["componentId", "dataBinding"], + }, + }, + }, + direction: { + type: "string", + description: "The direction in which the list items are laid out.", + enum: ["vertical", "horizontal"], + }, + alignment: { + type: "string", + description: "Defines the alignment of children along the cross axis.", + enum: ["start", "center", "end", "stretch"], + }, + }, + required: ["children"], + }, + Card: { + type: "object", + additionalProperties: false, + properties: { + child: { + type: "string", + description: "The ID of the component to be rendered inside the card.", + }, + }, + required: ["child"], + }, + Tabs: { + type: "object", + additionalProperties: false, + properties: { + tabItems: { + type: "array", + description: + "An array of objects, where each object defines a tab with a title and a child component.", + items: { + type: "object", + additionalProperties: false, + properties: { + title: { + type: "object", + description: + "The tab title. Defines the value as either a literal value or a path to data model value (e.g. '/options/title').", + additionalProperties: false, + properties: { + literalString: { type: "string" }, + path: { type: "string" }, + }, + }, + child: { type: "string" }, + }, + required: ["title", "child"], + }, + }, + }, + required: ["tabItems"], + }, + Divider: { + type: "object", + additionalProperties: false, + properties: { + axis: { + type: "string", + description: "The orientation of the divider.", + enum: ["horizontal", "vertical"], + }, + }, + }, + Modal: { + type: "object", + additionalProperties: false, + properties: { + entryPointChild: { + type: "string", + description: + "The ID of the component that opens the modal when interacted with (e.g., a button).", + }, + contentChild: { + type: "string", + description: "The ID of the component to be displayed inside the modal.", + }, + }, + required: ["entryPointChild", "contentChild"], + }, + Button: { + type: "object", + additionalProperties: false, + properties: { + child: { + type: "string", + description: + "The ID of the component to display in the button, typically a Text component.", + }, + primary: { + type: "boolean", + description: + "Indicates if this button should be styled as the primary action.", + }, + action: { + type: "object", + description: + "The client-side action to be dispatched when the button is clicked. It includes the action's name and an optional context payload.", + additionalProperties: false, + properties: { + name: { type: "string" }, + context: { + type: "array", + items: { + type: "object", + additionalProperties: false, + properties: { + key: { type: "string" }, + value: { + type: "object", + description: + "Defines the value to be included in the context as either a literal value or a path to a data model value (e.g. '/user/name').", + additionalProperties: false, + properties: { + path: { type: "string" }, + literalString: { type: "string" }, + literalNumber: { type: "number" }, + literalBoolean: { type: "boolean" }, + }, + }, + }, + required: ["key", "value"], + }, + }, + }, + required: ["name"], + }, + }, + required: ["child", "action"], + }, + CheckBox: { + type: "object", + additionalProperties: false, + properties: { + label: { + type: "object", + description: + "The text to display next to the checkbox. Defines the value as either a literal value or a path to data model ('path', e.g. '/option/label').", + additionalProperties: false, + properties: { + literalString: { type: "string" }, + path: { type: "string" }, + }, + }, + value: { + type: "object", + description: + "The current state of the checkbox (true for checked, false for unchecked). This can be a literal boolean ('literalBoolean') or a reference to a value in the data model ('path', e.g. '/filter/open').", + additionalProperties: false, + properties: { + literalBoolean: { type: "boolean" }, + path: { type: "string" }, + }, + }, + }, + required: ["label", "value"], + }, + TextField: { + type: "object", + additionalProperties: false, + properties: { + label: { + type: "object", + description: + "The text label for the input field. This can be a literal string or a reference to a value in the data model ('path, e.g. '/user/name').", + additionalProperties: false, + properties: { + literalString: { type: "string" }, + path: { type: "string" }, + }, + }, + text: { + type: "object", + description: + "The value of the text field. This can be a literal string or a reference to a value in the data model ('path', e.g. '/user/name').", + additionalProperties: false, + properties: { + literalString: { type: "string" }, + path: { type: "string" }, + }, + }, + textFieldType: { + type: "string", + description: "The type of input field to display.", + enum: ["date", "longText", "number", "shortText", "obscured"], + }, + validationRegexp: { + type: "string", + description: + "A regular expression used for client-side validation of the input.", + }, + }, + required: ["label"], + }, + DateTimeInput: { + type: "object", + additionalProperties: false, + properties: { + value: { + type: "object", + description: + "The selected date and/or time value. This can be a literal string ('literalString') or a reference to a value in the data model ('path', e.g. '/user/dob').", + additionalProperties: false, + properties: { + literalString: { type: "string" }, + path: { type: "string" }, + }, + }, + enableDate: { + type: "boolean", + description: "If true, allows the user to select a date.", + }, + enableTime: { + type: "boolean", + description: "If true, allows the user to select a time.", + }, + outputFormat: { + type: "string", + description: + "The desired format for the output string after a date or time is selected.", + }, + }, + required: ["value"], + }, + MultipleChoice: { + type: "object", + additionalProperties: false, + properties: { + selections: { + type: "object", + description: + "The currently selected values for the component. This can be a literal array of strings or a path to an array in the data model('path', e.g. '/hotel/options').", + additionalProperties: false, + properties: { + literalArray: { + type: "array", + items: { type: "string" }, + }, + path: { type: "string" }, + }, + }, + options: { + type: "array", + description: "An array of available options for the user to choose from.", + items: { + type: "object", + additionalProperties: false, + properties: { + label: { + type: "object", + description: + "The text to display for this option. This can be a literal string or a reference to a value in the data model (e.g. '/option/label').", + additionalProperties: false, + properties: { + literalString: { type: "string" }, + path: { type: "string" }, + }, + }, + value: { + type: "string", + description: + "The value to be associated with this option when selected.", + }, + }, + required: ["label", "value"], + }, + }, + maxAllowedSelections: { + type: "integer", + description: + "The maximum number of options that the user is allowed to select.", + }, + }, + required: ["selections", "options"], + }, + Slider: { + type: "object", + additionalProperties: false, + properties: { + value: { + type: "object", + description: + "The current value of the slider. This can be a literal number ('literalNumber') or a reference to a value in the data model ('path', e.g. '/restaurant/cost').", + additionalProperties: false, + properties: { + literalNumber: { type: "number" }, + path: { type: "string" }, + }, + }, + minValue: { + type: "number", + description: "The minimum value of the slider.", + }, + maxValue: { + type: "number", + description: "The maximum value of the slider.", + }, + }, + required: ["value"], + }, + }, + }, + }, + required: ["id", "component"], + }, + }, + }, + required: ["surfaceId", "components"], + }, + dataModelUpdate: { + type: "object", + description: "Updates the data model for a surface.", + additionalProperties: false, + properties: { + surfaceId: { + type: "string", + description: + "The unique identifier for the UI surface this data model update applies to.", + }, + path: { + type: "string", + description: + "An optional path to a location within the data model (e.g., '/user/name'). If omitted, or set to '/', the entire data model will be replaced.", + }, + contents: { + type: "array", + description: + "An array of data entries. Each entry must contain a 'key' and exactly one corresponding typed 'value*' property.", + items: { + type: "object", + description: + "A single data entry. Exactly one 'value*' property should be provided alongside the key.", + additionalProperties: false, + properties: { + key: { + type: "string", + description: "The key for this data entry.", + }, + valueString: { type: "string" }, + valueNumber: { type: "number" }, + valueBoolean: { type: "boolean" }, + valueMap: { + description: "Represents a map as an adjacency list.", + type: "array", + items: { + type: "object", + description: + "One entry in the map. Exactly one 'value*' property should be provided alongside the key.", + additionalProperties: false, + properties: { + key: { type: "string" }, + valueString: { type: "string" }, + valueNumber: { type: "number" }, + valueBoolean: { type: "boolean" }, + }, + required: ["key"], + }, + }, + }, + required: ["key"], + }, + }, + }, + required: ["contents", "surfaceId"], + }, + deleteSurface: { + type: "object", + description: "Signals the client to delete the surface identified by 'surfaceId'.", + additionalProperties: false, + properties: { + surfaceId: { + type: "string", + description: "The unique identifier for the UI surface to be deleted.", + }, + }, + required: ["surfaceId"], + }, + }, }; const Data = { - createSignalA2uiMessageProcessor: create, - A2uiMessageProcessor, - Guards: guards_exports + createSignalA2uiMessageProcessor: create, + A2uiMessageProcessor, + Guards: guards_exports, }; const Schemas = { A2UIClientEventMessage: server_to_client_with_standard_catalog_default }; /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ const t$1 = (t$7) => (e$14, o$15) => { - void 0 !== o$15 ? o$15.addInitializer(() => { - customElements.define(t$7, e$14); - }) : customElements.define(t$7, e$14); + void 0 !== o$15 + ? o$15.addInitializer(() => { + customElements.define(t$7, e$14); + }) + : customElements.define(t$7, e$14); }; /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ const o$9 = { - attribute: !0, - type: String, - converter: u$3, - reflect: !1, - hasChanged: f$3 -}, r$7 = (t$7 = o$9, e$14, r$12) => { - const { kind: n$13, metadata: i$10 } = r$12; - let s$9 = globalThis.litPropertyMetadata.get(i$10); - if (void 0 === s$9 && globalThis.litPropertyMetadata.set(i$10, s$9 = new Map()), "setter" === n$13 && ((t$7 = Object.create(t$7)).wrapped = !0), s$9.set(r$12.name, t$7), "accessor" === n$13) { - const { name: o$15 } = r$12; - return { - set(r$13) { - const n$14 = e$14.get.call(this); - e$14.set.call(this, r$13), this.requestUpdate(o$15, n$14, t$7, !0, r$13); - }, - init(e$15) { - return void 0 !== e$15 && this.C(o$15, void 0, t$7, e$15), e$15; - } - }; - } - if ("setter" === n$13) { - const { name: o$15 } = r$12; - return function(r$13) { - const n$14 = this[o$15]; - e$14.call(this, r$13), this.requestUpdate(o$15, n$14, t$7, !0, r$13); - }; - } - throw Error("Unsupported decorator location: " + n$13); -}; + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ const o$9 = { + attribute: !0, + type: String, + converter: u$3, + reflect: !1, + hasChanged: f$3, + }, + r$7 = (t$7 = o$9, e$14, r$12) => { + const { kind: n$13, metadata: i$10 } = r$12; + let s$9 = globalThis.litPropertyMetadata.get(i$10); + if ( + (void 0 === s$9 && globalThis.litPropertyMetadata.set(i$10, (s$9 = new Map())), + "setter" === n$13 && ((t$7 = Object.create(t$7)).wrapped = !0), + s$9.set(r$12.name, t$7), + "accessor" === n$13) + ) { + const { name: o$15 } = r$12; + return { + set(r$13) { + const n$14 = e$14.get.call(this); + (e$14.set.call(this, r$13), this.requestUpdate(o$15, n$14, t$7, !0, r$13)); + }, + init(e$15) { + return (void 0 !== e$15 && this.C(o$15, void 0, t$7, e$15), e$15); + }, + }; + } + if ("setter" === n$13) { + const { name: o$15 } = r$12; + return function (r$13) { + const n$14 = this[o$15]; + (e$14.call(this, r$13), this.requestUpdate(o$15, n$14, t$7, !0, r$13)); + }; + } + throw Error("Unsupported decorator location: " + n$13); + }; function n$6(t$7) { - return (e$14, o$15) => "object" == typeof o$15 ? r$7(t$7, e$14, o$15) : ((t$8, e$15, o$16) => { - const r$12 = e$15.hasOwnProperty(o$16); - return e$15.constructor.createProperty(o$16, t$8), r$12 ? Object.getOwnPropertyDescriptor(e$15, o$16) : void 0; - })(t$7, e$14, o$15); + return (e$14, o$15) => + "object" == typeof o$15 + ? r$7(t$7, e$14, o$15) + : ((t$8, e$15, o$16) => { + const r$12 = e$15.hasOwnProperty(o$16); + return ( + e$15.constructor.createProperty(o$16, t$8), + r$12 ? Object.getOwnPropertyDescriptor(e$15, o$16) : void 0 + ); + })(t$7, e$14, o$15); } /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ function r$6(r$12) { - return n$6({ - ...r$12, - state: !0, - attribute: !1 - }); + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ function r$6(r$12) { + return n$6({ + ...r$12, + state: !0, + attribute: !1, + }); } /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ function t(t$7) { - return (n$13, o$15) => { - const c$7 = "function" == typeof n$13 ? n$13 : n$13[o$15]; - Object.assign(c$7, t$7); - }; + return (n$13, o$15) => { + const c$7 = "function" == typeof n$13 ? n$13 : n$13[o$15]; + Object.assign(c$7, t$7); + }; } /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ -const e$6 = (e$14, t$7, c$7) => (c$7.configurable = !0, c$7.enumerable = !0, Reflect.decorate && "object" != typeof t$7 && Object.defineProperty(e$14, t$7, c$7), c$7); + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ +const e$6 = (e$14, t$7, c$7) => ( + (c$7.configurable = !0), + (c$7.enumerable = !0), + Reflect.decorate && "object" != typeof t$7 && Object.defineProperty(e$14, t$7, c$7), + c$7 +); /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ function e$5(e$14, r$12) { - return (n$13, s$9, i$10) => { - const o$15 = (t$7) => t$7.renderRoot?.querySelector(e$14) ?? null; - if (r$12) { - const { get: e$15, set: r$13 } = "object" == typeof s$9 ? n$13 : i$10 ?? (() => { - const t$7 = Symbol(); - return { - get() { - return this[t$7]; - }, - set(e$16) { - this[t$7] = e$16; - } - }; - })(); - return e$6(n$13, s$9, { get() { - let t$7 = e$15.call(this); - return void 0 === t$7 && (t$7 = o$15(this), (null !== t$7 || this.hasUpdated) && r$13.call(this, t$7)), t$7; - } }); - } - return e$6(n$13, s$9, { get() { - return o$15(this); - } }); - }; + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ function e$5(e$14, r$12) { + return (n$13, s$9, i$10) => { + const o$15 = (t$7) => t$7.renderRoot?.querySelector(e$14) ?? null; + if (r$12) { + const { get: e$15, set: r$13 } = + "object" == typeof s$9 + ? n$13 + : (i$10 ?? + (() => { + const t$7 = Symbol(); + return { + get() { + return this[t$7]; + }, + set(e$16) { + this[t$7] = e$16; + }, + }; + })()); + return e$6(n$13, s$9, { + get() { + let t$7 = e$15.call(this); + return ( + void 0 === t$7 && + ((t$7 = o$15(this)), (null !== t$7 || this.hasUpdated) && r$13.call(this, t$7)), + t$7 + ); + }, + }); + } + return e$6(n$13, s$9, { + get() { + return o$15(this); + }, + }); + }; } /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ let e$4; function r$5(r$12) { - return (n$13, o$15) => e$6(n$13, o$15, { get() { - return (this.renderRoot ?? (e$4 ??= document.createDocumentFragment())).querySelectorAll(r$12); - } }); + return (n$13, o$15) => + e$6(n$13, o$15, { + get() { + return (this.renderRoot ?? (e$4 ??= document.createDocumentFragment())).querySelectorAll( + r$12, + ); + }, + }); } /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ function r$4(r$12) { - return (n$13, e$14) => e$6(n$13, e$14, { async get() { - return await this.updateComplete, this.renderRoot?.querySelector(r$12) ?? null; - } }); + return (n$13, e$14) => + e$6(n$13, e$14, { + async get() { + return (await this.updateComplete, this.renderRoot?.querySelector(r$12) ?? null); + }, + }); } /** -* @license -* Copyright 2021 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ function o$8(o$15) { - return (e$14, n$13) => { - const { slot: r$12, selector: s$9 } = o$15 ?? {}, c$7 = "slot" + (r$12 ? `[name=${r$12}]` : ":not([name])"); - return e$6(e$14, n$13, { get() { - const t$7 = this.renderRoot?.querySelector(c$7), e$15 = t$7?.assignedElements(o$15) ?? []; - return void 0 === s$9 ? e$15 : e$15.filter((t$8) => t$8.matches(s$9)); - } }); - }; + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ function o$8(o$15) { + return (e$14, n$13) => { + const { slot: r$12, selector: s$9 } = o$15 ?? {}, + c$7 = "slot" + (r$12 ? `[name=${r$12}]` : ":not([name])"); + return e$6(e$14, n$13, { + get() { + const t$7 = this.renderRoot?.querySelector(c$7), + e$15 = t$7?.assignedElements(o$15) ?? []; + return void 0 === s$9 ? e$15 : e$15.filter((t$8) => t$8.matches(s$9)); + }, + }); + }; } /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ function n$5(n$13) { - return (o$15, r$12) => { - const { slot: e$14 } = n$13 ?? {}, s$9 = "slot" + (e$14 ? `[name=${e$14}]` : ":not([name])"); - return e$6(o$15, r$12, { get() { - const t$7 = this.renderRoot?.querySelector(s$9); - return t$7?.assignedNodes(n$13) ?? []; - } }); - }; + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ function n$5(n$13) { + return (o$15, r$12) => { + const { slot: e$14 } = n$13 ?? {}, + s$9 = "slot" + (e$14 ? `[name=${e$14}]` : ":not([name])"); + return e$6(o$15, r$12, { + get() { + const t$7 = this.renderRoot?.querySelector(s$9); + return t$7?.assignedNodes(n$13) ?? []; + }, + }); + }; } /** -* @license -* Copyright 2023 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ let i$2 = !1; + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ let i$2 = !1; const s$1 = new Signal.subtle.Watcher(() => { - i$2 || (i$2 = !0, queueMicrotask(() => { - i$2 = !1; - for (const t$7 of s$1.getPending()) t$7.get(); - s$1.watch(); - })); -}), h$3 = Symbol("SignalWatcherBrand"), e$3 = new FinalizationRegistry((i$10) => { - i$10.unwatch(...Signal.subtle.introspectSources(i$10)); -}), n$4 = new WeakMap(); + i$2 || + ((i$2 = !0), + queueMicrotask(() => { + i$2 = !1; + for (const t$7 of s$1.getPending()) t$7.get(); + s$1.watch(); + })); + }), + h$3 = Symbol("SignalWatcherBrand"), + e$3 = new FinalizationRegistry((i$10) => { + i$10.unwatch(...Signal.subtle.introspectSources(i$10)); + }), + n$4 = new WeakMap(); function o$7(i$10) { - return !0 === i$10[h$3] ? (console.warn("SignalWatcher should not be applied to the same class more than once."), i$10) : class extends i$10 { - constructor() { - super(...arguments), this._$St = new Map(), this._$So = new Signal.State(0), this._$Si = !1; - } - _$Sl() { - var t$7, i$11; - const s$9 = [], h$7 = []; - this._$St.forEach((t$8, i$12) => { - ((null == t$8 ? void 0 : t$8.beforeUpdate) ? s$9 : h$7).push(i$12); - }); - const e$14 = null === (t$7 = this.h) || void 0 === t$7 ? void 0 : t$7.getPending().filter((t$8) => t$8 !== this._$Su && !this._$St.has(t$8)); - s$9.forEach((t$8) => t$8.get()), null === (i$11 = this._$Su) || void 0 === i$11 || i$11.get(), e$14.forEach((t$8) => t$8.get()), h$7.forEach((t$8) => t$8.get()); - } - _$Sv() { - this.isUpdatePending || queueMicrotask(() => { - this.isUpdatePending || this._$Sl(); - }); - } - _$S_() { - if (void 0 !== this.h) return; - this._$Su = new Signal.Computed(() => { - this._$So.get(), super.performUpdate(); - }); - const i$11 = this.h = new Signal.subtle.Watcher(function() { - const t$7 = n$4.get(this); - void 0 !== t$7 && (!1 === t$7._$Si && (new Set(this.getPending()).has(t$7._$Su) ? t$7.requestUpdate() : t$7._$Sv()), this.watch()); - }); - n$4.set(i$11, this), e$3.register(this, i$11), i$11.watch(this._$Su), i$11.watch(...Array.from(this._$St).map(([t$7]) => t$7)); - } - _$Sp() { - if (void 0 === this.h) return; - let i$11 = !1; - this.h.unwatch(...Signal.subtle.introspectSources(this.h).filter((t$7) => { - var s$9; - const h$7 = !0 !== (null === (s$9 = this._$St.get(t$7)) || void 0 === s$9 ? void 0 : s$9.manualDispose); - return h$7 && this._$St.delete(t$7), i$11 || (i$11 = !h$7), h$7; - })), i$11 || (this._$Su = void 0, this.h = void 0, this._$St.clear()); - } - updateEffect(i$11, s$9) { - var h$7; - this._$S_(); - const e$14 = new Signal.Computed(() => { - i$11(); - }); - return this.h.watch(e$14), this._$St.set(e$14, s$9), null !== (h$7 = null == s$9 ? void 0 : s$9.beforeUpdate) && void 0 !== h$7 && h$7 ? Signal.subtle.untrack(() => e$14.get()) : this.updateComplete.then(() => Signal.subtle.untrack(() => e$14.get())), () => { - this._$St.delete(e$14), this.h.unwatch(e$14), !1 === this.isConnected && this._$Sp(); - }; - } - performUpdate() { - this.isUpdatePending && (this._$S_(), this._$Si = !0, this._$So.set(this._$So.get() + 1), this._$Si = !1, this._$Sl()); - } - connectedCallback() { - super.connectedCallback(), this.requestUpdate(); - } - disconnectedCallback() { - super.disconnectedCallback(), queueMicrotask(() => { - !1 === this.isConnected && this._$Sp(); - }); - } - }; + return !0 === i$10[h$3] + ? (console.warn("SignalWatcher should not be applied to the same class more than once."), i$10) + : class extends i$10 { + constructor() { + (super(...arguments), + (this._$St = new Map()), + (this._$So = new Signal.State(0)), + (this._$Si = !1)); + } + _$Sl() { + var t$7, i$11; + const s$9 = [], + h$7 = []; + this._$St.forEach((t$8, i$12) => { + ((null == t$8 ? void 0 : t$8.beforeUpdate) ? s$9 : h$7).push(i$12); + }); + const e$14 = + null === (t$7 = this.h) || void 0 === t$7 + ? void 0 + : t$7.getPending().filter((t$8) => t$8 !== this._$Su && !this._$St.has(t$8)); + (s$9.forEach((t$8) => t$8.get()), + null === (i$11 = this._$Su) || void 0 === i$11 || i$11.get(), + e$14.forEach((t$8) => t$8.get()), + h$7.forEach((t$8) => t$8.get())); + } + _$Sv() { + this.isUpdatePending || + queueMicrotask(() => { + this.isUpdatePending || this._$Sl(); + }); + } + _$S_() { + if (void 0 !== this.h) return; + this._$Su = new Signal.Computed(() => { + (this._$So.get(), super.performUpdate()); + }); + const i$11 = (this.h = new Signal.subtle.Watcher(function () { + const t$7 = n$4.get(this); + void 0 !== t$7 && + (!1 === t$7._$Si && + (new Set(this.getPending()).has(t$7._$Su) ? t$7.requestUpdate() : t$7._$Sv()), + this.watch()); + })); + (n$4.set(i$11, this), + e$3.register(this, i$11), + i$11.watch(this._$Su), + i$11.watch(...Array.from(this._$St).map(([t$7]) => t$7))); + } + _$Sp() { + if (void 0 === this.h) return; + let i$11 = !1; + (this.h.unwatch( + ...Signal.subtle.introspectSources(this.h).filter((t$7) => { + var s$9; + const h$7 = + !0 !== + (null === (s$9 = this._$St.get(t$7)) || void 0 === s$9 + ? void 0 + : s$9.manualDispose); + return (h$7 && this._$St.delete(t$7), i$11 || (i$11 = !h$7), h$7); + }), + ), + i$11 || ((this._$Su = void 0), (this.h = void 0), this._$St.clear())); + } + updateEffect(i$11, s$9) { + var h$7; + this._$S_(); + const e$14 = new Signal.Computed(() => { + i$11(); + }); + return ( + this.h.watch(e$14), + this._$St.set(e$14, s$9), + null !== (h$7 = null == s$9 ? void 0 : s$9.beforeUpdate) && void 0 !== h$7 && h$7 + ? Signal.subtle.untrack(() => e$14.get()) + : this.updateComplete.then(() => Signal.subtle.untrack(() => e$14.get())), + () => { + (this._$St.delete(e$14), + this.h.unwatch(e$14), + !1 === this.isConnected && this._$Sp()); + } + ); + } + performUpdate() { + this.isUpdatePending && + (this._$S_(), + (this._$Si = !0), + this._$So.set(this._$So.get() + 1), + (this._$Si = !1), + this._$Sl()); + } + connectedCallback() { + (super.connectedCallback(), this.requestUpdate()); + } + disconnectedCallback() { + (super.disconnectedCallback(), + queueMicrotask(() => { + !1 === this.isConnected && this._$Sp(); + })); + } + }; } /** -* @license -* Copyright 2017 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ const s = (i$10, t$7) => { - const e$14 = i$10._$AN; - if (void 0 === e$14) return !1; - for (const i$11 of e$14) i$11._$AO?.(t$7, !1), s(i$11, t$7); - return !0; -}, o$6 = (i$10) => { - let t$7, e$14; - do { - if (void 0 === (t$7 = i$10._$AM)) break; - e$14 = t$7._$AN, e$14.delete(i$10), i$10 = t$7; - } while (0 === e$14?.size); -}, r$3 = (i$10) => { - for (let t$7; t$7 = i$10._$AM; i$10 = t$7) { - let e$14 = t$7._$AN; - if (void 0 === e$14) t$7._$AN = e$14 = new Set(); - else if (e$14.has(i$10)) break; - e$14.add(i$10), c(t$7); - } -}; + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ const s = (i$10, t$7) => { + const e$14 = i$10._$AN; + if (void 0 === e$14) return !1; + for (const i$11 of e$14) (i$11._$AO?.(t$7, !1), s(i$11, t$7)); + return !0; + }, + o$6 = (i$10) => { + let t$7, e$14; + do { + if (void 0 === (t$7 = i$10._$AM)) break; + ((e$14 = t$7._$AN), e$14.delete(i$10), (i$10 = t$7)); + } while (0 === e$14?.size); + }, + r$3 = (i$10) => { + for (let t$7; (t$7 = i$10._$AM); i$10 = t$7) { + let e$14 = t$7._$AN; + if (void 0 === e$14) t$7._$AN = e$14 = new Set(); + else if (e$14.has(i$10)) break; + (e$14.add(i$10), c(t$7)); + } + }; function h$2(i$10) { - void 0 !== this._$AN ? (o$6(this), this._$AM = i$10, r$3(this)) : this._$AM = i$10; + void 0 !== this._$AN ? (o$6(this), (this._$AM = i$10), r$3(this)) : (this._$AM = i$10); } function n$3(i$10, t$7 = !1, e$14 = 0) { - const r$12 = this._$AH, h$7 = this._$AN; - if (void 0 !== h$7 && 0 !== h$7.size) if (t$7) if (Array.isArray(r$12)) for (let i$11 = e$14; i$11 < r$12.length; i$11++) s(r$12[i$11], !1), o$6(r$12[i$11]); - else null != r$12 && (s(r$12, !1), o$6(r$12)); - else s(this, i$10); + const r$12 = this._$AH, + h$7 = this._$AN; + if (void 0 !== h$7 && 0 !== h$7.size) + if (t$7) + if (Array.isArray(r$12)) + for (let i$11 = e$14; i$11 < r$12.length; i$11++) (s(r$12[i$11], !1), o$6(r$12[i$11])); + else null != r$12 && (s(r$12, !1), o$6(r$12)); + else s(this, i$10); } const c = (i$10) => { - i$10.type == t$4.CHILD && (i$10._$AP ??= n$3, i$10._$AQ ??= h$2); + i$10.type == t$4.CHILD && ((i$10._$AP ??= n$3), (i$10._$AQ ??= h$2)); }; var f = class extends i$5 { - constructor() { - super(...arguments), this._$AN = void 0; - } - _$AT(i$10, t$7, e$14) { - super._$AT(i$10, t$7, e$14), r$3(this), this.isConnected = i$10._$AU; - } - _$AO(i$10, t$7 = !0) { - i$10 !== this.isConnected && (this.isConnected = i$10, i$10 ? this.reconnected?.() : this.disconnected?.()), t$7 && (s(this, i$10), o$6(this)); - } - setValue(t$7) { - if (r$8(this._$Ct)) this._$Ct._$AI(t$7, this); - else { - const i$10 = [...this._$Ct._$AH]; - i$10[this._$Ci] = t$7, this._$Ct._$AI(i$10, this, 0); - } - } - disconnected() {} - reconnected() {} + constructor() { + (super(...arguments), (this._$AN = void 0)); + } + _$AT(i$10, t$7, e$14) { + (super._$AT(i$10, t$7, e$14), r$3(this), (this.isConnected = i$10._$AU)); + } + _$AO(i$10, t$7 = !0) { + (i$10 !== this.isConnected && + ((this.isConnected = i$10), i$10 ? this.reconnected?.() : this.disconnected?.()), + t$7 && (s(this, i$10), o$6(this))); + } + setValue(t$7) { + if (r$8(this._$Ct)) this._$Ct._$AI(t$7, this); + else { + const i$10 = [...this._$Ct._$AH]; + ((i$10[this._$Ci] = t$7), this._$Ct._$AI(i$10, this, 0)); + } + } + disconnected() {} + reconnected() {} }; /** -* @license -* Copyright 2023 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ let o$5 = !1; const n$2 = new Signal.subtle.Watcher(async () => { - o$5 || (o$5 = !0, queueMicrotask(() => { - o$5 = !1; - for (const i$10 of n$2.getPending()) i$10.get(); - n$2.watch(); - })); + o$5 || + ((o$5 = !0), + queueMicrotask(() => { + o$5 = !1; + for (const i$10 of n$2.getPending()) i$10.get(); + n$2.watch(); + })); }); var r$2 = class extends f { - _$S_() { - var i$10, t$7; - void 0 === this._$Sm && (this._$Sj = new Signal.Computed(() => { - var i$11; - const t$8 = null === (i$11 = this._$SW) || void 0 === i$11 ? void 0 : i$11.get(); - return this.setValue(t$8), t$8; - }), this._$Sm = null !== (t$7 = null === (i$10 = this._$Sk) || void 0 === i$10 ? void 0 : i$10.h) && void 0 !== t$7 ? t$7 : n$2, this._$Sm.watch(this._$Sj), Signal.subtle.untrack(() => { - var i$11; - return null === (i$11 = this._$Sj) || void 0 === i$11 ? void 0 : i$11.get(); - })); - } - _$Sp() { - void 0 !== this._$Sm && (this._$Sm.unwatch(this._$SW), this._$Sm = void 0); - } - render(i$10) { - return Signal.subtle.untrack(() => i$10.get()); - } - update(i$10, [t$7]) { - var o$15, n$13; - return null !== (o$15 = this._$Sk) && void 0 !== o$15 || (this._$Sk = null === (n$13 = i$10.options) || void 0 === n$13 ? void 0 : n$13.host), t$7 !== this._$SW && void 0 !== this._$SW && this._$Sp(), this._$SW = t$7, this._$S_(), Signal.subtle.untrack(() => this._$SW.get()); - } - disconnected() { - this._$Sp(); - } - reconnected() { - this._$S_(); - } + _$S_() { + var i$10, t$7; + void 0 === this._$Sm && + ((this._$Sj = new Signal.Computed(() => { + var i$11; + const t$8 = null === (i$11 = this._$SW) || void 0 === i$11 ? void 0 : i$11.get(); + return (this.setValue(t$8), t$8); + })), + (this._$Sm = + null !== (t$7 = null === (i$10 = this._$Sk) || void 0 === i$10 ? void 0 : i$10.h) && + void 0 !== t$7 + ? t$7 + : n$2), + this._$Sm.watch(this._$Sj), + Signal.subtle.untrack(() => { + var i$11; + return null === (i$11 = this._$Sj) || void 0 === i$11 ? void 0 : i$11.get(); + })); + } + _$Sp() { + void 0 !== this._$Sm && (this._$Sm.unwatch(this._$SW), (this._$Sm = void 0)); + } + render(i$10) { + return Signal.subtle.untrack(() => i$10.get()); + } + update(i$10, [t$7]) { + var o$15, n$13; + return ( + (null !== (o$15 = this._$Sk) && void 0 !== o$15) || + (this._$Sk = null === (n$13 = i$10.options) || void 0 === n$13 ? void 0 : n$13.host), + t$7 !== this._$SW && void 0 !== this._$SW && this._$Sp(), + (this._$SW = t$7), + this._$S_(), + Signal.subtle.untrack(() => this._$SW.get()) + ); + } + disconnected() { + this._$Sp(); + } + reconnected() { + this._$S_(); + } }; const h$1 = e$10(r$2); /** -* @license -* Copyright 2023 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ const m = (o$15) => (t$7, ...m$3) => o$15(t$7, ...m$3.map((o$16) => o$16 instanceof Signal.State || o$16 instanceof Signal.Computed ? h$1(o$16) : o$16)), l$1 = m(b), r$1 = m(w); + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ const m = + (o$15) => + (t$7, ...m$3) => + o$15( + t$7, + ...m$3.map((o$16) => + o$16 instanceof Signal.State || o$16 instanceof Signal.Computed ? h$1(o$16) : o$16, + ), + ), + l$1 = m(b), + r$1 = m(w); /** -* @license -* Copyright 2023 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ const l = Signal.State, o$4 = Signal.Computed, r = (l$5, o$15) => new Signal.State(l$5, o$15), i$1 = (l$5, o$15) => new Signal.Computed(l$5, o$15); + * @license + * Copyright 2023 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ const l = Signal.State, + o$4 = Signal.Computed, + r = (l$5, o$15) => new Signal.State(l$5, o$15), + i$1 = (l$5, o$15) => new Signal.Computed(l$5, o$15); /** -* @license -* Copyright 2021 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ + * @license + * Copyright 2021 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ function* o$3(o$15, f$4) { - if (void 0 !== o$15) { - let i$10 = 0; - for (const t$7 of o$15) yield f$4(t$7, i$10++); - } + if (void 0 !== o$15) { + let i$10 = 0; + for (const t$7 of o$15) yield f$4(t$7, i$10++); + } } let pending = false; let watcher = new Signal.subtle.Watcher(() => { - if (!pending) { - pending = true; - queueMicrotask(() => { - pending = false; - flushPending(); - }); - } + if (!pending) { + pending = true; + queueMicrotask(() => { + pending = false; + flushPending(); + }); + } }); function flushPending() { - for (const signal of watcher.getPending()) { - signal.get(); - } - watcher.watch(); + for (const signal of watcher.getPending()) { + signal.get(); + } + watcher.watch(); } /** -* ⚠️ WARNING: Nothing unwatches ⚠️ -* This will produce a memory leak. -*/ + * ⚠️ WARNING: Nothing unwatches ⚠️ + * This will produce a memory leak. + */ function effect(cb) { - let c$7 = new Signal.Computed(() => cb()); - watcher.watch(c$7); - c$7.get(); - return () => { - watcher.unwatch(c$7); - }; + let c$7 = new Signal.Computed(() => cb()); + watcher.watch(c$7); + c$7.get(); + return () => { + watcher.unwatch(c$7); + }; } const themeContext = n$7("A2UITheme"); @@ -4287,371 +5037,469 @@ const themeContext = n$7("A2UITheme"); const structuralStyles = r$11(structuralStyles$1); var ComponentRegistry = class { - constructor() { - this.registry = new Map(); - } - register(typeName, constructor, tagName) { - if (!/^[a-zA-Z0-9]+$/.test(typeName)) { - throw new Error(`[Registry] Invalid typeName '${typeName}'. Must be alphanumeric.`); - } - this.registry.set(typeName, constructor); - const actualTagName = tagName || `a2ui-custom-${typeName.toLowerCase()}`; - const existingName = customElements.getName(constructor); - if (existingName) { - if (existingName !== actualTagName) { - throw new Error(`Component ${typeName} is already registered as ${existingName}, but requested as ${actualTagName}.`); - } - return; - } - if (!customElements.get(actualTagName)) { - customElements.define(actualTagName, constructor); - } - } - get(typeName) { - return this.registry.get(typeName); - } + constructor() { + this.registry = new Map(); + } + register(typeName, constructor, tagName) { + if (!/^[a-zA-Z0-9]+$/.test(typeName)) { + throw new Error(`[Registry] Invalid typeName '${typeName}'. Must be alphanumeric.`); + } + this.registry.set(typeName, constructor); + const actualTagName = tagName || `a2ui-custom-${typeName.toLowerCase()}`; + const existingName = customElements.getName(constructor); + if (existingName) { + if (existingName !== actualTagName) { + throw new Error( + `Component ${typeName} is already registered as ${existingName}, but requested as ${actualTagName}.`, + ); + } + return; + } + if (!customElements.get(actualTagName)) { + customElements.define(actualTagName, constructor); + } + } + get(typeName) { + return this.registry.get(typeName); + } }; const componentRegistry = new ComponentRegistry(); -var __runInitializers$19 = void 0 && (void 0).__runInitializers || function(thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i$10 = 0; i$10 < initializers.length; i$10++) { - value = useValue ? initializers[i$10].call(thisArg, value) : initializers[i$10].call(thisArg); - } - return useValue ? value : void 0; -}; -var __esDecorate$19 = void 0 && (void 0).__esDecorate || function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f$4) { - if (f$4 !== void 0 && typeof f$4 !== "function") throw new TypeError("Function expected"); - return f$4; - } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _$1, done = false; - for (var i$10 = decorators.length - 1; i$10 >= 0; i$10--) { - var context = {}; - for (var p$3 in contextIn) context[p$3] = p$3 === "access" ? {} : contextIn[p$3]; - for (var p$3 in contextIn.access) context.access[p$3] = contextIn.access[p$3]; - context.addInitializer = function(f$4) { - if (done) throw new TypeError("Cannot add initializers after decoration has completed"); - extraInitializers.push(accept(f$4 || null)); - }; - var result = (0, decorators[i$10])(kind === "accessor" ? { - get: descriptor.get, - set: descriptor.set - } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_$1 = accept(result.get)) descriptor.get = _$1; - if (_$1 = accept(result.set)) descriptor.set = _$1; - if (_$1 = accept(result.init)) initializers.unshift(_$1); - } else if (_$1 = accept(result)) { - if (kind === "field") initializers.unshift(_$1); - else descriptor[key] = _$1; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; -}; +var __runInitializers$19 = + (void 0 && (void 0).__runInitializers) || + function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i$10 = 0; i$10 < initializers.length; i$10++) { + value = useValue ? initializers[i$10].call(thisArg, value) : initializers[i$10].call(thisArg); + } + return useValue ? value : void 0; + }; +var __esDecorate$19 = + (void 0 && (void 0).__esDecorate) || + function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f$4) { + if (f$4 !== void 0 && typeof f$4 !== "function") throw new TypeError("Function expected"); + return f$4; + } + var kind = contextIn.kind, + key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? (contextIn["static"] ? ctor : ctor.prototype) : null; + var descriptor = + descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _$1, + done = false; + for (var i$10 = decorators.length - 1; i$10 >= 0; i$10--) { + var context = {}; + for (var p$3 in contextIn) context[p$3] = p$3 === "access" ? {} : contextIn[p$3]; + for (var p$3 in contextIn.access) context.access[p$3] = contextIn.access[p$3]; + context.addInitializer = function (f$4) { + if (done) throw new TypeError("Cannot add initializers after decoration has completed"); + extraInitializers.push(accept(f$4 || null)); + }; + var result = (0, decorators[i$10])( + kind === "accessor" + ? { + get: descriptor.get, + set: descriptor.set, + } + : descriptor[key], + context, + ); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if ((_$1 = accept(result.get))) descriptor.get = _$1; + if ((_$1 = accept(result.set))) descriptor.set = _$1; + if ((_$1 = accept(result.init))) initializers.unshift(_$1); + } else if ((_$1 = accept(result))) { + if (kind === "field") initializers.unshift(_$1); + else descriptor[key] = _$1; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; + }; let Root = (() => { - let _classDecorators = [t$1("a2ui-root")]; - let _classDescriptor; - let _classExtraInitializers = []; - let _classThis; - let _classSuper = o$7(i$6); - let _instanceExtraInitializers = []; - let _surfaceId_decorators; - let _surfaceId_initializers = []; - let _surfaceId_extraInitializers = []; - let _component_decorators; - let _component_initializers = []; - let _component_extraInitializers = []; - let _theme_decorators; - let _theme_initializers = []; - let _theme_extraInitializers = []; - let _childComponents_decorators; - let _childComponents_initializers = []; - let _childComponents_extraInitializers = []; - let _processor_decorators; - let _processor_initializers = []; - let _processor_extraInitializers = []; - let _dataContextPath_decorators; - let _dataContextPath_initializers = []; - let _dataContextPath_extraInitializers = []; - let _enableCustomElements_decorators; - let _enableCustomElements_initializers = []; - let _enableCustomElements_extraInitializers = []; - let _set_weight_decorators; - var Root$1 = class extends _classSuper { - static { - _classThis = this; - } - static { - const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0; - _surfaceId_decorators = [n$6()]; - _component_decorators = [n$6()]; - _theme_decorators = [c$1({ context: themeContext })]; - _childComponents_decorators = [n$6({ attribute: false })]; - _processor_decorators = [n$6({ attribute: false })]; - _dataContextPath_decorators = [n$6()]; - _enableCustomElements_decorators = [n$6()]; - _set_weight_decorators = [n$6()]; - __esDecorate$19(this, null, _surfaceId_decorators, { - kind: "accessor", - name: "surfaceId", - static: false, - private: false, - access: { - has: (obj) => "surfaceId" in obj, - get: (obj) => obj.surfaceId, - set: (obj, value) => { - obj.surfaceId = value; - } - }, - metadata: _metadata - }, _surfaceId_initializers, _surfaceId_extraInitializers); - __esDecorate$19(this, null, _component_decorators, { - kind: "accessor", - name: "component", - static: false, - private: false, - access: { - has: (obj) => "component" in obj, - get: (obj) => obj.component, - set: (obj, value) => { - obj.component = value; - } - }, - metadata: _metadata - }, _component_initializers, _component_extraInitializers); - __esDecorate$19(this, null, _theme_decorators, { - kind: "accessor", - name: "theme", - static: false, - private: false, - access: { - has: (obj) => "theme" in obj, - get: (obj) => obj.theme, - set: (obj, value) => { - obj.theme = value; - } - }, - metadata: _metadata - }, _theme_initializers, _theme_extraInitializers); - __esDecorate$19(this, null, _childComponents_decorators, { - kind: "accessor", - name: "childComponents", - static: false, - private: false, - access: { - has: (obj) => "childComponents" in obj, - get: (obj) => obj.childComponents, - set: (obj, value) => { - obj.childComponents = value; - } - }, - metadata: _metadata - }, _childComponents_initializers, _childComponents_extraInitializers); - __esDecorate$19(this, null, _processor_decorators, { - kind: "accessor", - name: "processor", - static: false, - private: false, - access: { - has: (obj) => "processor" in obj, - get: (obj) => obj.processor, - set: (obj, value) => { - obj.processor = value; - } - }, - metadata: _metadata - }, _processor_initializers, _processor_extraInitializers); - __esDecorate$19(this, null, _dataContextPath_decorators, { - kind: "accessor", - name: "dataContextPath", - static: false, - private: false, - access: { - has: (obj) => "dataContextPath" in obj, - get: (obj) => obj.dataContextPath, - set: (obj, value) => { - obj.dataContextPath = value; - } - }, - metadata: _metadata - }, _dataContextPath_initializers, _dataContextPath_extraInitializers); - __esDecorate$19(this, null, _enableCustomElements_decorators, { - kind: "accessor", - name: "enableCustomElements", - static: false, - private: false, - access: { - has: (obj) => "enableCustomElements" in obj, - get: (obj) => obj.enableCustomElements, - set: (obj, value) => { - obj.enableCustomElements = value; - } - }, - metadata: _metadata - }, _enableCustomElements_initializers, _enableCustomElements_extraInitializers); - __esDecorate$19(this, null, _set_weight_decorators, { - kind: "setter", - name: "weight", - static: false, - private: false, - access: { - has: (obj) => "weight" in obj, - set: (obj, value) => { - obj.weight = value; - } - }, - metadata: _metadata - }, null, _instanceExtraInitializers); - __esDecorate$19(null, _classDescriptor = { value: _classThis }, _classDecorators, { - kind: "class", - name: _classThis.name, - metadata: _metadata - }, null, _classExtraInitializers); - Root$1 = _classThis = _classDescriptor.value; - if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { - enumerable: true, - configurable: true, - writable: true, - value: _metadata - }); - } - #surfaceId_accessor_storage = (__runInitializers$19(this, _instanceExtraInitializers), __runInitializers$19(this, _surfaceId_initializers, null)); - get surfaceId() { - return this.#surfaceId_accessor_storage; - } - set surfaceId(value) { - this.#surfaceId_accessor_storage = value; - } - #component_accessor_storage = (__runInitializers$19(this, _surfaceId_extraInitializers), __runInitializers$19(this, _component_initializers, null)); - get component() { - return this.#component_accessor_storage; - } - set component(value) { - this.#component_accessor_storage = value; - } - #theme_accessor_storage = (__runInitializers$19(this, _component_extraInitializers), __runInitializers$19(this, _theme_initializers, void 0)); - get theme() { - return this.#theme_accessor_storage; - } - set theme(value) { - this.#theme_accessor_storage = value; - } - #childComponents_accessor_storage = (__runInitializers$19(this, _theme_extraInitializers), __runInitializers$19(this, _childComponents_initializers, null)); - get childComponents() { - return this.#childComponents_accessor_storage; - } - set childComponents(value) { - this.#childComponents_accessor_storage = value; - } - #processor_accessor_storage = (__runInitializers$19(this, _childComponents_extraInitializers), __runInitializers$19(this, _processor_initializers, null)); - get processor() { - return this.#processor_accessor_storage; - } - set processor(value) { - this.#processor_accessor_storage = value; - } - #dataContextPath_accessor_storage = (__runInitializers$19(this, _processor_extraInitializers), __runInitializers$19(this, _dataContextPath_initializers, "")); - get dataContextPath() { - return this.#dataContextPath_accessor_storage; - } - set dataContextPath(value) { - this.#dataContextPath_accessor_storage = value; - } - #enableCustomElements_accessor_storage = (__runInitializers$19(this, _dataContextPath_extraInitializers), __runInitializers$19(this, _enableCustomElements_initializers, false)); - get enableCustomElements() { - return this.#enableCustomElements_accessor_storage; - } - set enableCustomElements(value) { - this.#enableCustomElements_accessor_storage = value; - } - set weight(weight) { - this.#weight = weight; - this.style.setProperty("--weight", `${weight}`); - } - get weight() { - return this.#weight; - } - #weight = (__runInitializers$19(this, _enableCustomElements_extraInitializers), 1); - static { - this.styles = [structuralStyles, i$9` + let _classDecorators = [t$1("a2ui-root")]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = o$7(i$6); + let _instanceExtraInitializers = []; + let _surfaceId_decorators; + let _surfaceId_initializers = []; + let _surfaceId_extraInitializers = []; + let _component_decorators; + let _component_initializers = []; + let _component_extraInitializers = []; + let _theme_decorators; + let _theme_initializers = []; + let _theme_extraInitializers = []; + let _childComponents_decorators; + let _childComponents_initializers = []; + let _childComponents_extraInitializers = []; + let _processor_decorators; + let _processor_initializers = []; + let _processor_extraInitializers = []; + let _dataContextPath_decorators; + let _dataContextPath_initializers = []; + let _dataContextPath_extraInitializers = []; + let _enableCustomElements_decorators; + let _enableCustomElements_initializers = []; + let _enableCustomElements_extraInitializers = []; + let _set_weight_decorators; + var Root$1 = class extends _classSuper { + static { + _classThis = this; + } + static { + const _metadata = + typeof Symbol === "function" && Symbol.metadata + ? Object.create(_classSuper[Symbol.metadata] ?? null) + : void 0; + _surfaceId_decorators = [n$6()]; + _component_decorators = [n$6()]; + _theme_decorators = [c$1({ context: themeContext })]; + _childComponents_decorators = [n$6({ attribute: false })]; + _processor_decorators = [n$6({ attribute: false })]; + _dataContextPath_decorators = [n$6()]; + _enableCustomElements_decorators = [n$6()]; + _set_weight_decorators = [n$6()]; + __esDecorate$19( + this, + null, + _surfaceId_decorators, + { + kind: "accessor", + name: "surfaceId", + static: false, + private: false, + access: { + has: (obj) => "surfaceId" in obj, + get: (obj) => obj.surfaceId, + set: (obj, value) => { + obj.surfaceId = value; + }, + }, + metadata: _metadata, + }, + _surfaceId_initializers, + _surfaceId_extraInitializers, + ); + __esDecorate$19( + this, + null, + _component_decorators, + { + kind: "accessor", + name: "component", + static: false, + private: false, + access: { + has: (obj) => "component" in obj, + get: (obj) => obj.component, + set: (obj, value) => { + obj.component = value; + }, + }, + metadata: _metadata, + }, + _component_initializers, + _component_extraInitializers, + ); + __esDecorate$19( + this, + null, + _theme_decorators, + { + kind: "accessor", + name: "theme", + static: false, + private: false, + access: { + has: (obj) => "theme" in obj, + get: (obj) => obj.theme, + set: (obj, value) => { + obj.theme = value; + }, + }, + metadata: _metadata, + }, + _theme_initializers, + _theme_extraInitializers, + ); + __esDecorate$19( + this, + null, + _childComponents_decorators, + { + kind: "accessor", + name: "childComponents", + static: false, + private: false, + access: { + has: (obj) => "childComponents" in obj, + get: (obj) => obj.childComponents, + set: (obj, value) => { + obj.childComponents = value; + }, + }, + metadata: _metadata, + }, + _childComponents_initializers, + _childComponents_extraInitializers, + ); + __esDecorate$19( + this, + null, + _processor_decorators, + { + kind: "accessor", + name: "processor", + static: false, + private: false, + access: { + has: (obj) => "processor" in obj, + get: (obj) => obj.processor, + set: (obj, value) => { + obj.processor = value; + }, + }, + metadata: _metadata, + }, + _processor_initializers, + _processor_extraInitializers, + ); + __esDecorate$19( + this, + null, + _dataContextPath_decorators, + { + kind: "accessor", + name: "dataContextPath", + static: false, + private: false, + access: { + has: (obj) => "dataContextPath" in obj, + get: (obj) => obj.dataContextPath, + set: (obj, value) => { + obj.dataContextPath = value; + }, + }, + metadata: _metadata, + }, + _dataContextPath_initializers, + _dataContextPath_extraInitializers, + ); + __esDecorate$19( + this, + null, + _enableCustomElements_decorators, + { + kind: "accessor", + name: "enableCustomElements", + static: false, + private: false, + access: { + has: (obj) => "enableCustomElements" in obj, + get: (obj) => obj.enableCustomElements, + set: (obj, value) => { + obj.enableCustomElements = value; + }, + }, + metadata: _metadata, + }, + _enableCustomElements_initializers, + _enableCustomElements_extraInitializers, + ); + __esDecorate$19( + this, + null, + _set_weight_decorators, + { + kind: "setter", + name: "weight", + static: false, + private: false, + access: { + has: (obj) => "weight" in obj, + set: (obj, value) => { + obj.weight = value; + }, + }, + metadata: _metadata, + }, + null, + _instanceExtraInitializers, + ); + __esDecorate$19( + null, + (_classDescriptor = { value: _classThis }), + _classDecorators, + { + kind: "class", + name: _classThis.name, + metadata: _metadata, + }, + null, + _classExtraInitializers, + ); + Root$1 = _classThis = _classDescriptor.value; + if (_metadata) + Object.defineProperty(_classThis, Symbol.metadata, { + enumerable: true, + configurable: true, + writable: true, + value: _metadata, + }); + } + #surfaceId_accessor_storage = + (__runInitializers$19(this, _instanceExtraInitializers), + __runInitializers$19(this, _surfaceId_initializers, null)); + get surfaceId() { + return this.#surfaceId_accessor_storage; + } + set surfaceId(value) { + this.#surfaceId_accessor_storage = value; + } + #component_accessor_storage = + (__runInitializers$19(this, _surfaceId_extraInitializers), + __runInitializers$19(this, _component_initializers, null)); + get component() { + return this.#component_accessor_storage; + } + set component(value) { + this.#component_accessor_storage = value; + } + #theme_accessor_storage = + (__runInitializers$19(this, _component_extraInitializers), + __runInitializers$19(this, _theme_initializers, void 0)); + get theme() { + return this.#theme_accessor_storage; + } + set theme(value) { + this.#theme_accessor_storage = value; + } + #childComponents_accessor_storage = + (__runInitializers$19(this, _theme_extraInitializers), + __runInitializers$19(this, _childComponents_initializers, null)); + get childComponents() { + return this.#childComponents_accessor_storage; + } + set childComponents(value) { + this.#childComponents_accessor_storage = value; + } + #processor_accessor_storage = + (__runInitializers$19(this, _childComponents_extraInitializers), + __runInitializers$19(this, _processor_initializers, null)); + get processor() { + return this.#processor_accessor_storage; + } + set processor(value) { + this.#processor_accessor_storage = value; + } + #dataContextPath_accessor_storage = + (__runInitializers$19(this, _processor_extraInitializers), + __runInitializers$19(this, _dataContextPath_initializers, "")); + get dataContextPath() { + return this.#dataContextPath_accessor_storage; + } + set dataContextPath(value) { + this.#dataContextPath_accessor_storage = value; + } + #enableCustomElements_accessor_storage = + (__runInitializers$19(this, _dataContextPath_extraInitializers), + __runInitializers$19(this, _enableCustomElements_initializers, false)); + get enableCustomElements() { + return this.#enableCustomElements_accessor_storage; + } + set enableCustomElements(value) { + this.#enableCustomElements_accessor_storage = value; + } + set weight(weight) { + this.#weight = weight; + this.style.setProperty("--weight", `${weight}`); + } + get weight() { + return this.#weight; + } + #weight = (__runInitializers$19(this, _enableCustomElements_extraInitializers), 1); + static { + this.styles = [ + structuralStyles, + i$9` :host { display: flex; flex-direction: column; gap: 8px; max-height: 80%; } - `]; - } - /** - * Holds the cleanup function for our effect. - * We need this to stop the effect when the component is disconnected. - */ - #lightDomEffectDisposer = null; - willUpdate(changedProperties) { - if (changedProperties.has("childComponents")) { - if (this.#lightDomEffectDisposer) { - this.#lightDomEffectDisposer(); - } - this.#lightDomEffectDisposer = effect(() => { - const allChildren = this.childComponents ?? null; - const lightDomTemplate = this.renderComponentTree(allChildren); - D(lightDomTemplate, this, { host: this }); - }); - } - } - /** - * Clean up the effect when the component is removed from the DOM. - */ - disconnectedCallback() { - super.disconnectedCallback(); - if (this.#lightDomEffectDisposer) { - this.#lightDomEffectDisposer(); - } - } - /** - * Turns the SignalMap into a renderable TemplateResult for Lit. - */ - renderComponentTree(components) { - if (!components) { - return A; - } - if (!Array.isArray(components)) { - return A; - } - return b` ${o$3(components, (component) => { - if (this.enableCustomElements) { - const registeredCtor = componentRegistry.get(component.type); - const elCtor = registeredCtor || customElements.get(component.type); - if (elCtor) { - const node = component; - const el = new elCtor(); - el.id = node.id; - if (node.slotName) { - el.slot = node.slotName; - } - el.component = node; - el.weight = node.weight ?? "initial"; - el.processor = this.processor; - el.surfaceId = this.surfaceId; - el.dataContextPath = node.dataContextPath ?? "/"; - for (const [prop, val] of Object.entries(component.properties)) { - el[prop] = val; - } - return b`${el}`; - } - } - switch (component.type) { - case "List": { - const node = component; - const childComponents = node.properties.children; - return b` { + const allChildren = this.childComponents ?? null; + const lightDomTemplate = this.renderComponentTree(allChildren); + D(lightDomTemplate, this, { host: this }); + }); + } + } + /** + * Clean up the effect when the component is removed from the DOM. + */ + disconnectedCallback() { + super.disconnectedCallback(); + if (this.#lightDomEffectDisposer) { + this.#lightDomEffectDisposer(); + } + } + /** + * Turns the SignalMap into a renderable TemplateResult for Lit. + */ + renderComponentTree(components) { + if (!components) { + return A; + } + if (!Array.isArray(components)) { + return A; + } + return b` ${o$3(components, (component) => { + if (this.enableCustomElements) { + const registeredCtor = componentRegistry.get(component.type); + const elCtor = registeredCtor || customElements.get(component.type); + if (elCtor) { + const node = component; + const el = new elCtor(); + el.id = node.id; + if (node.slotName) { + el.slot = node.slotName; + } + el.component = node; + el.weight = node.weight ?? "initial"; + el.processor = this.processor; + el.surfaceId = this.surfaceId; + el.dataContextPath = node.dataContextPath ?? "/"; + for (const [prop, val] of Object.entries(component.properties)) { + el[prop] = val; + } + return b`${el}`; + } + } + switch (component.type) { + case "List": { + const node = component; + const childComponents = node.properties.children; + return b` { .childComponents=${childComponents} .enableCustomElements=${this.enableCustomElements} >`; - } - case "Card": { - const node = component; - let childComponents = node.properties.children; - if (!childComponents && node.properties.child) { - childComponents = [node.properties.child]; - } - return b` { .dataContextPath=${node.dataContextPath ?? ""} .enableCustomElements=${this.enableCustomElements} >`; - } - case "Column": { - const node = component; - return b` { .distribution=${node.properties.distribution ?? "start"} .enableCustomElements=${this.enableCustomElements} >`; - } - case "Row": { - const node = component; - return b` { .distribution=${node.properties.distribution ?? "start"} .enableCustomElements=${this.enableCustomElements} >`; - } - case "Image": { - const node = component; - return b` { .fit=${node.properties.fit} .enableCustomElements=${this.enableCustomElements} >`; - } - case "Icon": { - const node = component; - return b` { .dataContextPath=${node.dataContextPath ?? ""} .enableCustomElements=${this.enableCustomElements} >`; - } - case "AudioPlayer": { - const node = component; - return b` { .dataContextPath=${node.dataContextPath ?? ""} .enableCustomElements=${this.enableCustomElements} >`; - } - case "Button": { - const node = component; - return b` { .childComponents=${[node.properties.child]} .enableCustomElements=${this.enableCustomElements} >`; - } - case "Text": { - const node = component; - return b` { .usageHint=${node.properties.usageHint} .enableCustomElements=${this.enableCustomElements} >`; - } - case "CheckBox": { - const node = component; - return b` { .value=${node.properties.value} .enableCustomElements=${this.enableCustomElements} >`; - } - case "DateTimeInput": { - const node = component; - return b` { .value=${node.properties.value} .enableCustomElements=${this.enableCustomElements} >`; - } - case "Divider": { - const node = component; - return b` { .color=${node.properties.color} .enableCustomElements=${this.enableCustomElements} >`; - } - case "MultipleChoice": { - const node = component; - return b` { .selections=${node.properties.selections} .enableCustomElements=${this.enableCustomElements} >`; - } - case "Slider": { - const node = component; - return b` { .maxValue=${node.properties.maxValue} .enableCustomElements=${this.enableCustomElements} >`; - } - case "TextField": { - const node = component; - return b` { .validationRegexp=${node.properties.validationRegexp} .enableCustomElements=${this.enableCustomElements} >`; - } - case "Video": { - const node = component; - return b` { .url=${node.properties.url} .enableCustomElements=${this.enableCustomElements} >`; - } - case "Tabs": { - const node = component; - const titles = []; - const childComponents = []; - if (node.properties.tabItems) { - for (const item of node.properties.tabItems) { - titles.push(item.title); - childComponents.push(item.child); - } - } - return b` { .childComponents=${childComponents} .enableCustomElements=${this.enableCustomElements} >`; - } - case "Modal": { - const node = component; - const childComponents = [node.properties.entryPointChild, node.properties.contentChild]; - node.properties.entryPointChild.slotName = "entry"; - return b` { .childComponents=${childComponents} .enableCustomElements=${this.enableCustomElements} >`; - } - default: { - return this.renderCustomComponent(component); - } - } - })}`; - } - renderCustomComponent(component) { - if (!this.enableCustomElements) { - return; - } - const node = component; - const registeredCtor = componentRegistry.get(component.type); - const elCtor = registeredCtor || customElements.get(component.type); - if (!elCtor) { - return b`Unknown element ${component.type}`; - } - const el = new elCtor(); - el.id = node.id; - if (node.slotName) { - el.slot = node.slotName; - } - el.component = node; - el.weight = node.weight ?? "initial"; - el.processor = this.processor; - el.surfaceId = this.surfaceId; - el.dataContextPath = node.dataContextPath ?? "/"; - for (const [prop, val] of Object.entries(component.properties)) { - el[prop] = val; - } - return b`${el}`; - } - render() { - return b``; - } - static { - __runInitializers$19(_classThis, _classExtraInitializers); - } - }; - return Root$1 = _classThis; + } + default: { + return this.renderCustomComponent(component); + } + } + })}`; + } + renderCustomComponent(component) { + if (!this.enableCustomElements) { + return; + } + const node = component; + const registeredCtor = componentRegistry.get(component.type); + const elCtor = registeredCtor || customElements.get(component.type); + if (!elCtor) { + return b`Unknown element ${component.type}`; + } + const el = new elCtor(); + el.id = node.id; + if (node.slotName) { + el.slot = node.slotName; + } + el.component = node; + el.weight = node.weight ?? "initial"; + el.processor = this.processor; + el.surfaceId = this.surfaceId; + el.dataContextPath = node.dataContextPath ?? "/"; + for (const [prop, val] of Object.entries(component.properties)) { + el[prop] = val; + } + return b`${el}`; + } + render() { + return b``; + } + static { + __runInitializers$19(_classThis, _classExtraInitializers); + } + }; + return (Root$1 = _classThis); })(); /** -* @license -* Copyright 2018 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ const e$2 = e$10(class extends i$5 { - constructor(t$7) { - if (super(t$7), t$7.type !== t$4.ATTRIBUTE || "class" !== t$7.name || t$7.strings?.length > 2) throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute."); - } - render(t$7) { - return " " + Object.keys(t$7).filter((s$9) => t$7[s$9]).join(" ") + " "; - } - update(s$9, [i$10]) { - if (void 0 === this.st) { - this.st = new Set(), void 0 !== s$9.strings && (this.nt = new Set(s$9.strings.join(" ").split(/\s/).filter((t$7) => "" !== t$7))); - for (const t$7 in i$10) i$10[t$7] && !this.nt?.has(t$7) && this.st.add(t$7); - return this.render(i$10); - } - const r$12 = s$9.element.classList; - for (const t$7 of this.st) t$7 in i$10 || (r$12.remove(t$7), this.st.delete(t$7)); - for (const t$7 in i$10) { - const s$10 = !!i$10[t$7]; - s$10 === this.st.has(t$7) || this.nt?.has(t$7) || (s$10 ? (r$12.add(t$7), this.st.add(t$7)) : (r$12.remove(t$7), this.st.delete(t$7))); - } - return E; - } -}); + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ const e$2 = e$10( + class extends i$5 { + constructor(t$7) { + if ( + (super(t$7), t$7.type !== t$4.ATTRIBUTE || "class" !== t$7.name || t$7.strings?.length > 2) + ) + throw Error( + "`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.", + ); + } + render(t$7) { + return ( + " " + + Object.keys(t$7) + .filter((s$9) => t$7[s$9]) + .join(" ") + + " " + ); + } + update(s$9, [i$10]) { + if (void 0 === this.st) { + ((this.st = new Set()), + void 0 !== s$9.strings && + (this.nt = new Set( + s$9.strings + .join(" ") + .split(/\s/) + .filter((t$7) => "" !== t$7), + ))); + for (const t$7 in i$10) i$10[t$7] && !this.nt?.has(t$7) && this.st.add(t$7); + return this.render(i$10); + } + const r$12 = s$9.element.classList; + for (const t$7 of this.st) t$7 in i$10 || (r$12.remove(t$7), this.st.delete(t$7)); + for (const t$7 in i$10) { + const s$10 = !!i$10[t$7]; + s$10 === this.st.has(t$7) || + this.nt?.has(t$7) || + (s$10 ? (r$12.add(t$7), this.st.add(t$7)) : (r$12.remove(t$7), this.st.delete(t$7))); + } + return E; + } + }, +); /** -* @license -* Copyright 2018 Google LLC -* SPDX-License-Identifier: BSD-3-Clause -*/ const n$1 = "important", i = " !" + n$1, o$2 = e$10(class extends i$5 { - constructor(t$7) { - if (super(t$7), t$7.type !== t$4.ATTRIBUTE || "style" !== t$7.name || t$7.strings?.length > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute."); - } - render(t$7) { - return Object.keys(t$7).reduce((e$14, r$12) => { - const s$9 = t$7[r$12]; - return null == s$9 ? e$14 : e$14 + `${r$12 = r$12.includes("-") ? r$12 : r$12.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s$9};`; - }, ""); - } - update(e$14, [r$12]) { - const { style: s$9 } = e$14.element; - if (void 0 === this.ft) return this.ft = new Set(Object.keys(r$12)), this.render(r$12); - for (const t$7 of this.ft) null == r$12[t$7] && (this.ft.delete(t$7), t$7.includes("-") ? s$9.removeProperty(t$7) : s$9[t$7] = null); - for (const t$7 in r$12) { - const e$15 = r$12[t$7]; - if (null != e$15) { - this.ft.add(t$7); - const r$13 = "string" == typeof e$15 && e$15.endsWith(i); - t$7.includes("-") || r$13 ? s$9.setProperty(t$7, r$13 ? e$15.slice(0, -11) : e$15, r$13 ? n$1 : "") : s$9[t$7] = e$15; - } - } - return E; - } -}); + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */ const n$1 = "important", + i = " !" + n$1, + o$2 = e$10( + class extends i$5 { + constructor(t$7) { + if ( + (super(t$7), + t$7.type !== t$4.ATTRIBUTE || "style" !== t$7.name || t$7.strings?.length > 2) + ) + throw Error( + "The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.", + ); + } + render(t$7) { + return Object.keys(t$7).reduce((e$14, r$12) => { + const s$9 = t$7[r$12]; + return null == s$9 + ? e$14 + : e$14 + + `${(r$12 = r$12.includes("-") ? r$12 : r$12.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase())}:${s$9};`; + }, ""); + } + update(e$14, [r$12]) { + const { style: s$9 } = e$14.element; + if (void 0 === this.ft) return ((this.ft = new Set(Object.keys(r$12))), this.render(r$12)); + for (const t$7 of this.ft) + null == r$12[t$7] && + (this.ft.delete(t$7), t$7.includes("-") ? s$9.removeProperty(t$7) : (s$9[t$7] = null)); + for (const t$7 in r$12) { + const e$15 = r$12[t$7]; + if (null != e$15) { + this.ft.add(t$7); + const r$13 = "string" == typeof e$15 && e$15.endsWith(i); + t$7.includes("-") || r$13 + ? s$9.setProperty(t$7, r$13 ? e$15.slice(0, -11) : e$15, r$13 ? n$1 : "") + : (s$9[t$7] = e$15); + } + } + return E; + } + }, + ); -var __esDecorate$18 = void 0 && (void 0).__esDecorate || function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { - function accept(f$4) { - if (f$4 !== void 0 && typeof f$4 !== "function") throw new TypeError("Function expected"); - return f$4; - } - var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; - var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; - var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); - var _$1, done = false; - for (var i$10 = decorators.length - 1; i$10 >= 0; i$10--) { - var context = {}; - for (var p$3 in contextIn) context[p$3] = p$3 === "access" ? {} : contextIn[p$3]; - for (var p$3 in contextIn.access) context.access[p$3] = contextIn.access[p$3]; - context.addInitializer = function(f$4) { - if (done) throw new TypeError("Cannot add initializers after decoration has completed"); - extraInitializers.push(accept(f$4 || null)); - }; - var result = (0, decorators[i$10])(kind === "accessor" ? { - get: descriptor.get, - set: descriptor.set - } : descriptor[key], context); - if (kind === "accessor") { - if (result === void 0) continue; - if (result === null || typeof result !== "object") throw new TypeError("Object expected"); - if (_$1 = accept(result.get)) descriptor.get = _$1; - if (_$1 = accept(result.set)) descriptor.set = _$1; - if (_$1 = accept(result.init)) initializers.unshift(_$1); - } else if (_$1 = accept(result)) { - if (kind === "field") initializers.unshift(_$1); - else descriptor[key] = _$1; - } - } - if (target) Object.defineProperty(target, contextIn.name, descriptor); - done = true; -}; -var __runInitializers$18 = void 0 && (void 0).__runInitializers || function(thisArg, initializers, value) { - var useValue = arguments.length > 2; - for (var i$10 = 0; i$10 < initializers.length; i$10++) { - value = useValue ? initializers[i$10].call(thisArg, value) : initializers[i$10].call(thisArg); - } - return useValue ? value : void 0; -}; +var __esDecorate$18 = + (void 0 && (void 0).__esDecorate) || + function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f$4) { + if (f$4 !== void 0 && typeof f$4 !== "function") throw new TypeError("Function expected"); + return f$4; + } + var kind = contextIn.kind, + key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? (contextIn["static"] ? ctor : ctor.prototype) : null; + var descriptor = + descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _$1, + done = false; + for (var i$10 = decorators.length - 1; i$10 >= 0; i$10--) { + var context = {}; + for (var p$3 in contextIn) context[p$3] = p$3 === "access" ? {} : contextIn[p$3]; + for (var p$3 in contextIn.access) context.access[p$3] = contextIn.access[p$3]; + context.addInitializer = function (f$4) { + if (done) throw new TypeError("Cannot add initializers after decoration has completed"); + extraInitializers.push(accept(f$4 || null)); + }; + var result = (0, decorators[i$10])( + kind === "accessor" + ? { + get: descriptor.get, + set: descriptor.set, + } + : descriptor[key], + context, + ); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if ((_$1 = accept(result.get))) descriptor.get = _$1; + if ((_$1 = accept(result.set))) descriptor.set = _$1; + if ((_$1 = accept(result.init))) initializers.unshift(_$1); + } else if ((_$1 = accept(result))) { + if (kind === "field") initializers.unshift(_$1); + else descriptor[key] = _$1; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; + }; +var __runInitializers$18 = + (void 0 && (void 0).__runInitializers) || + function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i$10 = 0; i$10 < initializers.length; i$10++) { + value = useValue ? initializers[i$10].call(thisArg, value) : initializers[i$10].call(thisArg); + } + return useValue ? value : void 0; + }; let Audio = (() => { - let _classDecorators = [t$1("a2ui-audioplayer")]; - let _classDescriptor; - let _classExtraInitializers = []; - let _classThis; - let _classSuper = Root; - let _url_decorators; - let _url_initializers = []; - let _url_extraInitializers = []; - var Audio$1 = class extends _classSuper { - static { - _classThis = this; - } - static { - const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0; - _url_decorators = [n$6()]; - __esDecorate$18(this, null, _url_decorators, { - kind: "accessor", - name: "url", - static: false, - private: false, - access: { - has: (obj) => "url" in obj, - get: (obj) => obj.url, - set: (obj, value) => { - obj.url = value; - } - }, - metadata: _metadata - }, _url_initializers, _url_extraInitializers); - __esDecorate$18(null, _classDescriptor = { value: _classThis }, _classDecorators, { - kind: "class", - name: _classThis.name, - metadata: _metadata - }, null, _classExtraInitializers); - Audio$1 = _classThis = _classDescriptor.value; - if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { - enumerable: true, - configurable: true, - writable: true, - value: _metadata - }); - } - #url_accessor_storage = __runInitializers$18(this, _url_initializers, null); - get url() { - return this.#url_accessor_storage; - } - set url(value) { - this.#url_accessor_storage = value; - } - static { - this.styles = [structuralStyles, i$9` + let _classDecorators = [t$1("a2ui-audioplayer")]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + let _classSuper = Root; + let _url_decorators; + let _url_initializers = []; + let _url_extraInitializers = []; + var Audio$1 = class extends _classSuper { + static { + _classThis = this; + } + static { + const _metadata = + typeof Symbol === "function" && Symbol.metadata + ? Object.create(_classSuper[Symbol.metadata] ?? null) + : void 0; + _url_decorators = [n$6()]; + __esDecorate$18( + this, + null, + _url_decorators, + { + kind: "accessor", + name: "url", + static: false, + private: false, + access: { + has: (obj) => "url" in obj, + get: (obj) => obj.url, + set: (obj, value) => { + obj.url = value; + }, + }, + metadata: _metadata, + }, + _url_initializers, + _url_extraInitializers, + ); + __esDecorate$18( + null, + (_classDescriptor = { value: _classThis }), + _classDecorators, + { + kind: "class", + name: _classThis.name, + metadata: _metadata, + }, + null, + _classExtraInitializers, + ); + Audio$1 = _classThis = _classDescriptor.value; + if (_metadata) + Object.defineProperty(_classThis, Symbol.metadata, { + enumerable: true, + configurable: true, + writable: true, + value: _metadata, + }); + } + #url_accessor_storage = __runInitializers$18(this, _url_initializers, null); + get url() { + return this.#url_accessor_storage; + } + set url(value) { + this.#url_accessor_storage = value; + } + static { + this.styles = [ + structuralStyles, + i$9` * { box-sizing: border-box; } @@ -5145,254 +6064,317 @@ let Audio = (() => { display: block; width: 100%; } - `]; - } - #renderAudio() { - if (!this.url) { - return A; - } - if (this.url && typeof this.url === "object") { - if ("literalString" in this.url) { - return b`