From 199c070398c21893cb8910f13d165bfe6a0c29ae Mon Sep 17 00:00:00 2001 From: Tyler <26290074+tylersayshi@users.noreply.github.com> Date: Sun, 19 Oct 2025 00:39:22 -0700 Subject: [PATCH 1/6] test cli more --- packages/cli/tests/integration/cli.test.ts | 76 ++++ .../tests/integration/error-handling.test.ts | 179 ++++++++ .../cli/tests/integration/filesystem.test.ts | 210 +++++++++ .../cli/tests/integration/workflow.test.ts | 218 +++++++++ .../performance/large-schema-set.test.ts | 234 ++++++++++ .../tests/unit/template-edge-cases.test.ts | 122 +++++ packages/site/dist/assets/index-BsKdg2XM.css | 1 + packages/site/dist/assets/index-vwl5Isce.js | 41 ++ packages/site/dist/index.html | 13 + packages/site/dist/types/index.d.ts | 2 + packages/site/dist/types/infer.d.ts | 91 ++++ packages/site/dist/types/lib.d.ts | 420 ++++++++++++++++++ packages/site/dist/types/type-utils.d.ts | 14 + 13 files changed, 1621 insertions(+) create mode 100644 packages/cli/tests/integration/cli.test.ts create mode 100644 packages/cli/tests/integration/error-handling.test.ts create mode 100644 packages/cli/tests/integration/filesystem.test.ts create mode 100644 packages/cli/tests/integration/workflow.test.ts create mode 100644 packages/cli/tests/performance/large-schema-set.test.ts create mode 100644 packages/cli/tests/unit/template-edge-cases.test.ts create mode 100644 packages/site/dist/assets/index-BsKdg2XM.css create mode 100644 packages/site/dist/assets/index-vwl5Isce.js create mode 100644 packages/site/dist/index.html create mode 100644 packages/site/dist/types/index.d.ts create mode 100644 packages/site/dist/types/infer.d.ts create mode 100644 packages/site/dist/types/lib.d.ts create mode 100644 packages/site/dist/types/type-utils.d.ts diff --git a/packages/cli/tests/integration/cli.test.ts b/packages/cli/tests/integration/cli.test.ts new file mode 100644 index 0000000..6b979ad --- /dev/null +++ b/packages/cli/tests/integration/cli.test.ts @@ -0,0 +1,76 @@ +import { expect, test, describe } from "vitest"; +import { spawn } from "node:child_process"; +import { join } from "node:path"; + +describe("CLI Integration", () => { + test("shows error when called without arguments", async () => { + const { stdout, stderr, code } = await runCLI(); + expect(code).toBe(1); + expect(stderr).toContain("No command specified"); + expect(stderr).toContain("Run `$ prototypey --help` for more info"); + }); + + test("shows version", async () => { + const { stdout, stderr } = await runCLI(["--version"]); + expect(stderr).toBe(""); + expect(stdout).toContain("prototypey, 0.0.0"); + }); + + test("shows help for gen-inferred command", async () => { + const { stdout, stderr } = await runCLI(["gen-inferred", "--help"]); + expect(stderr).toBe(""); + expect(stdout).toContain("gen-inferred "); + expect(stdout).toContain( + "Generate type-inferred code from lexicon schemas", + ); + }); + + test("shows help for gen-emit command", async () => { + const { stdout, stderr } = await runCLI(["gen-emit", "--help"]); + expect(stderr).toBe(""); + expect(stdout).toContain("gen-emit "); + expect(stdout).toContain( + "Emit JSON lexicon schemas from authored TypeScript", + ); + }); + + test("handles unknown command", async () => { + const { stdout, stderr, code } = await runCLI(["unknown-command"]); + expect(code).toBe(1); + expect(stderr).toContain("Invalid command: unknown-command"); + expect(stderr).toContain("Run `$ prototypey --help` for more info"); + }); + + test("handles missing arguments", async () => { + const { stdout, stderr, code } = await runCLI(["gen-inferred"]); + expect(code).toBe(1); + expect(stderr).toContain("Insufficient arguments!"); + expect(stderr).toContain( + "Run `$ prototypey gen-inferred --help` for more info", + ); + }); +}); + +function runCLI( + args: string[] = [], +): Promise<{ stdout: string; stderr: string; code: number }> { + return new Promise((resolve) => { + const cliPath = join(__dirname, "../../lib/index.js"); + const child = spawn("node", [cliPath, ...args]); + + let stdout = ""; + let stderr = ""; + + child.stdout.on("data", (data) => { + stdout += data.toString(); + }); + + child.stderr.on("data", (data) => { + stderr += data.toString(); + }); + + child.on("close", (code) => { + resolve({ stdout, stderr, code: code ?? 0 }); + }); + }); +} diff --git a/packages/cli/tests/integration/error-handling.test.ts b/packages/cli/tests/integration/error-handling.test.ts new file mode 100644 index 0000000..1ef1a66 --- /dev/null +++ b/packages/cli/tests/integration/error-handling.test.ts @@ -0,0 +1,179 @@ +import { expect, test, describe, beforeEach, afterEach } from "vitest"; +import { mkdir, writeFile, rm } from "node:fs/promises"; +import { join } from "node:path"; +import { tmpdir } from "node:os"; +import { spawn } from "node:child_process"; + +describe("CLI Error Handling", () => { + let testDir: string; + let outDir: string; + let schemasDir: string; + + beforeEach(async () => { + // Create a temporary directory for test files + testDir = join(tmpdir(), `prototypey-error-test-${Date.now()}`); + outDir = join(testDir, "output"); + schemasDir = join(testDir, "schemas"); + await mkdir(testDir, { recursive: true }); + await mkdir(outDir, { recursive: true }); + await mkdir(schemasDir, { recursive: true }); + }); + + afterEach(async () => { + // Clean up test directory + await rm(testDir, { recursive: true, force: true }); + }); + + test("handles non-existent schema files gracefully", async () => { + const { stdout, stderr, code } = await runCLI([ + "gen-inferred", + outDir, + join(schemasDir, "non-existent.json"), + ]); + + expect(code).toBe(0); // Should not crash + expect(stdout).toContain("No schema files found matching patterns"); + expect(stderr).toBe(""); + }); + + test("handles invalid JSON schema files", async () => { + // Create an invalid JSON file + const invalidSchema = join(schemasDir, "invalid.json"); + await writeFile(invalidSchema, "not valid json"); + + const { stdout, stderr, code } = await runCLI([ + "gen-inferred", + outDir, + invalidSchema, + ]); + + expect(code).toBe(1); // Should exit with error + expect(stderr).toContain("Error generating inferred types"); + }); + + test("handles schema files with missing id", async () => { + // Create a schema with missing id + const schemaFile = join(schemasDir, "missing-id.json"); + await writeFile( + schemaFile, + JSON.stringify({ + lexicon: 1, + defs: { main: { type: "record" } }, + }), + ); + + const { stdout, stderr, code } = await runCLI([ + "gen-inferred", + outDir, + schemaFile, + ]); + + expect(code).toBe(0); // Should not crash + expect(stdout).toContain("Found 1 schema file(s)"); + expect(stdout).toContain("Generated inferred types in"); + // Should skip the invalid file silently + }); + + test("handles schema files with missing defs", async () => { + // Create a schema with missing defs + const schemaFile = join(schemasDir, "missing-defs.json"); + await writeFile( + schemaFile, + JSON.stringify({ + lexicon: 1, + id: "app.test.missing", + }), + ); + + const { stdout, stderr, code } = await runCLI([ + "gen-inferred", + outDir, + schemaFile, + ]); + + expect(code).toBe(0); // Should not crash + expect(stdout).toContain("Found 1 schema file(s)"); + expect(stdout).toContain("Generated inferred types in"); + // Should skip the invalid file silently + }); + + test("handles non-existent source files for gen-emit", async () => { + const { stdout, stderr, code } = await runCLI([ + "gen-emit", + outDir, + join(schemasDir, "non-existent.ts"), + ]); + + expect(code).toBe(0); // Should not crash + expect(stdout).toContain("No source files found matching patterns"); + expect(stderr).toBe(""); + }); + + test("handles valid TypeScript files with no lexicon exports for gen-emit", async () => { + // Create a valid TypeScript file with no lexicon exports + const validSource = join(schemasDir, "no-namespace.ts"); + await writeFile(validSource, "export const x = 1;"); + + const { stdout, stderr, code } = await runCLI([ + "gen-emit", + outDir, + validSource, + ]); + + expect(code).toBe(0); // Should not crash + expect(stdout).toContain("Found 1 source file(s)"); + expect(stderr).toContain("No lexicon namespaces found"); + }); + + test("handles permission errors when writing output", async () => { + // This test might be platform-specific, so we'll make it lenient + // Create a schema file first + const schemaFile = join(schemasDir, "test.json"); + await writeFile( + schemaFile, + JSON.stringify({ + lexicon: 1, + id: "app.test.permission", + defs: { main: { type: "record" } }, + }), + ); + + // Try to write to a directory that might have permission issues + // We'll use a path that likely won't exist and is invalid + const invalidOutDir = "/invalid/path/that/does/not/exist"; + + const { stdout, stderr, code } = await runCLI([ + "gen-inferred", + invalidOutDir, + schemaFile, + ]); + + // Should handle the error gracefully + expect(code).toBe(1); + expect(stderr).toContain("Error generating inferred types"); + }); +}); + +function runCLI( + args: string[], +): Promise<{ stdout: string; stderr: string; code: number }> { + return new Promise((resolve) => { + const cliPath = join(__dirname, "../../lib/index.js"); + const child = spawn("node", [cliPath, ...args]); + + let stdout = ""; + let stderr = ""; + + child.stdout.on("data", (data) => { + stdout += data.toString(); + }); + + child.stderr.on("data", (data) => { + stderr += data.toString(); + }); + + child.on("close", (code) => { + resolve({ stdout, stderr, code: code ?? 0 }); + }); + }); +} diff --git a/packages/cli/tests/integration/filesystem.test.ts b/packages/cli/tests/integration/filesystem.test.ts new file mode 100644 index 0000000..232da48 --- /dev/null +++ b/packages/cli/tests/integration/filesystem.test.ts @@ -0,0 +1,210 @@ +import { expect, test, describe, beforeEach, afterEach } from "vitest"; +import { + mkdir, + writeFile, + rm, + chmod, + access, + constants, +} from "node:fs/promises"; +import { join } from "node:path"; +import { tmpdir } from "node:os"; +import { spawn } from "node:child_process"; + +describe("CLI File System Handling", () => { + let testDir: string; + let outDir: string; + let schemasDir: string; + + beforeEach(async () => { + // Create a temporary directory for test files + testDir = join(tmpdir(), `prototypey-fs-test-${Date.now()}`); + outDir = join(testDir, "output"); + schemasDir = join(testDir, "schemas"); + await mkdir(testDir, { recursive: true }); + await mkdir(schemasDir, { recursive: true }); + }); + + afterEach(async () => { + // Clean up test directory + try { + await rm(testDir, { recursive: true, force: true }); + } catch (error) { + // Ignore cleanup errors + } + }); + + test("creates nested output directories when they don't exist", async () => { + // Create a schema file + const schemaFile = join(schemasDir, "test.json"); + await writeFile( + schemaFile, + JSON.stringify({ + lexicon: 1, + id: "app.deeply.nested.schema", + defs: { main: { type: "record" } }, + }), + ); + + // Use a deeply nested output directory that doesn't exist + const deepOutDir = join(outDir, "very", "deeply", "nested", "path"); + + const { stdout, stderr, code } = await runCLI([ + "gen-inferred", + deepOutDir, + schemaFile, + ]); + + expect(code).toBe(0); + expect(stderr).toBe(""); + expect(stdout).toContain( + "app.deeply.nested.schema -> app/deeply/nested/schema.ts", + ); + + // Verify the file was created in the deeply nested path + const generatedFile = join(deepOutDir, "app/deeply/nested/schema.ts"); + await access(generatedFile, constants.F_OK); + }); + + test("handles special characters in NSID correctly", async () => { + // Create a schema with special characters in the name + const schemaFile = join(schemasDir, "special.json"); + await writeFile( + schemaFile, + JSON.stringify({ + lexicon: 1, + id: "app.test.special-name_with.mixedChars123", + defs: { main: { type: "record" } }, + }), + ); + + const { stdout, stderr, code } = await runCLI([ + "gen-inferred", + outDir, + schemaFile, + ]); + + expect(code).toBe(0); + expect(stderr).toBe(""); + // Should convert to proper PascalCase + expect(stdout).toContain( + "app.test.special-name_with.mixedChars123 -> app/test/special-name_with/mixedChars123.ts", + ); + }); + + test("handles very long NSID paths", async () => { + // Create a schema with a very long NSID + const longNSID = "com." + "verylongdomainname.".repeat(10) + "test"; + const schemaFile = join(schemasDir, "long.json"); + await writeFile( + schemaFile, + JSON.stringify({ + lexicon: 1, + id: longNSID, + defs: { main: { type: "record" } }, + }), + ); + + const { stdout, stderr, code } = await runCLI([ + "gen-inferred", + outDir, + schemaFile, + ]); + + expect(code).toBe(0); + expect(stderr).toBe(""); + expect(stdout).toContain(`Found 1 schema file(s)`); + }); + + test("handles existing files gracefully", async () => { + // Create a schema file + const schemaFile = join(schemasDir, "test.json"); + await writeFile( + schemaFile, + JSON.stringify({ + lexicon: 1, + id: "app.test.overwrite", + defs: { main: { type: "record" } }, + }), + ); + + // Run CLI once + await runCLI(["gen-inferred", outDir, schemaFile]); + + // Verify file exists + const generatedFile = join(outDir, "app/test/overwrite.ts"); + await access(generatedFile, constants.F_OK); + + // Run CLI again (should overwrite) + const { stdout, stderr, code } = await runCLI([ + "gen-inferred", + outDir, + schemaFile, + ]); + + expect(code).toBe(0); + expect(stderr).toBe(""); + expect(stdout).toContain("app.test.overwrite -> app/test/overwrite.ts"); + }); + + test("handles read-only output directory gracefully", async () => { + // This test might be platform-specific and could fail on some systems + // We'll make it lenient to not fail the test suite + + // Create a schema file + const schemaFile = join(schemasDir, "test.json"); + await writeFile( + schemaFile, + JSON.stringify({ + lexicon: 1, + id: "app.test.permission", + defs: { main: { type: "record" } }, + }), + ); + + // Create output directory and make it read-only + const readOnlyDir = join(outDir, "readonly"); + await mkdir(readOnlyDir, { recursive: true }); + + // Try to make read-only (might not work on all systems) + try { + await chmod(readOnlyDir, 0o444); + } catch (error) { + // Ignore if we can't change permissions + } + + const { stdout, stderr, code } = await runCLI([ + "gen-inferred", + readOnlyDir, + schemaFile, + ]); + + // Should handle the error gracefully + // On some systems this might succeed, on others fail - we just want it to not crash + expect([0, 1]).toContain(code); + }); +}); + +function runCLI( + args: string[], +): Promise<{ stdout: string; stderr: string; code: number }> { + return new Promise((resolve) => { + const cliPath = join(__dirname, "../../lib/index.js"); + const child = spawn("node", [cliPath, ...args]); + + let stdout = ""; + let stderr = ""; + + child.stdout.on("data", (data) => { + stdout += data.toString(); + }); + + child.stderr.on("data", (data) => { + stderr += data.toString(); + }); + + child.on("close", (code) => { + resolve({ stdout, stderr, code: code ?? 0 }); + }); + }); +} diff --git a/packages/cli/tests/integration/workflow.test.ts b/packages/cli/tests/integration/workflow.test.ts new file mode 100644 index 0000000..39b31aa --- /dev/null +++ b/packages/cli/tests/integration/workflow.test.ts @@ -0,0 +1,218 @@ +import { expect, test, describe, beforeEach, afterEach } from "vitest"; +import { mkdir, writeFile, rm, readFile } from "node:fs/promises"; +import { join } from "node:path"; +import { tmpdir } from "node:os"; +import { spawn } from "node:child_process"; + +describe("CLI End-to-End Workflow", () => { + let testDir: string; + let schemasDir: string; + let generatedDir: string; + + beforeEach(async () => { + // Create a temporary directory for test files + testDir = join(tmpdir(), `prototypey-e2e-test-${Date.now()}`); + schemasDir = join(testDir, "schemas"); + generatedDir = join(testDir, "generated"); + await mkdir(testDir, { recursive: true }); + await mkdir(schemasDir, { recursive: true }); + await mkdir(generatedDir, { recursive: true }); + }); + + afterEach(async () => { + // Clean up test directory + await rm(testDir, { recursive: true, force: true }); + }); + + test("complete workflow: JSON schema -> inferred types", async () => { + // Step 1: Create JSON schema file directly (avoiding dynamic import issues) + const schemaPath = join(schemasDir, "app.test.profile.json"); + await writeFile( + schemaPath, + JSON.stringify( + { + lexicon: 1, + id: "app.test.profile", + defs: { + main: { + type: "record", + key: "self", + record: { + type: "object", + properties: { + displayName: { type: "string", maxLength: 64 }, + description: { type: "string", maxLength: 256 }, + }, + }, + }, + }, + }, + null, + 2, + ), + ); + + // Step 2: Generate inferred TypeScript from JSON schema + const inferResult = await runCLI([ + "gen-inferred", + generatedDir, + schemaPath, + ]); + + console.log("Infer result code:", inferResult.code); + console.log("Infer stdout:", inferResult.stdout); + console.log("Infer stderr:", inferResult.stderr); + + expect(inferResult.code).toBe(0); + expect(inferResult.stdout).toContain("Generated inferred types in"); + expect(inferResult.stdout).toContain( + "app.test.profile -> app/test/profile.ts", + ); + + // Verify generated TypeScript file + const generatedPath = join(generatedDir, "app/test/profile.ts"); + const generatedContent = await readFile(generatedPath, "utf-8"); + expect(generatedContent).toContain( + 'import type { Infer } from "prototypey"', + ); + expect(generatedContent).toContain( + "export type Profile = Infer", + ); + expect(generatedContent).toContain("export const ProfileSchema = schema"); + expect(generatedContent).toContain( + "export function isProfile(v: unknown): v is Profile", + ); + }); + + test("workflow with multiple schemas", async () => { + // Create multiple JSON schema files + const postSchema = join(schemasDir, "app.test.post.json"); + await writeFile( + postSchema, + JSON.stringify( + { + lexicon: 1, + id: "app.test.post", + defs: { + main: { + type: "record", + key: "tid", + record: { + type: "object", + properties: { + text: { type: "string", maxLength: 300, required: true }, + createdAt: { + type: "string", + format: "datetime", + required: true, + }, + }, + }, + }, + }, + }, + null, + 2, + ), + ); + + const searchSchema = join(schemasDir, "app.test.searchPosts.json"); + await writeFile( + searchSchema, + JSON.stringify( + { + lexicon: 1, + id: "app.test.searchPosts", + defs: { + main: { + type: "query", + parameters: { + type: "params", + properties: { + q: { type: "string", required: true }, + limit: { + type: "integer", + minimum: 1, + maximum: 100, + default: 25, + }, + }, + required: ["q"], + }, + output: { + encoding: "application/json", + schema: { + type: "object", + properties: { + posts: { + type: "array", + items: { type: "ref", ref: "app.test.post#main" }, + required: true, + }, + }, + required: ["posts"], + }, + }, + }, + }, + }, + null, + 2, + ), + ); + + // Generate inferred types + const inferResult = await runCLI([ + "gen-inferred", + generatedDir, + `${schemasDir}/*.json`, + ]); + expect(inferResult.code).toBe(0); + expect(inferResult.stdout).toContain("app.test.post -> app/test/post.ts"); + expect(inferResult.stdout).toContain( + "app.test.searchPosts -> app/test/searchPosts.ts", + ); + + // Verify both generated files exist and have correct content + const postContent = await readFile( + join(generatedDir, "app/test/post.ts"), + "utf-8", + ); + const searchContent = await readFile( + join(generatedDir, "app/test/searchPosts.ts"), + "utf-8", + ); + + expect(postContent).toContain("export type Post = Infer"); + expect(searchContent).toContain( + "export type SearchPosts = Infer", + ); + }); +}); + +function runCLI( + args: string[], +): Promise<{ stdout: string; stderr: string; code: number }> { + return new Promise((resolve) => { + const cliPath = join(__dirname, "../../lib/index.js"); + const child = spawn("node", [cliPath, ...args], { + cwd: process.cwd(), + env: process.env, + }); + + let stdout = ""; + let stderr = ""; + + child.stdout.on("data", (data) => { + stdout += data.toString(); + }); + + child.stderr.on("data", (data) => { + stderr += data.toString(); + }); + + child.on("close", (code) => { + resolve({ stdout, stderr, code: code ?? 0 }); + }); + }); +} diff --git a/packages/cli/tests/performance/large-schema-set.test.ts b/packages/cli/tests/performance/large-schema-set.test.ts new file mode 100644 index 0000000..9f6d2a6 --- /dev/null +++ b/packages/cli/tests/performance/large-schema-set.test.ts @@ -0,0 +1,234 @@ +import { expect, test, describe, beforeEach, afterEach } from "vitest"; +import { mkdir, writeFile, rm } from "node:fs/promises"; +import { join } from "node:path"; +import { tmpdir } from "node:os"; +import { spawn } from "node:child_process"; + +describe("CLI Performance", () => { + let testDir: string; + let outDir: string; + let schemasDir: string; + + beforeEach(async () => { + // Create a temporary directory for test files + testDir = join(tmpdir(), `prototypey-perf-test-${Date.now()}`); + outDir = join(testDir, "output"); + schemasDir = join(testDir, "schemas"); + await mkdir(testDir, { recursive: true }); + await mkdir(outDir, { recursive: true }); + await mkdir(schemasDir, { recursive: true }); + }); + + afterEach(async () => { + // Clean up test directory + await rm(testDir, { recursive: true, force: true }); + }); + + test("handles large number of schemas efficiently", async () => { + // Create 50 schema files + const schemaCount = 50; + const schemaFiles = []; + + for (let i = 0; i < schemaCount; i++) { + const schemaFile = join(schemasDir, `test${i}.json`); + await writeFile( + schemaFile, + JSON.stringify({ + lexicon: 1, + id: `app.test.schema${i}`, + defs: { + main: { + type: "record", + key: "tid", + record: { + type: "object", + properties: { + name: { type: "string", maxLength: 64 }, + value: { type: "integer" }, + }, + }, + }, + }, + }), + ); + schemaFiles.push(schemaFile); + } + + const startTime = Date.now(); + const { stdout, stderr, code } = await runCLI([ + "gen-inferred", + outDir, + `${schemasDir}/*.json`, + ]); + const endTime = Date.now(); + + const duration = endTime - startTime; + + expect(code).toBe(0); + expect(stdout).toContain(`Found ${schemaCount} schema file(s)`); + expect(stderr).toBe(""); + + // Should complete within reasonable time (less than 5 seconds for 50 files) + expect(duration).toBeLessThan(5000); + + // Verify some generated files exist + expect(stdout).toContain("app.test.schema0 -> app/test/schema0.ts"); + expect(stdout).toContain("app.test.schema49 -> app/test/schema49.ts"); + }); + + test("memory usage stays reasonable with large schemas", async () => { + // Create a schema with complex nested structure + const complexSchema = join(schemasDir, "complex.json"); + await writeFile( + complexSchema, + JSON.stringify({ + lexicon: 1, + id: "app.test.complex", + defs: { + main: { + type: "record", + key: "tid", + record: { + type: "object", + properties: { + // Create a deeply nested structure + level1: { + type: "object", + properties: { + level2: { + type: "object", + properties: { + level3: { + type: "object", + properties: { + level4: { + type: "object", + properties: { + items: { + type: "array", + items: { + type: "object", + properties: { + id: { type: "string" }, + data: { type: "string" }, + metadata: { + type: "object", + properties: { + created: { + type: "string", + format: "datetime", + }, + updated: { + type: "string", + format: "datetime", + }, + tags: { + type: "array", + items: { type: "string" }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }), + ); + + const startTime = Date.now(); + const { stdout, stderr, code } = await runCLI([ + "gen-inferred", + outDir, + complexSchema, + ]); + const endTime = Date.now(); + + const duration = endTime - startTime; + + expect(code).toBe(0); + expect(stdout).toContain("Found 1 schema file(s)"); + expect(stdout).toContain("app.test.complex -> app/test/complex.ts"); + expect(stderr).toBe(""); + + // Should complete within reasonable time (less than 2 seconds) + expect(duration).toBeLessThan(2000); + }); + + test("concurrent processing of multiple commands", async () => { + // Create test schemas + const schema1 = join(schemasDir, "test1.json"); + const schema2 = join(schemasDir, "test2.json"); + + await writeFile( + schema1, + JSON.stringify({ + lexicon: 1, + id: "app.test.concurrent1", + defs: { + main: { type: "record", key: "tid", record: { type: "object" } }, + }, + }), + ); + + await writeFile( + schema2, + JSON.stringify({ + lexicon: 1, + id: "app.test.concurrent2", + defs: { + main: { type: "record", key: "tid", record: { type: "object" } }, + }, + }), + ); + + // Run two CLI commands concurrently + const [result1, result2] = await Promise.all([ + runCLI(["gen-inferred", join(outDir, "out1"), schema1]), + runCLI(["gen-inferred", join(outDir, "out2"), schema2]), + ]); + + expect(result1.code).toBe(0); + expect(result2.code).toBe(0); + expect(result1.stdout).toContain( + "app.test.concurrent1 -> app/test/concurrent1.ts", + ); + expect(result2.stdout).toContain( + "app.test.concurrent2 -> app/test/concurrent2.ts", + ); + }); +}); + +function runCLI( + args: string[], +): Promise<{ stdout: string; stderr: string; code: number }> { + return new Promise((resolve) => { + const cliPath = join(__dirname, "../../lib/index.js"); + const child = spawn("node", [cliPath, ...args]); + + let stdout = ""; + let stderr = ""; + + child.stdout.on("data", (data) => { + stdout += data.toString(); + }); + + child.stderr.on("data", (data) => { + stderr += data.toString(); + }); + + child.on("close", (code) => { + resolve({ stdout, stderr, code: code ?? 0 }); + }); + }); +} diff --git a/packages/cli/tests/unit/template-edge-cases.test.ts b/packages/cli/tests/unit/template-edge-cases.test.ts new file mode 100644 index 0000000..11b7403 --- /dev/null +++ b/packages/cli/tests/unit/template-edge-cases.test.ts @@ -0,0 +1,122 @@ +import { expect, test, describe } from "vitest"; +import { generateInferredCode } from "../../src/templates/inferred.ts"; + +describe("Template Edge Cases", () => { + test("handles NSID with trailing numbers correctly", () => { + const schema = { + lexicon: 1, + id: "app.test.v1", + defs: { main: { type: "record" } }, + }; + + const code = generateInferredCode(schema, "/test/v1.json", "/output"); + expect(code).toContain("export type V1 = Infer"); + expect(code).toContain("export const V1Schema = schema"); + expect(code).toContain("export function isV1(v: unknown): v is V1"); + }); + + test("handles NSID with multiple consecutive separators", () => { + const schema = { + lexicon: 1, + id: "app.test.my--double--dash", + defs: { main: { type: "record" } }, + }; + + const code = generateInferredCode(schema, "/test/double.json", "/output"); + expect(code).toContain("export type MyDoubleDash = Infer"); + }); + + test("handles single character NSID parts", () => { + const schema = { + lexicon: 1, + id: "a.b.c", + defs: { main: { type: "record" } }, + }; + + const code = generateInferredCode(schema, "/test/single.json", "/output"); + expect(code).toContain("export type C = Infer"); + }); + + test("handles NSID with underscores and mixed case", () => { + const schema = { + lexicon: 1, + id: "app.test.my_custom_Type_Name", + defs: { main: { type: "record" } }, + }; + + const code = generateInferredCode(schema, "/test/custom.json", "/output"); + expect(code).toContain( + "export type MyCustomTypeName = Infer", + ); + }); + + test("handles very long NSID name", () => { + const longName = "a".repeat(100); + const schema = { + lexicon: 1, + id: `app.test.${longName}`, + defs: { main: { type: "record" } }, + }; + + const code = generateInferredCode(schema, "/test/long.json", "/output"); + // Should not crash and should generate valid TypeScript + expect(code).toContain("export type"); + expect(code).toContain("Infer"); + }); + + test("handles schema with no main def", () => { + const schema = { + lexicon: 1, + id: "app.test.no-main", + defs: { + other: { type: "object" }, + }, + }; + + const code = generateInferredCode(schema, "/test/no-main.json", "/output"); + // Should still generate valid code even without main def + expect(code).toContain("export type NoMain = Infer"); + // The path will be relative with ../../../ prefix + expect(code).toContain( + 'import schema from "../../../test/no-main.json" with { type: "json" };', + ); + }); + + test("generates correct relative paths for deeply nested output", () => { + const schema = { + lexicon: 1, + id: "app.bsky.feed.post", + defs: { main: { type: "record" } }, + }; + + const code = generateInferredCode( + schema, + "/project/schemas/feed.json", + "/project/generated/inferred", + ); + + // Should have correct relative import path + expect(code).toContain( + 'import schema from "../../../../../schemas/feed.json" with { type: "json" };', + ); + }); + + test("handles special characters in import paths", () => { + const schema = { + lexicon: 1, + id: "app.test.special", + defs: { main: { type: "record" } }, + }; + + const code = generateInferredCode( + schema, + "/project/schemas with spaces/special[chars].json", + "/project/generated", + ); + + // Should handle spaces and special characters in paths + expect(code).toContain( + 'import schema from "../../../schemas with spaces/special[chars].json" with { type: "json" };', + ); + }); +}); diff --git a/packages/site/dist/assets/index-BsKdg2XM.css b/packages/site/dist/assets/index-BsKdg2XM.css new file mode 100644 index 0000000..7fad108 --- /dev/null +++ b/packages/site/dist/assets/index-BsKdg2XM.css @@ -0,0 +1 @@ +*{box-sizing:border-box;margin:0;padding:0}:root{color:#213547;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-weight:400;line-height:1.5}body{min-width:320px;min-height:100vh;margin:0;display:flex}#root{flex-direction:column;width:100%;display:flex} diff --git a/packages/site/dist/assets/index-vwl5Isce.js b/packages/site/dist/assets/index-vwl5Isce.js new file mode 100644 index 0000000..ad739e8 --- /dev/null +++ b/packages/site/dist/assets/index-vwl5Isce.js @@ -0,0 +1,41 @@ +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e){if(t.type!==`childList`)continue;for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o(exports=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1{t.exports=l()}),d=o(exports=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;exports.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();exports.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,ae(x);else{var t=n(l);t!==null&&oe(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=exports.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&oe(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function ee(){return exports.unstable_now()-Ee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,oe(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ae(x))),r},exports.unstable_shouldYield=ee,exports.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}),f=o((exports,t)=>{t.exports=d()}),p=o(exports=>{var t=u(),n=f();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,d=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},m={};function h(e){return l.call(m,e)?!0:l.call(p,e)?!1:d.test(e)?m[e]=!0:(p[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` +`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{fe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?de(e):``}function me(e){switch(e.tag){case 5:return de(e.type);case 16:return de(`Lazy`);case 13:return de(`Suspense`);case 19:return de(`SuspenseList`);case 0:case 2:case 15:return e=pe(e.type,!1),e;case 11:return e=pe(e.type.render,!1),e;case 1:return e=pe(e.type,!0),e;default:return``}}function he(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case te:return`Profiler`;case ee:return`StrictMode`;case ae:return`Suspense`;case oe:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case re:return(e.displayName||`Context`)+`.Consumer`;case ne:return(e._context.displayName||`Context`)+`.Provider`;case ie:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||``,e=e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?he(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return he(e(t))}catch{}}return null}function ge(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return he(t);case 8:return t===ee?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function _e(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function ve(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ye(e){var t=ve(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function be(e){e._valueTracker||=ye(e)}function xe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=ve(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Se(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ce(e,t){var n=t.checked;return k({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function we(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=_e(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function Te(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function Ee(e,t){Te(e,t);var n=_e(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?Oe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Oe(e,t.type,_e(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function De(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function Oe(e,t,n){(t!==`number`||Se(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ke=Array.isArray;function Ae(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=Le.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ze(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Be={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ve=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Be).forEach(function(e){Ve.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Be[t]=Be[e]})});function He(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Be.hasOwnProperty(e)&&Be[e]?(``+t).trim():t+`px`}function Ue(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=He(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var We=k({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ge(e,t){if(t){if(We[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Ke(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var qe=null;function Je(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ye=null,Xe=null,Ze=null;function Qe(e){if(e=sa(e)){if(typeof Ye!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=la(t),Ye(e.stateNode,e.type,t))}}function $e(e){Xe?Ze?Ze.push(e):Ze=[e]:Xe=e}function A(){if(Xe){var e=Xe,t=Ze;if(Ze=Xe=null,Qe(e),t)for(e=0;e>>=0,e===0?32:31-(Ft(e)/It|0)|0}var Rt=64,zt=4194304;function Bt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Vt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Bt(a))):r=Bt(s)}else o=n&~i,o===0?a!==0&&(r=Bt(a)):r=Bt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function qt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Pt(t),e[t]=n}function Jt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=yr),Sr=` `,Cr=!1;function wr(e,t){switch(e){case`keyup`:return _r.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Tr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Er=!1;function Dr(e,t){switch(e){case`compositionend`:return Tr(t);case`keypress`:return t.which===32?(Cr=!0,Sr):null;case`textInput`:return e=t.data,e===Sr&&Cr?null:e;default:return null}}function Or(e,t){if(Er)return e===`compositionend`||!vr&&wr(e,t)?(e=Mn(),jn=An=kn=null,Er=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Xr(n)}}function Qr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $r(){for(var e=window,t=Se();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Se(e.document)}return t}function ei(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function ti(e){var t=$r(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Qr(n.ownerDocument.documentElement,n)){if(r!==null&&ei(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Zr(n,a);var o=Zr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n=document.documentMode,ri=null,ii=null,ai=null,oi=!1;function si(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;oi||ri==null||ri!==Se(r)||(r=ri,`selectionStart`in r&&ei(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ai&&Yr(ai,r)||(ai=r,r=Pi(ii,`onSelect`),0da||(e.current=ua[da],ua[da]=null,da--)}function F(e,t){da++,ua[da]=e.current,e.current=t}var pa={},I=fa(pa),ma=fa(!1),ha=pa;function ga(e,t){var n=e.type.contextTypes;if(!n)return pa;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function _a(e){return e=e.childContextTypes,e!=null}function va(){P(ma),P(I)}function ya(e,t,n){if(I.current!==pa)throw Error(r(168));F(I,t),F(ma,n)}function ba(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,ge(e)||`Unknown`,a));return k({},n,i)}function xa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pa,ha=I.current,F(I,e),F(ma,ma.current),!0}function Sa(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=ba(e,t,ha),i.__reactInternalMemoizedMergedChildContext=e,P(ma),P(I),F(I,e)):P(ma),F(ma,n)}var Ca=null,wa=!1,Ta=!1;function Ea(e){Ca===null?Ca=[e]:Ca.push(e)}function Da(e){wa=!0,Ea(e)}function Oa(){if(!Ta&&Ca!==null){Ta=!0;var e=0,t=M;try{var n=Ca;for(M=1;e>=o,i-=o,Ia=1<<32-Pt(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),L&&Ra(r,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),L&&Ra(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return L&&Ra(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),L&&Ra(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===O&&ro(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=to(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=fu(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=du(i.type,i.key,i.props,null,e.mode,o),o.ref=to(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=hu(i,e.mode,o),r.return=e,e=r}return s(e);case O:return l=i._init,_(e,r,l(i._payload),o)}if(ke(i))return h(e,r,i,o);if(le(i))return g(e,r,i,o);no(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=mu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var ao=io(!0),oo=io(!1),so=fa(null),co=null,lo=null,uo=null;function fo(){uo=lo=co=null}function po(e){var t=so.current;P(so),e._currentValue=t}function mo(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ho(e,t){co=e,uo=lo=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(tc=!0),e.firstContext=null)}function go(e){var t=e._currentValue;if(uo!==e)if(e={context:e,memoizedValue:t,next:null},lo===null){if(co===null)throw Error(r(308));lo=e,co.dependencies={lanes:0,firstContext:e}}else lo=lo.next=e;return t}var _o=null;function vo(e){_o===null?_o=[e]:_o.push(e)}function yo(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,vo(t)):(n.next=i.next,i.next=n),t.interleaved=n,bo(e,r)}function bo(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var xo=!1;function So(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Co(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function wo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function To(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,bo(e,n)}return i=r.interleaved,i===null?(t.next=t,vo(r)):(t.next=i.next,i.next=t),r.interleaved=t,bo(e,n)}function Eo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Yt(e,n)}}function Do(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Oo(e,t,n,r){var i=e.updateQueue;xo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=k({},d,f);break a;case 2:xo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);dl|=o,e.lanes=o,e.memoizedState=d}}function ko(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Uo.transition;Uo.transition={};try{e(!1),t()}finally{M=n,Uo.transition=r}}function Os(){return $o().memoizedState}function ks(e,t,n){var r=kl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},js(e))Ms(t,n);else if(n=yo(e,t,n,r),n!==null){var i=Q();Al(n,e,r,i),Ns(n,t,r)}}function As(e,t,n){var r=kl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(js(e))Ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Jr(s,o)){var c=t.interleaved;c===null?(i.next=i,vo(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=yo(e,t,i,r),n!==null&&(i=Q(),Al(n,e,r,i),Ns(n,t,r))}}function js(e){var t=e.alternate;return e===z||t!==null&&t===z}function Ms(e,t){Ko=Go=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ns(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Yt(e,n)}}var Ps={readContext:go,useCallback:H,useContext:H,useEffect:H,useImperativeHandle:H,useInsertionEffect:H,useLayoutEffect:H,useMemo:H,useReducer:H,useRef:H,useState:H,useDebugValue:H,useDeferredValue:H,useTransition:H,useMutableSource:H,useSyncExternalStore:H,useId:H,unstable_isNewReconciler:!1},Fs={readContext:go,useCallback:function(e,t){return Qo().memoizedState=[e,t===void 0?null:t],e},useContext:go,useEffect:_s,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),hs(4194308,4,xs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return hs(4194308,4,e,t)},useInsertionEffect:function(e,t){return hs(4,2,e,t)},useMemo:function(e,t){var n=Qo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ks.bind(null,z,e),[r.memoizedState,e]},useRef:function(e){var t=Qo();return e={current:e},t.memoizedState=e},useState:fs,useDebugValue:Cs,useDeferredValue:function(e){return Qo().memoizedState=e},useTransition:function(){var e=fs(!1),t=e[0];return e=Ds.bind(null,e[1]),Qo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=z,a=Qo();if(L){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),J===null)throw Error(r(349));Wo&30||ss(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,_s(ls.bind(null,i,o,e),[e]),i.flags|=2048,ps(9,cs.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Qo(),t=J.identifierPrefix;if(L){var n=La,r=Ia;n=(r&~(1<<32-Pt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=qo++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[ea]=t,e[ta]=i,Tc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ke(n,i),n){case`dialog`:N(`cancel`,e),N(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:N(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o_l&&(t.flags|=128,i=!0,kc(s,!1),t.lanes=4194304)}else{if(!i)if(e=zo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),kc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!L)return U(t),null}else 2*j()-s.renderingStartTime>_l&&n!==1073741824&&(t.flags|=128,i=!0,kc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(U(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=j(),t.sibling=null,n=R.current,F(R,i?n&1|2:n&1),t);case 22:case 23:return Bl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?cl&1073741824&&(U(t),t.subtreeFlags&6&&(t.flags|=8192)):U(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function jc(e,t){switch(Va(t),t.tag){case 1:return _a(t.type)&&va(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Io(),P(ma),P(I),Vo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ro(t),null;case 13:if(P(R),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Qa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return P(R),null;case 4:return Io(),null;case 10:return po(t.type._context),null;case 22:case 23:return Bl(),null;case 24:return null;default:return null}}var Mc=!1,W=!1,Nc=typeof WeakSet==`function`?WeakSet:Set,G=null;function Pc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}function Fc(e,t,n){try{n()}catch(n){$(e,t,n)}}var Ic=!1;function Lc(e,t){if(Hi=Sn,e=$r(),ei(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ui={focusedElem:e,selectionRange:n},Sn=!1,G=t;G!==null;)if(t=G,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,G=e;else for(;G!==null;){t=G;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Rs(t.type,g),_);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent=``:b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,G=e;break}G=t.return}return h=Ic,Ic=!1,h}function Rc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&Fc(t,n,a)}i=i.next}while(i!==r)}}function zc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Bc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Vc(e){var t=e.alternate;t!==null&&(e.alternate=null,Vc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ea],delete t[ta],delete t[ra],delete t[ia],delete t[aa])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Hc(e){return e.tag===5||e.tag===3||e.tag===4}function Uc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Hc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Vi));else if(r!==4&&(e=e.child,e!==null))for(Wc(e,t,n),e=e.sibling;e!==null;)Wc(e,t,n),e=e.sibling}function Gc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}var K=null,Kc=!1;function qc(e,t,n){for(n=n.child;n!==null;)Jc(e,t,n),n=n.sibling}function Jc(e,t,n){if(Mt&&typeof Mt.onCommitFiberUnmount==`function`)try{Mt.onCommitFiberUnmount(jt,n)}catch{}switch(n.tag){case 5:W||Pc(n,t);case 6:var r=K,i=Kc;K=null,qc(e,t,n),K=r,Kc=i,K!==null&&(Kc?(e=K,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):K.removeChild(n.stateNode));break;case 18:K!==null&&(Kc?(e=K,n=n.stateNode,e.nodeType===8?Xi(e.parentNode,n):e.nodeType===1&&Xi(e,n),bn(e)):Xi(K,n.stateNode));break;case 4:r=K,i=Kc,K=n.stateNode.containerInfo,Kc=!0,qc(e,t,n),K=r,Kc=i;break;case 0:case 11:case 14:case 15:if(!W&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&Fc(n,t,o),i=i.next}while(i!==r)}qc(e,t,n);break;case 1:if(!W&&(Pc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}qc(e,t,n);break;case 21:qc(e,t,n);break;case 22:n.mode&1?(W=(r=W)||n.memoizedState!==null,qc(e,t,n),W=r):qc(e,t,n);break;default:qc(e,t,n)}}function Yc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Nc),t.forEach(function(t){var r=ru.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Xc(e,t){var n=t.deletions;if(n!==null)for(var i=0;ia&&(a=s),i&=~o}if(i=a,i=j()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*il(i/1960))-i,10e?16:e,Cl===null)var i=!1;else{if(e=Cl,Cl=null,wl=0,q&6)throw Error(r(331));var a=q;for(q|=4,G=e.current;G!==null;){var o=G,s=o.child;if(G.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lj()-gl?Vl(e,0):pl|=n),jl(e,t)}function tu(e,t){t===0&&(e.mode&1?(t=zt,zt<<=1,!(zt&130023424)&&(zt=4194304)):t=1);var n=Q();e=bo(e,t),e!==null&&(qt(e,t,n),jl(e,n))}function nu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),tu(e,n)}function ru(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),tu(e,n)}var iu;iu=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ma.current)tc=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return tc=!1,wc(e,t,n);tc=e.flags&131072?!0:!1}else tc=!1,L&&t.flags&1048576&&za(t,Ma,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;Sc(e,t),e=t.pendingProps;var a=ga(t,I.current);ho(t,n),a=Xo(null,t,i,e,a,n);var o=Zo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,_a(i)?(o=!0,xa(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,So(t),a.updater=Bs,t.stateNode=a,a._reactInternals=t,Ws(t,i,e,n),t=uc(null,t,i,!0,o,n)):(t.tag=0,L&&o&&Ba(t),nc(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(Sc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=lu(i),e=Rs(i,e),a){case 0:t=cc(null,t,i,e,n);break a;case 1:t=lc(null,t,i,e,n);break a;case 11:t=rc(null,t,i,e,n);break a;case 14:t=ic(null,t,i,Rs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Rs(i,a),cc(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Rs(i,a),lc(e,t,i,a,n);case 3:a:{if(dc(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,Co(e,t),Oo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Gs(Error(r(423)),t),t=fc(e,t,i,n,a);break a}else if(i!==a){a=Gs(Error(r(424)),t),t=fc(e,t,i,n,a);break a}else for(Ua=Zi(t.stateNode.containerInfo.firstChild),Ha=t,L=!0,Wa=null,n=oo(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Qa(),i===a){t=Cc(e,t,n);break a}nc(e,t,i,n)}t=t.child}return t;case 5:return Lo(t),e===null&&Ja(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Wi(i,a)?s=null:o!==null&&Wi(i,o)&&(t.flags|=32),sc(e,t),nc(e,t,s,n),t.child;case 6:return e===null&&Ja(t),null;case 13:return hc(e,t,n);case 4:return Fo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=ao(t,null,i,n):nc(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Rs(i,a),rc(e,t,i,a,n);case 7:return nc(e,t,t.pendingProps,n),t.child;case 8:return nc(e,t,t.pendingProps.children,n),t.child;case 12:return nc(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,F(so,i._currentValue),i._currentValue=s,o!==null)if(Jr(o.value,s)){if(o.children===a.children&&!ma.current){t=Cc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=wo(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),mo(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),mo(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}nc(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,ho(t,n),a=go(a),i=i(a),t.flags|=1,nc(e,t,i,n),t.child;case 14:return i=t.type,a=Rs(i,t.pendingProps),a=Rs(i.type,a),ic(e,t,i,a,n);case 15:return ac(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Rs(i,a),Sc(e,t),t.tag=1,_a(i)?(e=!0,xa(t)):e=!1,ho(t,n),Hs(t,i,a),Ws(t,i,a,n),uc(null,t,i,!0,e,n);case 19:return xc(e,t,n);case 22:return oc(e,t,n)}throw Error(r(156,t.tag))};function au(e,t){return xt(e,t)}function ou(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function su(e,t,n,r){return new ou(e,t,n,r)}function cu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function lu(e){if(typeof e==`function`)return cu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ie)return 11;if(e===D)return 14}return 2}function uu(e,t){var n=e.alternate;return n===null?(n=su(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function du(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)cu(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return fu(n.children,a,o,t);case ee:s=8,a|=8;break;case te:return e=su(12,n,t,a|2),e.elementType=te,e.lanes=o,e;case ae:return e=su(13,n,t,a),e.elementType=ae,e.lanes=o,e;case oe:return e=su(19,n,t,a),e.elementType=oe,e.lanes=o,e;case se:return pu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case ne:s=10;break a;case re:s=9;break a;case ie:s=11;break a;case D:s=14;break a;case O:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=su(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function fu(e,t,n,r){return e=su(7,e,r,t),e.lanes=n,e}function pu(e,t,n,r){return e=su(22,e,r,t),e.elementType=se,e.lanes=n,e.stateNode={isHidden:!1},e}function mu(e,t,n){return e=su(6,e,null,t),e.lanes=n,e}function hu(e,t,n){return t=su(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function gu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Kt(0),this.expirationTimes=Kt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Kt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function _u(e,t,n,r,i,a,o,s,c){return e=new gu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=su(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},So(a),e}function vu(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()}),h=o(exports=>{var t=m();if(1)exports.createRoot=t.createRoot,exports.hydrateRoot=t.hydrateRoot;else var n}),g=o(exports=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}exports.Fragment=r,exports.jsx=s,exports.jsxs=s}),_=o((exports,t)=>{t.exports=g()}),v=c(_());function y(){return(0,v.jsx)(`header`,{style:{padding:`2rem 2rem 1rem 2rem`,borderBottom:`1px solid #e5e7eb`},children:(0,v.jsxs)(`div`,{style:{maxWidth:`1400px`,margin:`0 auto`},children:[(0,v.jsxs)(`h1`,{style:{fontSize:`2.5rem`,fontWeight:`700`,marginBottom:`0.5rem`},children:[(0,v.jsx)(`span`,{style:{color:`#6b7280`},children:`at://`}),`prototypekit`]}),(0,v.jsx)(`p`,{style:{fontSize:`1.125rem`,color:`#6b7280`,marginTop:`0.5rem`},children:`Type-safe lexicon inference for ATProto schemas`})]})})}function b(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=e.length?e.apply(this,i):function(){for(var e=arguments.length,r=Array(e),a=0;a1&&arguments[1]!==void 0?arguments[1]:{};ye.initial(e),ye.handler(t);var n={current:e},r=ce(Ce)(n,t),i=ce(Se)(n),a=ce(ye.changes)(e),o=ce(xe)(n);function s(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(e){return e};return ye.selector(e),e(n.current)}function c(e){se(r,i,a,o)(e)}return[s,c]}function xe(e,t){return ue(t)?t(e.current):t}function Se(e,t){return e.current=O(O({},e.current),t),t}function Ce(e,t,n){return ue(t)?t(e.current):Object.keys(n).forEach(function(n){var r;return(r=t[n])?.call(t,e.current[n])}),n}var we={create:be},Te=we,Ee={paths:{vs:`https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs`}};function De(e){return function t(){for(var n=this,r=arguments.length,i=Array(r),a=0;a=e.length?e.apply(this,i):function(){for(var e=arguments.length,r=Array(e),a=0;a{r.current=!1}:e,t)}var pt=ft;function mt(){}function ht(e,t,n,r){return gt(e,r)||_t(e,t,n,r)}function gt(e,t){return e.editor.getModel(vt(e,t))}function _t(e,t,n,r){return e.editor.createModel(t,n,r?vt(e,r):void 0)}function vt(e,t){return e.Uri.parse(t)}function yt({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:i,originalModelPath:a,modifiedModelPath:o,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:c=!1,theme:l=`light`,loading:u=`Loading...`,options:d={},height:f=`100%`,width:p=`100%`,className:m,wrapperProps:h={},beforeMount:g=mt,onMount:_=mt}){let[v,y]=(0,A.useState)(!1),[b,x]=(0,A.useState)(!0),S=(0,A.useRef)(null),C=(0,A.useRef)(null),w=(0,A.useRef)(null),T=(0,A.useRef)(_),E=(0,A.useRef)(g),ee=(0,A.useRef)(!1);dt(()=>{let e=$e.init();return e.then(e=>(C.current=e)&&x(!1)).catch(e=>e?.type!==`cancelation`&&console.error(`Monaco initialization: error:`,e)),()=>S.current?re():e.cancel()}),pt(()=>{if(S.current&&C.current){let t=S.current.getOriginalEditor(),i=ht(C.current,e||``,r||n||`text`,a||``);i!==t.getModel()&&t.setModel(i)}},[a],v),pt(()=>{if(S.current&&C.current){let e=S.current.getModifiedEditor(),r=ht(C.current,t||``,i||n||`text`,o||``);r!==e.getModel()&&e.setModel(r)}},[o],v),pt(()=>{let e=S.current.getModifiedEditor();e.getOption(C.current.editor.EditorOption.readOnly)?e.setValue(t||``):t!==e.getValue()&&(e.executeEdits(``,[{range:e.getModel().getFullModelRange(),text:t||``,forceMoveMarkers:!0}]),e.pushUndoStop())},[t],v),pt(()=>{S.current?.getModel()?.original.setValue(e||``)},[e],v),pt(()=>{let{original:e,modified:t}=S.current.getModel();C.current.editor.setModelLanguage(e,r||n||`text`),C.current.editor.setModelLanguage(t,i||n||`text`)},[n,r,i],v),pt(()=>{C.current?.editor.setTheme(l)},[l],v),pt(()=>{S.current?.updateOptions(d)},[d],v);let te=(0,A.useCallback)(()=>{if(!C.current)return;E.current(C.current);let s=ht(C.current,e||``,r||n||`text`,a||``),c=ht(C.current,t||``,i||n||`text`,o||``);S.current?.setModel({original:s,modified:c})},[n,t,i,e,r,a,o]),ne=(0,A.useCallback)(()=>{!ee.current&&w.current&&(S.current=C.current.editor.createDiffEditor(w.current,{automaticLayout:!0,...d}),te(),C.current?.editor.setTheme(l),y(!0),ee.current=!0)},[d,l,te]);(0,A.useEffect)(()=>{v&&T.current(S.current,C.current)},[v]),(0,A.useEffect)(()=>{!b&&!v&&ne()},[b,v,ne]);function re(){let e=S.current?.getModel();s||e?.original?.dispose(),c||e?.modified?.dispose(),S.current?.dispose()}return A.createElement(lt,{width:p,height:f,isEditorReady:v,loading:u,_ref:w,className:m,wrapperProps:h})}var bt=yt,xt=(0,A.memo)(bt);function St(){let[e,t]=(0,A.useState)($e.__getMonacoInstance());return dt(()=>{let n;return e||(n=$e.init(),n.then(e=>{t(e)})),()=>n?.cancel()}),e}var Ct=St;function wt(e){let t=(0,A.useRef)();return(0,A.useEffect)(()=>{t.current=e},[e]),t.current}var j=wt,Tt=new Map;function Et({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:i,path:a,theme:o=`light`,line:s,loading:c=`Loading...`,options:l={},overrideServices:u={},saveViewState:d=!0,keepCurrentModel:f=!1,width:p=`100%`,height:m=`100%`,className:h,wrapperProps:g={},beforeMount:_=mt,onMount:v=mt,onChange:y,onValidate:b=mt}){let[x,S]=(0,A.useState)(!1),[C,w]=(0,A.useState)(!0),T=(0,A.useRef)(null),E=(0,A.useRef)(null),ee=(0,A.useRef)(null),te=(0,A.useRef)(v),ne=(0,A.useRef)(_),re=(0,A.useRef)(),ie=(0,A.useRef)(r),ae=j(a),oe=(0,A.useRef)(!1),D=(0,A.useRef)(!1);dt(()=>{let e=$e.init();return e.then(e=>(T.current=e)&&w(!1)).catch(e=>e?.type!==`cancelation`&&console.error(`Monaco initialization: error:`,e)),()=>E.current?se():e.cancel()}),pt(()=>{let o=ht(T.current,e||r||``,t||i||``,a||n||``);o!==E.current?.getModel()&&(d&&Tt.set(ae,E.current?.saveViewState()),E.current?.setModel(o),d&&E.current?.restoreViewState(Tt.get(a)))},[a],x),pt(()=>{E.current?.updateOptions(l)},[l],x),pt(()=>{!E.current||r===void 0||(E.current.getOption(T.current.editor.EditorOption.readOnly)?E.current.setValue(r):r!==E.current.getValue()&&(D.current=!0,E.current.executeEdits(``,[{range:E.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),E.current.pushUndoStop(),D.current=!1))},[r],x),pt(()=>{let e=E.current?.getModel();e&&i&&T.current?.editor.setModelLanguage(e,i)},[i],x),pt(()=>{s!==void 0&&E.current?.revealLine(s)},[s],x),pt(()=>{T.current?.editor.setTheme(o)},[o],x);let O=(0,A.useCallback)(()=>{if(!(!ee.current||!T.current)&&!oe.current){ne.current(T.current);let c=a||n,f=ht(T.current,r||e||``,t||i||``,c||``);E.current=T.current?.editor.create(ee.current,{model:f,automaticLayout:!0,...l},u),d&&E.current.restoreViewState(Tt.get(c)),T.current.editor.setTheme(o),s!==void 0&&E.current.revealLine(s),S(!0),oe.current=!0}},[e,t,n,r,i,a,l,u,d,o,s]);(0,A.useEffect)(()=>{x&&te.current(E.current,T.current)},[x]),(0,A.useEffect)(()=>{!C&&!x&&O()},[C,x,O]),ie.current=r,(0,A.useEffect)(()=>{x&&y&&(re.current?.dispose(),re.current=E.current?.onDidChangeModelContent(e=>{D.current||y(E.current.getValue(),e)}))},[x,y]),(0,A.useEffect)(()=>{if(x){let e=T.current.editor.onDidChangeMarkers(e=>{let t=E.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=T.current.editor.getModelMarkers({resource:t});b?.(e)}});return()=>{e?.dispose()}}return()=>{}},[x,b]);function se(){re.current?.dispose(),f?d&&Tt.set(a,E.current.saveViewState()):E.current.getModel()?.dispose(),E.current.dispose()}return A.createElement(lt,{width:p,height:m,isEditorReady:x,loading:c,_ref:ee,className:h,wrapperProps:g})}var Dt=Et,Ot=(0,A.memo)(Dt),kt=Ot;function At({value:e,onChange:t,onReady:n}){let[r,i]=(0,A.useState)(!1);return(0,A.useEffect)(()=>{$e.init().then(e=>{e.languages.typescript.typescriptDefaults.setCompilerOptions({target:e.languages.typescript.ScriptTarget.ES2020,allowNonTsExtensions:!0,moduleResolution:e.languages.typescript.ModuleResolutionKind.NodeJs,module:e.languages.typescript.ModuleKind.ESNext,noEmit:!0,esModuleInterop:!0,allowSyntheticDefaultImports:!0,strict:!1}),e.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!1,noSyntaxValidation:!1}),Promise.all([fetch(`/types/type-utils.d.ts`).then(e=>e.text()),fetch(`/types/infer.d.ts`).then(e=>e.text()),fetch(`/types/lib.d.ts`).then(e=>e.text())]).then(([t,r,a])=>{let o=e=>e.replace(/import\s+{[^}]*}\s+from\s+['""][^'"]*['""];?\s*/g,``).replace(/import\s+.*\s+from\s+['""][^'"]*['""];?\s*/g,``).replace(/^export\s+{[^}]*};?\s*/gm,``).replace(/^export\s+/gm,``).replace(/\/\/# sourceMappingURL=.*/g,``).replace(/\/\/#region.*\n?/g,``).replace(/\/\/#endregion.*\n?/g,``),s=` +${o(t)} +${o(r)} +${o(a)} +`,c=`declare module "prototypekit" { +${s} +}`;e.languages.typescript.typescriptDefaults.addExtraLib(c,`prototypekit.d.ts`),i(!0),n?.()})})},[n]),r?(0,v.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,v.jsx)(`div`,{style:{padding:`0.75rem 1rem`,backgroundColor:`#f9fafb`,borderBottom:`1px solid #e5e7eb`,fontSize:`0.875rem`,fontWeight:`600`,color:`#374151`},children:`Input`}),(0,v.jsx)(`div`,{style:{flex:1},children:(0,v.jsx)(kt,{height:`100%`,defaultLanguage:`typescript`,path:`file:///main.ts`,value:e,onChange:e=>t(e||``),theme:`vs-light`,options:{minimap:{enabled:!1},fontSize:14,lineNumbers:`on`,renderLineHighlight:`all`,scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,padding:{top:16,bottom:16}}})})]}):(0,v.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,v.jsx)(`div`,{style:{padding:`0.75rem 1rem`,backgroundColor:`#f9fafb`,borderBottom:`1px solid #e5e7eb`,fontSize:`0.875rem`,fontWeight:`600`,color:`#374151`},children:`Input`}),(0,v.jsx)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`},children:`Loading...`})]})}function jt({output:e}){return(0,v.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,v.jsx)(`div`,{style:{padding:`0.75rem 1rem`,backgroundColor:`#f9fafb`,borderBottom:`1px solid #e5e7eb`,fontSize:`0.875rem`,fontWeight:`600`,color:`#374151`},children:`Output`}),(0,v.jsx)(`div`,{style:{flex:1},children:e.error?(0,v.jsxs)(`div`,{style:{padding:`1rem`,color:`#dc2626`,backgroundColor:`#fef2f2`,height:`100%`,overflow:`auto`},children:[(0,v.jsx)(`strong`,{children:`Error:`}),` `,e.error]}):(0,v.jsx)(kt,{height:`100%`,defaultLanguage:`json`,value:e.json,theme:`vs-light`,options:{readOnly:!0,minimap:{enabled:!1},fontSize:14,lineNumbers:`on`,renderLineHighlight:`none`,scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:16,bottom:16}}})})]})}var Mt=class{json;infer=null;constructor(e){this.json=e}};const Nt={null(e){return{type:`null`,...e}},boolean(e){return{type:`boolean`,...e}},integer(e){return{type:`integer`,...e}},string(e){return{type:`string`,...e}},unknown(e){return{type:`unknown`,...e}},bytes(e){return{type:`bytes`,...e}},cidLink(e){return{type:`cid-link`,$link:e}},blob(e){return{type:`blob`,...e}},array(e,t){return{type:`array`,items:e,...t}},token(e){return{type:`token`,description:e}},ref(e,t){return{type:`ref`,ref:e,...t}},union(e,t){return{type:`union`,refs:e,...t}},record(e){return{type:`record`,...e}},object(e){let t=Object.keys(e).filter(t=>`required`in e[t]&&e[t].required),n=Object.keys(e).filter(t=>`nullable`in e[t]&&e[t].nullable),r={type:`object`,properties:e};return t.length>0&&(r.required=t),n.length>0&&(r.nullable=n),r},params(e){let t=Object.keys(e).filter(t=>e[t].required),n={type:`params`,properties:e};return t.length>0&&(n.required=t),n},query(e){return{type:`query`,...e}},procedure(e){return{type:`procedure`,...e}},subscription(e){return{type:`subscription`,...e}},namespace(e,t){return new Mt({lexicon:1,id:e,defs:t})}};let Pt=null;function Ft(){let[e,t]=(0,A.useState)(Lt),[n,r]=(0,A.useState)({json:``,typeInfo:``,error:``}),[i,a]=(0,A.useState)(!1),o=Ct(),s=(0,A.useRef)(null),c=e=>{t(e)},l=()=>{a(!0)};return(0,A.useEffect)(()=>{if(o&&i&&!s.current&&!Pt){let e=async()=>{try{await new Promise(e=>setTimeout(e,200));let e=await o.languages.typescript.getTypeScriptWorker(),t=o.Uri.parse(`file:///main.ts`),n=await e(t);s.current=n,Pt=n}catch(e){console.error(`Failed to initialize TypeScript worker:`,e)}};e()}},[o,i]),(0,A.useEffect)(()=>{let t=setTimeout(async()=>{try{let t=e.replace(/import\s+{[^}]*}\s+from\s+['"][^'"]+['"]\s*;?\s*/g,``).replace(/^type\s+\w+\s*=\s*[^;]+;?\s*$/gm,``),n=t.match(/(?:const|let|var)\s+(\w+)\s*=/),i=n?n[1]:null,a=i?`${t}\nreturn ${i};`:t,c=Function(`lx`,a),l=c(Nt),u=`// Hover over .infer in the editor to see the type`;if(i&&o&&s.current)try{let t=o.Uri.parse(`file:///main.ts`),n=o.editor.getModel(t);if(n){let n=e.indexOf(`${i}.infer`);if(n!==-1){let e=n+`${i}.infer`.length-1,r=await s.current.getQuickInfoAtPosition(t.toString(),e);if(r?.displayParts){let e=r.displayParts.map(e=>e.text).join(``),t=e.match(/\(property\)\s+.*?\.infer:\s*([\s\S]+?)$/);t&&(u=It(t[1]))}}}}catch(e){console.error(`Type extraction error:`,e)}if(l&&typeof l==`object`&&`json`in l){let e=l.json;r({json:JSON.stringify(e,null,2),typeInfo:u,error:``})}else r({json:JSON.stringify(l,null,2),typeInfo:u,error:``})}catch(e){r({json:``,typeInfo:``,error:e instanceof Error?e.message:`Unknown error`})}},500);return()=>clearTimeout(t)},[e,o]),(0,v.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`},children:[(0,v.jsx)(`div`,{style:{flex:1,display:`flex`,borderRight:`1px solid #e5e7eb`},children:(0,v.jsx)(At,{value:e,onChange:c,onReady:l})}),(0,v.jsx)(`div`,{style:{flex:1,display:`flex`},children:(0,v.jsx)(jt,{output:n})})]})}function It(e){let t=e.trim();t=t.replace(/\s+/g,` `),t=t.replace(/;\s*/g,` +`),t=t.replace(/{\s*/g,`{ +`),t=t.replace(/\s*}/g,` +}`);let n=t.split(` +`),r=0,i=[];for(let e of n){let t=e.trim();if(!t)continue;t.startsWith(`}`)&&(r=Math.max(0,r-1)),i.push(` `.repeat(r)+t),t.endsWith(`{`)&&!t.includes(`}`)&&r++}return i.join(` +`)}const Lt=`import { lx, type Infer } from "prototypekit"; + +const profileNamespace = lx.namespace("app.bsky.actor.profile", { + main: lx.record({ + key: "self", + record: lx.object({ + displayName: lx.string({ maxLength: 64, maxGraphemes: 64 }), + description: lx.string({ maxLength: 256, maxGraphemes: 256 }), + }), + }), +}); + +type ProfileInferred = Infer;`;function Rt(){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(y,{}),(0,v.jsx)(Ft,{})]})}var zt=c(h());(0,zt.createRoot)(document.getElementById(`root`)).render((0,v.jsx)(A.StrictMode,{children:(0,v.jsx)(Rt,{})})); \ No newline at end of file diff --git a/packages/site/dist/index.html b/packages/site/dist/index.html new file mode 100644 index 0000000..df4a242 --- /dev/null +++ b/packages/site/dist/index.html @@ -0,0 +1,13 @@ + + + + + + prototypey - Type-safe lexicon inference for ATProto + + + + +
+ + diff --git a/packages/site/dist/types/index.d.ts b/packages/site/dist/types/index.d.ts new file mode 100644 index 0000000..881584c --- /dev/null +++ b/packages/site/dist/types/index.d.ts @@ -0,0 +1,2 @@ +export { GetNullable, GetRequired, Infer } from "./infer"; +export { lx } from "./lib"; diff --git a/packages/site/dist/types/infer.d.ts b/packages/site/dist/types/infer.d.ts new file mode 100644 index 0000000..53fdb73 --- /dev/null +++ b/packages/site/dist/types/infer.d.ts @@ -0,0 +1,91 @@ +import { Prettify } from "./type-utils.js"; + +//#region src/infer.d.ts +type InferType = T extends { + type: "record"; +} ? InferRecord : T extends { + type: "object"; +} ? InferObject : T extends { + type: "array"; +} ? InferArray : T extends { + type: "params"; +} ? InferParams : T extends { + type: "union"; +} ? InferUnion : T extends { + type: "token"; +} ? InferToken : T extends { + type: "ref"; +} ? InferRef : T extends { + type: "unknown"; +} ? unknown : T extends { + type: "null"; +} ? null : T extends { + type: "boolean"; +} ? boolean : T extends { + type: "integer"; +} ? number : T extends { + type: "string"; +} ? string : T extends { + type: "bytes"; +} ? Uint8Array : T extends { + type: "cid-link"; +} ? string : T extends { + type: "blob"; +} ? Blob : never; +type InferToken = T extends { + enum: readonly (infer U)[]; +} ? U : string; +type GetRequired = T extends { + required: readonly (infer R)[]; +} ? R : never; +type GetNullable = T extends { + nullable: readonly (infer N)[]; +} ? N : never; +type InferObject & string, Required extends string = GetRequired & string, NullableAndRequired extends string = Required & Nullable & string, Normal extends string = ("properties" extends keyof T ? Exclude & string : never)> = Prettify } & { -readonly [K in Exclude]-?: InferType } & { -readonly [K in Exclude]?: InferType | null } & { -readonly [K in NullableAndRequired]: InferType | null } : {}>; +type InferArray = T extends { + items: infer Items; +} ? InferType[] : never[]; +type InferUnion = T extends { + refs: readonly (infer R)[]; +} ? R extends string ? { + $type: R; + [key: string]: unknown; +} : never : never; +type InferRef = T extends { + ref: infer R; +} ? R extends string ? { + $type: R; + [key: string]: unknown; +} : unknown : unknown; +type InferParams = InferObject; +type InferRecord = T extends { + record: infer R; +} ? R extends { + type: "object"; +} ? InferObject : R extends { + type: "union"; +} ? InferUnion : unknown : unknown; +/** + * Recursively replaces stub references in a type with their actual definitions. + * Detects circular references and missing references, returning string literal error messages. + */ +type ReplaceRefsInType = T extends { + $type: `#${infer DefName}`; +} ? DefName extends keyof Defs ? DefName extends Visited ? `[Circular reference detected: #${DefName}]` : Prettify & { + $type: T["$type"]; +}> : `[Reference not found: #${DefName}]` : T extends Uint8Array | Blob ? T : T extends readonly (infer Item)[] ? ReplaceRefsInType[] : T extends object ? T extends ((...args: unknown[]) => unknown) ? T : { [K in keyof T]: ReplaceRefsInType } : T; +/** + * Infers the TypeScript type for a lexicon namespace, returning only the 'main' definition + * with all local refs (#user, #post, etc.) resolved to their actual types. + */ +type Infer; +}> = Prettify<"main" extends keyof T["defs"] ? { + $type: T["id"]; +} & ReplaceRefsInType, { [K in keyof T["defs"]]: InferType }> : never>; +//#endregion +export { GetNullable, GetRequired, Infer }; +//# sourceMappingURL=infer.d.ts.map \ No newline at end of file diff --git a/packages/site/dist/types/lib.d.ts b/packages/site/dist/types/lib.d.ts new file mode 100644 index 0000000..0db0dfb --- /dev/null +++ b/packages/site/dist/types/lib.d.ts @@ -0,0 +1,420 @@ +import { UnionToTuple } from "./type-utils.js"; +import { Infer } from "./infer.js"; + +//#region src/lib.d.ts +/** @see https://atproto.com/specs/lexicon#overview-of-types */ +type LexiconType = "null" | "boolean" | "integer" | "string" | "bytes" | "cid-link" | "blob" | "array" | "object" | "params" | "token" | "ref" | "union" | "unknown" | "record" | "query" | "procedure" | "subscription"; +/** + * Common options available for lexicon items. + * @see https://atproto.com/specs/lexicon#string-formats + */ +interface LexiconItemCommonOptions { + /** Indicates this field must be provided */ + required?: boolean; + /** Indicates this field can be explicitly set to null */ + nullable?: boolean; +} +/** + * Base interface for all lexicon items. + * @see https://atproto.com/specs/lexicon#overview-of-types + */ +interface LexiconItem extends LexiconItemCommonOptions { + type: LexiconType; +} +/** + * Definition in a lexicon namespace. + * @see https://atproto.com/specs/lexicon#lexicon-document + */ +interface Def { + type: LexiconType; +} +/** + * Lexicon namespace document structure. + * @see https://atproto.com/specs/lexicon#lexicon-document + */ +interface LexiconNamespace { + /** Namespaced identifier (NSID) for this lexicon */ + id: string; + /** Named definitions within this namespace */ + defs: Record; +} +/** + * String type options. + * @see https://atproto.com/specs/lexicon#string + */ +interface StringOptions extends LexiconItemCommonOptions { + /** + * Semantic string format constraint. + * @see https://atproto.com/specs/lexicon#string-formats + */ + format?: "at-identifier" | "at-uri" | "cid" | "datetime" | "did" | "handle" | "nsid" | "tid" | "record-key" | "uri" | "language"; + /** Maximum string length in bytes */ + maxLength?: number; + /** Minimum string length in bytes */ + minLength?: number; + /** Maximum string length in Unicode graphemes */ + maxGraphemes?: number; + /** Minimum string length in Unicode graphemes */ + minGraphemes?: number; + /** Hints at expected values, not enforced */ + knownValues?: string[]; + /** Restricts to an exact set of string values */ + enum?: string[]; + /** Default value if not provided */ + default?: string; + /** Fixed, unchangeable value */ + const?: string; +} +/** + * Boolean type options. + * @see https://atproto.com/specs/lexicon#boolean + */ +interface BooleanOptions extends LexiconItemCommonOptions { + /** Default value if not provided */ + default?: boolean; + /** Fixed, unchangeable value */ + const?: boolean; +} +/** + * Integer type options. + * @see https://atproto.com/specs/lexicon#integer + */ +interface IntegerOptions extends LexiconItemCommonOptions { + /** Minimum allowed value (inclusive) */ + minimum?: number; + /** Maximum allowed value (inclusive) */ + maximum?: number; + /** Restricts to an exact set of integer values */ + enum?: number[]; + /** Default value if not provided */ + default?: number; + /** Fixed, unchangeable value */ + const?: number; +} +/** + * Bytes type options for arbitrary byte arrays. + * @see https://atproto.com/specs/lexicon#bytes + */ +interface BytesOptions extends LexiconItemCommonOptions { + /** Minimum byte array length */ + minLength?: number; + /** Maximum byte array length */ + maxLength?: number; +} +/** + * Blob type options for binary data with MIME types. + * @see https://atproto.com/specs/lexicon#blob + */ +interface BlobOptions extends LexiconItemCommonOptions { + /** Allowed MIME types (e.g., ["image/png", "image/jpeg"]) */ + accept?: string[]; + /** Maximum blob size in bytes */ + maxSize?: number; +} +/** + * Array type options. + * @see https://atproto.com/specs/lexicon#array + */ +interface ArrayOptions extends LexiconItemCommonOptions { + /** Minimum array length */ + minLength?: number; + /** Maximum array length */ + maxLength?: number; +} +/** + * Record type options for repository records. + * @see https://atproto.com/specs/lexicon#record + */ +interface RecordOptions { + /** Record key strategy: "self" for self-describing or "tid" for timestamp IDs */ + key: "self" | "tid"; + /** Object schema defining the record structure */ + record: { + type: "object"; + }; + /** Human-readable description */ + description?: string; +} +/** + * Union type options for multiple possible types. + * @see https://atproto.com/specs/lexicon#union + */ +interface UnionOptions extends LexiconItemCommonOptions { + /** If true, only listed refs are allowed; if false, additional types may be added */ + closed?: boolean; +} +/** + * Map of property names to their lexicon item definitions. + * @see https://atproto.com/specs/lexicon#object + */ +type ObjectProperties = Record; +type RequiredKeys = { [K in keyof T]: T[K] extends { + required: true; +} ? K : never }[keyof T]; +type NullableKeys = { [K in keyof T]: T[K] extends { + nullable: true; +} ? K : never }[keyof T]; +/** + * Resulting object schema with required and nullable fields extracted. + * @see https://atproto.com/specs/lexicon#object + */ +type ObjectResult = { + type: "object"; + /** Property definitions */ + properties: { [K in keyof T]: T[K] extends { + type: "object"; + } ? T[K] : Omit }; +} & ([RequiredKeys] extends [never] ? {} : { + required: UnionToTuple>; +}) & ([NullableKeys] extends [never] ? {} : { + nullable: UnionToTuple>; +}); +/** + * Map of parameter names to their lexicon item definitions. + * @see https://atproto.com/specs/lexicon#params + */ +type ParamsProperties = Record; +/** + * Resulting params schema with required fields extracted. + * @see https://atproto.com/specs/lexicon#params + */ +type ParamsResult = { + type: "params"; + /** Parameter definitions */ + properties: { [K in keyof T]: Omit }; +} & ([RequiredKeys] extends [never] ? {} : { + required: UnionToTuple>; +}); +/** + * HTTP request or response body schema. + * @see https://atproto.com/specs/lexicon#http-endpoints + */ +interface BodySchema { + /** MIME type encoding (typically "application/json") */ + encoding: "application/json" | (string & {}); + /** Human-readable description */ + description?: string; + /** Object schema defining the body structure */ + schema?: ObjectResult; +} +/** + * Error definition for HTTP endpoints. + * @see https://atproto.com/specs/lexicon#http-endpoints + */ +interface ErrorDef { + /** Error name/code */ + name: string; + /** Human-readable error description */ + description?: string; +} +/** + * Query endpoint options (HTTP GET). + * @see https://atproto.com/specs/lexicon#query + */ +interface QueryOptions { + /** Human-readable description */ + description?: string; + /** Query string parameters */ + parameters?: ParamsResult; + /** Response body schema */ + output?: BodySchema; + /** Possible error responses */ + errors?: ErrorDef[]; +} +/** + * Procedure endpoint options (HTTP POST). + * @see https://atproto.com/specs/lexicon#procedure + */ +interface ProcedureOptions { + /** Human-readable description */ + description?: string; + /** Query string parameters */ + parameters?: ParamsResult; + /** Request body schema */ + input?: BodySchema; + /** Response body schema */ + output?: BodySchema; + /** Possible error responses */ + errors?: ErrorDef[]; +} +/** + * WebSocket message schema for subscriptions. + * @see https://atproto.com/specs/lexicon#subscription + */ +interface MessageSchema { + /** Human-readable description */ + description?: string; + /** Union of possible message types */ + schema: { + type: "union"; + refs: readonly string[]; + }; +} +/** + * Subscription endpoint options (WebSocket). + * @see https://atproto.com/specs/lexicon#subscription + */ +interface SubscriptionOptions { + /** Human-readable description */ + description?: string; + /** Query string parameters */ + parameters?: ParamsResult; + /** Message schema for events */ + message?: MessageSchema; + /** Possible error responses */ + errors?: ErrorDef[]; +} +declare class Namespace { + json: T; + infer: Infer; + constructor(json: T); +} +/** + * Main API for creating lexicon schemas. + * @see https://atproto.com/specs/lexicon + */ +declare const lx: { + /** + * Creates a null type. + * @see https://atproto.com/specs/lexicon#null + */ + null(options?: LexiconItemCommonOptions): { + type: "null"; + } & LexiconItemCommonOptions; + /** + * Creates a boolean type with optional constraints. + * @see https://atproto.com/specs/lexicon#boolean + */ + boolean(options?: T): T & { + type: "boolean"; + }; + /** + * Creates an integer type with optional min/max and enum constraints. + * @see https://atproto.com/specs/lexicon#integer + */ + integer(options?: T): T & { + type: "integer"; + }; + /** + * Creates a string type with optional format, length, and value constraints. + * @see https://atproto.com/specs/lexicon#string + */ + string(options?: T): T & { + type: "string"; + }; + /** + * Creates an unknown type for flexible, unvalidated objects. + * @see https://atproto.com/specs/lexicon#unknown + */ + unknown(options?: LexiconItemCommonOptions): { + type: "unknown"; + } & LexiconItemCommonOptions; + /** + * Creates a bytes type for arbitrary byte arrays. + * @see https://atproto.com/specs/lexicon#bytes + */ + bytes(options?: T): T & { + type: "bytes"; + }; + /** + * Creates a CID link reference to content-addressed data. + * @see https://atproto.com/specs/lexicon#cid-link + */ + cidLink(link: Link): { + type: "cid-link"; + $link: Link; + }; + /** + * Creates a blob type for binary data with MIME type constraints. + * @see https://atproto.com/specs/lexicon#blob + */ + blob(options?: T): T & { + type: "blob"; + }; + /** + * Creates an array type with item schema and length constraints. + * @see https://atproto.com/specs/lexicon#array + */ + array(items: Items, options?: Options): Options & { + type: "array"; + items: Items; + }; + /** + * Creates a token type for symbolic values in unions. + * @see https://atproto.com/specs/lexicon#token + */ + token(description: Description): { + type: "token"; + description: Description; + }; + /** + * Creates a reference to another schema definition. + * @see https://atproto.com/specs/lexicon#ref + */ + ref(ref: Ref, options?: LexiconItemCommonOptions): LexiconItemCommonOptions & { + type: "ref"; + ref: Ref; + }; + /** + * Creates a union type for multiple possible type variants. + * @see https://atproto.com/specs/lexicon#union + */ + union(refs: Refs, options?: Options): Options & { + type: "union"; + refs: Refs; + }; + /** + * Creates a record type for repository records. + * @see https://atproto.com/specs/lexicon#record + */ + record(options: T): T & { + type: "record"; + }; + /** + * Creates an object type with defined properties. + * @see https://atproto.com/specs/lexicon#object + */ + object(options: T): ObjectResult; + /** + * Creates a params type for query string parameters. + * @see https://atproto.com/specs/lexicon#params + */ + params(properties: Properties): ParamsResult; + /** + * Creates a query endpoint definition (HTTP GET). + * @see https://atproto.com/specs/lexicon#query + */ + query(options?: T): T & { + type: "query"; + }; + /** + * Creates a procedure endpoint definition (HTTP POST). + * @see https://atproto.com/specs/lexicon#procedure + */ + procedure(options?: T): T & { + type: "procedure"; + }; + /** + * Creates a subscription endpoint definition (WebSocket). + * @see https://atproto.com/specs/lexicon#subscription + */ + subscription(options?: T): T & { + type: "subscription"; + }; + /** + * Creates a lexicon namespace document. + * @see https://atproto.com/specs/lexicon#lexicon-document + */ + namespace(id: ID, defs: D): Namespace<{ + lexicon: 1; + id: ID; + defs: D; + }>; +}; +//#endregion +export { lx }; +//# sourceMappingURL=lib.d.ts.map \ No newline at end of file diff --git a/packages/site/dist/types/type-utils.d.ts b/packages/site/dist/types/type-utils.d.ts new file mode 100644 index 0000000..48f1d28 --- /dev/null +++ b/packages/site/dist/types/type-utils.d.ts @@ -0,0 +1,14 @@ +//#region src/type-utils.d.ts +/** + * Converts a string union type to a tuple type + * @example + * type Colors = "red" | "green" | "blue"; + * type ColorTuple = UnionToTuple; // ["red", "green", "blue"] + */ +type UnionToTuple = ((T extends unknown ? (x: () => T) => void : never) extends ((x: infer I) => void) ? I : never) extends (() => infer R) ? [...UnionToTuple>, R] : []; +type Prettify = { [K in keyof T]: T[K] } & {}; +//# sourceMappingURL=type-utils.d.ts.map + +//#endregion +export { Prettify, UnionToTuple }; +//# sourceMappingURL=type-utils.d.ts.map \ No newline at end of file From 513fc05d3b56a1d9e9617a02c1b7315b1f69997c Mon Sep 17 00:00:00 2001 From: Tyler <26290074+tylersayshi@users.noreply.github.com> Date: Sun, 19 Oct 2025 14:26:30 -0700 Subject: [PATCH 2/6] esm --- packages/cli/tests/integration/cli.test.ts | 5 +++-- packages/cli/tests/integration/error-handling.test.ts | 5 +++-- packages/cli/tests/integration/filesystem.test.ts | 5 +++-- packages/cli/tests/integration/workflow.test.ts | 5 +++-- packages/cli/tests/performance/large-schema-set.test.ts | 5 +++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/packages/cli/tests/integration/cli.test.ts b/packages/cli/tests/integration/cli.test.ts index 6b979ad..3bbb13f 100644 --- a/packages/cli/tests/integration/cli.test.ts +++ b/packages/cli/tests/integration/cli.test.ts @@ -1,6 +1,7 @@ import { expect, test, describe } from "vitest"; import { spawn } from "node:child_process"; -import { join } from "node:path"; +import { join, dirname } from "node:path"; +import { fileURLToPath } from "node:url"; describe("CLI Integration", () => { test("shows error when called without arguments", async () => { @@ -55,7 +56,7 @@ function runCLI( args: string[] = [], ): Promise<{ stdout: string; stderr: string; code: number }> { return new Promise((resolve) => { - const cliPath = join(__dirname, "../../lib/index.js"); + const cliPath = join(dirname(fileURLToPath(import.meta.url)), "../../lib/index.js"); const child = spawn("node", [cliPath, ...args]); let stdout = ""; diff --git a/packages/cli/tests/integration/error-handling.test.ts b/packages/cli/tests/integration/error-handling.test.ts index 1ef1a66..e68f00d 100644 --- a/packages/cli/tests/integration/error-handling.test.ts +++ b/packages/cli/tests/integration/error-handling.test.ts @@ -1,8 +1,9 @@ import { expect, test, describe, beforeEach, afterEach } from "vitest"; import { mkdir, writeFile, rm } from "node:fs/promises"; -import { join } from "node:path"; +import { join, dirname } from "node:path"; import { tmpdir } from "node:os"; import { spawn } from "node:child_process"; +import { fileURLToPath } from "node:url"; describe("CLI Error Handling", () => { let testDir: string; @@ -158,7 +159,7 @@ function runCLI( args: string[], ): Promise<{ stdout: string; stderr: string; code: number }> { return new Promise((resolve) => { - const cliPath = join(__dirname, "../../lib/index.js"); + const cliPath = join(dirname(fileURLToPath(import.meta.url)), "../../lib/index.js"); const child = spawn("node", [cliPath, ...args]); let stdout = ""; diff --git a/packages/cli/tests/integration/filesystem.test.ts b/packages/cli/tests/integration/filesystem.test.ts index 232da48..ad16046 100644 --- a/packages/cli/tests/integration/filesystem.test.ts +++ b/packages/cli/tests/integration/filesystem.test.ts @@ -7,9 +7,10 @@ import { access, constants, } from "node:fs/promises"; -import { join } from "node:path"; +import { join, dirname } from "node:path"; import { tmpdir } from "node:os"; import { spawn } from "node:child_process"; +import { fileURLToPath } from "node:url"; describe("CLI File System Handling", () => { let testDir: string; @@ -189,7 +190,7 @@ function runCLI( args: string[], ): Promise<{ stdout: string; stderr: string; code: number }> { return new Promise((resolve) => { - const cliPath = join(__dirname, "../../lib/index.js"); + const cliPath = join(dirname(fileURLToPath(import.meta.url)), "../../lib/index.js"); const child = spawn("node", [cliPath, ...args]); let stdout = ""; diff --git a/packages/cli/tests/integration/workflow.test.ts b/packages/cli/tests/integration/workflow.test.ts index 39b31aa..8e24b3a 100644 --- a/packages/cli/tests/integration/workflow.test.ts +++ b/packages/cli/tests/integration/workflow.test.ts @@ -1,8 +1,9 @@ import { expect, test, describe, beforeEach, afterEach } from "vitest"; import { mkdir, writeFile, rm, readFile } from "node:fs/promises"; -import { join } from "node:path"; +import { join, dirname } from "node:path"; import { tmpdir } from "node:os"; import { spawn } from "node:child_process"; +import { fileURLToPath } from "node:url"; describe("CLI End-to-End Workflow", () => { let testDir: string; @@ -194,7 +195,7 @@ function runCLI( args: string[], ): Promise<{ stdout: string; stderr: string; code: number }> { return new Promise((resolve) => { - const cliPath = join(__dirname, "../../lib/index.js"); + const cliPath = join(dirname(fileURLToPath(import.meta.url)), "../../lib/index.js"); const child = spawn("node", [cliPath, ...args], { cwd: process.cwd(), env: process.env, diff --git a/packages/cli/tests/performance/large-schema-set.test.ts b/packages/cli/tests/performance/large-schema-set.test.ts index 9f6d2a6..5528aa2 100644 --- a/packages/cli/tests/performance/large-schema-set.test.ts +++ b/packages/cli/tests/performance/large-schema-set.test.ts @@ -1,8 +1,9 @@ import { expect, test, describe, beforeEach, afterEach } from "vitest"; import { mkdir, writeFile, rm } from "node:fs/promises"; -import { join } from "node:path"; +import { join, dirname } from "node:path"; import { tmpdir } from "node:os"; import { spawn } from "node:child_process"; +import { fileURLToPath } from "node:url"; describe("CLI Performance", () => { let testDir: string; @@ -213,7 +214,7 @@ function runCLI( args: string[], ): Promise<{ stdout: string; stderr: string; code: number }> { return new Promise((resolve) => { - const cliPath = join(__dirname, "../../lib/index.js"); + const cliPath = join(dirname(fileURLToPath(import.meta.url)), "../../lib/index.js"); const child = spawn("node", [cliPath, ...args]); let stdout = ""; From 8cf91a484129ff7f49bda9e1d178af4664d4127f Mon Sep 17 00:00:00 2001 From: Tyler <26290074+tylersayshi@users.noreply.github.com> Date: Sun, 19 Oct 2025 14:30:40 -0700 Subject: [PATCH 3/6] test util for runCLI --- packages/cli/tests/integration/cli.test.ts | 28 +--------------- .../tests/integration/error-handling.test.ts | 29 ++--------------- .../cli/tests/integration/filesystem.test.ts | 29 ++--------------- .../cli/tests/integration/workflow.test.ts | 32 ++----------------- .../performance/large-schema-set.test.ts | 29 ++--------------- packages/cli/tests/test-utils.ts | 31 ++++++++++++++++++ 6 files changed, 40 insertions(+), 138 deletions(-) create mode 100644 packages/cli/tests/test-utils.ts diff --git a/packages/cli/tests/integration/cli.test.ts b/packages/cli/tests/integration/cli.test.ts index 3bbb13f..060adb8 100644 --- a/packages/cli/tests/integration/cli.test.ts +++ b/packages/cli/tests/integration/cli.test.ts @@ -1,7 +1,5 @@ import { expect, test, describe } from "vitest"; -import { spawn } from "node:child_process"; -import { join, dirname } from "node:path"; -import { fileURLToPath } from "node:url"; +import { runCLI } from "../test-utils.js"; describe("CLI Integration", () => { test("shows error when called without arguments", async () => { @@ -51,27 +49,3 @@ describe("CLI Integration", () => { ); }); }); - -function runCLI( - args: string[] = [], -): Promise<{ stdout: string; stderr: string; code: number }> { - return new Promise((resolve) => { - const cliPath = join(dirname(fileURLToPath(import.meta.url)), "../../lib/index.js"); - const child = spawn("node", [cliPath, ...args]); - - let stdout = ""; - let stderr = ""; - - child.stdout.on("data", (data) => { - stdout += data.toString(); - }); - - child.stderr.on("data", (data) => { - stderr += data.toString(); - }); - - child.on("close", (code) => { - resolve({ stdout, stderr, code: code ?? 0 }); - }); - }); -} diff --git a/packages/cli/tests/integration/error-handling.test.ts b/packages/cli/tests/integration/error-handling.test.ts index e68f00d..74d6fa6 100644 --- a/packages/cli/tests/integration/error-handling.test.ts +++ b/packages/cli/tests/integration/error-handling.test.ts @@ -1,9 +1,8 @@ import { expect, test, describe, beforeEach, afterEach } from "vitest"; import { mkdir, writeFile, rm } from "node:fs/promises"; -import { join, dirname } from "node:path"; +import { join } from "node:path"; import { tmpdir } from "node:os"; -import { spawn } from "node:child_process"; -import { fileURLToPath } from "node:url"; +import { runCLI } from "../test-utils.js"; describe("CLI Error Handling", () => { let testDir: string; @@ -154,27 +153,3 @@ describe("CLI Error Handling", () => { expect(stderr).toContain("Error generating inferred types"); }); }); - -function runCLI( - args: string[], -): Promise<{ stdout: string; stderr: string; code: number }> { - return new Promise((resolve) => { - const cliPath = join(dirname(fileURLToPath(import.meta.url)), "../../lib/index.js"); - const child = spawn("node", [cliPath, ...args]); - - let stdout = ""; - let stderr = ""; - - child.stdout.on("data", (data) => { - stdout += data.toString(); - }); - - child.stderr.on("data", (data) => { - stderr += data.toString(); - }); - - child.on("close", (code) => { - resolve({ stdout, stderr, code: code ?? 0 }); - }); - }); -} diff --git a/packages/cli/tests/integration/filesystem.test.ts b/packages/cli/tests/integration/filesystem.test.ts index ad16046..2e88a41 100644 --- a/packages/cli/tests/integration/filesystem.test.ts +++ b/packages/cli/tests/integration/filesystem.test.ts @@ -7,10 +7,9 @@ import { access, constants, } from "node:fs/promises"; -import { join, dirname } from "node:path"; +import { join } from "node:path"; import { tmpdir } from "node:os"; -import { spawn } from "node:child_process"; -import { fileURLToPath } from "node:url"; +import { runCLI } from "../test-utils.js"; describe("CLI File System Handling", () => { let testDir: string; @@ -185,27 +184,3 @@ describe("CLI File System Handling", () => { expect([0, 1]).toContain(code); }); }); - -function runCLI( - args: string[], -): Promise<{ stdout: string; stderr: string; code: number }> { - return new Promise((resolve) => { - const cliPath = join(dirname(fileURLToPath(import.meta.url)), "../../lib/index.js"); - const child = spawn("node", [cliPath, ...args]); - - let stdout = ""; - let stderr = ""; - - child.stdout.on("data", (data) => { - stdout += data.toString(); - }); - - child.stderr.on("data", (data) => { - stderr += data.toString(); - }); - - child.on("close", (code) => { - resolve({ stdout, stderr, code: code ?? 0 }); - }); - }); -} diff --git a/packages/cli/tests/integration/workflow.test.ts b/packages/cli/tests/integration/workflow.test.ts index 8e24b3a..11d7c4b 100644 --- a/packages/cli/tests/integration/workflow.test.ts +++ b/packages/cli/tests/integration/workflow.test.ts @@ -1,9 +1,8 @@ import { expect, test, describe, beforeEach, afterEach } from "vitest"; import { mkdir, writeFile, rm, readFile } from "node:fs/promises"; -import { join, dirname } from "node:path"; +import { join } from "node:path"; import { tmpdir } from "node:os"; -import { spawn } from "node:child_process"; -import { fileURLToPath } from "node:url"; +import { runCLI } from "../test-utils.js"; describe("CLI End-to-End Workflow", () => { let testDir: string; @@ -190,30 +189,3 @@ describe("CLI End-to-End Workflow", () => { ); }); }); - -function runCLI( - args: string[], -): Promise<{ stdout: string; stderr: string; code: number }> { - return new Promise((resolve) => { - const cliPath = join(dirname(fileURLToPath(import.meta.url)), "../../lib/index.js"); - const child = spawn("node", [cliPath, ...args], { - cwd: process.cwd(), - env: process.env, - }); - - let stdout = ""; - let stderr = ""; - - child.stdout.on("data", (data) => { - stdout += data.toString(); - }); - - child.stderr.on("data", (data) => { - stderr += data.toString(); - }); - - child.on("close", (code) => { - resolve({ stdout, stderr, code: code ?? 0 }); - }); - }); -} diff --git a/packages/cli/tests/performance/large-schema-set.test.ts b/packages/cli/tests/performance/large-schema-set.test.ts index 5528aa2..4d64810 100644 --- a/packages/cli/tests/performance/large-schema-set.test.ts +++ b/packages/cli/tests/performance/large-schema-set.test.ts @@ -1,9 +1,8 @@ import { expect, test, describe, beforeEach, afterEach } from "vitest"; import { mkdir, writeFile, rm } from "node:fs/promises"; -import { join, dirname } from "node:path"; +import { join } from "node:path"; import { tmpdir } from "node:os"; -import { spawn } from "node:child_process"; -import { fileURLToPath } from "node:url"; +import { runCLI } from "../test-utils.js"; describe("CLI Performance", () => { let testDir: string; @@ -209,27 +208,3 @@ describe("CLI Performance", () => { ); }); }); - -function runCLI( - args: string[], -): Promise<{ stdout: string; stderr: string; code: number }> { - return new Promise((resolve) => { - const cliPath = join(dirname(fileURLToPath(import.meta.url)), "../../lib/index.js"); - const child = spawn("node", [cliPath, ...args]); - - let stdout = ""; - let stderr = ""; - - child.stdout.on("data", (data) => { - stdout += data.toString(); - }); - - child.stderr.on("data", (data) => { - stderr += data.toString(); - }); - - child.on("close", (code) => { - resolve({ stdout, stderr, code: code ?? 0 }); - }); - }); -} diff --git a/packages/cli/tests/test-utils.ts b/packages/cli/tests/test-utils.ts new file mode 100644 index 0000000..62a9acf --- /dev/null +++ b/packages/cli/tests/test-utils.ts @@ -0,0 +1,31 @@ +import { spawn } from "node:child_process"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; + +export function runCLI( + args: string[] = [], + options?: { cwd?: string; env?: NodeJS.ProcessEnv }, +): Promise<{ stdout: string; stderr: string; code: number }> { + return new Promise((resolve) => { + const cliPath = join(dirname(fileURLToPath(import.meta.url)), "../lib/index.js"); + const child = spawn("node", [cliPath, ...args], { + cwd: options?.cwd ?? process.cwd(), + env: options?.env ?? process.env, + }); + + let stdout = ""; + let stderr = ""; + + child.stdout.on("data", (data) => { + stdout += data.toString(); + }); + + child.stderr.on("data", (data) => { + stderr += data.toString(); + }); + + child.on("close", (code) => { + resolve({ stdout, stderr, code: code ?? 0 }); + }); + }); +} From 0eae9417708e062c15845e35466fa25ca07f1727 Mon Sep 17 00:00:00 2001 From: Tyler <26290074+tylersayshi@users.noreply.github.com> Date: Sun, 19 Oct 2025 14:31:59 -0700 Subject: [PATCH 4/6] remove site assets --- packages/site/dist/assets/index-BsKdg2XM.css | 1 - packages/site/dist/assets/index-vwl5Isce.js | 41 -- packages/site/dist/index.html | 13 - packages/site/dist/types/index.d.ts | 2 - packages/site/dist/types/infer.d.ts | 91 ---- packages/site/dist/types/lib.d.ts | 420 ------------------- packages/site/dist/types/type-utils.d.ts | 14 - 7 files changed, 582 deletions(-) delete mode 100644 packages/site/dist/assets/index-BsKdg2XM.css delete mode 100644 packages/site/dist/assets/index-vwl5Isce.js delete mode 100644 packages/site/dist/index.html delete mode 100644 packages/site/dist/types/index.d.ts delete mode 100644 packages/site/dist/types/infer.d.ts delete mode 100644 packages/site/dist/types/lib.d.ts delete mode 100644 packages/site/dist/types/type-utils.d.ts diff --git a/packages/site/dist/assets/index-BsKdg2XM.css b/packages/site/dist/assets/index-BsKdg2XM.css deleted file mode 100644 index 7fad108..0000000 --- a/packages/site/dist/assets/index-BsKdg2XM.css +++ /dev/null @@ -1 +0,0 @@ -*{box-sizing:border-box;margin:0;padding:0}:root{color:#213547;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-weight:400;line-height:1.5}body{min-width:320px;min-height:100vh;margin:0;display:flex}#root{flex-direction:column;width:100%;display:flex} diff --git a/packages/site/dist/assets/index-vwl5Isce.js b/packages/site/dist/assets/index-vwl5Isce.js deleted file mode 100644 index ad739e8..0000000 --- a/packages/site/dist/assets/index-vwl5Isce.js +++ /dev/null @@ -1,41 +0,0 @@ -var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e){if(t.type!==`childList`)continue;for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=o(exports=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1{t.exports=l()}),d=o(exports=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;exports.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();exports.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,ae(x);else{var t=n(l);t!==null&&oe(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=exports.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&oe(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function ee(){return exports.unstable_now()-Ee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,oe(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ae(x))),r},exports.unstable_shouldYield=ee,exports.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}}),f=o((exports,t)=>{t.exports=d()}),p=o(exports=>{var t=u(),n=f();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,d=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},m={};function h(e){return l.call(m,e)?!0:l.call(p,e)?!1:d.test(e)?m[e]=!0:(p[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` -`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{fe=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?de(e):``}function me(e){switch(e.tag){case 5:return de(e.type);case 16:return de(`Lazy`);case 13:return de(`Suspense`);case 19:return de(`SuspenseList`);case 0:case 2:case 15:return e=pe(e.type,!1),e;case 11:return e=pe(e.type.render,!1),e;case 1:return e=pe(e.type,!0),e;default:return``}}function he(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case te:return`Profiler`;case ee:return`StrictMode`;case ae:return`Suspense`;case oe:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case re:return(e.displayName||`Context`)+`.Consumer`;case ne:return(e._context.displayName||`Context`)+`.Provider`;case ie:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||``,e=e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?he(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return he(e(t))}catch{}}return null}function ge(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return he(t);case 8:return t===ee?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function _e(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function ve(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ye(e){var t=ve(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function be(e){e._valueTracker||=ye(e)}function xe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=ve(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Se(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ce(e,t){var n=t.checked;return k({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function we(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=_e(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function Te(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function Ee(e,t){Te(e,t);var n=_e(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?Oe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Oe(e,t.type,_e(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function De(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function Oe(e,t,n){(t!==`number`||Se(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ke=Array.isArray;function Ae(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=Le.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ze(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Be={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ve=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Be).forEach(function(e){Ve.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Be[t]=Be[e]})});function He(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Be.hasOwnProperty(e)&&Be[e]?(``+t).trim():t+`px`}function Ue(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=He(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var We=k({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ge(e,t){if(t){if(We[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Ke(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var qe=null;function Je(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ye=null,Xe=null,Ze=null;function Qe(e){if(e=sa(e)){if(typeof Ye!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=la(t),Ye(e.stateNode,e.type,t))}}function $e(e){Xe?Ze?Ze.push(e):Ze=[e]:Xe=e}function A(){if(Xe){var e=Xe,t=Ze;if(Ze=Xe=null,Qe(e),t)for(e=0;e>>=0,e===0?32:31-(Ft(e)/It|0)|0}var Rt=64,zt=4194304;function Bt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Vt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Bt(a))):r=Bt(s)}else o=n&~i,o===0?a!==0&&(r=Bt(a)):r=Bt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function qt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Pt(t),e[t]=n}function Jt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=yr),Sr=` `,Cr=!1;function wr(e,t){switch(e){case`keyup`:return _r.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Tr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Er=!1;function Dr(e,t){switch(e){case`compositionend`:return Tr(t);case`keypress`:return t.which===32?(Cr=!0,Sr):null;case`textInput`:return e=t.data,e===Sr&&Cr?null:e;default:return null}}function Or(e,t){if(Er)return e===`compositionend`||!vr&&wr(e,t)?(e=Mn(),jn=An=kn=null,Er=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Xr(n)}}function Qr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function $r(){for(var e=window,t=Se();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Se(e.document)}return t}function ei(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function ti(e){var t=$r(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Qr(n.ownerDocument.documentElement,n)){if(r!==null&&ei(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Zr(n,a);var o=Zr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n=document.documentMode,ri=null,ii=null,ai=null,oi=!1;function si(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;oi||ri==null||ri!==Se(r)||(r=ri,`selectionStart`in r&&ei(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ai&&Yr(ai,r)||(ai=r,r=Pi(ii,`onSelect`),0da||(e.current=ua[da],ua[da]=null,da--)}function F(e,t){da++,ua[da]=e.current,e.current=t}var pa={},I=fa(pa),ma=fa(!1),ha=pa;function ga(e,t){var n=e.type.contextTypes;if(!n)return pa;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function _a(e){return e=e.childContextTypes,e!=null}function va(){P(ma),P(I)}function ya(e,t,n){if(I.current!==pa)throw Error(r(168));F(I,t),F(ma,n)}function ba(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,ge(e)||`Unknown`,a));return k({},n,i)}function xa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pa,ha=I.current,F(I,e),F(ma,ma.current),!0}function Sa(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=ba(e,t,ha),i.__reactInternalMemoizedMergedChildContext=e,P(ma),P(I),F(I,e)):P(ma),F(ma,n)}var Ca=null,wa=!1,Ta=!1;function Ea(e){Ca===null?Ca=[e]:Ca.push(e)}function Da(e){wa=!0,Ea(e)}function Oa(){if(!Ta&&Ca!==null){Ta=!0;var e=0,t=M;try{var n=Ca;for(M=1;e>=o,i-=o,Ia=1<<32-Pt(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),L&&Ra(r,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),L&&Ra(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return L&&Ra(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),L&&Ra(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===O&&ro(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=to(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=fu(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=du(i.type,i.key,i.props,null,e.mode,o),o.ref=to(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=hu(i,e.mode,o),r.return=e,e=r}return s(e);case O:return l=i._init,_(e,r,l(i._payload),o)}if(ke(i))return h(e,r,i,o);if(le(i))return g(e,r,i,o);no(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=mu(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var ao=io(!0),oo=io(!1),so=fa(null),co=null,lo=null,uo=null;function fo(){uo=lo=co=null}function po(e){var t=so.current;P(so),e._currentValue=t}function mo(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ho(e,t){co=e,uo=lo=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(tc=!0),e.firstContext=null)}function go(e){var t=e._currentValue;if(uo!==e)if(e={context:e,memoizedValue:t,next:null},lo===null){if(co===null)throw Error(r(308));lo=e,co.dependencies={lanes:0,firstContext:e}}else lo=lo.next=e;return t}var _o=null;function vo(e){_o===null?_o=[e]:_o.push(e)}function yo(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,vo(t)):(n.next=i.next,i.next=n),t.interleaved=n,bo(e,r)}function bo(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var xo=!1;function So(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Co(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function wo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function To(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,bo(e,n)}return i=r.interleaved,i===null?(t.next=t,vo(r)):(t.next=i.next,i.next=t),r.interleaved=t,bo(e,n)}function Eo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Yt(e,n)}}function Do(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Oo(e,t,n,r){var i=e.updateQueue;xo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=k({},d,f);break a;case 2:xo=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);dl|=o,e.lanes=o,e.memoizedState=d}}function ko(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Uo.transition;Uo.transition={};try{e(!1),t()}finally{M=n,Uo.transition=r}}function Os(){return $o().memoizedState}function ks(e,t,n){var r=kl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},js(e))Ms(t,n);else if(n=yo(e,t,n,r),n!==null){var i=Q();Al(n,e,r,i),Ns(n,t,r)}}function As(e,t,n){var r=kl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(js(e))Ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Jr(s,o)){var c=t.interleaved;c===null?(i.next=i,vo(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=yo(e,t,i,r),n!==null&&(i=Q(),Al(n,e,r,i),Ns(n,t,r))}}function js(e){var t=e.alternate;return e===z||t!==null&&t===z}function Ms(e,t){Ko=Go=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ns(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Yt(e,n)}}var Ps={readContext:go,useCallback:H,useContext:H,useEffect:H,useImperativeHandle:H,useInsertionEffect:H,useLayoutEffect:H,useMemo:H,useReducer:H,useRef:H,useState:H,useDebugValue:H,useDeferredValue:H,useTransition:H,useMutableSource:H,useSyncExternalStore:H,useId:H,unstable_isNewReconciler:!1},Fs={readContext:go,useCallback:function(e,t){return Qo().memoizedState=[e,t===void 0?null:t],e},useContext:go,useEffect:_s,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),hs(4194308,4,xs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return hs(4194308,4,e,t)},useInsertionEffect:function(e,t){return hs(4,2,e,t)},useMemo:function(e,t){var n=Qo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Qo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ks.bind(null,z,e),[r.memoizedState,e]},useRef:function(e){var t=Qo();return e={current:e},t.memoizedState=e},useState:fs,useDebugValue:Cs,useDeferredValue:function(e){return Qo().memoizedState=e},useTransition:function(){var e=fs(!1),t=e[0];return e=Ds.bind(null,e[1]),Qo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=z,a=Qo();if(L){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),J===null)throw Error(r(349));Wo&30||ss(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,_s(ls.bind(null,i,o,e),[e]),i.flags|=2048,ps(9,cs.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Qo(),t=J.identifierPrefix;if(L){var n=La,r=Ia;n=(r&~(1<<32-Pt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=qo++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[ea]=t,e[ta]=i,Tc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ke(n,i),n){case`dialog`:N(`cancel`,e),N(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:N(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o_l&&(t.flags|=128,i=!0,kc(s,!1),t.lanes=4194304)}else{if(!i)if(e=zo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),kc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!L)return U(t),null}else 2*j()-s.renderingStartTime>_l&&n!==1073741824&&(t.flags|=128,i=!0,kc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(U(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=j(),t.sibling=null,n=R.current,F(R,i?n&1|2:n&1),t);case 22:case 23:return Bl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?cl&1073741824&&(U(t),t.subtreeFlags&6&&(t.flags|=8192)):U(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function jc(e,t){switch(Va(t),t.tag){case 1:return _a(t.type)&&va(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Io(),P(ma),P(I),Vo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ro(t),null;case 13:if(P(R),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Qa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return P(R),null;case 4:return Io(),null;case 10:return po(t.type._context),null;case 22:case 23:return Bl(),null;case 24:return null;default:return null}}var Mc=!1,W=!1,Nc=typeof WeakSet==`function`?WeakSet:Set,G=null;function Pc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}function Fc(e,t,n){try{n()}catch(n){$(e,t,n)}}var Ic=!1;function Lc(e,t){if(Hi=Sn,e=$r(),ei(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ui={focusedElem:e,selectionRange:n},Sn=!1,G=t;G!==null;)if(t=G,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,G=e;else for(;G!==null;){t=G;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Rs(t.type,g),_);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent=``:b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,G=e;break}G=t.return}return h=Ic,Ic=!1,h}function Rc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&Fc(t,n,a)}i=i.next}while(i!==r)}}function zc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Bc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Vc(e){var t=e.alternate;t!==null&&(e.alternate=null,Vc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ea],delete t[ta],delete t[ra],delete t[ia],delete t[aa])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Hc(e){return e.tag===5||e.tag===3||e.tag===4}function Uc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Hc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Vi));else if(r!==4&&(e=e.child,e!==null))for(Wc(e,t,n),e=e.sibling;e!==null;)Wc(e,t,n),e=e.sibling}function Gc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}var K=null,Kc=!1;function qc(e,t,n){for(n=n.child;n!==null;)Jc(e,t,n),n=n.sibling}function Jc(e,t,n){if(Mt&&typeof Mt.onCommitFiberUnmount==`function`)try{Mt.onCommitFiberUnmount(jt,n)}catch{}switch(n.tag){case 5:W||Pc(n,t);case 6:var r=K,i=Kc;K=null,qc(e,t,n),K=r,Kc=i,K!==null&&(Kc?(e=K,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):K.removeChild(n.stateNode));break;case 18:K!==null&&(Kc?(e=K,n=n.stateNode,e.nodeType===8?Xi(e.parentNode,n):e.nodeType===1&&Xi(e,n),bn(e)):Xi(K,n.stateNode));break;case 4:r=K,i=Kc,K=n.stateNode.containerInfo,Kc=!0,qc(e,t,n),K=r,Kc=i;break;case 0:case 11:case 14:case 15:if(!W&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&Fc(n,t,o),i=i.next}while(i!==r)}qc(e,t,n);break;case 1:if(!W&&(Pc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}qc(e,t,n);break;case 21:qc(e,t,n);break;case 22:n.mode&1?(W=(r=W)||n.memoizedState!==null,qc(e,t,n),W=r):qc(e,t,n);break;default:qc(e,t,n)}}function Yc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Nc),t.forEach(function(t){var r=ru.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Xc(e,t){var n=t.deletions;if(n!==null)for(var i=0;ia&&(a=s),i&=~o}if(i=a,i=j()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*il(i/1960))-i,10e?16:e,Cl===null)var i=!1;else{if(e=Cl,Cl=null,wl=0,q&6)throw Error(r(331));var a=q;for(q|=4,G=e.current;G!==null;){var o=G,s=o.child;if(G.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lj()-gl?Vl(e,0):pl|=n),jl(e,t)}function tu(e,t){t===0&&(e.mode&1?(t=zt,zt<<=1,!(zt&130023424)&&(zt=4194304)):t=1);var n=Q();e=bo(e,t),e!==null&&(qt(e,t,n),jl(e,n))}function nu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),tu(e,n)}function ru(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),tu(e,n)}var iu;iu=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ma.current)tc=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return tc=!1,wc(e,t,n);tc=e.flags&131072?!0:!1}else tc=!1,L&&t.flags&1048576&&za(t,Ma,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;Sc(e,t),e=t.pendingProps;var a=ga(t,I.current);ho(t,n),a=Xo(null,t,i,e,a,n);var o=Zo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,_a(i)?(o=!0,xa(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,So(t),a.updater=Bs,t.stateNode=a,a._reactInternals=t,Ws(t,i,e,n),t=uc(null,t,i,!0,o,n)):(t.tag=0,L&&o&&Ba(t),nc(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(Sc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=lu(i),e=Rs(i,e),a){case 0:t=cc(null,t,i,e,n);break a;case 1:t=lc(null,t,i,e,n);break a;case 11:t=rc(null,t,i,e,n);break a;case 14:t=ic(null,t,i,Rs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Rs(i,a),cc(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Rs(i,a),lc(e,t,i,a,n);case 3:a:{if(dc(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,Co(e,t),Oo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Gs(Error(r(423)),t),t=fc(e,t,i,n,a);break a}else if(i!==a){a=Gs(Error(r(424)),t),t=fc(e,t,i,n,a);break a}else for(Ua=Zi(t.stateNode.containerInfo.firstChild),Ha=t,L=!0,Wa=null,n=oo(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Qa(),i===a){t=Cc(e,t,n);break a}nc(e,t,i,n)}t=t.child}return t;case 5:return Lo(t),e===null&&Ja(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Wi(i,a)?s=null:o!==null&&Wi(i,o)&&(t.flags|=32),sc(e,t),nc(e,t,s,n),t.child;case 6:return e===null&&Ja(t),null;case 13:return hc(e,t,n);case 4:return Fo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=ao(t,null,i,n):nc(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Rs(i,a),rc(e,t,i,a,n);case 7:return nc(e,t,t.pendingProps,n),t.child;case 8:return nc(e,t,t.pendingProps.children,n),t.child;case 12:return nc(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,F(so,i._currentValue),i._currentValue=s,o!==null)if(Jr(o.value,s)){if(o.children===a.children&&!ma.current){t=Cc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=wo(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),mo(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),mo(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}nc(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,ho(t,n),a=go(a),i=i(a),t.flags|=1,nc(e,t,i,n),t.child;case 14:return i=t.type,a=Rs(i,t.pendingProps),a=Rs(i.type,a),ic(e,t,i,a,n);case 15:return ac(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Rs(i,a),Sc(e,t),t.tag=1,_a(i)?(e=!0,xa(t)):e=!1,ho(t,n),Hs(t,i,a),Ws(t,i,a,n),uc(null,t,i,!0,e,n);case 19:return xc(e,t,n);case 22:return oc(e,t,n)}throw Error(r(156,t.tag))};function au(e,t){return xt(e,t)}function ou(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function su(e,t,n,r){return new ou(e,t,n,r)}function cu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function lu(e){if(typeof e==`function`)return cu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ie)return 11;if(e===D)return 14}return 2}function uu(e,t){var n=e.alternate;return n===null?(n=su(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function du(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)cu(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return fu(n.children,a,o,t);case ee:s=8,a|=8;break;case te:return e=su(12,n,t,a|2),e.elementType=te,e.lanes=o,e;case ae:return e=su(13,n,t,a),e.elementType=ae,e.lanes=o,e;case oe:return e=su(19,n,t,a),e.elementType=oe,e.lanes=o,e;case se:return pu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case ne:s=10;break a;case re:s=9;break a;case ie:s=11;break a;case D:s=14;break a;case O:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=su(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function fu(e,t,n,r){return e=su(7,e,r,t),e.lanes=n,e}function pu(e,t,n,r){return e=su(22,e,r,t),e.elementType=se,e.lanes=n,e.stateNode={isHidden:!1},e}function mu(e,t,n){return e=su(6,e,null,t),e.lanes=n,e}function hu(e,t,n){return t=su(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function gu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Kt(0),this.expirationTimes=Kt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Kt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function _u(e,t,n,r,i,a,o,s,c){return e=new gu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=su(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},So(a),e}function vu(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()}),h=o(exports=>{var t=m();if(1)exports.createRoot=t.createRoot,exports.hydrateRoot=t.hydrateRoot;else var n}),g=o(exports=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}exports.Fragment=r,exports.jsx=s,exports.jsxs=s}),_=o((exports,t)=>{t.exports=g()}),v=c(_());function y(){return(0,v.jsx)(`header`,{style:{padding:`2rem 2rem 1rem 2rem`,borderBottom:`1px solid #e5e7eb`},children:(0,v.jsxs)(`div`,{style:{maxWidth:`1400px`,margin:`0 auto`},children:[(0,v.jsxs)(`h1`,{style:{fontSize:`2.5rem`,fontWeight:`700`,marginBottom:`0.5rem`},children:[(0,v.jsx)(`span`,{style:{color:`#6b7280`},children:`at://`}),`prototypekit`]}),(0,v.jsx)(`p`,{style:{fontSize:`1.125rem`,color:`#6b7280`,marginTop:`0.5rem`},children:`Type-safe lexicon inference for ATProto schemas`})]})})}function b(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=e.length?e.apply(this,i):function(){for(var e=arguments.length,r=Array(e),a=0;a1&&arguments[1]!==void 0?arguments[1]:{};ye.initial(e),ye.handler(t);var n={current:e},r=ce(Ce)(n,t),i=ce(Se)(n),a=ce(ye.changes)(e),o=ce(xe)(n);function s(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(e){return e};return ye.selector(e),e(n.current)}function c(e){se(r,i,a,o)(e)}return[s,c]}function xe(e,t){return ue(t)?t(e.current):t}function Se(e,t){return e.current=O(O({},e.current),t),t}function Ce(e,t,n){return ue(t)?t(e.current):Object.keys(n).forEach(function(n){var r;return(r=t[n])?.call(t,e.current[n])}),n}var we={create:be},Te=we,Ee={paths:{vs:`https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs`}};function De(e){return function t(){for(var n=this,r=arguments.length,i=Array(r),a=0;a=e.length?e.apply(this,i):function(){for(var e=arguments.length,r=Array(e),a=0;a{r.current=!1}:e,t)}var pt=ft;function mt(){}function ht(e,t,n,r){return gt(e,r)||_t(e,t,n,r)}function gt(e,t){return e.editor.getModel(vt(e,t))}function _t(e,t,n,r){return e.editor.createModel(t,n,r?vt(e,r):void 0)}function vt(e,t){return e.Uri.parse(t)}function yt({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:i,originalModelPath:a,modifiedModelPath:o,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:c=!1,theme:l=`light`,loading:u=`Loading...`,options:d={},height:f=`100%`,width:p=`100%`,className:m,wrapperProps:h={},beforeMount:g=mt,onMount:_=mt}){let[v,y]=(0,A.useState)(!1),[b,x]=(0,A.useState)(!0),S=(0,A.useRef)(null),C=(0,A.useRef)(null),w=(0,A.useRef)(null),T=(0,A.useRef)(_),E=(0,A.useRef)(g),ee=(0,A.useRef)(!1);dt(()=>{let e=$e.init();return e.then(e=>(C.current=e)&&x(!1)).catch(e=>e?.type!==`cancelation`&&console.error(`Monaco initialization: error:`,e)),()=>S.current?re():e.cancel()}),pt(()=>{if(S.current&&C.current){let t=S.current.getOriginalEditor(),i=ht(C.current,e||``,r||n||`text`,a||``);i!==t.getModel()&&t.setModel(i)}},[a],v),pt(()=>{if(S.current&&C.current){let e=S.current.getModifiedEditor(),r=ht(C.current,t||``,i||n||`text`,o||``);r!==e.getModel()&&e.setModel(r)}},[o],v),pt(()=>{let e=S.current.getModifiedEditor();e.getOption(C.current.editor.EditorOption.readOnly)?e.setValue(t||``):t!==e.getValue()&&(e.executeEdits(``,[{range:e.getModel().getFullModelRange(),text:t||``,forceMoveMarkers:!0}]),e.pushUndoStop())},[t],v),pt(()=>{S.current?.getModel()?.original.setValue(e||``)},[e],v),pt(()=>{let{original:e,modified:t}=S.current.getModel();C.current.editor.setModelLanguage(e,r||n||`text`),C.current.editor.setModelLanguage(t,i||n||`text`)},[n,r,i],v),pt(()=>{C.current?.editor.setTheme(l)},[l],v),pt(()=>{S.current?.updateOptions(d)},[d],v);let te=(0,A.useCallback)(()=>{if(!C.current)return;E.current(C.current);let s=ht(C.current,e||``,r||n||`text`,a||``),c=ht(C.current,t||``,i||n||`text`,o||``);S.current?.setModel({original:s,modified:c})},[n,t,i,e,r,a,o]),ne=(0,A.useCallback)(()=>{!ee.current&&w.current&&(S.current=C.current.editor.createDiffEditor(w.current,{automaticLayout:!0,...d}),te(),C.current?.editor.setTheme(l),y(!0),ee.current=!0)},[d,l,te]);(0,A.useEffect)(()=>{v&&T.current(S.current,C.current)},[v]),(0,A.useEffect)(()=>{!b&&!v&&ne()},[b,v,ne]);function re(){let e=S.current?.getModel();s||e?.original?.dispose(),c||e?.modified?.dispose(),S.current?.dispose()}return A.createElement(lt,{width:p,height:f,isEditorReady:v,loading:u,_ref:w,className:m,wrapperProps:h})}var bt=yt,xt=(0,A.memo)(bt);function St(){let[e,t]=(0,A.useState)($e.__getMonacoInstance());return dt(()=>{let n;return e||(n=$e.init(),n.then(e=>{t(e)})),()=>n?.cancel()}),e}var Ct=St;function wt(e){let t=(0,A.useRef)();return(0,A.useEffect)(()=>{t.current=e},[e]),t.current}var j=wt,Tt=new Map;function Et({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:i,path:a,theme:o=`light`,line:s,loading:c=`Loading...`,options:l={},overrideServices:u={},saveViewState:d=!0,keepCurrentModel:f=!1,width:p=`100%`,height:m=`100%`,className:h,wrapperProps:g={},beforeMount:_=mt,onMount:v=mt,onChange:y,onValidate:b=mt}){let[x,S]=(0,A.useState)(!1),[C,w]=(0,A.useState)(!0),T=(0,A.useRef)(null),E=(0,A.useRef)(null),ee=(0,A.useRef)(null),te=(0,A.useRef)(v),ne=(0,A.useRef)(_),re=(0,A.useRef)(),ie=(0,A.useRef)(r),ae=j(a),oe=(0,A.useRef)(!1),D=(0,A.useRef)(!1);dt(()=>{let e=$e.init();return e.then(e=>(T.current=e)&&w(!1)).catch(e=>e?.type!==`cancelation`&&console.error(`Monaco initialization: error:`,e)),()=>E.current?se():e.cancel()}),pt(()=>{let o=ht(T.current,e||r||``,t||i||``,a||n||``);o!==E.current?.getModel()&&(d&&Tt.set(ae,E.current?.saveViewState()),E.current?.setModel(o),d&&E.current?.restoreViewState(Tt.get(a)))},[a],x),pt(()=>{E.current?.updateOptions(l)},[l],x),pt(()=>{!E.current||r===void 0||(E.current.getOption(T.current.editor.EditorOption.readOnly)?E.current.setValue(r):r!==E.current.getValue()&&(D.current=!0,E.current.executeEdits(``,[{range:E.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),E.current.pushUndoStop(),D.current=!1))},[r],x),pt(()=>{let e=E.current?.getModel();e&&i&&T.current?.editor.setModelLanguage(e,i)},[i],x),pt(()=>{s!==void 0&&E.current?.revealLine(s)},[s],x),pt(()=>{T.current?.editor.setTheme(o)},[o],x);let O=(0,A.useCallback)(()=>{if(!(!ee.current||!T.current)&&!oe.current){ne.current(T.current);let c=a||n,f=ht(T.current,r||e||``,t||i||``,c||``);E.current=T.current?.editor.create(ee.current,{model:f,automaticLayout:!0,...l},u),d&&E.current.restoreViewState(Tt.get(c)),T.current.editor.setTheme(o),s!==void 0&&E.current.revealLine(s),S(!0),oe.current=!0}},[e,t,n,r,i,a,l,u,d,o,s]);(0,A.useEffect)(()=>{x&&te.current(E.current,T.current)},[x]),(0,A.useEffect)(()=>{!C&&!x&&O()},[C,x,O]),ie.current=r,(0,A.useEffect)(()=>{x&&y&&(re.current?.dispose(),re.current=E.current?.onDidChangeModelContent(e=>{D.current||y(E.current.getValue(),e)}))},[x,y]),(0,A.useEffect)(()=>{if(x){let e=T.current.editor.onDidChangeMarkers(e=>{let t=E.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=T.current.editor.getModelMarkers({resource:t});b?.(e)}});return()=>{e?.dispose()}}return()=>{}},[x,b]);function se(){re.current?.dispose(),f?d&&Tt.set(a,E.current.saveViewState()):E.current.getModel()?.dispose(),E.current.dispose()}return A.createElement(lt,{width:p,height:m,isEditorReady:x,loading:c,_ref:ee,className:h,wrapperProps:g})}var Dt=Et,Ot=(0,A.memo)(Dt),kt=Ot;function At({value:e,onChange:t,onReady:n}){let[r,i]=(0,A.useState)(!1);return(0,A.useEffect)(()=>{$e.init().then(e=>{e.languages.typescript.typescriptDefaults.setCompilerOptions({target:e.languages.typescript.ScriptTarget.ES2020,allowNonTsExtensions:!0,moduleResolution:e.languages.typescript.ModuleResolutionKind.NodeJs,module:e.languages.typescript.ModuleKind.ESNext,noEmit:!0,esModuleInterop:!0,allowSyntheticDefaultImports:!0,strict:!1}),e.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!1,noSyntaxValidation:!1}),Promise.all([fetch(`/types/type-utils.d.ts`).then(e=>e.text()),fetch(`/types/infer.d.ts`).then(e=>e.text()),fetch(`/types/lib.d.ts`).then(e=>e.text())]).then(([t,r,a])=>{let o=e=>e.replace(/import\s+{[^}]*}\s+from\s+['""][^'"]*['""];?\s*/g,``).replace(/import\s+.*\s+from\s+['""][^'"]*['""];?\s*/g,``).replace(/^export\s+{[^}]*};?\s*/gm,``).replace(/^export\s+/gm,``).replace(/\/\/# sourceMappingURL=.*/g,``).replace(/\/\/#region.*\n?/g,``).replace(/\/\/#endregion.*\n?/g,``),s=` -${o(t)} -${o(r)} -${o(a)} -`,c=`declare module "prototypekit" { -${s} -}`;e.languages.typescript.typescriptDefaults.addExtraLib(c,`prototypekit.d.ts`),i(!0),n?.()})})},[n]),r?(0,v.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,v.jsx)(`div`,{style:{padding:`0.75rem 1rem`,backgroundColor:`#f9fafb`,borderBottom:`1px solid #e5e7eb`,fontSize:`0.875rem`,fontWeight:`600`,color:`#374151`},children:`Input`}),(0,v.jsx)(`div`,{style:{flex:1},children:(0,v.jsx)(kt,{height:`100%`,defaultLanguage:`typescript`,path:`file:///main.ts`,value:e,onChange:e=>t(e||``),theme:`vs-light`,options:{minimap:{enabled:!1},fontSize:14,lineNumbers:`on`,renderLineHighlight:`all`,scrollBeyondLastLine:!1,automaticLayout:!0,tabSize:2,padding:{top:16,bottom:16}}})})]}):(0,v.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,v.jsx)(`div`,{style:{padding:`0.75rem 1rem`,backgroundColor:`#f9fafb`,borderBottom:`1px solid #e5e7eb`,fontSize:`0.875rem`,fontWeight:`600`,color:`#374151`},children:`Input`}),(0,v.jsx)(`div`,{style:{flex:1,display:`flex`,alignItems:`center`,justifyContent:`center`},children:`Loading...`})]})}function jt({output:e}){return(0,v.jsxs)(`div`,{style:{flex:1,display:`flex`,flexDirection:`column`},children:[(0,v.jsx)(`div`,{style:{padding:`0.75rem 1rem`,backgroundColor:`#f9fafb`,borderBottom:`1px solid #e5e7eb`,fontSize:`0.875rem`,fontWeight:`600`,color:`#374151`},children:`Output`}),(0,v.jsx)(`div`,{style:{flex:1},children:e.error?(0,v.jsxs)(`div`,{style:{padding:`1rem`,color:`#dc2626`,backgroundColor:`#fef2f2`,height:`100%`,overflow:`auto`},children:[(0,v.jsx)(`strong`,{children:`Error:`}),` `,e.error]}):(0,v.jsx)(kt,{height:`100%`,defaultLanguage:`json`,value:e.json,theme:`vs-light`,options:{readOnly:!0,minimap:{enabled:!1},fontSize:14,lineNumbers:`on`,renderLineHighlight:`none`,scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:16,bottom:16}}})})]})}var Mt=class{json;infer=null;constructor(e){this.json=e}};const Nt={null(e){return{type:`null`,...e}},boolean(e){return{type:`boolean`,...e}},integer(e){return{type:`integer`,...e}},string(e){return{type:`string`,...e}},unknown(e){return{type:`unknown`,...e}},bytes(e){return{type:`bytes`,...e}},cidLink(e){return{type:`cid-link`,$link:e}},blob(e){return{type:`blob`,...e}},array(e,t){return{type:`array`,items:e,...t}},token(e){return{type:`token`,description:e}},ref(e,t){return{type:`ref`,ref:e,...t}},union(e,t){return{type:`union`,refs:e,...t}},record(e){return{type:`record`,...e}},object(e){let t=Object.keys(e).filter(t=>`required`in e[t]&&e[t].required),n=Object.keys(e).filter(t=>`nullable`in e[t]&&e[t].nullable),r={type:`object`,properties:e};return t.length>0&&(r.required=t),n.length>0&&(r.nullable=n),r},params(e){let t=Object.keys(e).filter(t=>e[t].required),n={type:`params`,properties:e};return t.length>0&&(n.required=t),n},query(e){return{type:`query`,...e}},procedure(e){return{type:`procedure`,...e}},subscription(e){return{type:`subscription`,...e}},namespace(e,t){return new Mt({lexicon:1,id:e,defs:t})}};let Pt=null;function Ft(){let[e,t]=(0,A.useState)(Lt),[n,r]=(0,A.useState)({json:``,typeInfo:``,error:``}),[i,a]=(0,A.useState)(!1),o=Ct(),s=(0,A.useRef)(null),c=e=>{t(e)},l=()=>{a(!0)};return(0,A.useEffect)(()=>{if(o&&i&&!s.current&&!Pt){let e=async()=>{try{await new Promise(e=>setTimeout(e,200));let e=await o.languages.typescript.getTypeScriptWorker(),t=o.Uri.parse(`file:///main.ts`),n=await e(t);s.current=n,Pt=n}catch(e){console.error(`Failed to initialize TypeScript worker:`,e)}};e()}},[o,i]),(0,A.useEffect)(()=>{let t=setTimeout(async()=>{try{let t=e.replace(/import\s+{[^}]*}\s+from\s+['"][^'"]+['"]\s*;?\s*/g,``).replace(/^type\s+\w+\s*=\s*[^;]+;?\s*$/gm,``),n=t.match(/(?:const|let|var)\s+(\w+)\s*=/),i=n?n[1]:null,a=i?`${t}\nreturn ${i};`:t,c=Function(`lx`,a),l=c(Nt),u=`// Hover over .infer in the editor to see the type`;if(i&&o&&s.current)try{let t=o.Uri.parse(`file:///main.ts`),n=o.editor.getModel(t);if(n){let n=e.indexOf(`${i}.infer`);if(n!==-1){let e=n+`${i}.infer`.length-1,r=await s.current.getQuickInfoAtPosition(t.toString(),e);if(r?.displayParts){let e=r.displayParts.map(e=>e.text).join(``),t=e.match(/\(property\)\s+.*?\.infer:\s*([\s\S]+?)$/);t&&(u=It(t[1]))}}}}catch(e){console.error(`Type extraction error:`,e)}if(l&&typeof l==`object`&&`json`in l){let e=l.json;r({json:JSON.stringify(e,null,2),typeInfo:u,error:``})}else r({json:JSON.stringify(l,null,2),typeInfo:u,error:``})}catch(e){r({json:``,typeInfo:``,error:e instanceof Error?e.message:`Unknown error`})}},500);return()=>clearTimeout(t)},[e,o]),(0,v.jsxs)(`div`,{style:{flex:1,display:`flex`,overflow:`hidden`},children:[(0,v.jsx)(`div`,{style:{flex:1,display:`flex`,borderRight:`1px solid #e5e7eb`},children:(0,v.jsx)(At,{value:e,onChange:c,onReady:l})}),(0,v.jsx)(`div`,{style:{flex:1,display:`flex`},children:(0,v.jsx)(jt,{output:n})})]})}function It(e){let t=e.trim();t=t.replace(/\s+/g,` `),t=t.replace(/;\s*/g,` -`),t=t.replace(/{\s*/g,`{ -`),t=t.replace(/\s*}/g,` -}`);let n=t.split(` -`),r=0,i=[];for(let e of n){let t=e.trim();if(!t)continue;t.startsWith(`}`)&&(r=Math.max(0,r-1)),i.push(` `.repeat(r)+t),t.endsWith(`{`)&&!t.includes(`}`)&&r++}return i.join(` -`)}const Lt=`import { lx, type Infer } from "prototypekit"; - -const profileNamespace = lx.namespace("app.bsky.actor.profile", { - main: lx.record({ - key: "self", - record: lx.object({ - displayName: lx.string({ maxLength: 64, maxGraphemes: 64 }), - description: lx.string({ maxLength: 256, maxGraphemes: 256 }), - }), - }), -}); - -type ProfileInferred = Infer;`;function Rt(){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(y,{}),(0,v.jsx)(Ft,{})]})}var zt=c(h());(0,zt.createRoot)(document.getElementById(`root`)).render((0,v.jsx)(A.StrictMode,{children:(0,v.jsx)(Rt,{})})); \ No newline at end of file diff --git a/packages/site/dist/index.html b/packages/site/dist/index.html deleted file mode 100644 index df4a242..0000000 --- a/packages/site/dist/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - prototypey - Type-safe lexicon inference for ATProto - - - - -
- - diff --git a/packages/site/dist/types/index.d.ts b/packages/site/dist/types/index.d.ts deleted file mode 100644 index 881584c..0000000 --- a/packages/site/dist/types/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { GetNullable, GetRequired, Infer } from "./infer"; -export { lx } from "./lib"; diff --git a/packages/site/dist/types/infer.d.ts b/packages/site/dist/types/infer.d.ts deleted file mode 100644 index 53fdb73..0000000 --- a/packages/site/dist/types/infer.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { Prettify } from "./type-utils.js"; - -//#region src/infer.d.ts -type InferType = T extends { - type: "record"; -} ? InferRecord : T extends { - type: "object"; -} ? InferObject : T extends { - type: "array"; -} ? InferArray : T extends { - type: "params"; -} ? InferParams : T extends { - type: "union"; -} ? InferUnion : T extends { - type: "token"; -} ? InferToken : T extends { - type: "ref"; -} ? InferRef : T extends { - type: "unknown"; -} ? unknown : T extends { - type: "null"; -} ? null : T extends { - type: "boolean"; -} ? boolean : T extends { - type: "integer"; -} ? number : T extends { - type: "string"; -} ? string : T extends { - type: "bytes"; -} ? Uint8Array : T extends { - type: "cid-link"; -} ? string : T extends { - type: "blob"; -} ? Blob : never; -type InferToken = T extends { - enum: readonly (infer U)[]; -} ? U : string; -type GetRequired = T extends { - required: readonly (infer R)[]; -} ? R : never; -type GetNullable = T extends { - nullable: readonly (infer N)[]; -} ? N : never; -type InferObject & string, Required extends string = GetRequired & string, NullableAndRequired extends string = Required & Nullable & string, Normal extends string = ("properties" extends keyof T ? Exclude & string : never)> = Prettify } & { -readonly [K in Exclude]-?: InferType } & { -readonly [K in Exclude]?: InferType | null } & { -readonly [K in NullableAndRequired]: InferType | null } : {}>; -type InferArray = T extends { - items: infer Items; -} ? InferType[] : never[]; -type InferUnion = T extends { - refs: readonly (infer R)[]; -} ? R extends string ? { - $type: R; - [key: string]: unknown; -} : never : never; -type InferRef = T extends { - ref: infer R; -} ? R extends string ? { - $type: R; - [key: string]: unknown; -} : unknown : unknown; -type InferParams = InferObject; -type InferRecord = T extends { - record: infer R; -} ? R extends { - type: "object"; -} ? InferObject : R extends { - type: "union"; -} ? InferUnion : unknown : unknown; -/** - * Recursively replaces stub references in a type with their actual definitions. - * Detects circular references and missing references, returning string literal error messages. - */ -type ReplaceRefsInType = T extends { - $type: `#${infer DefName}`; -} ? DefName extends keyof Defs ? DefName extends Visited ? `[Circular reference detected: #${DefName}]` : Prettify & { - $type: T["$type"]; -}> : `[Reference not found: #${DefName}]` : T extends Uint8Array | Blob ? T : T extends readonly (infer Item)[] ? ReplaceRefsInType[] : T extends object ? T extends ((...args: unknown[]) => unknown) ? T : { [K in keyof T]: ReplaceRefsInType } : T; -/** - * Infers the TypeScript type for a lexicon namespace, returning only the 'main' definition - * with all local refs (#user, #post, etc.) resolved to their actual types. - */ -type Infer; -}> = Prettify<"main" extends keyof T["defs"] ? { - $type: T["id"]; -} & ReplaceRefsInType, { [K in keyof T["defs"]]: InferType }> : never>; -//#endregion -export { GetNullable, GetRequired, Infer }; -//# sourceMappingURL=infer.d.ts.map \ No newline at end of file diff --git a/packages/site/dist/types/lib.d.ts b/packages/site/dist/types/lib.d.ts deleted file mode 100644 index 0db0dfb..0000000 --- a/packages/site/dist/types/lib.d.ts +++ /dev/null @@ -1,420 +0,0 @@ -import { UnionToTuple } from "./type-utils.js"; -import { Infer } from "./infer.js"; - -//#region src/lib.d.ts -/** @see https://atproto.com/specs/lexicon#overview-of-types */ -type LexiconType = "null" | "boolean" | "integer" | "string" | "bytes" | "cid-link" | "blob" | "array" | "object" | "params" | "token" | "ref" | "union" | "unknown" | "record" | "query" | "procedure" | "subscription"; -/** - * Common options available for lexicon items. - * @see https://atproto.com/specs/lexicon#string-formats - */ -interface LexiconItemCommonOptions { - /** Indicates this field must be provided */ - required?: boolean; - /** Indicates this field can be explicitly set to null */ - nullable?: boolean; -} -/** - * Base interface for all lexicon items. - * @see https://atproto.com/specs/lexicon#overview-of-types - */ -interface LexiconItem extends LexiconItemCommonOptions { - type: LexiconType; -} -/** - * Definition in a lexicon namespace. - * @see https://atproto.com/specs/lexicon#lexicon-document - */ -interface Def { - type: LexiconType; -} -/** - * Lexicon namespace document structure. - * @see https://atproto.com/specs/lexicon#lexicon-document - */ -interface LexiconNamespace { - /** Namespaced identifier (NSID) for this lexicon */ - id: string; - /** Named definitions within this namespace */ - defs: Record; -} -/** - * String type options. - * @see https://atproto.com/specs/lexicon#string - */ -interface StringOptions extends LexiconItemCommonOptions { - /** - * Semantic string format constraint. - * @see https://atproto.com/specs/lexicon#string-formats - */ - format?: "at-identifier" | "at-uri" | "cid" | "datetime" | "did" | "handle" | "nsid" | "tid" | "record-key" | "uri" | "language"; - /** Maximum string length in bytes */ - maxLength?: number; - /** Minimum string length in bytes */ - minLength?: number; - /** Maximum string length in Unicode graphemes */ - maxGraphemes?: number; - /** Minimum string length in Unicode graphemes */ - minGraphemes?: number; - /** Hints at expected values, not enforced */ - knownValues?: string[]; - /** Restricts to an exact set of string values */ - enum?: string[]; - /** Default value if not provided */ - default?: string; - /** Fixed, unchangeable value */ - const?: string; -} -/** - * Boolean type options. - * @see https://atproto.com/specs/lexicon#boolean - */ -interface BooleanOptions extends LexiconItemCommonOptions { - /** Default value if not provided */ - default?: boolean; - /** Fixed, unchangeable value */ - const?: boolean; -} -/** - * Integer type options. - * @see https://atproto.com/specs/lexicon#integer - */ -interface IntegerOptions extends LexiconItemCommonOptions { - /** Minimum allowed value (inclusive) */ - minimum?: number; - /** Maximum allowed value (inclusive) */ - maximum?: number; - /** Restricts to an exact set of integer values */ - enum?: number[]; - /** Default value if not provided */ - default?: number; - /** Fixed, unchangeable value */ - const?: number; -} -/** - * Bytes type options for arbitrary byte arrays. - * @see https://atproto.com/specs/lexicon#bytes - */ -interface BytesOptions extends LexiconItemCommonOptions { - /** Minimum byte array length */ - minLength?: number; - /** Maximum byte array length */ - maxLength?: number; -} -/** - * Blob type options for binary data with MIME types. - * @see https://atproto.com/specs/lexicon#blob - */ -interface BlobOptions extends LexiconItemCommonOptions { - /** Allowed MIME types (e.g., ["image/png", "image/jpeg"]) */ - accept?: string[]; - /** Maximum blob size in bytes */ - maxSize?: number; -} -/** - * Array type options. - * @see https://atproto.com/specs/lexicon#array - */ -interface ArrayOptions extends LexiconItemCommonOptions { - /** Minimum array length */ - minLength?: number; - /** Maximum array length */ - maxLength?: number; -} -/** - * Record type options for repository records. - * @see https://atproto.com/specs/lexicon#record - */ -interface RecordOptions { - /** Record key strategy: "self" for self-describing or "tid" for timestamp IDs */ - key: "self" | "tid"; - /** Object schema defining the record structure */ - record: { - type: "object"; - }; - /** Human-readable description */ - description?: string; -} -/** - * Union type options for multiple possible types. - * @see https://atproto.com/specs/lexicon#union - */ -interface UnionOptions extends LexiconItemCommonOptions { - /** If true, only listed refs are allowed; if false, additional types may be added */ - closed?: boolean; -} -/** - * Map of property names to their lexicon item definitions. - * @see https://atproto.com/specs/lexicon#object - */ -type ObjectProperties = Record; -type RequiredKeys = { [K in keyof T]: T[K] extends { - required: true; -} ? K : never }[keyof T]; -type NullableKeys = { [K in keyof T]: T[K] extends { - nullable: true; -} ? K : never }[keyof T]; -/** - * Resulting object schema with required and nullable fields extracted. - * @see https://atproto.com/specs/lexicon#object - */ -type ObjectResult = { - type: "object"; - /** Property definitions */ - properties: { [K in keyof T]: T[K] extends { - type: "object"; - } ? T[K] : Omit }; -} & ([RequiredKeys] extends [never] ? {} : { - required: UnionToTuple>; -}) & ([NullableKeys] extends [never] ? {} : { - nullable: UnionToTuple>; -}); -/** - * Map of parameter names to their lexicon item definitions. - * @see https://atproto.com/specs/lexicon#params - */ -type ParamsProperties = Record; -/** - * Resulting params schema with required fields extracted. - * @see https://atproto.com/specs/lexicon#params - */ -type ParamsResult = { - type: "params"; - /** Parameter definitions */ - properties: { [K in keyof T]: Omit }; -} & ([RequiredKeys] extends [never] ? {} : { - required: UnionToTuple>; -}); -/** - * HTTP request or response body schema. - * @see https://atproto.com/specs/lexicon#http-endpoints - */ -interface BodySchema { - /** MIME type encoding (typically "application/json") */ - encoding: "application/json" | (string & {}); - /** Human-readable description */ - description?: string; - /** Object schema defining the body structure */ - schema?: ObjectResult; -} -/** - * Error definition for HTTP endpoints. - * @see https://atproto.com/specs/lexicon#http-endpoints - */ -interface ErrorDef { - /** Error name/code */ - name: string; - /** Human-readable error description */ - description?: string; -} -/** - * Query endpoint options (HTTP GET). - * @see https://atproto.com/specs/lexicon#query - */ -interface QueryOptions { - /** Human-readable description */ - description?: string; - /** Query string parameters */ - parameters?: ParamsResult; - /** Response body schema */ - output?: BodySchema; - /** Possible error responses */ - errors?: ErrorDef[]; -} -/** - * Procedure endpoint options (HTTP POST). - * @see https://atproto.com/specs/lexicon#procedure - */ -interface ProcedureOptions { - /** Human-readable description */ - description?: string; - /** Query string parameters */ - parameters?: ParamsResult; - /** Request body schema */ - input?: BodySchema; - /** Response body schema */ - output?: BodySchema; - /** Possible error responses */ - errors?: ErrorDef[]; -} -/** - * WebSocket message schema for subscriptions. - * @see https://atproto.com/specs/lexicon#subscription - */ -interface MessageSchema { - /** Human-readable description */ - description?: string; - /** Union of possible message types */ - schema: { - type: "union"; - refs: readonly string[]; - }; -} -/** - * Subscription endpoint options (WebSocket). - * @see https://atproto.com/specs/lexicon#subscription - */ -interface SubscriptionOptions { - /** Human-readable description */ - description?: string; - /** Query string parameters */ - parameters?: ParamsResult; - /** Message schema for events */ - message?: MessageSchema; - /** Possible error responses */ - errors?: ErrorDef[]; -} -declare class Namespace { - json: T; - infer: Infer; - constructor(json: T); -} -/** - * Main API for creating lexicon schemas. - * @see https://atproto.com/specs/lexicon - */ -declare const lx: { - /** - * Creates a null type. - * @see https://atproto.com/specs/lexicon#null - */ - null(options?: LexiconItemCommonOptions): { - type: "null"; - } & LexiconItemCommonOptions; - /** - * Creates a boolean type with optional constraints. - * @see https://atproto.com/specs/lexicon#boolean - */ - boolean(options?: T): T & { - type: "boolean"; - }; - /** - * Creates an integer type with optional min/max and enum constraints. - * @see https://atproto.com/specs/lexicon#integer - */ - integer(options?: T): T & { - type: "integer"; - }; - /** - * Creates a string type with optional format, length, and value constraints. - * @see https://atproto.com/specs/lexicon#string - */ - string(options?: T): T & { - type: "string"; - }; - /** - * Creates an unknown type for flexible, unvalidated objects. - * @see https://atproto.com/specs/lexicon#unknown - */ - unknown(options?: LexiconItemCommonOptions): { - type: "unknown"; - } & LexiconItemCommonOptions; - /** - * Creates a bytes type for arbitrary byte arrays. - * @see https://atproto.com/specs/lexicon#bytes - */ - bytes(options?: T): T & { - type: "bytes"; - }; - /** - * Creates a CID link reference to content-addressed data. - * @see https://atproto.com/specs/lexicon#cid-link - */ - cidLink(link: Link): { - type: "cid-link"; - $link: Link; - }; - /** - * Creates a blob type for binary data with MIME type constraints. - * @see https://atproto.com/specs/lexicon#blob - */ - blob(options?: T): T & { - type: "blob"; - }; - /** - * Creates an array type with item schema and length constraints. - * @see https://atproto.com/specs/lexicon#array - */ - array(items: Items, options?: Options): Options & { - type: "array"; - items: Items; - }; - /** - * Creates a token type for symbolic values in unions. - * @see https://atproto.com/specs/lexicon#token - */ - token(description: Description): { - type: "token"; - description: Description; - }; - /** - * Creates a reference to another schema definition. - * @see https://atproto.com/specs/lexicon#ref - */ - ref(ref: Ref, options?: LexiconItemCommonOptions): LexiconItemCommonOptions & { - type: "ref"; - ref: Ref; - }; - /** - * Creates a union type for multiple possible type variants. - * @see https://atproto.com/specs/lexicon#union - */ - union(refs: Refs, options?: Options): Options & { - type: "union"; - refs: Refs; - }; - /** - * Creates a record type for repository records. - * @see https://atproto.com/specs/lexicon#record - */ - record(options: T): T & { - type: "record"; - }; - /** - * Creates an object type with defined properties. - * @see https://atproto.com/specs/lexicon#object - */ - object(options: T): ObjectResult; - /** - * Creates a params type for query string parameters. - * @see https://atproto.com/specs/lexicon#params - */ - params(properties: Properties): ParamsResult; - /** - * Creates a query endpoint definition (HTTP GET). - * @see https://atproto.com/specs/lexicon#query - */ - query(options?: T): T & { - type: "query"; - }; - /** - * Creates a procedure endpoint definition (HTTP POST). - * @see https://atproto.com/specs/lexicon#procedure - */ - procedure(options?: T): T & { - type: "procedure"; - }; - /** - * Creates a subscription endpoint definition (WebSocket). - * @see https://atproto.com/specs/lexicon#subscription - */ - subscription(options?: T): T & { - type: "subscription"; - }; - /** - * Creates a lexicon namespace document. - * @see https://atproto.com/specs/lexicon#lexicon-document - */ - namespace(id: ID, defs: D): Namespace<{ - lexicon: 1; - id: ID; - defs: D; - }>; -}; -//#endregion -export { lx }; -//# sourceMappingURL=lib.d.ts.map \ No newline at end of file diff --git a/packages/site/dist/types/type-utils.d.ts b/packages/site/dist/types/type-utils.d.ts deleted file mode 100644 index 48f1d28..0000000 --- a/packages/site/dist/types/type-utils.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -//#region src/type-utils.d.ts -/** - * Converts a string union type to a tuple type - * @example - * type Colors = "red" | "green" | "blue"; - * type ColorTuple = UnionToTuple; // ["red", "green", "blue"] - */ -type UnionToTuple = ((T extends unknown ? (x: () => T) => void : never) extends ((x: infer I) => void) ? I : never) extends (() => infer R) ? [...UnionToTuple>, R] : []; -type Prettify = { [K in keyof T]: T[K] } & {}; -//# sourceMappingURL=type-utils.d.ts.map - -//#endregion -export { Prettify, UnionToTuple }; -//# sourceMappingURL=type-utils.d.ts.map \ No newline at end of file From c7d065a52e471e3d20d7edb2cfa8430d575ff68e Mon Sep 17 00:00:00 2001 From: Tyler <26290074+tylersayshi@users.noreply.github.com> Date: Sun, 19 Oct 2025 14:32:50 -0700 Subject: [PATCH 5/6] formatting --- .prettierignore | 5 +++-- packages/cli/tests/test-utils.ts | 5 ++++- packages/site/tests/components/Playground.test.tsx | 4 +--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.prettierignore b/.prettierignore index b5b85af..01e47ba 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,3 @@ -/lib -/pnpm-lock.yaml +lib/ +dist/ +pnpm-lock.yaml diff --git a/packages/cli/tests/test-utils.ts b/packages/cli/tests/test-utils.ts index 62a9acf..57196d5 100644 --- a/packages/cli/tests/test-utils.ts +++ b/packages/cli/tests/test-utils.ts @@ -7,7 +7,10 @@ export function runCLI( options?: { cwd?: string; env?: NodeJS.ProcessEnv }, ): Promise<{ stdout: string; stderr: string; code: number }> { return new Promise((resolve) => { - const cliPath = join(dirname(fileURLToPath(import.meta.url)), "../lib/index.js"); + const cliPath = join( + dirname(fileURLToPath(import.meta.url)), + "../lib/index.js", + ); const child = spawn("node", [cliPath, ...args], { cwd: options?.cwd ?? process.cwd(), env: options?.env ?? process.env, diff --git a/packages/site/tests/components/Playground.test.tsx b/packages/site/tests/components/Playground.test.tsx index 505606c..05e3378 100644 --- a/packages/site/tests/components/Playground.test.tsx +++ b/packages/site/tests/components/Playground.test.tsx @@ -84,9 +84,7 @@ describe("Playground", () => { const editors = screen.getAllByTestId("monaco-editor"); const inputEditor = editors[0] as HTMLTextAreaElement; - expect(inputEditor.value).toContain( - 'lx.lexicon("app.bsky.actor.profile"', - ); + expect(inputEditor.value).toContain('lx.lexicon("app.bsky.actor.profile"'); }); it("evaluates code and displays output", async () => { From 43c499019108a97e34a112a24817076292403975 Mon Sep 17 00:00:00 2001 From: Tyler <26290074+tylersayshi@users.noreply.github.com> Date: Sun, 19 Oct 2025 14:35:04 -0700 Subject: [PATCH 6/6] error msg --- packages/cli/src/commands/gen-emit.ts | 2 +- packages/cli/tests/integration/error-handling.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/commands/gen-emit.ts b/packages/cli/src/commands/gen-emit.ts index c426d09..8afe73c 100644 --- a/packages/cli/src/commands/gen-emit.ts +++ b/packages/cli/src/commands/gen-emit.ts @@ -77,7 +77,7 @@ async function processSourceFile( } if (lexicons.length === 0) { - console.warn(` ⚠ ${sourcePath}: No lexicon lexicons found`); + console.warn(` ⚠ ${sourcePath}: No lexicons found`); return; } diff --git a/packages/cli/tests/integration/error-handling.test.ts b/packages/cli/tests/integration/error-handling.test.ts index 74d6fa6..77cb6c2 100644 --- a/packages/cli/tests/integration/error-handling.test.ts +++ b/packages/cli/tests/integration/error-handling.test.ts @@ -122,7 +122,7 @@ describe("CLI Error Handling", () => { expect(code).toBe(0); // Should not crash expect(stdout).toContain("Found 1 source file(s)"); - expect(stderr).toContain("No lexicon namespaces found"); + expect(stderr).toContain("No lexicons found"); }); test("handles permission errors when writing output", async () => {