diff --git a/config/scripts/electron-builder-config.test.mjs b/config/scripts/electron-builder-config.test.mjs index 9cf319af092..9ae35a1bf65 100644 --- a/config/scripts/electron-builder-config.test.mjs +++ b/config/scripts/electron-builder-config.test.mjs @@ -320,6 +320,7 @@ describe('electron-builder config', () => { join('/app', 'resources', 'plugins', 'types', 'orca-host.d.ts'), join('/app', 'resources', 'plugins', 'types', 'orca-frame.d.ts'), join('/app', 'resources', 'plugins', 'types', 'orca-worker.d.ts'), + join('/app', 'resources', 'plugins', 'types', 'orca-services.d.ts'), join('/app', 'resources', 'plugins', 'types', 'orca-testing.d.ts'), // `orca plugin test` and `check` run these from a Node process. join('/app', 'resources', 'plugins', 'declarative', 'orca-runtime.mjs'), diff --git a/config/scripts/generate-plugin-authoring-skill-references.mjs b/config/scripts/generate-plugin-authoring-skill-references.mjs index 106ef5dacfa..3fb0d54c8ba 100644 --- a/config/scripts/generate-plugin-authoring-skill-references.mjs +++ b/config/scripts/generate-plugin-authoring-skill-references.mjs @@ -12,6 +12,8 @@ const GENERATED_NOTE = '' const TYPINGS = { components: 'resources/plugins/declarative/orca.d.ts', + // Merges into module 'orca': shell, files, on, the worker bridge and plugin data. + services: 'resources/plugins/types/orca-services.d.ts', frame: 'resources/plugins/types/orca-frame.d.ts', worker: 'resources/plugins/types/orca-worker.d.ts' } @@ -39,6 +41,7 @@ async function readTypings(repoRoot) { const read = (file) => readFile(path.join(repoRoot, ...file.split('/')), 'utf8') return { components: readTypingsModule(await read(TYPINGS.components), TYPINGS.components, 'orca'), + services: readTypingsModule(await read(TYPINGS.services), TYPINGS.services, 'orca'), frame: readTypingsModule(await read(TYPINGS.frame), TYPINGS.frame, 'orca/frame'), worker: readTypingsModule(await read(TYPINGS.worker), TYPINGS.worker, 'orca/worker') } @@ -67,7 +70,7 @@ function childrenLabel(policy, catalog) { return labels[policy] } -function renderComponents({ catalog, limits }, { components }) { +function renderComponents({ catalog, limits }, { components, services }) { const vocabulary = ['Gap', 'Align', 'Tone', 'Size', 'Variant', 'Press'].map( (name) => `- ${code(name)}: ${code(components.typeText(name))}` ) @@ -82,13 +85,30 @@ function renderComponents({ catalog, limits }, { components }) { return `- ${code(name)} (children: ${children}): ${props.length > 0 ? code(props.join('; ')) : 'no props'}` }) const runtime = [ - ...components.functions.map((fn) => ({ ...fn, text: fn.text.replace(/^function /u, '') })), - ...['host', 'api', 'env', 'shell', 'files', 'ui'].flatMap((name) => components.value(name)) + ...[...components.functions, ...services.functions].map((fn) => ({ + ...fn, + text: fn.text.replace(/^function /u, '') + })), + ...['host', 'api', 'env', 'ui'].flatMap((name) => components.value(name)), + ...['shell', 'files', 'plugin', 'storage', 'settings', 'secrets'].flatMap((name) => + services.value(name) + ) ].map(bullet) - const types = ['PersistScope', 'AtomOptions', 'PanelContext', 'PanelSetup', 'HostError'].map( - (name) => - `- ${withSummary(code(components.typeDeclaration(name)), components.typeSummary(name))}` - ) + const typeLine = (module, name) => + `- ${withSummary(code(module.typeDeclaration(name)), module.typeSummary(name))}` + const types = [ + ...['PersistScope', 'AtomOptions', 'PanelContext', 'PanelSetup', 'HostError'].map((name) => + typeLine(components, name) + ), + ...[ + 'PluginRequestOptions', + 'PluginBridgeApi', + 'DataChange', + 'StorageApi', + 'SettingsApi', + 'SecretsApi' + ].map((name) => typeLine(services, name)) + ] const limit = limits.PLUGIN_DECLARATIVE_LIMITS return document( 'Components panel API', @@ -101,6 +121,12 @@ function renderComponents({ catalog, limits }, { components }) { [`- ${code('IconName')}: ${icons.join(', ')}. Any other name draws a fallback glyph.`, ''], ['## Components', '', ...entries, ''], ['## Runtime', '', ...runtime, ''], + [ + '## Panel ↔ worker contract', + '', + "Declare requests and worker posts once with declaration merging, in a file both the panel and the worker include: `declare module 'orca' { interface PluginRequests { 'todos.list': { input: { done?: boolean }; output: Todo[] } } interface PluginPanelEvents { 'todos.changed': { count: number } } }`. Declared names are typed end to end (`plugin.request`, `plugin.on`, the worker's `orca.panels.handle` and `orca.panels.post`, and `orca/testing`'s `requests` and `panel.post`); any other name carries JSON.", + '' + ], ['## Types', '', ...types, ''], [ '## Limits', @@ -190,7 +216,7 @@ function renderHostApi(sources, { frame, worker }) { ) } -function renderEvents({ events, eventContribution, typeText }, { components, frame }) { +function renderEvents({ events, eventContribution, typeText }, { services, frame }) { const { REFERENCE_TYPE_TEXT, zodTypeText } = typeText const workerEvents = eventContribution.PLUGIN_EVENT_NAMES.map( (name) => @@ -217,7 +243,8 @@ function renderEvents({ events, eventContribution, typeText }, { components, fra [ '## Components panel events (`on(event, handler)` from `orca`)', '', - ...components.literalMembers('OrcaEvents', { flatten: false }).map(bullet) + ...services.literalMembers('OrcaEvents', { flatten: false }).map(bullet), + '- Every worker event above, with the same payload and capability; a panel needs no `contributes.events` entry, it subscribes while it is open. HTML panels get them on `orca.on` too.' ] ] ) diff --git a/config/scripts/pr-plugin-e2e-routing.test.mjs b/config/scripts/pr-plugin-e2e-routing.test.mjs index acf691a0a0f..4eb51b7f3b7 100644 --- a/config/scripts/pr-plugin-e2e-routing.test.mjs +++ b/config/scripts/pr-plugin-e2e-routing.test.mjs @@ -78,6 +78,9 @@ describe('plugin PR E2E routing', () => { ['src/main/plugins/plugin-dev-watcher.ts', 'plugin-components-hot-reload'], ['resources/plugins/declarative/orca-runtime.mjs', 'plugin-components-hot-reload'], ['examples/plugins/hello-orca/main.mjs', 'plugin-demo'], + ['examples/plugins/hello-worker-panel/worker/main.mjs', 'plugin-worker-panel'], + ['src/main/plugins/panels/plugin-panel-bridge.ts', 'plugin-worker-panel'], + ['src/main/plugins/plugin-runtime-binding.ts', 'plugin-panel-agents'], ['examples/plugins/test-fixtures/hostile-panel/panel.html', 'plugin-panel-containment'] ])('routes %s to %s', (file, spec) => { expect(selectPrE2eSpecs([file])).toContain(`tests/e2e/${spec}.spec.ts`) diff --git a/config/scripts/pr-plugin-e2e-source-routes.mjs b/config/scripts/pr-plugin-e2e-source-routes.mjs index 8a58854c85c..2658dbae53c 100644 --- a/config/scripts/pr-plugin-e2e-source-routes.mjs +++ b/config/scripts/pr-plugin-e2e-source-routes.mjs @@ -170,6 +170,31 @@ const SPECIFIC_PLUGIN_ROUTES = [ ].join('|'), 'plugin-frame-guest|plugin-smoke' ), + // Agents and workspace changes in panels: agents.list, terminal ids on agent events. + pluginRoute( + 'plugins.panel-agents', + ['plugin-panel-agents'], + [ + 'src\\/main\\/plugins\\/(?:plugin-runtime-binding|plugin-agent-status-event|workers\\/plugin-workspace-projection)', + 'src\\/shared\\/plugins\\/events\\/plugin-events' + ].join('|'), + 'plugin-frame-guest|plugin-smoke|agent-hook-endpoint' + ), + // A panel and its own worker: requests, posts, storage, settings and pushes. + pluginRoute( + 'plugins.worker-panel', + ['plugin-worker-panel'], + [ + 'src\\/main\\/plugins\\/panels\\/plugin-panel-bridge', + 'src\\/main\\/plugins\\/(?:plugin-declared-settings|workers\\/plugin-(?:worker-orca-api|host-panel-method-bindings|worker-requests))', + 'src\\/main\\/ipc\\/plugin-(?:panel-push|settings)-ipc', + 'src\\/shared\\/plugins\\/(?:workers\\/plugin-panel-bridge-protocol|frames\\/plugin-panel-shell-facades|contributions\\/plugin-settings-)', + 'src\\/shared\\/plugins\\/declarative\\/runtime\\/declarative-(?:data-sdk|storage-sync)', + 'src\\/renderer\\/src\\/components\\/plugins\\/(?:page\\/PluginSettingsSection|state\\/use-plugin-declared-settings)', + 'examples\\/plugins\\/hello-worker-panel\\/' + ].join('|'), + 'plugin-frame-guest|plugin-smoke' + ), pluginRoute( 'plugins.vm-recipes', ['plugin-marketplace-content'], diff --git a/docs/reference/plugin-authoring.md b/docs/reference/plugin-authoring.md index 005250d3098..b6fb4a2fec2 100644 --- a/docs/reference/plugin-authoring.md +++ b/docs/reference/plugin-authoring.md @@ -12,12 +12,13 @@ A plugin is a folder (in practice its own Git repository) with `orca-plugin.json Start from one of these, or scaffold one with `orca plugin create` (see [Validate](#3-validate)). Add the `$schema` line from `orca-gleam-syntax` to your manifest for editor completion. -| Example | Execution | Shows | -| ------------------------------------ | ---------------- | ---------------------------------------------------------------------------- | -| `examples/plugins/orca-gleam-syntax` | `data` | A syntax, no code | -| `examples/plugins/hello-tsx` | `sandboxed-ui` | A [components](plugin-declarative-ui.md) TSX panel with no build step | -| `examples/plugins/hello-components` | `sandboxed-ui` | The same kind of [components](plugin-declarative-ui.md) panel, bundled first | -| `examples/plugins/hello-orca` | `trusted-worker` | A panel, a worker command and events | +| Example | Execution | Shows | +| ------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `examples/plugins/orca-gleam-syntax` | `data` | A syntax, no code | +| `examples/plugins/hello-tsx` | `sandboxed-ui` | A [components](plugin-declarative-ui.md) TSX panel with no build step | +| `examples/plugins/hello-worker-panel` | `trusted-worker` | A TSX panel with its own worker, storage atom, settings and events ([Panels, workers and data](#panels-workers-and-data)) | +| `examples/plugins/hello-components` | `sandboxed-ui` | The same kind of [components](plugin-declarative-ui.md) panel, bundled first | +| `examples/plugins/hello-orca` | `trusted-worker` | A panel, a worker command and events | Leave `publisher` out. Orca names the publisher after where the plugin comes from, the way a [Go module path](https://go.dev/ref/mod#module-path) is its repository path: the owner of the @@ -68,7 +69,7 @@ Before any plugin code runs, the frame shell defines a frozen `window.orca`. It supported way to talk to Orca; the messages underneath are internal and change without notice. ```js -orca.api // { major: 1, minor: 1 }: the host API this Orca implements +orca.api // { major: 1, minor: 2 }: the host API this Orca implements if (orca.host.has('workspace.readContext')) { // Synchronous: is the method offered to this surface by this Orca? const controller = new AbortController() @@ -132,10 +133,28 @@ Browser clients (`orca serve` in a web browser) still load a frame as one sandbo with an opaque origin and `connect-src 'none'`: inline your scripts and styles, use `data:` URLs for images and fonts, and do not rely on storage, workers or WASM loaded by URL there. +A worker's `main` module's **default export** is `activate(orca)`, which Orca calls once when the +worker starts; it may be `async`. A named `export function activate` is not called: the worker +fails to start with an error saying so. +An optional `export function deactivate()` runs (and is awaited) before the worker stops, for +flushing state; the worker may also stop when it has been idle for a while, and starts again on +its next command, event or panel request. + +```ts +import type { OrcaWorkerApi } from 'orca/worker' + +export default async function activate(orca: OrcaWorkerApi) { + orca.commands.register('hello', () => 'Hello from the worker') +} + +export async function deactivate() {} +``` + Workers get the same calls on the `orca` object passed to `activate(orca)`: `orca.api`, `orca.host.call(method, params, { signal })`, `orca.host.has(method)`, plus `orca.commands.register(id, (args, { signal }) => …)` and `orca.events.on(event, handler)`, which -both return `{ dispose() }`. A command's `signal` aborts when Orca stops waiting for it. +both return `{ dispose() }`, and the panel and data APIs in +[Panels, workers and data](#panels-workers-and-data). A command's `signal` aborts when Orca stops waiting for it. `orca.log(message)` writes to `orca plugin logs`. `orca.grantedCapabilities` is the frozen list of capability kinds the user approved (such as `['storage:own']`), fixed when the worker starts; the host still checks each call. In `agent.status.changed`, `state` and `mainAgent.state` are one of `working`, `blocked`, `waiting` @@ -150,6 +169,110 @@ Everything else, such as `node:` builtins, resolves exactly as Node resolves it worker. `orca/worker` holds only types, so import it with `import type`; a value import fails when the worker starts. +### Panels, workers and data + +A plugin's panels, custom editors and worker are one program. A panel asks its own worker, the +worker pushes back, and both read the same storage, settings and secrets (with the same +capabilities). Every surface spells it the same way: frames on `window.orca`, components panels +as imports from `orca`, workers on the `orca` from `activate`. + +Declare the contract once, in a file both sides include, and both type-check against it: + +```ts +// src/protocol.ts +export {} +declare module 'orca' { + interface PluginRequests { + 'todos.list': { input: { done?: boolean }; output: Todo[] } + } + interface PluginPanelEvents { + 'todos.changed': { count: number } + } +} +``` + +The worker answers and posts: + +```js +export default function activate(orca) { + orca.panels.handle('todos.list', async ({ done }, { panel, signal }) => list(done)) + // To every open panel of this plugin, or one: { panel: id } from a request's context. + orca.panels.post('todos.changed', { count: 3 }) +} +``` + +A panel asks and listens (in a frame, the same methods are on `orca.plugin`): + +```ts +import { plugin } from 'orca' +const todos = await plugin.request('todos.list', { done: false }, { timeoutMs: 5000 }) +plugin.on('todos.changed', ({ count }) => {}) +``` + +- `plugin.request` starts the worker if it is not running, so a panel-only plugin can keep its + logic in a worker that runs only while someone uses it. It needs `main` (`trusted-worker`). +- It rejects with `unknown_method` when no handler has that name, `timeout` past `timeoutMs` + (default 30 s, at most 120 s; the handler's `signal` aborts then, and when the panel closes), + `unavailable` when the worker cannot start, or the `code` the handler threw (`invalid_params`, + `conflict` and the other host error codes; anything else is `action_failed`). +- Inputs and answers are JSON: an input up to 64 KiB, an answer up to 1 MiB. Posts are fire and + forget, up to 256 KiB each and 200 per 10 seconds per plugin. +- Only the same plugin's panels and worker can reach each other. + +Storage, settings and secrets are the plugin's own, shared by every surface: + +```ts +import { atom, storage, settings, secrets } from 'orca' +await storage.set('filters', { done: false }) // storage:own +storage.onDidChange(({ key }) => {}) // any surface's write, the person's included +const url = await settings.get('apiUrl') // settings:own; declared ones read as their default +await secrets.set('token', value) // secrets:own +// A components atom kept in storage: the worker reads storage.get('todos') and its writes +// update the atom. +const todos = atom('todos', [], { persist: 'storage' }) +``` + +Declare settings the person edits in `contributes.settings`; Orca shows them under the plugin in +its Settings and checks every value against the declaration: + +```json +"settings": [ + { "key": "apiUrl", "title": "Server URL", "type": "string", "default": "https://example.com" }, + { "key": "pageSize", "title": "Page size", "type": "integer", "default": 20, "minimum": 1 } +], +"capabilities": [{ "kind": "settings:own" }] +``` + +`type` is `string`, `number`, `integer` or `boolean`; `enum` (with `enumLabels`), `minimum`, +`maximum`, `maxLength`, `multiline` and `placeholder` shape the control. A setting needs the +`settings:own` capability, which is also how code reads it. + +Panels hear workspace and agent events the same way workers do, with the same capability: +`on('agent.status.changed', handler)` needs `agent:read`, the workspace events `workspace:read`. +A panel needs no `contributes.events` entry for that; it subscribes while it is open. + +To show the workspace's agents, list them once with `agents.list` (`agent:read`), then follow +`agent.status.changed`. Both name each agent's terminal with `terminalId`, the id +`workspace.readContext` lists (with each terminal's `title`) and `terminal.sendText` takes; an +event's `paneKey` is Orca's own pane id. `workspace.changed` (`workspace:read`) carries the new +`workspace.readContext` answer whenever focus moves to another workspace or its terminals open, +close or are renamed, so a panel never polls. + +```ts +import { atom, host, on, read, set, update } from 'orca' +const agents = atom<{ terminalId: string | null; title: string | null; state: string }[]>([]) +export async function setup() { + set(agents, (await host.call('agents.list')).agents) + on('agent.status.changed', ({ terminalId, title, state }) => + update(agents, (list) => [ + { terminalId: terminalId ?? null, title: title ?? null, state }, + ...list.filter((agent) => agent.terminalId !== terminalId) + ]) + ) + on('workspace.changed', async () => set(agents, (await host.call('agents.list')).agents)) +} +``` + ### Custom editors A custom editor opens files that end in one of its `extensions` (with the dot, such as @@ -376,7 +499,6 @@ arbitrary plugin UI: - `mcpServers`: MCP server definitions offered to the agents Orca launches. - `skills`: agent skills shipped as files. - `hooks`: agent lifecycle hooks for the agents Orca launches. -- `settings`: typed plugin settings shown in Orca's settings UI. `skills`, `mcpServers` and `hooks` will mean what they mean in agent-plugin formats such as Claude Code's. Orca does not reserve `agents`, because those formats use it for subagent files. diff --git a/docs/reference/plugin-catalog.md b/docs/reference/plugin-catalog.md index 3942f5db7f6..40b15e7d2e1 100644 --- a/docs/reference/plugin-catalog.md +++ b/docs/reference/plugin-catalog.md @@ -108,7 +108,7 @@ One thing the release adds to Orca. | Field | Type | Required | Since | Description | | --- | --- | --- | --- | --- | -| `kind` | `"panels"` \| `"commands"` \| `"events"` \| `"languagePacks"` \| `"keybindings"` \| `"vmRecipes"` \| `"themes"` \| `"terminalThemes"` \| `"iconThemes"` \| `"syntaxes"` \| `"customEditors"` \| `"newFiles"` | yes | 1.4.245 | Contribution point. Example: `"themes"` | +| `kind` | `"panels"` \| `"commands"` \| `"events"` \| `"languagePacks"` \| `"keybindings"` \| `"vmRecipes"` \| `"themes"` \| `"terminalThemes"` \| `"iconThemes"` \| `"syntaxes"` \| `"customEditors"` \| `"newFiles"` \| `"settings"` | yes | 1.4.245 | Contribution point. Example: `"themes"` | | `name` | string | yes | 1.4.245 | What the item is called in Orca. Example: `"Dusk"` | | `detail` | string | no | 1.4.245 | Extra context, such as file extensions. | diff --git a/docs/reference/plugin-declarative-ui.md b/docs/reference/plugin-declarative-ui.md index d8293b03732..5b5d115f4cf 100644 --- a/docs/reference/plugin-declarative-ui.md +++ b/docs/reference/plugin-declarative-ui.md @@ -61,6 +61,10 @@ export default function Panel() { first render, are saved shortly after they change, and live in the plugin's own data folder; no capability is needed. When the stored shape changes, bump `version`; `migrate(stored, fromVersion)` turns an older value into the new shape, and without it the atom starts from `initial`. +- `persist: 'storage'` keeps the atom in the plugin's own storage under its key (the `storage:own` + capability): the worker reads the same value with `orca.storage.get(key)`, and a write from the + worker or another panel updates the atom. Values are stored as they are, so `version` and + `migrate` do not apply; atoms the module creates on load have their value before the first render. - `derived(() => ...)` computes from other atoms; it is read-only. - `read(atom)` reads; reading while rendering subscribes the panel to it. - `set(atom, value)` stores a value as is, functions included; `update(atom, (previous) => next)` derives @@ -107,6 +111,10 @@ The `orca` module has the same facade as frame panels: are not events and `on()` refuses them. - `ui.catalog` is a number that grows with the component catalog; `ui.has(component, prop?)` says whether this Orca draws a component or accepts a prop on it. +- `plugin.request(name, input)` and `plugin.on(event)` talk to the plugin's own worker; + `storage`, `settings` and `secrets` are the plugin's own data; `on('agent.status.changed')` and + the workspace events arrive with their read capability. See + [Panels, workers and data](./plugin-authoring.md#panels-workers-and-data). ## Hot reload @@ -207,14 +215,22 @@ test('adds a task', async () => { same edit protocol as Orca. - Inspect `tree()` (plain data for snapshots, handlers shown as `[handler]`), `errors` (what the panel threw, with its stack, and renders Orca would refuse), `warnings` (props and components Orca would - drop) and `persisted`. `emit('theme', ...)`, `setVisible`, `rerender` and `settled` drive the rest; - `unmount()` ends the run, running `setup` cleanup. + drop) and `persisted` (`plugin`, `workspace`, and the plugin's `storage`). `emit(event, payload)` + delivers `theme` or a workspace or agent event, `post(event, payload)` is the worker's + `orca.panels.post` (what `plugin.on` hears), and `setVisible`, `rerender` and `settled` drive the + rest; `unmount()` ends the run, running `setup` cleanup. - `mockHost({ capabilities, results })` stands in for Orca's host. It refuses what Orca refuses, with the same error codes: a method panels cannot call, a capability the manifest does not declare (capabilities default to the manifest's), bad params, and `shell.openExternal` or `files.saveAs` without a press first (each `press` grants one). `results` maps a method to a value or to a function of its params, which may throw `hostError(code)`; `calls` and `callsOf(method)` record every call. The stationary-control rule for gestures is not simulated. +- The mock host keeps the plugin's storage, settings and secrets in memory (seed them with + `mockHost({ storage, settings, secrets })`, read them with `host.data()`), so `storage`, + `settings`, `secrets` and `persist: 'storage'` atoms work under `mount()`, and a write reaches + `onDidChange` as in Orca. `requests` stands in for the worker: each `plugin.request` name maps to + its answer or a function of the input (which may throw `hostError(code)`); an unlisted name is + `unknown_method`. Both follow your `PluginRequests` types. `orca plugin check [dir]` validates the plugin like `orca plugin validate`, then renders every components panel once against `mockHost()` and reports what the panel threw (with `file:line`), @@ -314,7 +330,7 @@ without granting a second gesture. ## Isolation The module runs in a hidden, sandboxed guest of the plugin's own partition, with the same isolation as frame -panels: no network (requests outside the plugin's own files are cancelled; Electron 43 still resolves -`dns-prefetch` hostnames), no Node, no popups, no DOM the person sees. It reaches Orca only through -`host.call`, `on`, and the UI it renders. Components panels need the desktop app: browser clients +panels: no network (requests outside the plugin's own files are cancelled), no Node, no popups, no DOM +the person sees. It reaches Orca only through `host.call` (which `plugin`, `storage`, `settings` and +`secrets` use), `on`, and the UI it renders. Components panels need the desktop app: browser clients (`orca serve` in a web browser) show that instead of the panel. diff --git a/docs/reference/plugin-host-api.md b/docs/reference/plugin-host-api.md index 09da51f1b7c..1898ae79e31 100644 --- a/docs/reference/plugin-host-api.md +++ b/docs/reference/plugin-host-api.md @@ -2,7 +2,7 @@ -Host API 1.1 (`"pluginApi": 1`). Workers call a method with `await orca.host.call(name, params)`; panels and custom editors call the same methods through `window.orca.host.call(name, params)`. Each method lists the surfaces allowed to call it; any other surface gets `not_permitted`. `orca.host.has(name)` answers synchronously whether this Orca offers a method on the current surface, and `orca.api` is `{ major, minor }`. See [Plugin authoring](./plugin-authoring.md) for the frame API. +Host API 1.2 (`"pluginApi": 1`). Workers call a method with `await orca.host.call(name, params)`; panels and custom editors call the same methods through `window.orca.host.call(name, params)`. Each method lists the surfaces allowed to call it; any other surface gets `not_permitted`. `orca.host.has(name)` answers synchronously whether this Orca offers a method on the current surface, and `orca.api` is `{ major, minor }`. See [Plugin authoring](./plugin-authoring.md) for the frame API. Every call is checked against the capabilities the user approved, and params are validated before Orca runs anything: params are strict, so a field this Orca does not know is refused with `invalid_params` instead of being dropped. Mutations are recorded in the audit log as `plugin:.`. @@ -15,25 +15,28 @@ Methods whose capability is `none` need no capability but still need the plugin | [`workspace.readContext`](#workspacereadcontext) | `workspace:read` | worker, panel, editor | no | 1.0 | Branch, name and terminal ids of the focused workspace, or null when none is focused. | | [`terminal.sendText`](#terminalsendtext) | `terminal:send` | worker | yes | 1.0 | Types text into one terminal named by id, optionally pressing Enter. | | [`notifications.show`](#notificationsshow) | `notifications:show` | worker, panel, editor | yes | 1.0 | Shows a desktop notification. | -| [`storage.get`](#storageget) | `storage:own` | worker | no | 1.0 | Reads a JSON value from the plugin's private store; null when absent. | -| [`storage.set`](#storageset) | `storage:own` | worker | yes | 1.0 | Writes a JSON value to the plugin's private store. | -| [`storage.delete`](#storagedelete) | `storage:own` | worker | yes | 1.0 | Removes a key from the plugin's private store. | -| [`storage.keys`](#storagekeys) | `storage:own` | worker | no | 1.0 | Lists the keys in the plugin's private store. | -| [`secrets.get`](#secretsget) | `secrets:own` | worker | no | 1.0 | Reads a secret from the plugin's encrypted secrets file; null when absent. | -| [`secrets.set`](#secretsset) | `secrets:own` | worker | yes | 1.0 | Stores a secret in the plugin's encrypted secrets file. | -| [`secrets.delete`](#secretsdelete) | `secrets:own` | worker | yes | 1.0 | Removes a secret from the plugin's encrypted secrets file. | -| [`secrets.protection`](#secretsprotection) | `secrets:own` | worker | no | 1.1 | How secrets are protected at rest: `os-keyring`, or `unavailable` (no OS key store, or Linux `basic_text`), where `secrets.set` fails. | -| [`settings.get`](#settingsget) | `settings:own` | worker | no | 1.0 | Reads every setting the plugin owns. | -| [`settings.set`](#settingsset) | `settings:own` | worker | yes | 1.0 | Writes one setting the plugin owns. | +| [`storage.get`](#storageget) | `storage:own` | worker, panel, editor | no | 1.0 | Reads a JSON value from the plugin's private store; null when absent. | +| [`storage.set`](#storageset) | `storage:own` | worker, panel, editor | yes | 1.0 | Writes a JSON value to the plugin's private store. | +| [`storage.delete`](#storagedelete) | `storage:own` | worker, panel, editor | yes | 1.0 | Removes a key from the plugin's private store. | +| [`storage.keys`](#storagekeys) | `storage:own` | worker, panel, editor | no | 1.0 | Lists the keys in the plugin's private store. | +| [`secrets.get`](#secretsget) | `secrets:own` | worker, panel, editor | no | 1.0 | Reads a secret from the plugin's encrypted secrets file; null when absent. | +| [`secrets.set`](#secretsset) | `secrets:own` | worker, panel, editor | yes | 1.0 | Stores a secret in the plugin's encrypted secrets file. | +| [`secrets.delete`](#secretsdelete) | `secrets:own` | worker, panel, editor | yes | 1.0 | Removes a secret from the plugin's encrypted secrets file. | +| [`secrets.protection`](#secretsprotection) | `secrets:own` | worker, panel, editor | no | 1.1 | How secrets are protected at rest: `os-keyring`, or `unavailable` (no OS key store, or Linux `basic_text`), where `secrets.set` fails. | +| [`settings.get`](#settingsget) | `settings:own` | worker, panel, editor | no | 1.0 | Reads every setting the plugin owns. | +| [`settings.set`](#settingsset) | `settings:own` | worker, panel, editor | yes | 1.0 | Writes one setting the plugin owns. | | [`shell.openExternal`](#shellopenexternal) | none | panel, editor | no | 1.1 | Opens an http:, https: or mailto: URL in the default browser. Needs a click or key press in the frame; desktop app only. Orca asks the person before an http(s) host the plugin was not allowed; `opened` is false if they cancel. | | [`files.saveAs`](#filessaveas) | none | panel, editor | yes | 1.1 | Offers data (a string or ArrayBuffer, up to 64 MiB) in Orca's save dialog; the plugin never learns the path. Needs a click or key press in the frame; desktop app only. | +| [`plugin.request`](#pluginrequest) | none | panel, editor | no | 1.2 | Asks the plugin's own worker to run the handler it registered with `orca.panels.handle(name)`, starting the worker if needed; resolves with what the handler returned. `unknown_method` when no handler has that name. | +| [`agents.list`](#agentslist) | `agent:read` | worker, panel, editor | no | 1.2 | The agents in the focused workspace: their terminal, title, agent kind and status. `agent.status.changed` reports each change after. | +| [`events.subscribe`](#eventssubscribe) | none | panel, editor | no | 1.2 | Delivers a workspace or agent event to this panel as `orca.on(event)`; needs the event's read capability. The frame APIs call it for you. | ### `workspace.readContext` Branch, name and terminal ids of the focused workspace, or null when none is focused. ```ts -(params?: {}) => { branch: string; displayName: string; terminals: { id: string }[] } | null +(params?: {}) => { branch: string; displayName: string; terminals: { id: string; title?: string }[] } | null ``` ### `terminal.sendText` @@ -137,7 +140,7 @@ Writes one setting the plugin owns. Opens an http:, https: or mailto: URL in the default browser. Needs a click or key press in the frame; desktop app only. Orca asks the person before an http(s) host the plugin was not allowed; `opened` is false if they cancel. ```ts -(params: { url: string }) => { opened: boolean } +(params: { url: string }) => { opened: boolean; reason?: "cancelled" | "consent-unavailable" } ``` ### `files.saveAs` @@ -148,6 +151,30 @@ Offers data (a string or ArrayBuffer, up to 64 MiB) in Orca's save dialog; the p (params: { suggestedName?: string; mimeType?: string; data: string | ArrayBuffer }) => { status: "saved" | "cancelled" } ``` +### `plugin.request` + +Asks the plugin's own worker to run the handler it registered with `orca.panels.handle(name)`, starting the worker if needed; resolves with what the handler returned. `unknown_method` when no handler has that name. + +```ts +(params: { name: string; input?: JSON; timeoutMs?: number }) => { output: JSON } +``` + +### `agents.list` + +The agents in the focused workspace: their terminal, title, agent kind and status. `agent.status.changed` reports each change after. + +```ts +(params?: {}) => { agents: { terminalId: string | null; title: string | null; agent: string | null; state: "working" | "blocked" | "waiting" | "done"; stateStartedAt: number }[] } +``` + +### `events.subscribe` + +Delivers a workspace or agent event to this panel as `orca.on(event)`; needs the event's read capability. The frame APIs call it for you. + +```ts +(params: { event: "workspace.created" | "workspace.removed" | "agent.status.changed" | "workspace.changed" }) => { ok: true } +``` + ## Events A worker receives the events its manifest lists in `contributes.events` through `orca.events.on(event, handler)`, which returns `{ dispose() }`. Each needs `main`, the `trusted-worker` profile and its domain's capability (`workspace:read` or `agent:read`). `orca plugin types` writes the payloads as `PluginEvents` in `orca/host`. @@ -156,7 +183,8 @@ A worker receives the events its manifest lists in `contributes.events` through | --- | --- | --- | | `workspace.created` | `{ workspaceId: string; kind: "worktree" \| "folder"; path: string; branch: string }` | A worktree workspace was created. | | `workspace.removed` | `{ workspaceId: string; kind: "worktree" \| "folder"; path: string }` | A worktree workspace was removed. | -| `agent.status.changed` | `{ workspaceId: string \| null; paneKey: string; state: "working" \| "blocked" \| "waiting" \| "done"; receivedAt: number; mainAgent?: { state: "working" \| "blocked" \| "waiting" \| "done"; outcome?: "success" \| "failure" \| "cancellation" \| "superseded" \| "interruption" \| "unconfirmed"; stateStartedAt: number } }` | An agent in a terminal pane changed status; `workspaceId` is null when Orca cannot tie the pane to a workspace. | +| `agent.status.changed` | `{ workspaceId: string \| null; paneKey: string; terminalId?: string; title?: string; state: "working" \| "blocked" \| "waiting" \| "done"; receivedAt: number; mainAgent?: { state: "working" \| "blocked" \| "waiting" \| "done"; outcome?: "success" \| "failure" \| "cancellation" \| "superseded" \| "interruption" \| "unconfirmed"; stateStartedAt: number } }` | An agent in a terminal pane changed status; `workspaceId` is null when Orca cannot tie the pane to a workspace, and `terminalId` names its terminal when Orca lists it. | +| `workspace.changed` | `{ context: { branch: string; displayName: string; terminals: { id: string; title?: string }[] } \| null }` | The focused workspace changed, or its terminals were opened, closed or renamed; `context` is what `workspace.readContext` now answers. | ## Errors diff --git a/docs/reference/plugin-manifest.md b/docs/reference/plugin-manifest.md index 11bc2e26d06..5a9dbf9da67 100644 --- a/docs/reference/plugin-manifest.md +++ b/docs/reference/plugin-manifest.md @@ -32,7 +32,7 @@ Add `"$schema": "https://raw.githubusercontent.com/stablyai/orca/main/docs/schem | `contributes` | object | no | 1.4.160 | What the plugin adds to Orca. Every point defaults to empty. | | `contributes.panels` | [PanelContribution](#panelcontribution)[] | no | 1.4.160 | Sidebar panels. At most 64. | | `contributes.commands` | [CommandContribution](#commandcontribution)[] | no | 1.4.160 | Command palette entries. At most 256. | -| `contributes.events` | [EventContribution](#eventcontribution)[] | no | 1.4.160 | Events delivered to the plugin worker. At most 3. | +| `contributes.events` | [EventContribution](#eventcontribution)[] | no | 1.4.160 | Events delivered to the plugin worker. At most 4. | | `contributes.languagePacks` | [LanguagePackContribution](#languagepackcontribution)[] | no | 1.4.160 | Interface translations. At most 16. | | `contributes.keybindings` | [KeybindingContribution](#keybindingcontribution)[] | no | 1.4.160 | Keyboard shortcuts for contributed commands. At most 256. | | `contributes.vmRecipes` | [VmRecipeContribution](#vmrecipecontribution)[] | no | 1.4.160 | Virtual machine environment recipes. At most 64. | @@ -42,13 +42,13 @@ Add `"$schema": "https://raw.githubusercontent.com/stablyai/orca/main/docs/schem | `contributes.syntaxes` | [SyntaxContribution](#syntaxcontribution)[] | no | 1.4.245 | Syntax highlighting for editor languages. At most 16. | | `contributes.customEditors` | [CustomEditorContribution](#customeditorcontribution)[] | no | 1.4.245 | Editors that open files of given types in the editor tab. At most 16. | | `contributes.newFiles` | [NewFileContribution](#newfilecontribution)[] | no | 1.4.245 | Untitled files the user can create from the + menu and the command palette. At most 16. | +| `contributes.settings` | [SettingContribution](#settingcontribution)[] | no | 1.4.246 | Settings Orca shows under the plugin in Settings; code reads them with `settings.get` (`settings:own`). At most 64. | | `contributes.agentHarnesses` | any[] | no | 1.4.245 | Reserved for coding-agent harness definitions; must be empty until their format is defined. | | `contributes.skills` | any[] | no | 1.4.245 | Reserved for agent skills; must be empty until their format is defined. | | `contributes.mcpServers` | any[] | no | 1.4.245 | Reserved for MCP server definitions; must be empty until their format is defined. | | `contributes.hooks` | any[] | no | 1.4.245 | Reserved for agent hooks; must be empty until their format is defined. | | `contributes.taskSources` | any[] | no | 1.4.245 | Reserved for task sources; must be empty until their format is defined. | | `contributes.connections` | any[] | no | 1.4.245 | Reserved for account connections; must be empty until their format is defined. | -| `contributes.settings` | any[] | no | 1.4.245 | Reserved for plugin settings; must be empty until their format is defined. | | `contributes.statusBarItems` | any[] | no | 1.4.245 | Reserved for status bar items; must be empty until their format is defined. | | `contributes.sidebarCards` | any[] | no | 1.4.245 | Reserved for sidebar cards; must be empty until their format is defined. | | `capabilities` | [Capability](#capability)[] | no | 1.4.160 | Host APIs the plugin asks the user to grant. At most 32. | @@ -87,7 +87,7 @@ An event subscription. Requires `main`, the `trusted-worker` execution profile a | Field | Type | Required | Since | Description | | --- | --- | --- | --- | --- | -| `on` | `"workspace.created"` \| `"workspace.removed"` \| `"agent.status.changed"` | yes | 1.4.160 | Event delivered to the plugin worker. | +| `on` | `"workspace.created"` \| `"workspace.removed"` \| `"agent.status.changed"` \| `"workspace.changed"` | yes | 1.4.160 | Event delivered to the plugin worker. | ## LanguagePackContribution @@ -168,6 +168,25 @@ A kind of untitled file the user can create from the tab bar + menu or the comma | `template` | string | no | 1.4.245 | UTF-8 file copied into the new file, at most 256 KB. Without one the file starts empty. Relative to the plugin root; `..` segments and Windows device names such as `CON` are refused. Example: `"templates/empty.excalidraw"` | | `icon` | string | no | 1.4.245 | Square image shown beside the menu item. Defaults to the plugin icon. PNG, WEBP, static, at least 128×128, square, at most 256 KB. Relative to the plugin root; `..` segments and Windows device names such as `CON` are refused. Example: `"images/editor-icon.png"` | +## SettingContribution + +A setting shown under the plugin in Settings. Requires the `settings:own` capability, which is also how code reads it. + +| Field | Type | Required | Since | Description | +| --- | --- | --- | --- | --- | +| `key` | string | yes | 1.4.246 | Key code reads and writes, unique in this plugin. Example: `"apiUrl"` | +| `title` | string | yes | 1.4.246 | Label shown in Settings. Example: `"Server URL"` | +| `description` | string | no | 1.4.246 | Help text shown under the label. | +| `type` | `"string"` \| `"number"` \| `"integer"` \| `"boolean"` | yes | 1.4.246 | JSON Schema type of the value. Example: `"string"` | +| `default` | string \| number \| boolean | no | 1.4.246 | Value read while the person has not set one. | +| `enum` | (string \| number)[] | no | 1.4.246 | Allowed values; Settings shows a picker. | +| `enumLabels` | string[] | no | 1.4.246 | Picker labels, one per `enum` value. | +| `minimum` | number | no | 1.4.246 | Numbers: smallest value. | +| `maximum` | number | no | 1.4.246 | Numbers: largest value. | +| `maxLength` | integer | no | 1.4.246 | Strings: most characters. | +| `multiline` | boolean | no | 1.4.246 | Strings: a multi-line text box. | +| `placeholder` | string | no | 1.4.246 | Strings and numbers: hint shown while empty. | + ## Capability A host API the plugin may call once the user consents. @@ -195,7 +214,7 @@ One screenshot of the plugin in use. - **`terminal:send` needs `trusted-worker`.** Panels get no host method that types into a terminal, so Orca refuses the capability on any other profile instead of asking the user to grant something the plugin can never use. - **New fields, contribution points and values are additive.** They arrive with a `Since` version; nothing else changes. `manifestVersion` rises only if an existing field changes meaning. - **Deprecation.** A field to be removed is marked deprecated here and keeps working for at least one release; it is removed only together with a higher `engines.orca` requirement, and its name is never reused. -- **Reserved contribution points.** `contributes.agentHarnesses`, `skills`, `mcpServers`, `hooks`, `taskSources`, `connections`, `settings`, `statusBarItems` and `sidebarCards` are held for planned features and must stay empty until their format is defined. Each will arrive as an additive point with its own `Since`, without a new manifest format. `skills`, `mcpServers` and `hooks` keep the meaning agent-plugin formats such as Claude Code's give them; `agents` stays unclaimed because those formats use it for subagent files. +- **Reserved contribution points.** `contributes.agentHarnesses`, `skills`, `mcpServers`, `hooks`, `taskSources`, `connections`, `statusBarItems` and `sidebarCards` are held for planned features and must stay empty until their format is defined. Each will arrive as an additive point with its own `Since`, without a new manifest format. `skills`, `mcpServers` and `hooks` keep the meaning agent-plugin formats such as Claude Code's give them; `agents` stays unclaimed because those formats use it for subagent files. ## Planned contribution points @@ -209,7 +228,6 @@ Each reserved point is planned as declared data that Orca renders and enforces, - `mcpServers`: MCP server definitions that Orca offers to the agents it launches. - `skills`: Agent skills shipped as files that Orca installs for the agents it launches. - `hooks`: Agent lifecycle hooks, such as before and after a tool call, for the agents Orca launches. -- `settings`: Typed plugin settings that Orca renders in its own settings UI. ## Legacy format 1 diff --git a/docs/schemas/plugins/orca-catalog.v2.schema.json b/docs/schemas/plugins/orca-catalog.v2.schema.json index 464eda360f3..558a2f4f7c1 100644 --- a/docs/schemas/plugins/orca-catalog.v2.schema.json +++ b/docs/schemas/plugins/orca-catalog.v2.schema.json @@ -562,7 +562,8 @@ "iconThemes", "syntaxes", "customEditors", - "newFiles" + "newFiles", + "settings" ], "description": "Contribution point.", "x-orca-since": "1.4.245", diff --git a/docs/schemas/plugins/orca-plugin.v2.schema.json b/docs/schemas/plugins/orca-plugin.v2.schema.json index bf94e41f0a0..8326d840722 100644 --- a/docs/schemas/plugins/orca-plugin.v2.schema.json +++ b/docs/schemas/plugins/orca-plugin.v2.schema.json @@ -208,9 +208,9 @@ }, "events": { "default": [], - "description": "Events delivered to the plugin worker. At most 3.", + "description": "Events delivered to the plugin worker. At most 4.", "x-orca-since": "1.4.160", - "maxItems": 3, + "maxItems": 4, "type": "array", "items": { "$ref": "#/$defs/EventContribution" @@ -305,6 +305,16 @@ "$ref": "#/$defs/NewFileContribution" } }, + "settings": { + "default": [], + "description": "Settings Orca shows under the plugin in Settings; code reads them with `settings.get` (`settings:own`). At most 64.", + "x-orca-since": "1.4.246", + "maxItems": 64, + "type": "array", + "items": { + "$ref": "#/$defs/SettingContribution" + } + }, "agentHarnesses": { "description": "Reserved for coding-agent harness definitions; must be empty until their format is defined.", "x-orca-since": "1.4.245", @@ -347,13 +357,6 @@ "type": "array", "items": {} }, - "settings": { - "description": "Reserved for plugin settings; must be empty until their format is defined.", - "x-orca-since": "1.4.245", - "maxItems": 0, - "type": "array", - "items": {} - }, "statusBarItems": { "description": "Reserved for status bar items; must be empty until their format is defined.", "x-orca-since": "1.4.245", @@ -688,14 +691,16 @@ "enum": [ "workspace.created", "workspace.removed", - "agent.status.changed" + "agent.status.changed", + "workspace.changed" ], "description": "Event delivered to the plugin worker.", "x-orca-since": "1.4.160", "x-orca-enum-since": { "workspace.created": "1.4.245", "workspace.removed": "1.4.245", - "agent.status.changed": "1.4.160" + "agent.status.changed": "1.4.160", + "workspace.changed": "1.4.246" } } }, @@ -1131,6 +1136,130 @@ "additionalProperties": false, "description": "A kind of untitled file the user can create from the tab bar + menu or the command palette, in the active workspace." }, + "SettingContribution": { + "type": "object", + "properties": { + "key": { + "type": "string", + "pattern": "^[A-Za-z][A-Za-z0-9_.-]{0,63}$", + "description": "Key code reads and writes, unique in this plugin.", + "x-orca-since": "1.4.246", + "examples": [ + "apiUrl" + ] + }, + "title": { + "type": "string", + "minLength": 1, + "maxLength": 120, + "description": "Label shown in Settings.", + "x-orca-since": "1.4.246", + "examples": [ + "Server URL" + ] + }, + "description": { + "description": "Help text shown under the label.", + "x-orca-since": "1.4.246", + "type": "string", + "maxLength": 1000 + }, + "type": { + "type": "string", + "enum": [ + "string", + "number", + "integer", + "boolean" + ], + "description": "JSON Schema type of the value.", + "x-orca-since": "1.4.246", + "examples": [ + "string" + ] + }, + "default": { + "description": "Value read while the person has not set one.", + "x-orca-since": "1.4.246", + "anyOf": [ + { + "type": "string", + "maxLength": 10000 + }, + { + "type": "number" + }, + { + "type": "boolean" + } + ] + }, + "enum": { + "description": "Allowed values; Settings shows a picker.", + "x-orca-since": "1.4.246", + "minItems": 1, + "maxItems": 64, + "type": "array", + "items": { + "anyOf": [ + { + "type": "string", + "maxLength": 256 + }, + { + "type": "number" + } + ] + } + }, + "enumLabels": { + "description": "Picker labels, one per `enum` value.", + "x-orca-since": "1.4.246", + "maxItems": 64, + "type": "array", + "items": { + "type": "string", + "minLength": 1, + "maxLength": 120 + } + }, + "minimum": { + "description": "Numbers: smallest value.", + "x-orca-since": "1.4.246", + "type": "number" + }, + "maximum": { + "description": "Numbers: largest value.", + "x-orca-since": "1.4.246", + "type": "number" + }, + "maxLength": { + "description": "Strings: most characters.", + "x-orca-since": "1.4.246", + "type": "integer", + "minimum": 1, + "maximum": 10000 + }, + "multiline": { + "description": "Strings: a multi-line text box.", + "x-orca-since": "1.4.246", + "type": "boolean" + }, + "placeholder": { + "description": "Strings and numbers: hint shown while empty.", + "x-orca-since": "1.4.246", + "type": "string", + "maxLength": 120 + } + }, + "required": [ + "key", + "title", + "type" + ], + "additionalProperties": false, + "description": "A setting shown under the plugin in Settings. Requires the `settings:own` capability, which is also how code reads it." + }, "Capability": { "type": "object", "properties": { diff --git a/examples/plugins/hello-worker-panel/.gitattributes b/examples/plugins/hello-worker-panel/.gitattributes new file mode 100644 index 00000000000..fa1385d99a3 --- /dev/null +++ b/examples/plugins/hello-worker-panel/.gitattributes @@ -0,0 +1 @@ +* -text diff --git a/examples/plugins/hello-worker-panel/.gitignore b/examples/plugins/hello-worker-panel/.gitignore new file mode 100644 index 00000000000..ce65f0e1b1f --- /dev/null +++ b/examples/plugins/hello-worker-panel/.gitignore @@ -0,0 +1,2 @@ +node_modules/ +.orca/ diff --git a/examples/plugins/hello-worker-panel/README.md b/examples/plugins/hello-worker-panel/README.md new file mode 100644 index 00000000000..7334b9584e1 --- /dev/null +++ b/examples/plugins/hello-worker-panel/README.md @@ -0,0 +1,30 @@ +# Hello Worker Panel + +A components panel written in TSX with no build step, and the plugin's own worker. Start from +[hello-tsx](../hello-tsx) for a panel alone; this one adds everything a panel can reach beyond its +own UI, so it runs as a full-access (`trusted-worker`) plugin. Orca transpiles `src/*.tsx` and +`src/*.ts` when the panel loads (types stripped, JSX compiled for `orca`, relative imports such as +`./todos` resolved to their files). + +```sh +orca plugin dev load . # also writes .orca/types, the typings tsconfig.json extends +npx tsc -p . # optional type check +``` + +Import only `orca` and relative files: there is no bundler, so `import 'react'` fails with an +error naming the file and the import. + +It shows one of each part of the API: + +- **Components**: keyed atoms, `derived` values, `setup(ctx)` and `ui.has` feature detection. +- **Panel → worker**: Suggest calls `plugin.request('tasks.suggest')`, answered by + `orca.panels.handle` in `worker/main.mjs`, which starts on the panel's first request. +- **Worker → panel**: the worker `orca.panels.post`s `tasks.allDone` when the last task is done; + the panel hears it with `plugin.on`. +- **Shared storage**: the task list is `atom('todos', ..., { persist: 'storage' })`, so the + worker reads the same value with `orca.storage.get('todos')` and hears each change. +- **Settings**: `contributes.settings` declares `celebrate`, `suggestions` and `suggestionOrder` (a switch, a text box and a picker); change them under + the plugin in Orca's Settings and the worker reads them with `orca.settings.get`. +- **Events**: `on('agent.status.changed')` counts working agents (the `agent:read` capability). +- **One typed contract**: `src/protocol.ts` declares `PluginRequests` and `PluginPanelEvents` in + `declare module 'orca'`, so both sides type-check against it. diff --git a/examples/plugins/hello-worker-panel/orca-plugin.json b/examples/plugins/hello-worker-panel/orca-plugin.json new file mode 100644 index 00000000000..2d62e3d80f4 --- /dev/null +++ b/examples/plugins/hello-worker-panel/orca-plugin.json @@ -0,0 +1,61 @@ +{ + "manifestVersion": 2, + "execution": "trusted-worker", + "id": "hello-worker-panel", + "name": "Hello Worker Panel", + "version": "1.0.0", + "description": "A build-less TSX panel and its own worker: requests and posts between them, a storage-backed atom, declared settings and agent events, typed by one src/protocol.ts.", + "engines": { + "orca": ">=1.4.246" + }, + "pluginApi": 1, + "main": "worker/main.mjs", + "contributes": { + "panels": [ + { + "id": "tasks", + "title": "Hello Worker Panel", + "icon": "blocks", + "entry": "src/panel.tsx", + "ui": "components" + } + ], + "settings": [ + { + "key": "celebrate", + "title": "Celebrate finished lists", + "description": "The worker tells the panel when every task is done.", + "type": "boolean", + "default": true + }, + { + "key": "suggestions", + "title": "Task ideas", + "description": "One per line; Suggest picks the next one.", + "type": "string", + "multiline": true, + "default": "Write a test\nReview a pull request\nTake a break" + }, + { + "key": "suggestionOrder", + "title": "Suggestion order", + "description": "Which end of Task ideas Suggest starts from.", + "type": "string", + "enum": ["listed", "reversed"], + "enumLabels": ["As listed", "Last first"], + "default": "listed" + } + ] + }, + "capabilities": [ + { + "kind": "storage:own" + }, + { + "kind": "settings:own" + }, + { + "kind": "agent:read" + } + ] +} diff --git a/examples/plugins/hello-worker-panel/src/panel.tsx b/examples/plugins/hello-worker-panel/src/panel.tsx new file mode 100644 index 00000000000..8bc40b8d3ca --- /dev/null +++ b/examples/plugins/hello-worker-panel/src/panel.tsx @@ -0,0 +1,100 @@ +// No build step: Orca strips the types, compiles the JSX and resolves `./todos` when it loads. +import { + atom, + Badge, + Button, + Heading, + IconButton, + Input, + on, + plugin, + Progress, + read, + Row, + set, + Stack, + Text, + ui, + update, + type PanelContext +} from 'orca' +import { TodoList } from './todo-list' +import { add, clearDone, draft, openCount, percentDone, todos } from './todos' + +const themeSwitches = atom(0) +const celebration = atom(null) +/** Agent panes working right now, from `agent.status.changed` (the `agent:read` capability). */ +const workingAgents = atom>(new Set()) + +async function suggest(): Promise { + // Starts the plugin's worker if it is not running; typed by src/protocol.ts. + const { title } = await plugin.request('tasks.suggest', { + taken: read(todos).map((todo) => todo.title) + }) + set(draft, title ?? '') +} + +/** Runs once before the first render; what it pushes to `subscriptions` ends with the panel. */ +export function setup(ctx: PanelContext): void { + ctx.subscriptions.push( + on('theme', () => update(themeSwitches, (n) => n + 1)), + plugin.on('tasks.allDone', ({ count }) => set(celebration, `All ${count} done!`)), + on('agent.status.changed', ({ paneKey, state }) => + update(workingAgents, (panes) => { + const next = new Set(panes) + if (state === 'working') { + next.add(paneKey) + } else { + next.delete(paneKey) + } + return next + }) + ) + ) + // Wakes the worker so it sees the list change; the suggestion fills an empty field. + void suggest().catch(() => undefined) +} + +export default function Panel() { + const open = read(openCount) + const done = read(celebration) + return ( + + + Tasks + + {read(workingAgents).size > 0 ? ( + {read(workingAgents).size} agents working + ) : null} + 0 ? 'accent' : 'success'}>{open} open + + + {done ? {done} : null} + {/* Feature-detect: an older Orca without Progress still renders the rest. */} + {ui.has('Progress') ? : null} + + set(draft, value)} + onSubmit={add} + /> + + + + + + + + + Written in TSX with no build step. Theme switches seen: {read(themeSwitches)}. + + + ) +} diff --git a/examples/plugins/hello-worker-panel/src/protocol.ts b/examples/plugins/hello-worker-panel/src/protocol.ts new file mode 100644 index 00000000000..639e3b55826 --- /dev/null +++ b/examples/plugins/hello-worker-panel/src/protocol.ts @@ -0,0 +1,15 @@ +// The panel ↔ worker contract, declared once: src/panel.tsx and worker/main.mjs both read it. +export {} + +declare module 'orca' { + // oxlint-disable-next-line typescript/consistent-type-definitions -- declaration merging needs an interface + interface PluginRequests { + /** The next idea from the `suggestions` setting, skipping titles already on the list. */ + 'tasks.suggest': { input: { taken: string[] }; output: { title: string | null } } + } + // oxlint-disable-next-line typescript/consistent-type-definitions -- declaration merging needs an interface + interface PluginPanelEvents { + /** Posted by the worker when the stored list goes from open tasks to none. */ + 'tasks.allDone': { count: number } + } +} diff --git a/examples/plugins/hello-worker-panel/src/todo-list.tsx b/examples/plugins/hello-worker-panel/src/todo-list.tsx new file mode 100644 index 00000000000..3a248e58ec5 --- /dev/null +++ b/examples/plugins/hello-worker-panel/src/todo-list.tsx @@ -0,0 +1,21 @@ +import { EmptyState, List, ListItem } from 'orca' +import { toggle, type Todo } from './todos' + +export function TodoList({ items }: { items: Todo[] }) { + if (items.length === 0) { + return + } + return ( + + {items.map((todo) => ( + toggle(todo.id)} + /> + ))} + + ) +} diff --git a/examples/plugins/hello-worker-panel/src/todos.ts b/examples/plugins/hello-worker-panel/src/todos.ts new file mode 100644 index 00000000000..f2ee7b3e939 --- /dev/null +++ b/examples/plugins/hello-worker-panel/src/todos.ts @@ -0,0 +1,41 @@ +import { atom, derived, read, set, update } from 'orca' + +export type Todo = { id: number; title: string; done: boolean } + +// Kept in the plugin's own storage under `todos`: it survives restarts, and the worker reads it. +export const todos = atom( + 'todos', + [ + { id: 1, title: 'Read the components guide', done: true }, + { id: 2, title: 'Edit src/panel.tsx and save', done: false } + ], + { persist: 'storage' } +) +export const draft = atom('') +export const openCount = derived(() => read(todos).filter((todo) => !todo.done).length) +export const percentDone = derived(() => { + const list = read(todos) + return list.length === 0 ? 100 : Math.round((100 * (list.length - read(openCount))) / list.length) +}) + +export function add(): void { + const title = read(draft).trim() + if (!title) { + return + } + update(todos, (list) => [ + ...list, + { id: Math.max(0, ...list.map((todo) => todo.id)) + 1, title, done: false } + ]) + set(draft, '') +} + +export function toggle(id: number): void { + update(todos, (list) => + list.map((todo) => (todo.id === id ? { ...todo, done: !todo.done } : todo)) + ) +} + +export function clearDone(): void { + update(todos, (list) => list.filter((todo) => !todo.done)) +} diff --git a/examples/plugins/hello-worker-panel/tsconfig.json b/examples/plugins/hello-worker-panel/tsconfig.json new file mode 100644 index 00000000000..5b9684737e7 --- /dev/null +++ b/examples/plugins/hello-worker-panel/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "./.orca/types/tsconfig.json", + "include": ["src"] +} diff --git a/examples/plugins/hello-worker-panel/worker/main.mjs b/examples/plugins/hello-worker-panel/worker/main.mjs new file mode 100644 index 00000000000..4af74c07735 --- /dev/null +++ b/examples/plugins/hello-worker-panel/worker/main.mjs @@ -0,0 +1,42 @@ +// The plugin's own worker, started by the panel's first `plugin.request`. It answers +// `tasks.suggest` from the `suggestions` setting, and watches the task list the panel keeps in +// storage (`persist: 'storage'`) to post `tasks.allDone`. + +/** @param {unknown} todos */ +const openCount = (todos) => (Array.isArray(todos) ? todos.filter((todo) => !todo.done).length : 0) + +/** @type {import('orca/worker').Activate} */ +export default async function activate(orca) { + // Null until the panel first stores its list, so finishing the starting tasks still counts. + const stored = await orca.storage.get('todos') + let open = stored === null ? null : openCount(stored) + + orca.panels.handle('tasks.suggest', async ({ taken }) => { + const ideas = String((await orca.settings.get('suggestions')) ?? '') + .split('\n') + .map((line) => line.trim()) + .filter(Boolean) + if ((await orca.settings.get('suggestionOrder')) === 'reversed') { + ideas.reverse() + } + return { title: ideas.find((idea) => !taken.includes(idea)) ?? null } + }) + + orca.storage.onDidChange(async ({ key }) => { + if (key !== 'todos') { + return + } + const todos = await orca.storage.get('todos') + const nowOpen = openCount(todos) + const count = Array.isArray(todos) ? todos.length : 0 + if ( + open !== 0 && + nowOpen === 0 && + count > 0 && + (await orca.settings.get('celebrate')) !== false + ) { + orca.panels.post('tasks.allDone', { count }) + } + open = nowOpen + }) +} diff --git a/examples/plugins/test-fixtures/hostile-panel/panel.html b/examples/plugins/test-fixtures/hostile-panel/panel.html index 975ab9d9a07..53cef9dc8d3 100644 --- a/examples/plugins/test-fixtures/hostile-panel/panel.html +++ b/examples/plugins/test-fixtures/hostile-panel/panel.html @@ -157,7 +157,8 @@ // iframe can post raw invalid, pong and binary messages; an isolated guest (its own top // window, no raw channel) can only flood through orca.host.call. setTimeout(function () { - for (var i = 0; i < 40; i++) { + // Past the 120-per-10-seconds panel budget. + for (var i = 0; i < 150; i++) { if (window.parent !== window) { var payload = i % 3 === 0 diff --git a/resources/plugins/declarative/orca-runtime.mjs b/resources/plugins/declarative/orca-runtime.mjs index b8d562ca5ab..649d48cc82a 100644 --- a/resources/plugins/declarative/orca-runtime.mjs +++ b/resources/plugins/declarative/orca-runtime.mjs @@ -13,6 +13,7 @@ var snapshot = { }; var onPersistedChange = null; var onMemoryChange = null; +var onStorageAtom = null; var writableAtoms = /* @__PURE__ */ new Set(); function create(initial, fields = {}) { const created = Object.freeze({ @@ -39,7 +40,7 @@ function resetAtoms() { } } function stored(inner) { - if (!inner.key) { + if (!inner.key || inner.persist === "storage") { return { found: false }; } const entry = snapshot[inner.persist].get(inner.key); @@ -63,8 +64,8 @@ function atom(...args) { throw new Error(`atom key "${key}" is already used`); } const persist = options.persist ?? "memory"; - if (persist !== "memory" && persist !== "plugin" && persist !== "workspace") { - throw new TypeError('persist is "memory", "plugin" or "workspace"'); + if (!["memory", "plugin", "workspace", "storage"].includes(persist)) { + throw new TypeError('persist is "memory", "plugin", "workspace" or "storage"'); } const result = create(initial, { key, @@ -78,6 +79,9 @@ function atom(...args) { inner.value = hydrated.value; } keyed.set(key, result); + if (persist === "storage") { + onStorageAtom?.(key); + } return result; } function derived(compute) { @@ -167,6 +171,20 @@ function memoryEntry(target) { function watchMemoryAtoms(listener) { onMemoryChange = listener; } +function watchStorageAtoms(listener) { + onStorageAtom = listener; + for (const [key, target] of keyed) { + if (listener && target[ATOM].persist === "storage") { + listener(key); + } + } +} +function applyStorageValue(key, value) { + const inner = keyed.get(key)?.[ATOM]; + if (inner?.persist === "storage") { + assign(inner, value === void 0 ? inner.initial : value, false); + } +} function hydrateAtoms(scope, values) { snapshot[scope] = new Map(values); for (const target of keyed.values()) { @@ -433,43 +451,6 @@ function evaluateOrcaTree(component, editsSeen = /* @__PURE__ */ new Map()) { return { tree, callbacks }; } -// src/shared/plugins/declarative/runtime/declarative-persist-queue.ts -var PERSIST_DEBOUNCE_MS = 400; -function createPersistQueue(options) { - const pending = /* @__PURE__ */ new Set(); - let timer = null; - function flush() { - if (timer !== null) { - clearTimeout(timer); - timer = null; - } - const entries = []; - for (const target of pending) { - const entry = persistedEntry(target); - if (!entry) { - continue; - } - try { - assertPlainJson(entry.value, `persisted atom "${entry.key}"`); - entries.push(entry); - } catch (error) { - options.report(error); - } - } - pending.clear(); - if (entries.length > 0) { - options.post(entries); - } - } - return { - add(target) { - pending.add(target); - timer ??= setTimeout(flush, PERSIST_DEBOUNCE_MS); - }, - flush - }; -} - // src/shared/plugins/declarative/runtime/declarative-memory-retention.ts var RETAIN_DEBOUNCE_MS = 50; var RETAIN_BATCH = 64; @@ -671,6 +652,114 @@ function createPanelContext(onRetain) { }; } +// src/shared/plugins/declarative/runtime/declarative-persist-queue.ts +var PERSIST_DEBOUNCE_MS = 400; +function createPersistQueue(options) { + const pending = /* @__PURE__ */ new Set(); + let timer = null; + function flush() { + if (timer !== null) { + clearTimeout(timer); + timer = null; + } + const entries = []; + for (const target of pending) { + const entry = persistedEntry(target); + if (!entry) { + continue; + } + try { + assertPlainJson(entry.value, `persisted atom "${entry.key}"`); + entries.push(entry); + } catch (error) { + options.report(error); + } + } + pending.clear(); + if (entries.length > 0) { + options.post(entries); + } + } + return { + add(target) { + pending.add(target); + timer ??= setTimeout(flush, PERSIST_DEBOUNCE_MS); + }, + flush + }; +} + +// src/shared/plugins/declarative/runtime/declarative-storage-sync.ts +function createDeclarativeStorageSync(options) { + const storage2 = options.bridge?.storage; + const loads = /* @__PURE__ */ new Set(); + const writtenSince = /* @__PURE__ */ new Map(); + let generation = 0; + function load(key) { + if (!storage2) { + return; + } + const startedAt = generation; + const task = storage2.get(key).then((value) => { + if ((writtenSince.get(key) ?? -1) < startedAt) { + applyStorageValue(key, value ?? void 0); + } + }).catch(options.report).finally(() => loads.delete(task)); + loads.add(task); + } + watchStorageAtoms((key) => { + generation += 1; + load(key); + }); + const subscription = storage2?.onDidChange(({ key }) => { + generation += 1; + load(key); + }); + return { + write(entries) { + const rest = []; + for (const entry of entries) { + if (entry.scope !== "storage") { + rest.push(entry); + continue; + } + generation += 1; + writtenSince.set(entry.key, generation); + void storage2?.set(entry.key, entry.value).catch(options.report); + } + return rest; + }, + loaded: async () => { + await Promise.all(loads); + }, + dispose() { + watchStorageAtoms(null); + subscription?.dispose(); + } + }; +} +function createDeclarativePersistence(options) { + const storageSync = createDeclarativeStorageSync(options); + const queue = createPersistQueue({ + report: options.report, + post: (all) => { + const entries = storageSync.write(all); + if (entries.length > 0) { + options.post(entries); + } + } + }); + watchPersistedAtoms(queue.add); + return { + flush: queue.flush, + loaded: storageSync.loaded, + dispose() { + watchPersistedAtoms(null); + storageSync.dispose(); + } + }; +} + // src/shared/plugins/declarative/runtime/declarative-renderer.ts function createOrcaDeclarativeRuntime(options) { const { post } = options; @@ -805,12 +894,12 @@ function createOrcaDeclarativeRuntime(options) { invalidate(retryAfterMs); } } - const persistQueue = createPersistQueue({ + const persistence = createDeclarativePersistence({ + bridge, report, post: (entries) => post(PLUGIN_DECLARATIVE_MESSAGES.persist, { document: document2, entries }) }); - const flushPersist = persistQueue.flush; - watchPersistedAtoms(persistQueue.add); + const flushPersist = persistence.flush; const bridgeSubscriptions = bridge?.on ? [ bridge.on(PLUGIN_DECLARATIVE_MESSAGES.event, dispatchEvent), bridge.on(PLUGIN_DECLARATIVE_MESSAGES.ack, acknowledge), @@ -840,6 +929,7 @@ function createOrcaDeclarativeRuntime(options) { document: document2, async boot(module) { await panel.hydrated; + await persistence.loaded(); if (isCallable(module.setup)) { const cleanup = module.setup(context); setupCleanup = isCallable(cleanup) ? () => void cleanup() : null; @@ -900,7 +990,7 @@ function createOrcaDeclarativeRuntime(options) { component = null; scheduled = false; unsubscribeAll(); - watchPersistedAtoms(null); + persistence.dispose(); for (const subscription of [...bridgeSubscriptions, ...context.subscriptions]) { try { subscription.dispose(); @@ -1014,6 +1104,45 @@ function createOrcaSdk(source) { return { host: host2, api: api2, env: env2, shell: shell2, files: files2, on: on2, ui: ui2 }; } +// src/shared/plugins/declarative/runtime/declarative-data-sdk.ts +function unavailable2(what) { + return Promise.reject( + Object.assign(new Error(`${what} is not available in this Orca`), { + code: "unavailable", + retryable: false + }) + ); +} +var NOTHING = { dispose: () => void 0 }; +function createOrcaDataSdk(bridge) { + const plugin2 = Object.freeze({ + request(name, input, options) { + return bridge()?.plugin?.request(name, input, options) ?? unavailable2("plugin.request"); + }, + on(event, handler) { + return bridge()?.plugin?.on(event, handler) ?? NOTHING; + } + }); + const storage2 = Object.freeze({ + get: (key) => bridge()?.storage?.get(key) ?? unavailable2("storage"), + set: (key, value) => bridge()?.storage?.set(key, value) ?? unavailable2("storage"), + delete: (key) => bridge()?.storage?.delete(key) ?? unavailable2("storage"), + keys: () => bridge()?.storage?.keys() ?? unavailable2("storage"), + onDidChange: (handler) => bridge()?.storage?.onDidChange(handler) ?? NOTHING + }); + const settings2 = Object.freeze({ + get: (key) => bridge()?.settings?.get(key) ?? unavailable2("settings"), + set: (key, value) => bridge()?.settings?.set(key, value) ?? unavailable2("settings"), + onDidChange: (handler) => bridge()?.settings?.onDidChange(handler) ?? NOTHING + }); + const secrets2 = Object.freeze({ + get: (key) => bridge()?.secrets?.get(key) ?? unavailable2("secrets"), + set: (key, value) => bridge()?.secrets?.set(key, value) ?? unavailable2("secrets"), + delete: (key) => bridge()?.secrets?.delete(key) ?? unavailable2("secrets") + }); + return { plugin: plugin2, storage: storage2, settings: settings2, secrets: secrets2 }; +} + // src/shared/plugins/declarative/runtime/orca-module.ts var runtime = null; var pendingMount = null; @@ -1063,6 +1192,9 @@ var sdk = createOrcaSdk({ theme: () => runtime ? read(runtime.themeAtom) : { colorScheme: documentColorScheme() ?? "dark" } }); var { host, api, env, shell, files, on, ui } = sdk; +var { plugin, storage, settings, secrets } = createOrcaDataSdk( + () => runtime?.bridge ?? globalBridge() +); var Stack = "Stack"; var Row = "Row"; var Text = "Text"; @@ -1116,9 +1248,13 @@ export { jsx as jsxs, mount, on, + plugin, read, + secrets, set, + settings, shell, + storage, ui, update }; diff --git a/resources/plugins/declarative/orca-testing.mjs b/resources/plugins/declarative/orca-testing.mjs index 29164261070..ffd161425f6 100644 --- a/resources/plugins/declarative/orca-testing.mjs +++ b/resources/plugins/declarative/orca-testing.mjs @@ -1,49 +1,49 @@ // Generated by config/scripts/build-plugin-declarative-runtime.mjs from // src/shared/plugins/declarative/testing/. Do not edit. -var Iv=Object.defineProperty;var Pe=(e,n)=>{for(var i in n)Iv(e,i,{get:n[i],enumerable:!0})};import{readFileSync as Ex}from"node:fs";import{dirname as kv,join as Lx}from"node:path";var h={};Pe(h,{$brand:()=>Mo,$input:()=>fc,$output:()=>mc,INVALID:()=>re,NEVER:()=>Vo,TimePrecision:()=>Sc,ZodAny:()=>ml,ZodArray:()=>hl,ZodBase64:()=>co,ZodBase64URL:()=>so,ZodBigInt:()=>rn,ZodBigIntFormat:()=>mo,ZodBoolean:()=>nn,ZodCIDRv4:()=>ao,ZodCIDRv6:()=>uo,ZodCUID:()=>Qi,ZodCUID2:()=>eo,ZodCatch:()=>Cl,ZodCodec:()=>rr,ZodCompileAsyncError:()=>ye,ZodCompileUnsupportedError:()=>E,ZodCreditCard:()=>ol,ZodCustom:()=>ir,ZodCustomStringFormat:()=>mt,ZodDate:()=>qn,ZodDefault:()=>jl,ZodDiscriminatedUnion:()=>yl,ZodE164:()=>lo,ZodEmail:()=>Hi,ZodEmoji:()=>qi,ZodEnum:()=>Qt,ZodError:()=>F_,ZodExactOptional:()=>ho,ZodFile:()=>Pl,ZodFirstPartyTypeKind:()=>Yl,ZodFunction:()=>Wl,ZodGUID:()=>Xi,ZodIBAN:()=>al,ZodIPv4:()=>io,ZodIPv6:()=>oo,ZodISODate:()=>Be,ZodISODateTime:()=>Je,ZodISODuration:()=>We,ZodISOTime:()=>Ke,ZodInstanceOf:()=>ql,ZodIntersection:()=>_l,ZodIssueCode:()=>B_,ZodJWT:()=>po,ZodKSUID:()=>ro,ZodLazy:()=>Jl,ZodLiteral:()=>zl,ZodMAC:()=>il,ZodMap:()=>wl,ZodNaN:()=>Rl,ZodNanoID:()=>Yi,ZodNever:()=>gl,ZodNonOptional:()=>$o,ZodNull:()=>dl,ZodNullable:()=>Ol,ZodNumber:()=>tn,ZodNumberFormat:()=>ft,ZodObject:()=>Qn,ZodOptional:()=>tr,ZodPipe:()=>nr,ZodPrefault:()=>Ul,ZodPreprocess:()=>Vl,ZodPromise:()=>Kl,ZodReadonly:()=>Ml,ZodRealError:()=>de,ZodRecord:()=>Yt,ZodSet:()=>Sl,ZodString:()=>en,ZodStringFormat:()=>R,ZodSuccess:()=>Ll,ZodSymbol:()=>sl,ZodTemplateLiteral:()=>Gl,ZodTransform:()=>Dl,ZodTuple:()=>xl,ZodType:()=>A,ZodULID:()=>to,ZodURL:()=>Xn,ZodUUID:()=>Se,ZodUndefined:()=>ll,ZodUnion:()=>er,ZodUnknown:()=>fl,ZodVoid:()=>vl,ZodXID:()=>no,ZodXor:()=>$l,_ZodString:()=>Wi,_default:()=>Al,_function:()=>Hf,any:()=>Sf,array:()=>Yn,base64:()=>af,base64url:()=>uf,bigint:()=>bf,boolean:()=>cl,catch:()=>Zl,check:()=>Xf,cidrv4:()=>rf,cidrv6:()=>of,clone:()=>L,codec:()=>Jf,coerce:()=>ed,compile:()=>$c,config:()=>G,core:()=>Ae,creditCard:()=>sf,cuid:()=>Hm,cuid2:()=>Xm,currencyCode:()=>gf,custom:()=>qf,date:()=>Pf,decode:()=>qs,decodeAsync:()=>Qs,deepPartial:()=>lg,describe:()=>Yf,discriminatedUnion:()=>Uf,e164:()=>cf,email:()=>Zm,emoji:()=>Km,encode:()=>Xs,encodeAsync:()=>Ys,endsWith:()=>Vt,enum:()=>go,exactOptional:()=>Nl,file:()=>Vf,flattenError:()=>yn,float32:()=>hf,float64:()=>$f,formatError:()=>_n,fromJSONSchema:()=>cg,function:()=>Hf,getDiscriminatedOption:()=>Vu,getErrorMap:()=>W_,globalRegistry:()=>Q,gt:()=>Ie,gte:()=>fe,guid:()=>Rm,hash:()=>vf,hex:()=>ff,hostname:()=>mf,httpUrl:()=>Bm,iban:()=>lf,includes:()=>Zt,input:()=>pg,instanceof:()=>eg,int:()=>Bi,int32:()=>yf,int64:()=>xf,intersection:()=>bl,invertCodec:()=>Bf,ipv4:()=>ef,ipv6:()=>nf,iso:()=>or,json:()=>ng,jwt:()=>df,keyof:()=>Df,ksuid:()=>Qm,lazy:()=>Bl,length:()=>ct,literal:()=>Rf,locales:()=>Rn,looseObject:()=>jf,looseRecord:()=>Ef,lowercase:()=>Lt,lt:()=>ke,lte:()=>me,mac:()=>tf,map:()=>Lf,maxLength:()=>ut,maxSize:()=>Ve,memoizer:()=>Cn,meta:()=>Qf,mime:()=>Ft,minLength:()=>je,minSize:()=>we,multipleOf:()=>Re,nan:()=>Gf,nanoid:()=>Wm,nativeEnum:()=>Zf,negative:()=>Ti,never:()=>fo,nonnegative:()=>Li,nonoptional:()=>El,nonpositive:()=>Ei,normalize:()=>Gt,null:()=>pl,nullable:()=>Hn,nullish:()=>Mf,number:()=>ul,object:()=>Nf,optional:()=>dt,output:()=>mg,overwrite:()=>_e,parse:()=>Bs,parseAsync:()=>Ks,partialRecord:()=>Tf,pipe:()=>Ki,positive:()=>Ui,prefault:()=>Tl,preprocess:()=>rg,prettifyError:()=>Ko,promise:()=>Wf,properties:()=>Mt,property:()=>Ci,readonly:()=>Fl,record:()=>Il,refine:()=>Hl,regex:()=>Et,regexes:()=>he,registry:()=>si,safeDecode:()=>tl,safeDecodeAsync:()=>rl,safeEncode:()=>el,safeEncodeAsync:()=>nl,safeParse:()=>Ws,safeParseAsync:()=>Hs,set:()=>Cf,setErrorMap:()=>K_,size:()=>at,slugify:()=>Wt,startsWith:()=>Rt,strictObject:()=>Of,string:()=>Wn,stringFormat:()=>pf,stringbool:()=>tg,success:()=>Ff,superRefine:()=>Xl,symbol:()=>If,templateLiteral:()=>Kf,toJSONSchema:()=>Mi,toLowerCase:()=>Bt,toUpperCase:()=>Kt,toZod:()=>sn,transform:()=>vo,treeifyError:()=>Bo,trim:()=>Jt,tuple:()=>kl,uint32:()=>_f,uint64:()=>kf,ulid:()=>qm,undefined:()=>wf,union:()=>on,unknown:()=>lt,uppercase:()=>Ct,url:()=>Jm,util:()=>y,uuid:()=>Vm,uuidv4:()=>Mm,uuidv6:()=>Fm,uuidv7:()=>Gm,validate:()=>bn,validateAsync:()=>xn,void:()=>zf,withParser:()=>li,xid:()=>Ym,xor:()=>Af});var Ae={};Pe(Ae,{$ZodAny:()=>ju,$ZodArray:()=>Cu,$ZodAsyncError:()=>se,$ZodBase64:()=>_u,$ZodBase64URL:()=>bu,$ZodBigInt:()=>Hr,$ZodBigIntFormat:()=>Pu,$ZodBoolean:()=>jn,$ZodCIDRv4:()=>$u,$ZodCIDRv6:()=>yu,$ZodCUID:()=>au,$ZodCUID2:()=>uu,$ZodCatch:()=>rc,$ZodCheck:()=>M,$ZodCheckBigIntFormat:()=>Aa,$ZodCheckEndsWith:()=>Ja,$ZodCheckGreaterThan:()=>Ar,$ZodCheckIncludes:()=>Fa,$ZodCheckLengthEquals:()=>Za,$ZodCheckLessThan:()=>jr,$ZodCheckLowerCase:()=>Va,$ZodCheckMaxLength:()=>La,$ZodCheckMaxSize:()=>Ua,$ZodCheckMimeType:()=>Wa,$ZodCheckMinLength:()=>Ca,$ZodCheckMinSize:()=>Ta,$ZodCheckMultipleOf:()=>Oa,$ZodCheckNumberFormat:()=>ja,$ZodCheckOverwrite:()=>Ha,$ZodCheckProperties:()=>Ka,$ZodCheckProperty:()=>Ba,$ZodCheckRegex:()=>Ra,$ZodCheckSizeEquals:()=>Ea,$ZodCheckStartsWith:()=>Ga,$ZodCheckStringFormat:()=>Ot,$ZodCheckUpperCase:()=>Ma,$ZodCodec:()=>Un,$ZodCreditCard:()=>ku,$ZodCustom:()=>lc,$ZodCustomStringFormat:()=>Su,$ZodCyclicError:()=>ni,$ZodDate:()=>Eu,$ZodDefault:()=>Qu,$ZodDiscriminatedUnion:()=>Mu,$ZodE164:()=>xu,$ZodEmail:()=>eu,$ZodEmoji:()=>iu,$ZodEncodeError:()=>Ce,$ZodEnum:()=>Ku,$ZodError:()=>Jo,$ZodExactOptional:()=>qu,$ZodFile:()=>Hu,$ZodFunction:()=>cc,$ZodGUID:()=>Ya,$ZodIBAN:()=>Iu,$ZodIPv4:()=>gu,$ZodIPv6:()=>vu,$ZodISODate:()=>pu,$ZodISODateTime:()=>du,$ZodISODuration:()=>fu,$ZodISOTime:()=>mu,$ZodIntersection:()=>Fu,$ZodJWT:()=>wu,$ZodKSUID:()=>lu,$ZodLazy:()=>Tn,$ZodLiteral:()=>Wu,$ZodMAC:()=>hu,$ZodMap:()=>Ju,$ZodNaN:()=>ic,$ZodNanoID:()=>ou,$ZodNever:()=>Uu,$ZodNonOptional:()=>tc,$ZodNull:()=>Ou,$ZodNullable:()=>Yu,$ZodNumber:()=>Wr,$ZodNumberFormat:()=>zu,$ZodObject:()=>Hd,$ZodObjectJIT:()=>Zu,$ZodOptional:()=>qr,$ZodPipe:()=>Yr,$ZodPrefault:()=>ec,$ZodPreprocess:()=>oc,$ZodPromise:()=>sc,$ZodReadonly:()=>ac,$ZodRealError:()=>le,$ZodRecord:()=>Gu,$ZodRegistry:()=>ci,$ZodSet:()=>Bu,$ZodString:()=>nt,$ZodStringFormat:()=>C,$ZodSuccess:()=>nc,$ZodSymbol:()=>Du,$ZodTemplateLiteral:()=>uc,$ZodTransform:()=>Xu,$ZodTuple:()=>Xr,$ZodType:()=>j,$ZodULID:()=>cu,$ZodURL:()=>ru,$ZodUUID:()=>Qa,$ZodUndefined:()=>Nu,$ZodUnion:()=>An,$ZodUnknown:()=>Au,$ZodVoid:()=>Tu,$ZodXID:()=>su,$ZodXor:()=>Ru,$brand:()=>Mo,$constructor:()=>f,$input:()=>fc,$output:()=>mc,Doc:()=>tt,INVALID:()=>re,JSONSchema:()=>Em,JSONSchemaGenerator:()=>Fi,NEVER:()=>Vo,TimePrecision:()=>Sc,URL_BAD_FORMAT:()=>tu,URL_UNPARSEABLE:()=>zn,ZodCompileAsyncError:()=>ye,ZodCompileUnsupportedError:()=>E,_any:()=>Fc,_array:()=>Xc,_base64:()=>Ni,_base64url:()=>Oi,_bigint:()=>Ec,_boolean:()=>Uc,_catch:()=>O_,_check:()=>_m,_cidrv4:()=>Pi,_cidrv6:()=>Di,_coercedBigint:()=>Lc,_coercedBoolean:()=>Tc,_coercedDate:()=>Wc,_coercedNumber:()=>Pc,_coercedString:()=>xc,_creditCard:()=>Ic,_cuid:()=>bi,_cuid2:()=>xi,_custom:()=>Yc,_date:()=>Kc,_decode:()=>br,_decodeAsync:()=>kr,_default:()=>P_,_discriminatedUnion:()=>v_,_e164:()=>ji,_email:()=>mi,_emoji:()=>yi,_encode:()=>_r,_encodeAsync:()=>xr,_endsWith:()=>Vt,_enum:()=>x_,_file:()=>qc,_float32:()=>Nc,_float64:()=>Oc,_gt:()=>Ie,_gte:()=>fe,_guid:()=>fi,_iban:()=>wc,_includes:()=>Zt,_int:()=>Dc,_int32:()=>jc,_int64:()=>Cc,_intersection:()=>h_,_ipv4:()=>Si,_ipv6:()=>zi,_isoDate:()=>Fn,_isoDateTime:()=>Mn,_isoDuration:()=>Jn,_isoTime:()=>Gn,_jwt:()=>Ai,_ksuid:()=>wi,_lazy:()=>T_,_length:()=>ct,_literal:()=>I_,_lowercase:()=>Lt,_lt:()=>ke,_lte:()=>me,_mac:()=>kc,_map:()=>__,_max:()=>me,_maxLength:()=>ut,_maxSize:()=>Ve,_mime:()=>Ft,_min:()=>fe,_minLength:()=>je,_minSize:()=>we,_multipleOf:()=>Re,_nan:()=>Hc,_nanoid:()=>_i,_nativeEnum:()=>k_,_negative:()=>Ti,_never:()=>Jc,_nonnegative:()=>Li,_nonoptional:()=>D_,_nonpositive:()=>Ei,_normalize:()=>Gt,_null:()=>Mc,_nullable:()=>z_,_number:()=>zc,_optional:()=>S_,_overwrite:()=>_e,_parse:()=>zt,_parseAsync:()=>Pt,_pipe:()=>j_,_positive:()=>Ui,_promise:()=>E_,_properties:()=>Mt,_property:()=>Ci,_readonly:()=>A_,_record:()=>y_,_refine:()=>Qc,_regex:()=>Et,_safeDecode:()=>wr,_safeDecodeAsync:()=>zr,_safeEncode:()=>Ir,_safeEncodeAsync:()=>Sr,_safeParse:()=>Dt,_safeParseAsync:()=>Nt,_set:()=>b_,_size:()=>at,_slugify:()=>Wt,_startsWith:()=>Rt,_string:()=>bc,_stringFormat:()=>st,_stringbool:()=>rs,_success:()=>N_,_superRefine:()=>es,_symbol:()=>Rc,_templateLiteral:()=>U_,_toLowerCase:()=>Bt,_toUpperCase:()=>Kt,_transform:()=>w_,_trim:()=>Jt,_tuple:()=>$_,_uint32:()=>Ac,_uint64:()=>Zc,_ulid:()=>ki,_undefined:()=>Vc,_union:()=>f_,_unknown:()=>Gc,_uppercase:()=>Ct,_url:()=>Vn,_uuid:()=>gi,_uuidv4:()=>vi,_uuidv6:()=>hi,_uuidv7:()=>$i,_void:()=>Bc,_xid:()=>Ii,_xor:()=>g_,base64Charset:()=>Fr,base64urlCharset:()=>On,canParseURL:()=>nu,clone:()=>L,compile:()=>$c,compileFn:()=>di,config:()=>G,createStandardJSONSchemaMethod:()=>Ht,createToJSONSchemaMethod:()=>os,decode:()=>gh,decodeAsync:()=>hh,describe:()=>ts,encode:()=>fh,encodeAsync:()=>vh,extractDefs:()=>Fe,finalize:()=>Ge,flattenError:()=>yn,formatError:()=>_n,getDiscriminatedOption:()=>Vu,globalConfig:()=>q,globalRegistry:()=>Q,handleUnrepresentable:()=>K,initializeContext:()=>Me,isBackEdge:()=>ii,isRecursiveSchema:()=>ri,isValidBase64:()=>Nn,isValidBase64URL:()=>Gr,isValidCIDRv6:()=>Mr,isValidCreditCard:()=>Jr,isValidIBAN:()=>Br,isValidIPv6:()=>Dn,isValidJWT:()=>Kr,locales:()=>Rn,memoizer:()=>Cn,mergeValues:()=>jt,meta:()=>ns,parse:()=>$r,parseAsync:()=>yr,parseURLObject:()=>Bd,prettifyError:()=>Ko,process:()=>Z,processSchema:()=>Z,regexes:()=>he,registry:()=>si,safeDecode:()=>yh,safeDecodeAsync:()=>bh,safeEncode:()=>$h,safeEncodeAsync:()=>_h,safeParse:()=>sh,safeParseAsync:()=>lh,standardProps:()=>Cr,stripTabAndNewline:()=>Pn,toDotPath:()=>wd,toJSONSchema:()=>Mi,toZod:()=>sn,treeifyError:()=>Bo,urlHostnameOk:()=>Rr,urlProtocolOk:()=>Vr,util:()=>y,validate:()=>bn,validateAsync:()=>xn,validateURL:()=>Zr,version:()=>Xa,withParser:()=>li});var y={};Pe(y,{BIGINT_FORMAT_RANGES:()=>fn,CONSTANT_CATCH:()=>vr,Class:()=>Oo,NUMBER_FORMAT_RANGES:()=>mn,aborted:()=>ne,allowsEval:()=>Uo,assert:()=>Dv,assertEqual:()=>wv,assertIs:()=>zv,assertNever:()=>Pv,assertNotEqual:()=>Sv,assignProp:()=>Y,attachSchema:()=>gn,base64ToUint8Array:()=>yd,base64urlToUint8Array:()=>Wv,cached:()=>kt,captureStackTrace:()=>fr,cleanEnum:()=>Kv,cleanRegex:()=>Ne,clone:()=>L,cloneDef:()=>jv,codePointLength:()=>Qe,constantCatch:()=>Zo,createTransparentProxy:()=>Cv,defineLazy:()=>jo,defineLazyInternal:()=>T,derived:()=>Yv,esc:()=>te,escapeRegex:()=>ve,explicitlyAborted:()=>Lo,extend:()=>Vv,finalizeIssue:()=>ce,floatSafeRemainder:()=>ln,getElementAtPath:()=>Av,getEnumValues:()=>bt,getLengthableOrigin:()=>hn,getParsedType:()=>Lv,getSizableOrigin:()=>vn,hexToUint8Array:()=>Xv,hide:()=>$n,installLazyProp:()=>nh,isObject:()=>Ye,isPlainObject:()=>ge,issue:()=>St,joinValues:()=>g,jsonStringifyReplacer:()=>xt,members:()=>Co,merge:()=>Fv,mergeDefs:()=>$e,normalizeParams:()=>I,nullish:()=>mr,numKeys:()=>Ev,objectClone:()=>Nv,omit:()=>Rv,optionalKeys:()=>Eo,own:()=>Le,parsedType:()=>x,partial:()=>Gv,pick:()=>Zv,prefixIssues:()=>ue,primitiveTypes:()=>To,promiseAllObject:()=>Uv,propertyKeyTypes:()=>pn,randomString:()=>Tv,rawShape:()=>It,required:()=>Jv,safeExtend:()=>Mv,shallowClone:()=>dn,sizeCaps:()=>wt,slugify:()=>Ao,stringifyPrimitive:()=>_,toZod:()=>sn,uint8ArrayToBase64:()=>_d,uint8ArrayToBase64url:()=>Hv,uint8ArrayToHex:()=>qv,unwrapMessage:()=>_t});function wv(e){return e}function Sv(e){return e}function sn(){return e=>e}function zv(e){}function Pv(e){throw new Error("Unexpected value in exhaustive check")}function Dv(e){}function bt(e){let n=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,t])=>n.indexOf(+o)===-1).map(([o,t])=>t)}function g(e,n="|"){return e.map(i=>_(i)).join(n)}function xt(e,n){return typeof n=="bigint"?n.toString():n}var No=class{constructor(n){this._getter=n,this._value=void 0}get value(){let n=this._getter;return n!==void 0&&(this._value=n(),this._getter=void 0),this._value}};function kt(e){return new No(e)}function mr(e){return e==null}function Ne(e){let n=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(n,i)}function ln(e,n){let i=e/n,o=Math.round(i),t=4*Number.EPSILON*Math.max(Math.abs(i),1);return Math.abs(i-o){let u=n._zod.def.shape[r];return o?o(u,r):u}):hd(e,r,o?o(a.value,r):a.value))}}function Ov(e,n){for(let i of Reflect.ownKeys(n)){let o=Object.getOwnPropertyDescriptor(n,i);o.enumerable&&(o.get?vd(e,i,()=>n[i]):hd(e,i,o.value))}}function $e(...e){let n={};for(let i of e){let o=Object.getOwnPropertyDescriptors(i);Object.assign(n,o)}return Object.defineProperties({},n)}function jv(e){return $e(e._zod.def)}function Av(e,n){return n?n.reduce((i,o)=>i?.[o],e):e}function Uv(e){let n=Object.keys(e),i=n.map(o=>e[o]);return Promise.all(i).then(o=>{let t={};for(let r=0;r{};function Ye(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Uo=kt(()=>{if(q.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ge(e){if(Ye(e)===!1)return!1;let n=e.constructor;if(n===void 0||typeof n!="function")return!0;let i=n.prototype;return!(Ye(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function dn(e){return ge(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Ev(e){let n=0;for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&n++;return n}var Lv=e=>{let n=typeof e;switch(n){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${n}`)}},pn=new Set(["string","number","symbol"]),To=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ve(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L(e,n,i){let o=new e._zod.constr(n??e._zod.def);return(!n||i?.parent)&&(o._zod.parent=e),o}function I(e){let n=e;if(!n)return{};if(typeof n=="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,typeof n.error=="string"?{...n,error:()=>n.error}:n}function Cv(e){let n;return new Proxy({},{get(i,o,t){return n??(n=e()),Reflect.get(n,o,t)},set(i,o,t,r){return n??(n=e()),Reflect.set(n,o,t,r)},has(i,o){return n??(n=e()),Reflect.has(n,o)},deleteProperty(i,o){return n??(n=e()),Reflect.deleteProperty(n,o)},ownKeys(i){return n??(n=e()),Reflect.ownKeys(n)},getOwnPropertyDescriptor(i,o){return n??(n=e()),Reflect.getOwnPropertyDescriptor(n,o)},defineProperty(i,o,t){return n??(n=e()),Reflect.defineProperty(n,o,t)}})}function _(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Eo(e){return Object.keys(e).filter(n=>e[n]._zod.optin!==void 0&&e[n]._zod.optout==="optional")}var mn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},fn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Zv(e,n){let i=e._zod.def,o=i.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let r={};return qe(r,e,gr(e,n)),L(e,$e(i,{shape:r,checks:[]}))}function gr(e,n){let i=De(e),o=[];for(let t of Reflect.ownKeys(n)){if(!Object.getOwnPropertyDescriptor(i,t)?.enumerable)throw new Error(`Unrecognized key: "${String(t)}"`);n[t]&&o.push(t)}return o}function Rv(e,n){let i=e._zod.def,o=i.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let r=new Set(gr(e,n)),a={};return qe(a,e,Reflect.ownKeys(De(e)).filter(u=>!r.has(u))),L(e,$e(i,{shape:a,checks:[]}))}function Vv(e,n){if(!ge(n))throw new Error("Invalid input to extend: expected a plain object");let i=e._zod.def.checks;if(i&&i.length>0){let t=De(e);for(let r of Reflect.ownKeys(n))if(Object.getOwnPropertyDescriptor(t,r)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return L(e,$e(e._zod.def,{shape:$d(e,n)}))}function $d(e,n){let i={};return qe(i,e,Reflect.ownKeys(De(e))),Ov(i,n),i}function Mv(e,n){if(!ge(n))throw new Error("Invalid input to safeExtend: expected a plain object");return L(e,$e(e._zod.def,{shape:$d(e,n)}))}function Fv(e,n){if(!n?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let i={};qe(i,e,Reflect.ownKeys(De(e))),qe(i,n,Reflect.ownKeys(De(n)));let o=$e(e._zod.def,{shape:i,get catchall(){return n._zod.def.catchall},checks:n._zod.def.checks??[]});return L(e,o)}function Gv(e,n,i,o="partial"){let r=n._zod.def.checks;if(r&&r.length>0)throw new Error(`.${o}() cannot be used on object schemas containing refinements`);let u=i?new Set(gr(n,i)):void 0,s={};return qe(s,n,Reflect.ownKeys(De(n)),e&&((c,l)=>u&&!u.has(l)?c:new e({type:"optional",innerType:c}))),L(n,$e(n._zod.def,{shape:s,checks:[]}))}function Jv(e,n,i){let o=i?new Set(gr(n,i)):void 0,t={};return qe(t,n,Reflect.ownKeys(De(n)),(r,a)=>o&&!o.has(a)?r:new e({type:"nonoptional",innerType:r})),L(n,$e(n._zod.def,{shape:t}))}function ne(e,n=0){if(e.aborted===!0)return!0;for(let i=n;i{var o;return(o=i).path??(o.path=[]),i.path.unshift(e),i})}function _t(e){return typeof e=="string"?e:e?.message}function wt(e){let n=[];for(let i of e??[]){let o=i._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let t=o.maximum??o.length??o.size;t>=0&&n.push([t,i])}return n}function gn(e,n,i){var o;for(let t=n;tNumber.isNaN(Number.parseInt(n,10))).map(n=>n[1])}function yd(e){let n=atob(e),i=new Uint8Array(n.length);for(let o=0;on.toString(16).padStart(2,"0")).join("")}var Oo=class{constructor(...n){}};function Co(e,n){for(let i in n){let o=Object.getOwnPropertyDescriptor(n,i);o.get?Object.defineProperty(e,i,{...o,enumerable:!1}):Qv(e,i,o.value)}}function Le(e,n,i,o=!0){return Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:o,value:i}),i}function $n(e,n,i){return Le(e,n,i,!1)}function Yv(e,n){for(let i in e){let o=e[i];Object.defineProperty(n,i,{configurable:!0,enumerable:!0,get(){return Le(this,i,o(this))},set(t){Le(this,i,t)}})}return n}function Qv(e,n,i){Object.defineProperty(e,n,{configurable:!0,get(){return this==null?i:Le(this,n,i.bind(this))},set(o){Le(this,n,o)}})}function eh(e,n){let i=Object.getPrototypeOf(e);return n in i?void 0:i}var Do,Ee=!1,th={configurable:!0,get(){Ee=!0}};function T(e,n,i){let o=Object.getPrototypeOf(e._zod);if(n in o&&Do!==e._zod){Do=void 0;return}Do=e._zod,Object.defineProperty(o,n,{configurable:!0,get(){Object.defineProperty(this,n,th);let t=Ee;Ee=!1;try{let r=i(this);return Ee?delete this[n]:Object.defineProperty(this,n,{configurable:!0,writable:!0,value:r}),Ee=Ee||t,r}catch(r){throw delete this[n],Ee=Ee||t,r}},set(t){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:t})}})}function nh(e,n,i,o){let t=eh(e,n);t&&Object.defineProperty(t,n,{configurable:!0,get(){let r={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,n,r),r.value=i(this),Object.defineProperty(this,n,r),r.value},set(r){Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:o,value:r})}})}var vr="~constantCatch";function Zo(e){let n=()=>e;return n[vr]=!0,n}var bd,Vo=Object.freeze({status:"aborted"}),Ro={value:void 0,enumerable:!1},xd="captureStackTrace"in Error?Error:null;function rh(e){let n=xd;if(n){let i=n.stackTraceLimit;if(typeof i=="number"){try{n.stackTraceLimit=0}catch{return xd=null,new e}try{return new e}finally{n.stackTraceLimit=i}}}return new e}function f(e,n,i,o){let t={};function r(m){this.def=m,this.constr=d,this.traits=new Set}r.prototype=t;let a=i,u=a&&new WeakSet;function s(m,p){if(m._zod){if(m._zod.traits.has(e))return}else{Ro.value=new r(p);try{Object.defineProperty(m,"_zod",Ro)}finally{Ro.value=void 0}}if(m._zod.traits.add(e),n(m,p),u){let b=Object.getPrototypeOf(m),w=m._zod.constr.prototype,z=b;for(;z&&z!==w;)z=Object.getPrototypeOf(z);let $=z??b;u.has($)||(u.add($),Co($,a))}let v=d.prototype;for(let b in v)Object.prototype.hasOwnProperty.call(v,b)&&(b in m||(m[b]=v[b].bind(m)))}let c=o?.Parent??Object;class l extends c{}Object.defineProperty(l,"name",{value:e});function d(m){let p=o?.Parent?rh(l):this;s(p,m);let v=p._zod.deferred;if(v){for(let w of v)w();p._zod.deferred=void 0}let b=globalThis.__zod_globalConfig?.postProcessor;return b&&b(p),p}return Object.defineProperty(d,"init",{value:s}),Object.defineProperty(d,Symbol.hasInstance,{value:m=>o?.Parent&&m instanceof o.Parent?!0:m?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Mo=Symbol("zod_brand"),se=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ce=class extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`),this.name="ZodEncodeError"}};(bd=globalThis).__zod_globalConfig??(bd.__zod_globalConfig={});var q=globalThis.__zod_globalConfig;function G(e){return e&&Object.assign(q,e),q}function ih(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,xt,2)),e.message}function oh(e){this._zod.message=e}var ah={get:ih,set:oh,enumerable:!0,configurable:!0},Go={value:void 0,enumerable:!1},kd=new WeakSet([Object.prototype,Error.prototype]),Id=(e,n)=>{e.name="$ZodError",Go.value=n,Object.defineProperty(e,"issues",Go),Go.value=void 0,Object.defineProperty(e,"message",ah);let i=Object.getPrototypeOf(e);kd.has(i)||(kd.add(i),Object.defineProperty(i,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}}))},Jo=f("$ZodError",Id),le=f("$ZodError",Id,void 0,{Parent:Error});function uh(e,n,i){return Object.prototype.hasOwnProperty.call(e,n)||(n==="__proto__"?Object.defineProperty(e,n,{value:i(),writable:!0,enumerable:!0,configurable:!0}):e[n]=i()),e[n]}function yn(e,n=i=>i.message){let i={},o=[];for(let t of e.issues)t.path.length>0?uh(i,t.path[0],()=>[]).push(n(t)):o.push(n(t));return{formErrors:o,fieldErrors:i}}function _n(e,n=i=>i.message){let i={_errors:[]},o=(t,r=[])=>{for(let a of t.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(u=>o({issues:u},[...r,...a.path]));else if(a.code==="invalid_key")o({issues:a.issues},[...r,...a.path]);else if(a.code==="invalid_element")o({issues:a.issues},[...r,...a.path]);else{let u=[...r,...a.path];if(u.length===0)i._errors.push(n(a));else{let s=i,c=0;for(;ci.message){let i={errors:[]},o=(t,r=[])=>{var a;for(let u of t.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(s=>o({issues:s},[...r,...u.path]));else if(u.code==="invalid_key")o({issues:u.issues},[...r,...u.path]);else if(u.code==="invalid_element")o({issues:u.issues},[...r,...u.path]);else{let s=[...r,...u.path];if(s.length===0){i.errors.push(n(u));continue}let c=i,l=0;for(;ltypeof o=="object"?o.key:o);for(let o of i)typeof o=="number"?n.push(`[${o}]`):typeof o=="symbol"?n.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?n.push(`[${JSON.stringify(o)}]`):(n.length&&n.push("."),n.push(o));return n.join("")}function Ko(e){let n=[],i=[...e.issues].sort((o,t)=>(o.path??[]).length-(t.path??[]).length);for(let o of i)n.push(`✖ ${o.message}`),o.path?.length&&n.push(` → at ${wd(o.path)}`);return n.join(` -`)}function hr(e,n){return{callee:n?.callee??e,Err:n?.Err}}var zt=e=>{let n=(i,o,t,r)=>{let a=t?{...t,async:!1}:{async:!1},u=i._zod.run({value:o,issues:[]},a);if(u instanceof Promise)throw new se;if(u.issues.length){let s=new(r?.Err??e)(u.issues.map(c=>ce(c,a,G())));throw fr(s,r?.callee??n),s}return u.value};return n},$r=zt(le),Pt=e=>{let n=async(i,o,t,r)=>{let a=t?{...t,async:!0}:{async:!0},u=i._zod.run({value:o,issues:[]},a);if(u instanceof Promise&&(u=await u),u.issues.length){let s=new(r?.Err??e)(u.issues.map(c=>ce(c,a,G())));throw fr(s,r?.callee??n),s}return u.value};return n},yr=Pt(le),Dt=e=>(n,i,o)=>{let t=o?{...o,async:!1}:{async:!1},r=n._zod.run({value:i,issues:[]},t);if(r instanceof Promise)throw new se;return r.issues.length?Sd(e,r.issues,t):{success:!0,data:r.value}},sh=Dt(le);function Sd(e,n,i){let o;return{success:!1,get error(){return o||(o=new e(n.map(t=>ce(t,i,G()))),n=void 0,i=void 0),o},set error(t){o=t,n=void 0,i=void 0}}}var Nt=e=>async(n,i,o)=>{let t=o?{...o,async:!0}:{async:!0},r=n._zod.run({value:i,issues:[]},t);return r instanceof Promise&&(r=await r),r.issues.length?Sd(e,r.issues,t):{success:!0,data:r.value}},lh=Nt(le),dh=Symbol.for("zod.compile.invalid"),ph=Symbol.for("zod.compile.fallback"),bn=((e,n,i)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(n)!==dh)return!0;if(o.definite===!0&&i===void 0)return!1}return mh(e,n,i)});function mh(e,n,i){let o=i?{...i,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},t=e._zod.bag.fallbackRun,r;if(t?(o[ph]=!0,r=t({value:n,issues:[]},o)):r=e._zod.run({value:n,issues:[]},o),r instanceof Promise)throw new se;return r.issues.length===0}var xn=async(e,n,i)=>{let o=i?{...i,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},t=e._zod.run({value:n,issues:[]},o);return t instanceof Promise&&(t=await t),t.issues.length===0},_r=e=>{let n=zt(e),i=(o,t,r,a)=>{let u=r?{...r,direction:"backward"}:{direction:"backward"};return n(o,t,u,hr(i,a))};return i},fh=_r(le),br=e=>{let n=zt(e),i=(o,t,r,a)=>n(o,t,r,hr(i,a));return i},gh=br(le),xr=e=>{let n=Pt(e),i=async(o,t,r,a)=>{let u=r?{...r,direction:"backward"}:{direction:"backward"};return await n(o,t,u,hr(i,a))};return i},vh=xr(le),kr=e=>{let n=Pt(e),i=async(o,t,r,a)=>await n(o,t,r,hr(i,a));return i},hh=kr(le),Ir=e=>(n,i,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return Dt(e)(n,i,t)},$h=Ir(le),wr=e=>(n,i,o)=>Dt(e)(n,i,o),yh=wr(le),Sr=e=>async(n,i,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return Nt(e)(n,i,t)},_h=Sr(le),zr=e=>async(n,i,o)=>Nt(e)(n,i,o),bh=zr(le);var he={};Pe(he,{anyString:()=>_a,base64:()=>da,base64url:()=>pa,bigint:()=>xa,boolean:()=>ka,browserEmail:()=>Dh,cidrv4:()=>sa,cidrv6:()=>la,creditCard:()=>Pr,cuid:()=>Ho,cuid2:()=>Xo,currencyCode:()=>va,date:()=>ha,datetime:()=>ya,domain:()=>fa,duration:()=>na,e164:()=>ga,email:()=>ia,emoji:()=>oa,extendedDuration:()=>xh,guid:()=>ra,hex:()=>Pa,hostname:()=>ma,html5Email:()=>Sh,httpProtocol:()=>kn,iban:()=>Dr,idnEmail:()=>Ph,integer:()=>In,ipv4:()=>aa,ipv6:()=>ua,ksuid:()=>Qo,lowercase:()=>Sa,mac:()=>ca,md5_base64:()=>Ah,md5_base64url:()=>Uh,md5_hex:()=>jh,nanoid:()=>ea,nanoidOfLength:()=>ta,null:()=>Ia,number:()=>Oe,rfc5322Email:()=>zh,sha1_base64:()=>Eh,sha1_base64url:()=>Lh,sha1_hex:()=>Th,sha256_base64:()=>Zh,sha256_base64url:()=>Rh,sha256_hex:()=>Ch,sha384_base64:()=>Mh,sha384_base64url:()=>Fh,sha384_hex:()=>Vh,sha512_base64:()=>Jh,sha512_base64url:()=>Bh,sha512_hex:()=>Gh,string:()=>ba,time:()=>$a,ulid:()=>qo,undefined:()=>wa,unicodeEmail:()=>zd,uppercase:()=>za,uuid:()=>et,uuid4:()=>kh,uuid6:()=>Ih,uuid7:()=>wh,xid:()=>Yo});var Ho=/^[cC][0-9a-z]{6,}$/,Xo=/^[0-9a-z]+$/,qo=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Yo=/^[0-9a-vA-V]{20}$/,Qo=/^[A-Za-z0-9]{27}$/,ea=/^[a-zA-Z0-9_-]{21}$/;function ta(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var na=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,xh=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ra=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,et=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,kh=et(4),Ih=et(6),wh=et(7),ia=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Sh=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,zh=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,zd=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Ph=zd,Dh=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Nh="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function oa(){return new RegExp(Nh,"u")}var aa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ua=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ca=e=>{let n=ve(e??":");return new RegExp(`^(?:[0-9A-F]{2}${n}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${n}){5}[0-9a-f]{2}$`)},sa=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,la=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,da=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,pa=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ma=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,fa=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,kn=/^https?$/,ga=/^\+[1-9]\d{6,14}$/,Pr=/^\d(?:[ -]?\d){11,18}$/,va=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,Dr=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,Pd="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Oh(e){return new RegExp(`^${e}$`)}var ha=Oh(Pd);function Wo(e){let n="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${n}`:e.precision===0?`${n}:[0-5]\\d`:`${n}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${n}:[0-5]\\d(?:\\.\\d+)?`:`${n}(?::[0-5]\\d(?:\\.\\d+)?)?`}function $a(e){return new RegExp(`^${Wo(e)}$`)}function ya(e){let n=["Z"];e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${Wo({precision:e.precision,seconds:!0})}(?:${n.join("|")})`,o=e.local?`${i}|${Wo({precision:e.precision})}`:i;return new RegExp(`^${Pd}T(?:${o})$`)}var _a=/^[\s\S]{0,}$/,ba=e=>{let n=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},xa=/^-?\d+n?$/,In=/^-?\d+$/,Oe=/^-?\d+(?:\.\d+)?$/,ka=/^(?:true|false)$/i,Ia=/^null$/i;var wa=/^undefined$/i;var Sa=/^[^A-Z]*$/,za=/^[^a-z]*$/,Pa=/^[0-9a-fA-F]*$/;function wn(e,n){return new RegExp(`^[A-Za-z0-9+/]{${e}}${n}$`)}function Sn(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var jh=/^[0-9a-fA-F]{32}$/,Ah=wn(22,"=="),Uh=Sn(22),Th=/^[0-9a-fA-F]{40}$/,Eh=wn(27,"="),Lh=Sn(27),Ch=/^[0-9a-fA-F]{64}$/,Zh=wn(43,"="),Rh=Sn(43),Vh=/^[0-9a-fA-F]{96}$/,Mh=wn(64,""),Fh=Sn(64),Gh=/^[0-9a-fA-F]{128}$/,Jh=wn(86,"=="),Bh=Sn(86);var M=f("$ZodCheck",(e,n)=>{var i;e._zod??(e._zod={}),e._zod.def=n,(i=e._zod).onattach??(i.onattach=[])}),Da=e=>{let n=e.value;return!mr(n)&&n.size!==void 0},Na=e=>{let n=e.value;return!mr(n)&&n.length!==void 0},Nr={number:"number",bigint:"bigint",object:"date"},jr=f("$ZodCheckLessThan",(e,n)=>{M.init(e,n);let i=Nr[typeof n.value];e._zod.check=o=>{(n.inclusive?o.value<=n.value:o.value{M.init(e,n);let i=Nr[typeof n.value];e._zod.check=o=>{(n.inclusive?o.value>=n.value:o.value>n.value)||o.issues.push({origin:Nr[typeof o.value]??i,code:"too_small",minimum:typeof n.value=="object"?n.value.getTime():n.value,input:o.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),Oa=f("$ZodCheckMultipleOf",(e,n)=>{M.init(e,n),e._zod.check=i=>{if(typeof i.value!=typeof n.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof i.value=="bigint"?n.value!==BigInt(0)&&i.value%n.value===BigInt(0):ln(i.value,n.value)===0)||i.issues.push({origin:typeof i.value,code:"not_multiple_of",divisor:n.value,input:i.value,inst:e,continue:!n.abort})}}),ja=f("$ZodCheckNumberFormat",(e,n)=>{M.init(e,n),n.format=n.format||"float64";let i=n.format?.includes("int"),o=i?"int":"number",[t,r]=mn[n.format];e._zod.check=a=>{let u=a.value;if(i){if(!Number.isInteger(u)){a.issues.push({expected:o,format:n.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?a.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!n.abort}):a.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!n.abort});return}}ur&&a.issues.push({origin:"number",input:u,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!n.abort})}}),Aa=f("$ZodCheckBigIntFormat",(e,n)=>{M.init(e,n);let[i,o]=fn[n.format];e._zod.check=t=>{let r=t.value;ro&&t.issues.push({origin:"bigint",input:r,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!n.abort})}}),Ua=f("$ZodCheckMaxSize",(e,n)=>{var i;M.init(e,n),(i=e._zod.def).when??(i.when=Da),e._zod.check=o=>{let t=o.value;t.size<=n.maximum||o.issues.push({origin:vn(t),code:"too_big",maximum:n.maximum,inclusive:!0,input:t,inst:e,continue:!n.abort})}}),Ta=f("$ZodCheckMinSize",(e,n)=>{var i;M.init(e,n),(i=e._zod.def).when??(i.when=Da),e._zod.check=o=>{let t=o.value;t.size>=n.minimum||o.issues.push({origin:vn(t),code:"too_small",minimum:n.minimum,inclusive:!0,input:t,inst:e,continue:!n.abort})}}),Ea=f("$ZodCheckSizeEquals",(e,n)=>{var i;M.init(e,n),(i=e._zod.def).when??(i.when=Da),e._zod.check=o=>{let t=o.value,r=t.size;if(r===n.size)return;let a=r>n.size;o.issues.push({origin:vn(t),...a?{code:"too_big",maximum:n.size}:{code:"too_small",minimum:n.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!n.abort})}}),La=f("$ZodCheckMaxLength",(e,n)=>{var i;M.init(e,n),(i=e._zod.def).when??(i.when=Na),e._zod.check=o=>{let t=o.value,r=t.length;if((typeof t=="string"&&r>n.maximum?Qe(t):r)<=n.maximum)return;let u=hn(t);o.issues.push({origin:u,code:"too_big",maximum:n.maximum,inclusive:!0,input:t,inst:e,continue:!n.abort})}}),Ca=f("$ZodCheckMinLength",(e,n)=>{var i;M.init(e,n),(i=e._zod.def).when??(i.when=Na),e._zod.check=o=>{let t=o.value,r=t.length;if((typeof t=="string"&&r>=n.minimum&&r=n.minimum)return;let u=hn(t);o.issues.push({origin:u,code:"too_small",minimum:n.minimum,inclusive:!0,input:t,inst:e,continue:!n.abort})}}),Za=f("$ZodCheckLengthEquals",(e,n)=>{var i;M.init(e,n),(i=e._zod.def).when??(i.when=Na),e._zod.check=o=>{let t=o.value,r=t.length,a=typeof t=="string"&&r>=n.length&&r<=n.length*2?Qe(t):r;if(a===n.length)return;let u=hn(t),s=a>n.length;o.issues.push({origin:u,...s?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!n.abort})}}),Ot=f("$ZodCheckStringFormat",(e,n)=>{var i,o;M.init(e,n),n.pattern?(i=e._zod).check??(i.check=t=>{n.pattern.lastIndex=0,!n.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:n.format,input:t.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})}):(o=e._zod).check??(o.check=()=>{})}),Ra=f("$ZodCheckRegex",(e,n)=>{Ot.init(e,n),e._zod.check=i=>{n.pattern.lastIndex=0,!n.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}}),Va=f("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=Sa),Ot.init(e,n)}),Ma=f("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=za),Ot.init(e,n)}),Fa=f("$ZodCheckIncludes",(e,n)=>{M.init(e,n);let i=ve(n.includes),o=new RegExp(typeof n.position=="number"?`^.{${n.position},}${i}`:i);n.pattern=o,e._zod.check=t=>{t.value.includes(n.includes,n.position)||t.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:t.value,inst:e,continue:!n.abort})}}),Ga=f("$ZodCheckStartsWith",(e,n)=>{M.init(e,n);let i=new RegExp(`^${ve(n.prefix)}.*`);n.pattern??(n.pattern=i),e._zod.check=o=>{o.value.startsWith(n.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:o.value,inst:e,continue:!n.abort})}}),Ja=f("$ZodCheckEndsWith",(e,n)=>{M.init(e,n);let i=new RegExp(`.*${ve(n.suffix)}$`);n.pattern??(n.pattern=i),e._zod.check=o=>{o.value.endsWith(n.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:o.value,inst:e,continue:!n.abort})}});function Or(e,n,i){e.issues.length&&n.issues.push(...ue(i,e.issues))}var Ba=f("$ZodCheckProperty",(e,n)=>{M.init(e,n),e._zod.check=i=>{let o=n.schema._zod.run({value:i.value[n.property],issues:[]},{});if(o instanceof Promise)return o.then(t=>Or(t,i,n.property));Or(o,i,n.property)}}),Ka=f("$ZodCheckProperties",(e,n)=>{M.init(e,n),$n(e,Symbol.iterator,function*(){yield e});let i;e._zod.check=o=>{if(o.value==null){o.issues.push({expected:"object",code:"invalid_type",input:o.value,inst:e});return}i??(i=Reflect.ownKeys(n.shape).map(a=>[a,n.shape[a]]));let t=o.value,r;for(let[a,u]of i){let s=u._zod.run({value:t[a],issues:[]},{});s instanceof Promise?(r??(r=[]),r.push(s.then(c=>Or(c,o,a)))):Or(s,o,a)}if(r)return Promise.all(r).then(()=>{})}}),Wa=f("$ZodCheckMimeType",(e,n)=>{M.init(e,n);let i=new Set(n.mime);e._zod.check=o=>{i.has(o.value.type)||o.issues.push({code:"invalid_value",values:n.mime,input:o.value.type,inst:e,continue:!n.abort})}}),Ha=f("$ZodCheckOverwrite",(e,n)=>{M.init(e,n),e._zod.check=i=>{i.value=n.tx(i.value)}});var tt=class{constructor(n=[],i={}){this.content=[],this.indent=0,this.args=n,this.closed=i}indented(n){this.indent+=1;try{n(this)}finally{this.indent-=1}}write(n){if(typeof n=="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}let o=n.split(` +var Mv=Object.defineProperty;var Ne=(e,n)=>{for(var i in n)Mv(e,i,{get:n[i],enumerable:!0})};import{readFileSync as dk}from"node:fs";import{dirname as Zv,join as pk}from"node:path";var m={};Ne(m,{$brand:()=>Ko,$input:()=>yu,$output:()=>$u,INVALID:()=>ie,NEVER:()=>Jo,TimePrecision:()=>Tu,ZodAny:()=>$l,ZodArray:()=>xl,ZodBase64:()=>mo,ZodBase64URL:()=>fo,ZodBigInt:()=>an,ZodBigIntFormat:()=>ho,ZodBoolean:()=>on,ZodCIDRv4:()=>lo,ZodCIDRv6:()=>po,ZodCUID:()=>ro,ZodCUID2:()=>io,ZodCatch:()=>Fl,ZodCodec:()=>ar,ZodCompileAsyncError:()=>be,ZodCompileUnsupportedError:()=>L,ZodCreditCard:()=>ll,ZodCustom:()=>sr,ZodCustomStringFormat:()=>vt,ZodDate:()=>er,ZodDefault:()=>Ll,ZodDiscriminatedUnion:()=>Il,ZodE164:()=>go,ZodEmail:()=>Qi,ZodEmoji:()=>to,ZodEnum:()=>tn,ZodError:()=>ab,ZodExactOptional:()=>bo,ZodFile:()=>Ol,ZodFirstPartyTypeKind:()=>rd,ZodFunction:()=>Ql,ZodGUID:()=>eo,ZodIBAN:()=>dl,ZodIPv4:()=>uo,ZodIPv6:()=>co,ZodISODate:()=>Ke,ZodISODateTime:()=>Je,ZodISODuration:()=>We,ZodISOTime:()=>He,ZodInstanceOf:()=>nd,ZodIntersection:()=>Sl,ZodIssueCode:()=>cb,ZodJWT:()=>vo,ZodKSUID:()=>so,ZodLazy:()=>Xl,ZodLiteral:()=>Dl,ZodMAC:()=>cl,ZodMap:()=>Nl,ZodNaN:()=>Bl,ZodNanoID:()=>no,ZodNever:()=>_l,ZodNonOptional:()=>xo,ZodNull:()=>vl,ZodNullable:()=>Ul,ZodNumber:()=>rn,ZodNumberFormat:()=>ht,ZodObject:()=>nr,ZodOptional:()=>ir,ZodPipe:()=>or,ZodPrefault:()=>Rl,ZodPreprocess:()=>Jl,ZodPromise:()=>Yl,ZodReadonly:()=>Kl,ZodRealError:()=>pe,ZodRecord:()=>en,ZodSet:()=>Tl,ZodString:()=>nn,ZodStringFormat:()=>M,ZodSuccess:()=>Vl,ZodSymbol:()=>fl,ZodTemplateLiteral:()=>Wl,ZodTransform:()=>El,ZodTuple:()=>Pl,ZodType:()=>j,ZodULID:()=>oo,ZodURL:()=>Qn,ZodUUID:()=>ze,ZodUndefined:()=>gl,ZodUnion:()=>rr,ZodUnknown:()=>yl,ZodVoid:()=>bl,ZodXID:()=>ao,ZodXor:()=>kl,_ZodString:()=>Yi,_default:()=>Cl,_function:()=>rg,any:()=>Ef,array:()=>tr,base64:()=>ff,base64url:()=>gf,bigint:()=>Af,boolean:()=>ml,catch:()=>Gl,check:()=>ig,cidrv4:()=>pf,cidrv6:()=>mf,clone:()=>C,codec:()=>Qf,coerce:()=>od,compile:()=>ku,config:()=>B,core:()=>je,creditCard:()=>hf,cuid:()=>rf,cuid2:()=>of,currencyCode:()=>kf,custom:()=>og,date:()=>Uf,decode:()=>nl,decodeAsync:()=>il,deepPartial:()=>$g,describe:()=>ag,discriminatedUnion:()=>Vf,e164:()=>vf,email:()=>Km,emoji:()=>tf,encode:()=>tl,encodeAsync:()=>rl,endsWith:()=>Ft,enum:()=>yo,exactOptional:()=>jl,file:()=>Wf,flattenError:()=>xn,float32:()=>Sf,float64:()=>wf,formatError:()=>kn,fromJSONSchema:()=>vg,function:()=>rg,getDiscriminatedOption:()=>Js,getErrorMap:()=>db,globalRegistry:()=>ee,gt:()=>we,gte:()=>ge,guid:()=>Hm,hash:()=>If,hex:()=>xf,hostname:()=>bf,httpUrl:()=>ef,iban:()=>$f,includes:()=>Mt,input:()=>_g,instanceof:()=>ug,int:()=>Xi,int32:()=>Pf,int64:()=>Nf,intersection:()=>wl,invertCodec:()=>eg,ipv4:()=>cf,ipv6:()=>df,iso:()=>ur,json:()=>lg,jwt:()=>yf,keyof:()=>Lf,ksuid:()=>uf,lazy:()=>ql,length:()=>dt,literal:()=>Hf,locales:()=>Fn,looseObject:()=>Zf,looseRecord:()=>Gf,lowercase:()=>Rt,lt:()=>Se,lte:()=>fe,mac:()=>lf,map:()=>Bf,maxLength:()=>lt,maxSize:()=>Ve,memoizer:()=>Mn,meta:()=>sg,mime:()=>Bt,minLength:()=>Ee,minSize:()=>Pe,multipleOf:()=>Me,nan:()=>Yf,nanoid:()=>nf,nativeEnum:()=>Kf,negative:()=>Ri,never:()=>$o,nonnegative:()=>Mi,nonoptional:()=>Ml,nonpositive:()=>Zi,normalize:()=>Jt,null:()=>hl,nullable:()=>Yn,nullish:()=>Xf,number:()=>pl,object:()=>Cf,optional:()=>ft,output:()=>bg,overwrite:()=>xe,parse:()=>qc,parseAsync:()=>Yc,partialRecord:()=>Ff,pipe:()=>qi,positive:()=>Ci,prefault:()=>Zl,preprocess:()=>dg,prettifyError:()=>Yo,promise:()=>ng,properties:()=>Gt,property:()=>Vi,readonly:()=>Hl,record:()=>Al,refine:()=>ed,regex:()=>Ct,regexes:()=>$e,registry:()=>mi,safeDecode:()=>al,safeDecodeAsync:()=>ul,safeEncode:()=>ol,safeEncodeAsync:()=>sl,safeParse:()=>Qc,safeParseAsync:()=>el,set:()=>Jf,setErrorMap:()=>lb,size:()=>ct,slugify:()=>Xt,startsWith:()=>Vt,strictObject:()=>Rf,string:()=>qn,stringFormat:()=>_f,stringbool:()=>cg,success:()=>qf,superRefine:()=>td,symbol:()=>Df,templateLiteral:()=>tg,toJSONSchema:()=>Ji,toLowerCase:()=>Ht,toUpperCase:()=>Wt,toZod:()=>pn,transform:()=>_o,treeifyError:()=>qo,trim:()=>Kt,tuple:()=>zl,uint32:()=>zf,uint64:()=>Tf,ulid:()=>af,undefined:()=>Of,union:()=>sn,unknown:()=>mt,uppercase:()=>Zt,url:()=>Qm,util:()=>$,uuid:()=>Wm,uuidv4:()=>Xm,uuidv6:()=>qm,uuidv7:()=>Ym,validate:()=>In,validateAsync:()=>Sn,void:()=>jf,withParser:()=>fi,xid:()=>sf,xor:()=>Mf});var je={};Ne(je,{$ZodAny:()=>Ls,$ZodArray:()=>Fs,$ZodAsyncError:()=>le,$ZodBase64:()=>Ss,$ZodBase64URL:()=>ws,$ZodBigInt:()=>Qr,$ZodBigIntFormat:()=>Os,$ZodBoolean:()=>jn,$ZodCIDRv4:()=>ks,$ZodCIDRv6:()=>Is,$ZodCUID:()=>ds,$ZodCUID2:()=>ps,$ZodCatch:()=>uu,$ZodCheck:()=>F,$ZodCheckBigIntFormat:()=>Ca,$ZodCheckEndsWith:()=>Xa,$ZodCheckGreaterThan:()=>Lr,$ZodCheckIncludes:()=>Ha,$ZodCheckLengthEquals:()=>Ga,$ZodCheckLessThan:()=>Ur,$ZodCheckLowerCase:()=>Ja,$ZodCheckMaxLength:()=>Va,$ZodCheckMaxSize:()=>Ra,$ZodCheckMimeType:()=>Qa,$ZodCheckMinLength:()=>Fa,$ZodCheckMinSize:()=>Za,$ZodCheckMultipleOf:()=>Ua,$ZodCheckNumberFormat:()=>La,$ZodCheckOverwrite:()=>es,$ZodCheckProperties:()=>Ya,$ZodCheckProperty:()=>qa,$ZodCheckRegex:()=>Ba,$ZodCheckSizeEquals:()=>Ma,$ZodCheckStartsWith:()=>Wa,$ZodCheckStringFormat:()=>Ot,$ZodCheckUpperCase:()=>Ka,$ZodCodec:()=>Ln,$ZodCreditCard:()=>zs,$ZodCustom:()=>gu,$ZodCustomStringFormat:()=>Ts,$ZodCyclicError:()=>ai,$ZodDate:()=>Ms,$ZodDefault:()=>iu,$ZodDiscriminatedUnion:()=>Ks,$ZodE164:()=>Ps,$ZodEmail:()=>os,$ZodEmoji:()=>cs,$ZodEncodeError:()=>Re,$ZodEnum:()=>Ys,$ZodError:()=>Xo,$ZodExactOptional:()=>nu,$ZodFile:()=>eu,$ZodFunction:()=>mu,$ZodGUID:()=>rs,$ZodIBAN:()=>As,$ZodIPv4:()=>_s,$ZodIPv6:()=>bs,$ZodISODate:()=>hs,$ZodISODateTime:()=>vs,$ZodISODuration:()=>ys,$ZodISOTime:()=>$s,$ZodIntersection:()=>Hs,$ZodJWT:()=>Ns,$ZodKSUID:()=>gs,$ZodLazy:()=>Cn,$ZodLiteral:()=>Qs,$ZodMAC:()=>xs,$ZodMap:()=>Xs,$ZodNaN:()=>cu,$ZodNanoID:()=>ls,$ZodNever:()=>Rs,$ZodNonOptional:()=>au,$ZodNull:()=>Us,$ZodNullable:()=>ru,$ZodNumber:()=>Yr,$ZodNumberFormat:()=>Ds,$ZodObject:()=>rp,$ZodObjectJIT:()=>Gs,$ZodOptional:()=>ti,$ZodPipe:()=>ni,$ZodPrefault:()=>ou,$ZodPreprocess:()=>lu,$ZodPromise:()=>fu,$ZodReadonly:()=>du,$ZodRealError:()=>de,$ZodRecord:()=>Ws,$ZodRegistry:()=>pi,$ZodSet:()=>qs,$ZodString:()=>ot,$ZodStringFormat:()=>R,$ZodSuccess:()=>su,$ZodSymbol:()=>Es,$ZodTemplateLiteral:()=>pu,$ZodTransform:()=>tu,$ZodTuple:()=>ei,$ZodType:()=>E,$ZodULID:()=>ms,$ZodURL:()=>us,$ZodUUID:()=>is,$ZodUndefined:()=>js,$ZodUnion:()=>Un,$ZodUnknown:()=>Cs,$ZodVoid:()=>Zs,$ZodXID:()=>fs,$ZodXor:()=>Bs,$brand:()=>Ko,$constructor:()=>g,$input:()=>yu,$output:()=>$u,Doc:()=>it,INVALID:()=>ie,JSONSchema:()=>Gm,JSONSchemaGenerator:()=>Ki,NEVER:()=>Jo,TimePrecision:()=>Tu,URL_BAD_FORMAT:()=>as,URL_UNPARSEABLE:()=>Nn,ZodCompileAsyncError:()=>be,ZodCompileUnsupportedError:()=>L,_any:()=>Hu,_array:()=>tc,_base64:()=>Ei,_base64url:()=>ji,_bigint:()=>Mu,_boolean:()=>Ru,_catch:()=>H_,_check:()=>zm,_cidrv4:()=>Di,_cidrv6:()=>Oi,_coercedBigint:()=>Vu,_coercedBoolean:()=>Zu,_coercedDate:()=>Qu,_coercedNumber:()=>Ou,_coercedString:()=>Pu,_creditCard:()=>Au,_cuid:()=>Si,_cuid2:()=>wi,_custom:()=>rc,_date:()=>Yu,_decode:()=>Sr,_decodeAsync:()=>Pr,_default:()=>B_,_discriminatedUnion:()=>O_,_e164:()=>Ui,_email:()=>hi,_emoji:()=>ki,_encode:()=>Ir,_encodeAsync:()=>wr,_endsWith:()=>Ft,_enum:()=>R_,_file:()=>nc,_float32:()=>ju,_float64:()=>Uu,_gt:()=>we,_gte:()=>ge,_guid:()=>$i,_iban:()=>Nu,_includes:()=>Mt,_int:()=>Eu,_int32:()=>Lu,_int64:()=>Fu,_intersection:()=>E_,_ipv4:()=>Ni,_ipv6:()=>Ti,_isoDate:()=>Jn,_isoDateTime:()=>Bn,_isoDuration:()=>Hn,_isoTime:()=>Kn,_jwt:()=>Li,_ksuid:()=>Ai,_lazy:()=>Y_,_length:()=>dt,_literal:()=>M_,_lowercase:()=>Rt,_lt:()=>Se,_lte:()=>fe,_mac:()=>zu,_map:()=>L_,_max:()=>fe,_maxLength:()=>lt,_maxSize:()=>Ve,_mime:()=>Bt,_min:()=>ge,_minLength:()=>Ee,_minSize:()=>Pe,_multipleOf:()=>Me,_nan:()=>ec,_nanoid:()=>Ii,_nativeEnum:()=>Z_,_negative:()=>Ri,_never:()=>Xu,_nonnegative:()=>Mi,_nonoptional:()=>J_,_nonpositive:()=>Zi,_normalize:()=>Jt,_null:()=>Ku,_nullable:()=>G_,_number:()=>Du,_optional:()=>F_,_overwrite:()=>xe,_parse:()=>At,_parseAsync:()=>Nt,_pipe:()=>W_,_positive:()=>Ci,_promise:()=>Q_,_properties:()=>Gt,_property:()=>Vi,_readonly:()=>X_,_record:()=>U_,_refine:()=>ic,_regex:()=>Ct,_safeDecode:()=>Ar,_safeDecodeAsync:()=>Tr,_safeEncode:()=>zr,_safeEncodeAsync:()=>Nr,_safeParse:()=>Tt,_safeParseAsync:()=>Dt,_set:()=>C_,_size:()=>ct,_slugify:()=>Xt,_startsWith:()=>Vt,_string:()=>wu,_stringFormat:()=>pt,_stringbool:()=>uc,_success:()=>K_,_superRefine:()=>oc,_symbol:()=>Bu,_templateLiteral:()=>q_,_toLowerCase:()=>Ht,_toUpperCase:()=>Wt,_transform:()=>V_,_trim:()=>Kt,_tuple:()=>j_,_uint32:()=>Cu,_uint64:()=>Gu,_ulid:()=>Pi,_undefined:()=>Ju,_union:()=>T_,_unknown:()=>Wu,_uppercase:()=>Zt,_url:()=>Gn,_uuid:()=>yi,_uuidv4:()=>_i,_uuidv6:()=>bi,_uuidv7:()=>xi,_void:()=>qu,_xid:()=>zi,_xor:()=>D_,base64Charset:()=>Kr,base64urlCharset:()=>En,canParseURL:()=>ss,clone:()=>C,compile:()=>ku,compileFn:()=>gi,config:()=>B,createStandardJSONSchemaMethod:()=>qt,createToJSONSchemaMethod:()=>lc,decode:()=>Dh,decodeAsync:()=>Eh,describe:()=>ac,encode:()=>Th,encodeAsync:()=>Oh,extractDefs:()=>Ge,finalize:()=>Be,flattenError:()=>xn,formatError:()=>kn,getDiscriminatedOption:()=>Js,globalConfig:()=>Y,globalRegistry:()=>ee,handleUnrepresentable:()=>H,initializeContext:()=>Fe,isBackEdge:()=>ui,isRecursiveSchema:()=>si,isValidBase64:()=>On,isValidBase64URL:()=>Hr,isValidCIDRv6:()=>Jr,isValidCreditCard:()=>Wr,isValidIBAN:()=>Xr,isValidIPv6:()=>Dn,isValidJWT:()=>qr,locales:()=>Fn,memoizer:()=>Mn,mergeValues:()=>Et,meta:()=>sc,parse:()=>xr,parseAsync:()=>kr,parseURLObject:()=>ep,prettifyError:()=>Yo,process:()=>Z,processSchema:()=>Z,regexes:()=>$e,registry:()=>mi,safeDecode:()=>Uh,safeDecodeAsync:()=>Ch,safeEncode:()=>jh,safeEncodeAsync:()=>Lh,safeParse:()=>wh,safeParseAsync:()=>Ph,standardProps:()=>Vr,stripTabAndNewline:()=>Tn,toDotPath:()=>Od,toJSONSchema:()=>Ji,toZod:()=>pn,treeifyError:()=>qo,urlHostnameOk:()=>Gr,urlProtocolOk:()=>Br,util:()=>$,validate:()=>In,validateAsync:()=>Sn,validateURL:()=>Fr,version:()=>ts,withParser:()=>fi});var $={};Ne($,{BIGINT_FORMAT_RANGES:()=>hn,CONSTANT_CATCH:()=>_r,Class:()=>Uo,NUMBER_FORMAT_RANGES:()=>vn,aborted:()=>re,allowsEval:()=>Ro,assert:()=>Jv,assertEqual:()=>Vv,assertIs:()=>Gv,assertNever:()=>Bv,assertNotEqual:()=>Fv,assignProp:()=>Q,attachSchema:()=>$n,base64ToUint8Array:()=>Pd,base64urlToUint8Array:()=>dh,cached:()=>St,captureStackTrace:()=>$r,cleanEnum:()=>lh,cleanRegex:()=>De,clone:()=>C,cloneDef:()=>Wv,codePointLength:()=>nt,constantCatch:()=>Go,createTransparentProxy:()=>th,defineLazy:()=>Lo,defineLazyInternal:()=>U,derived:()=>gh,esc:()=>ne,escapeRegex:()=>he,explicitlyAborted:()=>Vo,extend:()=>ih,finalizeIssue:()=>ce,floatSafeRemainder:()=>mn,getElementAtPath:()=>Xv,getEnumValues:()=>kt,getLengthableOrigin:()=>_n,getParsedType:()=>eh,getSizableOrigin:()=>yn,hexToUint8Array:()=>mh,hide:()=>bn,installLazyProp:()=>yh,isObject:()=>tt,isPlainObject:()=>ve,issue:()=>zt,joinValues:()=>v,jsonStringifyReplacer:()=>It,members:()=>Fo,merge:()=>ah,mergeDefs:()=>_e,normalizeParams:()=>I,nullish:()=>hr,numKeys:()=>Qv,objectClone:()=>Kv,omit:()=>rh,optionalKeys:()=>Mo,own:()=>Ce,parsedType:()=>b,partial:()=>sh,pick:()=>nh,prefixIssues:()=>ue,primitiveTypes:()=>Zo,promiseAllObject:()=>qv,propertyKeyTypes:()=>gn,randomString:()=>Yv,rawShape:()=>wt,required:()=>uh,safeExtend:()=>oh,shallowClone:()=>fn,sizeCaps:()=>Pt,slugify:()=>Co,stringifyPrimitive:()=>_,toZod:()=>pn,uint8ArrayToBase64:()=>zd,uint8ArrayToBase64url:()=>ph,uint8ArrayToHex:()=>fh,unwrapMessage:()=>xt});function Vv(e){return e}function Fv(e){return e}function pn(){return e=>e}function Gv(e){}function Bv(e){throw new Error("Unexpected value in exhaustive check")}function Jv(e){}function kt(e){let n=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,t])=>n.indexOf(+o)===-1).map(([o,t])=>t)}function v(e,n="|"){return e.map(i=>_(i)).join(n)}function It(e,n){return typeof n=="bigint"?n.toString():n}var jo=class{constructor(n){this._getter=n,this._value=void 0}get value(){let n=this._getter;return n!==void 0&&(this._value=n(),this._getter=void 0),this._value}};function St(e){return new jo(e)}function hr(e){return e==null}function De(e){let n=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(n,i)}function mn(e,n){let i=e/n,o=Math.round(i),t=4*Number.EPSILON*Math.max(Math.abs(i),1);return Math.abs(i-o){let s=n._zod.def.shape[r];return o?o(s,r):s}):Sd(e,r,o?o(a.value,r):a.value))}}function Hv(e,n){for(let i of Reflect.ownKeys(n)){let o=Object.getOwnPropertyDescriptor(n,i);o.enumerable&&(o.get?Id(e,i,()=>n[i]):Sd(e,i,o.value))}}function _e(...e){let n={};for(let i of e){let o=Object.getOwnPropertyDescriptors(i);Object.assign(n,o)}return Object.defineProperties({},n)}function Wv(e){return _e(e._zod.def)}function Xv(e,n){return n?n.reduce((i,o)=>i?.[o],e):e}function qv(e){let n=Object.keys(e),i=n.map(o=>e[o]);return Promise.all(i).then(o=>{let t={};for(let r=0;r{};function tt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Ro=St(()=>{if(Y.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ve(e){if(tt(e)===!1)return!1;let n=e.constructor;if(n===void 0||typeof n!="function")return!0;let i=n.prototype;return!(tt(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function fn(e){return ve(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Qv(e){let n=0;for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&n++;return n}var eh=e=>{let n=typeof e;switch(n){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${n}`)}},gn=new Set(["string","number","symbol"]),Zo=new Set(["string","number","bigint","boolean","symbol","undefined"]);function he(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function C(e,n,i){let o=new e._zod.constr(n??e._zod.def);return(!n||i?.parent)&&(o._zod.parent=e),o}function I(e){let n=e;if(!n)return{};if(typeof n=="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,typeof n.error=="string"?{...n,error:()=>n.error}:n}function th(e){let n;return new Proxy({},{get(i,o,t){return n??(n=e()),Reflect.get(n,o,t)},set(i,o,t,r){return n??(n=e()),Reflect.set(n,o,t,r)},has(i,o){return n??(n=e()),Reflect.has(n,o)},deleteProperty(i,o){return n??(n=e()),Reflect.deleteProperty(n,o)},ownKeys(i){return n??(n=e()),Reflect.ownKeys(n)},getOwnPropertyDescriptor(i,o){return n??(n=e()),Reflect.getOwnPropertyDescriptor(n,o)},defineProperty(i,o,t){return n??(n=e()),Reflect.defineProperty(n,o,t)}})}function _(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Mo(e){return Object.keys(e).filter(n=>e[n]._zod.optin!==void 0&&e[n]._zod.optout==="optional")}var vn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},hn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function nh(e,n){let i=e._zod.def,o=i.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let r={};return et(r,e,yr(e,n)),C(e,_e(i,{shape:r,checks:[]}))}function yr(e,n){let i=Te(e),o=[];for(let t of Reflect.ownKeys(n)){if(!Object.getOwnPropertyDescriptor(i,t)?.enumerable)throw new Error(`Unrecognized key: "${String(t)}"`);n[t]&&o.push(t)}return o}function rh(e,n){let i=e._zod.def,o=i.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let r=new Set(yr(e,n)),a={};return et(a,e,Reflect.ownKeys(Te(e)).filter(s=>!r.has(s))),C(e,_e(i,{shape:a,checks:[]}))}function ih(e,n){if(!ve(n))throw new Error("Invalid input to extend: expected a plain object");let i=e._zod.def.checks;if(i&&i.length>0){let t=Te(e);for(let r of Reflect.ownKeys(n))if(Object.getOwnPropertyDescriptor(t,r)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return C(e,_e(e._zod.def,{shape:wd(e,n)}))}function wd(e,n){let i={};return et(i,e,Reflect.ownKeys(Te(e))),Hv(i,n),i}function oh(e,n){if(!ve(n))throw new Error("Invalid input to safeExtend: expected a plain object");return C(e,_e(e._zod.def,{shape:wd(e,n)}))}function ah(e,n){if(!n?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let i={};et(i,e,Reflect.ownKeys(Te(e))),et(i,n,Reflect.ownKeys(Te(n)));let o=_e(e._zod.def,{shape:i,get catchall(){return n._zod.def.catchall},checks:n._zod.def.checks??[]});return C(e,o)}function sh(e,n,i,o="partial"){let r=n._zod.def.checks;if(r&&r.length>0)throw new Error(`.${o}() cannot be used on object schemas containing refinements`);let s=i?new Set(yr(n,i)):void 0,u={};return et(u,n,Reflect.ownKeys(Te(n)),e&&((c,l)=>s&&!s.has(l)?c:new e({type:"optional",innerType:c}))),C(n,_e(n._zod.def,{shape:u,checks:[]}))}function uh(e,n,i){let o=i?new Set(yr(n,i)):void 0,t={};return et(t,n,Reflect.ownKeys(Te(n)),(r,a)=>o&&!o.has(a)?r:new e({type:"nonoptional",innerType:r})),C(n,_e(n._zod.def,{shape:t}))}function re(e,n=0){if(e.aborted===!0)return!0;for(let i=n;i{var o;return(o=i).path??(o.path=[]),i.path.unshift(e),i})}function xt(e){return typeof e=="string"?e:e?.message}function Pt(e){let n=[];for(let i of e??[]){let o=i._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let t=o.maximum??o.length??o.size;t>=0&&n.push([t,i])}return n}function $n(e,n,i){var o;for(let t=n;tNumber.isNaN(Number.parseInt(n,10))).map(n=>n[1])}function Pd(e){let n=atob(e),i=new Uint8Array(n.length);for(let o=0;on.toString(16).padStart(2,"0")).join("")}var Uo=class{constructor(...n){}};function Fo(e,n){for(let i in n){let o=Object.getOwnPropertyDescriptor(n,i);o.get?Object.defineProperty(e,i,{...o,enumerable:!1}):vh(e,i,o.value)}}function Ce(e,n,i,o=!0){return Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:o,value:i}),i}function bn(e,n,i){return Ce(e,n,i,!1)}function gh(e,n){for(let i in e){let o=e[i];Object.defineProperty(n,i,{configurable:!0,enumerable:!0,get(){return Ce(this,i,o(this))},set(t){Ce(this,i,t)}})}return n}function vh(e,n,i){Object.defineProperty(e,n,{configurable:!0,get(){return this==null?i:Ce(this,n,i.bind(this))},set(o){Ce(this,n,o)}})}function hh(e,n){let i=Object.getPrototypeOf(e);return n in i?void 0:i}var Eo,Le=!1,$h={configurable:!0,get(){Le=!0}};function U(e,n,i){let o=Object.getPrototypeOf(e._zod);if(n in o&&Eo!==e._zod){Eo=void 0;return}Eo=e._zod,Object.defineProperty(o,n,{configurable:!0,get(){Object.defineProperty(this,n,$h);let t=Le;Le=!1;try{let r=i(this);return Le?delete this[n]:Object.defineProperty(this,n,{configurable:!0,writable:!0,value:r}),Le=Le||t,r}catch(r){throw delete this[n],Le=Le||t,r}},set(t){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:t})}})}function yh(e,n,i,o){let t=hh(e,n);t&&Object.defineProperty(t,n,{configurable:!0,get(){let r={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,n,r),r.value=i(this),Object.defineProperty(this,n,r),r.value},set(r){Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:o,value:r})}})}var _r="~constantCatch";function Go(e){let n=()=>e;return n[_r]=!0,n}var Ad,Jo=Object.freeze({status:"aborted"}),Bo={value:void 0,enumerable:!1},Nd="captureStackTrace"in Error?Error:null;function _h(e){let n=Nd;if(n){let i=n.stackTraceLimit;if(typeof i=="number"){try{n.stackTraceLimit=0}catch{return Nd=null,new e}try{return new e}finally{n.stackTraceLimit=i}}}return new e}function g(e,n,i,o){let t={};function r(p){this.def=p,this.constr=d,this.traits=new Set}r.prototype=t;let a=i,s=a&&new WeakSet;function u(p,f){if(p._zod){if(p._zod.traits.has(e))return}else{Bo.value=new r(f);try{Object.defineProperty(p,"_zod",Bo)}finally{Bo.value=void 0}}if(p._zod.traits.add(e),n(p,f),s){let y=Object.getPrototypeOf(p),k=p._zod.constr.prototype,P=y;for(;P&&P!==k;)P=Object.getPrototypeOf(P);let S=P??y;s.has(S)||(s.add(S),Fo(S,a))}let h=d.prototype;for(let y in h)Object.prototype.hasOwnProperty.call(h,y)&&(y in p||(p[y]=h[y].bind(p)))}let c=o?.Parent??Object;class l extends c{}Object.defineProperty(l,"name",{value:e});function d(p){let f=o?.Parent?_h(l):this;u(f,p);let h=f._zod.deferred;if(h){for(let k of h)k();f._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;return y&&y(f),f}return Object.defineProperty(d,"init",{value:u}),Object.defineProperty(d,Symbol.hasInstance,{value:p=>o?.Parent&&p instanceof o.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Ko=Symbol("zod_brand"),le=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Re=class extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`),this.name="ZodEncodeError"}};(Ad=globalThis).__zod_globalConfig??(Ad.__zod_globalConfig={});var Y=globalThis.__zod_globalConfig;function B(e){return e&&Object.assign(Y,e),Y}function bh(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,It,2)),e.message}function xh(e){this._zod.message=e}var kh={get:bh,set:xh,enumerable:!0,configurable:!0},Wo={value:void 0,enumerable:!1},Td=new WeakSet([Object.prototype,Error.prototype]),Dd=(e,n)=>{e.name="$ZodError",Wo.value=n,Object.defineProperty(e,"issues",Wo),Wo.value=void 0,Object.defineProperty(e,"message",kh);let i=Object.getPrototypeOf(e);Td.has(i)||(Td.add(i),Object.defineProperty(i,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}}))},Xo=g("$ZodError",Dd),de=g("$ZodError",Dd,void 0,{Parent:Error});function Ih(e,n,i){return Object.prototype.hasOwnProperty.call(e,n)||(n==="__proto__"?Object.defineProperty(e,n,{value:i(),writable:!0,enumerable:!0,configurable:!0}):e[n]=i()),e[n]}function xn(e,n=i=>i.message){let i={},o=[];for(let t of e.issues)t.path.length>0?Ih(i,t.path[0],()=>[]).push(n(t)):o.push(n(t));return{formErrors:o,fieldErrors:i}}function kn(e,n=i=>i.message){let i={_errors:[]},o=(t,r=[])=>{for(let a of t.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>o({issues:s},[...r,...a.path]));else if(a.code==="invalid_key")o({issues:a.issues},[...r,...a.path]);else if(a.code==="invalid_element")o({issues:a.issues},[...r,...a.path]);else{let s=[...r,...a.path];if(s.length===0)i._errors.push(n(a));else{let u=i,c=0;for(;ci.message){let i={errors:[]},o=(t,r=[])=>{var a;for(let s of t.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(u=>o({issues:u},[...r,...s.path]));else if(s.code==="invalid_key")o({issues:s.issues},[...r,...s.path]);else if(s.code==="invalid_element")o({issues:s.issues},[...r,...s.path]);else{let u=[...r,...s.path];if(u.length===0){i.errors.push(n(s));continue}let c=i,l=0;for(;ltypeof o=="object"?o.key:o);for(let o of i)typeof o=="number"?n.push(`[${o}]`):typeof o=="symbol"?n.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?n.push(`[${JSON.stringify(o)}]`):(n.length&&n.push("."),n.push(o));return n.join("")}function Yo(e){let n=[],i=[...e.issues].sort((o,t)=>(o.path??[]).length-(t.path??[]).length);for(let o of i)n.push(`✖ ${o.message}`),o.path?.length&&n.push(` → at ${Od(o.path)}`);return n.join(` +`)}function br(e,n){return{callee:n?.callee??e,Err:n?.Err}}var At=e=>{let n=(i,o,t,r)=>{let a=t?{...t,async:!1}:{async:!1},s=i._zod.run({value:o,issues:[]},a);if(s instanceof Promise)throw new le;if(s.issues.length){let u=new(r?.Err??e)(s.issues.map(c=>ce(c,a,B())));throw $r(u,r?.callee??n),u}return s.value};return n},xr=At(de),Nt=e=>{let n=async(i,o,t,r)=>{let a=t?{...t,async:!0}:{async:!0},s=i._zod.run({value:o,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){let u=new(r?.Err??e)(s.issues.map(c=>ce(c,a,B())));throw $r(u,r?.callee??n),u}return s.value};return n},kr=Nt(de),Tt=e=>(n,i,o)=>{let t=o?{...o,async:!1}:{async:!1},r=n._zod.run({value:i,issues:[]},t);if(r instanceof Promise)throw new le;return r.issues.length?Ed(e,r.issues,t):{success:!0,data:r.value}},wh=Tt(de);function Ed(e,n,i){let o;return{success:!1,get error(){return o||(o=new e(n.map(t=>ce(t,i,B()))),n=void 0,i=void 0),o},set error(t){o=t,n=void 0,i=void 0}}}var Dt=e=>async(n,i,o)=>{let t=o?{...o,async:!0}:{async:!0},r=n._zod.run({value:i,issues:[]},t);return r instanceof Promise&&(r=await r),r.issues.length?Ed(e,r.issues,t):{success:!0,data:r.value}},Ph=Dt(de),zh=Symbol.for("zod.compile.invalid"),Ah=Symbol.for("zod.compile.fallback"),In=((e,n,i)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(n)!==zh)return!0;if(o.definite===!0&&i===void 0)return!1}return Nh(e,n,i)});function Nh(e,n,i){let o=i?{...i,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},t=e._zod.bag.fallbackRun,r;if(t?(o[Ah]=!0,r=t({value:n,issues:[]},o)):r=e._zod.run({value:n,issues:[]},o),r instanceof Promise)throw new le;return r.issues.length===0}var Sn=async(e,n,i)=>{let o=i?{...i,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},t=e._zod.run({value:n,issues:[]},o);return t instanceof Promise&&(t=await t),t.issues.length===0},Ir=e=>{let n=At(e),i=(o,t,r,a)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return n(o,t,s,br(i,a))};return i},Th=Ir(de),Sr=e=>{let n=At(e),i=(o,t,r,a)=>n(o,t,r,br(i,a));return i},Dh=Sr(de),wr=e=>{let n=Nt(e),i=async(o,t,r,a)=>{let s=r?{...r,direction:"backward"}:{direction:"backward"};return await n(o,t,s,br(i,a))};return i},Oh=wr(de),Pr=e=>{let n=Nt(e),i=async(o,t,r,a)=>await n(o,t,r,br(i,a));return i},Eh=Pr(de),zr=e=>(n,i,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return Tt(e)(n,i,t)},jh=zr(de),Ar=e=>(n,i,o)=>Tt(e)(n,i,o),Uh=Ar(de),Nr=e=>async(n,i,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return Dt(e)(n,i,t)},Lh=Nr(de),Tr=e=>async(n,i,o)=>Dt(e)(n,i,o),Ch=Tr(de);var $e={};Ne($e,{anyString:()=>Sa,base64:()=>va,base64url:()=>ha,bigint:()=>Pa,boolean:()=>za,browserEmail:()=>Jh,cidrv4:()=>fa,cidrv6:()=>ga,creditCard:()=>Dr,cuid:()=>ea,cuid2:()=>ta,currencyCode:()=>ba,date:()=>xa,datetime:()=>Ia,domain:()=>ya,duration:()=>sa,e164:()=>_a,email:()=>ca,emoji:()=>la,extendedDuration:()=>Rh,guid:()=>ua,hex:()=>Oa,hostname:()=>$a,html5Email:()=>Fh,httpProtocol:()=>wn,iban:()=>Or,idnEmail:()=>Bh,integer:()=>Pn,ipv4:()=>da,ipv6:()=>pa,ksuid:()=>ia,lowercase:()=>Ta,mac:()=>ma,md5_base64:()=>Xh,md5_base64url:()=>qh,md5_hex:()=>Wh,nanoid:()=>oa,nanoidOfLength:()=>aa,null:()=>Aa,number:()=>Oe,rfc5322Email:()=>Gh,sha1_base64:()=>Qh,sha1_base64url:()=>e$,sha1_hex:()=>Yh,sha256_base64:()=>n$,sha256_base64url:()=>r$,sha256_hex:()=>t$,sha384_base64:()=>o$,sha384_base64url:()=>a$,sha384_hex:()=>i$,sha512_base64:()=>u$,sha512_base64url:()=>c$,sha512_hex:()=>s$,string:()=>wa,time:()=>ka,ulid:()=>na,undefined:()=>Na,unicodeEmail:()=>jd,uppercase:()=>Da,uuid:()=>rt,uuid4:()=>Zh,uuid6:()=>Mh,uuid7:()=>Vh,xid:()=>ra});var ea=/^[cC][0-9a-z]{6,}$/,ta=/^[0-9a-z]+$/,na=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ra=/^[0-9a-vA-V]{20}$/,ia=/^[A-Za-z0-9]{27}$/,oa=/^[a-zA-Z0-9_-]{21}$/;function aa(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var sa=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rh=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ua=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,rt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Zh=rt(4),Mh=rt(6),Vh=rt(7),ca=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Fh=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Gh=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,jd=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Bh=jd,Jh=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Kh="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function la(){return new RegExp(Kh,"u")}var da=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,pa=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ma=e=>{let n=he(e??":");return new RegExp(`^(?:[0-9A-F]{2}${n}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${n}){5}[0-9a-f]{2}$`)},fa=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ga=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,va=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ha=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,$a=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,ya=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,wn=/^https?$/,_a=/^\+[1-9]\d{6,14}$/,Dr=/^\d(?:[ -]?\d){11,18}$/,ba=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,Or=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,Ud="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function Hh(e){return new RegExp(`^${e}$`)}var xa=Hh(Ud);function Qo(e){let n="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${n}`:e.precision===0?`${n}:[0-5]\\d`:`${n}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${n}:[0-5]\\d(?:\\.\\d+)?`:`${n}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ka(e){return new RegExp(`^${Qo(e)}$`)}function Ia(e){let n=["Z"];e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${Qo({precision:e.precision,seconds:!0})}(?:${n.join("|")})`,o=e.local?`${i}|${Qo({precision:e.precision})}`:i;return new RegExp(`^${Ud}T(?:${o})$`)}var Sa=/^[\s\S]{0,}$/,wa=e=>{let n=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},Pa=/^-?\d+n?$/,Pn=/^-?\d+$/,Oe=/^-?\d+(?:\.\d+)?$/,za=/^(?:true|false)$/i,Aa=/^null$/i;var Na=/^undefined$/i;var Ta=/^[^A-Z]*$/,Da=/^[^a-z]*$/,Oa=/^[0-9a-fA-F]*$/;function zn(e,n){return new RegExp(`^[A-Za-z0-9+/]{${e}}${n}$`)}function An(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Wh=/^[0-9a-fA-F]{32}$/,Xh=zn(22,"=="),qh=An(22),Yh=/^[0-9a-fA-F]{40}$/,Qh=zn(27,"="),e$=An(27),t$=/^[0-9a-fA-F]{64}$/,n$=zn(43,"="),r$=An(43),i$=/^[0-9a-fA-F]{96}$/,o$=zn(64,""),a$=An(64),s$=/^[0-9a-fA-F]{128}$/,u$=zn(86,"=="),c$=An(86);var F=g("$ZodCheck",(e,n)=>{var i;e._zod??(e._zod={}),e._zod.def=n,(i=e._zod).onattach??(i.onattach=[])}),Ea=e=>{let n=e.value;return!hr(n)&&n.size!==void 0},ja=e=>{let n=e.value;return!hr(n)&&n.length!==void 0},Er={number:"number",bigint:"bigint",object:"date"},Ur=g("$ZodCheckLessThan",(e,n)=>{F.init(e,n);let i=Er[typeof n.value];e._zod.check=o=>{(n.inclusive?o.value<=n.value:o.value{F.init(e,n);let i=Er[typeof n.value];e._zod.check=o=>{(n.inclusive?o.value>=n.value:o.value>n.value)||o.issues.push({origin:Er[typeof o.value]??i,code:"too_small",minimum:typeof n.value=="object"?n.value.getTime():n.value,input:o.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),Ua=g("$ZodCheckMultipleOf",(e,n)=>{F.init(e,n),e._zod.check=i=>{if(typeof i.value!=typeof n.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof i.value=="bigint"?n.value!==BigInt(0)&&i.value%n.value===BigInt(0):mn(i.value,n.value)===0)||i.issues.push({origin:typeof i.value,code:"not_multiple_of",divisor:n.value,input:i.value,inst:e,continue:!n.abort})}}),La=g("$ZodCheckNumberFormat",(e,n)=>{F.init(e,n),n.format=n.format||"float64";let i=n.format?.includes("int"),o=i?"int":"number",[t,r]=vn[n.format];e._zod.check=a=>{let s=a.value;if(i){if(!Number.isInteger(s)){a.issues.push({expected:o,format:n.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!n.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!n.abort});return}}sr&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!n.abort})}}),Ca=g("$ZodCheckBigIntFormat",(e,n)=>{F.init(e,n);let[i,o]=hn[n.format];e._zod.check=t=>{let r=t.value;ro&&t.issues.push({origin:"bigint",input:r,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!n.abort})}}),Ra=g("$ZodCheckMaxSize",(e,n)=>{var i;F.init(e,n),(i=e._zod.def).when??(i.when=Ea),e._zod.check=o=>{let t=o.value;t.size<=n.maximum||o.issues.push({origin:yn(t),code:"too_big",maximum:n.maximum,inclusive:!0,input:t,inst:e,continue:!n.abort})}}),Za=g("$ZodCheckMinSize",(e,n)=>{var i;F.init(e,n),(i=e._zod.def).when??(i.when=Ea),e._zod.check=o=>{let t=o.value;t.size>=n.minimum||o.issues.push({origin:yn(t),code:"too_small",minimum:n.minimum,inclusive:!0,input:t,inst:e,continue:!n.abort})}}),Ma=g("$ZodCheckSizeEquals",(e,n)=>{var i;F.init(e,n),(i=e._zod.def).when??(i.when=Ea),e._zod.check=o=>{let t=o.value,r=t.size;if(r===n.size)return;let a=r>n.size;o.issues.push({origin:yn(t),...a?{code:"too_big",maximum:n.size}:{code:"too_small",minimum:n.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!n.abort})}}),Va=g("$ZodCheckMaxLength",(e,n)=>{var i;F.init(e,n),(i=e._zod.def).when??(i.when=ja),e._zod.check=o=>{let t=o.value,r=t.length;if((typeof t=="string"&&r>n.maximum?nt(t):r)<=n.maximum)return;let s=_n(t);o.issues.push({origin:s,code:"too_big",maximum:n.maximum,inclusive:!0,input:t,inst:e,continue:!n.abort})}}),Fa=g("$ZodCheckMinLength",(e,n)=>{var i;F.init(e,n),(i=e._zod.def).when??(i.when=ja),e._zod.check=o=>{let t=o.value,r=t.length;if((typeof t=="string"&&r>=n.minimum&&r=n.minimum)return;let s=_n(t);o.issues.push({origin:s,code:"too_small",minimum:n.minimum,inclusive:!0,input:t,inst:e,continue:!n.abort})}}),Ga=g("$ZodCheckLengthEquals",(e,n)=>{var i;F.init(e,n),(i=e._zod.def).when??(i.when=ja),e._zod.check=o=>{let t=o.value,r=t.length,a=typeof t=="string"&&r>=n.length&&r<=n.length*2?nt(t):r;if(a===n.length)return;let s=_n(t),u=a>n.length;o.issues.push({origin:s,...u?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!n.abort})}}),Ot=g("$ZodCheckStringFormat",(e,n)=>{var i,o;F.init(e,n),n.pattern?(i=e._zod).check??(i.check=t=>{n.pattern.lastIndex=0,!n.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:n.format,input:t.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})}):(o=e._zod).check??(o.check=()=>{})}),Ba=g("$ZodCheckRegex",(e,n)=>{Ot.init(e,n),e._zod.check=i=>{n.pattern.lastIndex=0,!n.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}}),Ja=g("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=Ta),Ot.init(e,n)}),Ka=g("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=Da),Ot.init(e,n)}),Ha=g("$ZodCheckIncludes",(e,n)=>{F.init(e,n);let i=he(n.includes),o=new RegExp(typeof n.position=="number"?`^.{${n.position},}${i}`:i);n.pattern=o,e._zod.check=t=>{t.value.includes(n.includes,n.position)||t.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:t.value,inst:e,continue:!n.abort})}}),Wa=g("$ZodCheckStartsWith",(e,n)=>{F.init(e,n);let i=new RegExp(`^${he(n.prefix)}.*`);n.pattern??(n.pattern=i),e._zod.check=o=>{o.value.startsWith(n.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:o.value,inst:e,continue:!n.abort})}}),Xa=g("$ZodCheckEndsWith",(e,n)=>{F.init(e,n);let i=new RegExp(`.*${he(n.suffix)}$`);n.pattern??(n.pattern=i),e._zod.check=o=>{o.value.endsWith(n.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:o.value,inst:e,continue:!n.abort})}});function jr(e,n,i){e.issues.length&&n.issues.push(...ue(i,e.issues))}var qa=g("$ZodCheckProperty",(e,n)=>{F.init(e,n),e._zod.check=i=>{let o=n.schema._zod.run({value:i.value[n.property],issues:[]},{});if(o instanceof Promise)return o.then(t=>jr(t,i,n.property));jr(o,i,n.property)}}),Ya=g("$ZodCheckProperties",(e,n)=>{F.init(e,n),bn(e,Symbol.iterator,function*(){yield e});let i;e._zod.check=o=>{if(o.value==null){o.issues.push({expected:"object",code:"invalid_type",input:o.value,inst:e});return}i??(i=Reflect.ownKeys(n.shape).map(a=>[a,n.shape[a]]));let t=o.value,r;for(let[a,s]of i){let u=s._zod.run({value:t[a],issues:[]},{});u instanceof Promise?(r??(r=[]),r.push(u.then(c=>jr(c,o,a)))):jr(u,o,a)}if(r)return Promise.all(r).then(()=>{})}}),Qa=g("$ZodCheckMimeType",(e,n)=>{F.init(e,n);let i=new Set(n.mime);e._zod.check=o=>{i.has(o.value.type)||o.issues.push({code:"invalid_value",values:n.mime,input:o.value.type,inst:e,continue:!n.abort})}}),es=g("$ZodCheckOverwrite",(e,n)=>{F.init(e,n),e._zod.check=i=>{i.value=n.tx(i.value)}});var it=class{constructor(n=[],i={}){this.content=[],this.indent=0,this.args=n,this.closed=i}indented(n){this.indent+=1;try{n(this)}finally{this.indent-=1}}write(n){if(typeof n=="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}let o=n.split(` `).filter(a=>a),t=Math.min(...o.map(a=>a.length-a.trimStart().length)),r=o.map(a=>a.slice(t)).map(a=>" ".repeat(this.indent*2)+a);for(let a of r)this.content.push(a)}compile(){let n=Function,i=this?.content??[""];return new n(...Object.keys(this.closed),`return function (${this.args.join(", ")}) { ${i.join(` `)} -};`)(...Object.values(this.closed))}};var Xa={major:4,minor:6,patch:7};var j=f("$ZodType",(e,n)=>{var i;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=Xa;let o=e._zod.def.checks,t=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let r of t)for(let a of r._zod.onattach)a(e);if(t.length===0)(i=e._zod).deferred??(i.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(u,s,c)=>{if(u.memo)return u;let l=ne(u),d;for(let m of s){if(m._zod.def.when){if(Lo(u)||!m._zod.def.when(u))continue}else if(l)continue;let p=u.issues.length,v=m._zod.check(u);if(v instanceof Promise&&c?.async===!1)throw new se;if(d||v instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await v,u.issues.length!==p&&(gn(u.issues,p,e),l||(l=ne(u,p)))});else{if(u.issues.length===p)continue;gn(u.issues,p,e),l||(l=ne(u,p))}}return d?d.then(()=>u):u},a=(u,s,c)=>{if(ne(u))return u.aborted=!0,u;let l=r(s,t,c);if(l instanceof Promise){if(c.async===!1)throw new se;return l.then(d=>e._zod.parse(d,c))}return e._zod.parse(l,c)};e._zod.run=(u,s)=>{if(s.skipChecks)return e._zod.parse(u,s);if(s.direction==="backward"){let l=e._zod.parse({value:u.value,issues:[]},{...s,skipChecks:!0});return l instanceof Promise?l.then(d=>a(d,u,s)):a(l,u,s)}let c=e._zod.parse(u,s);if(c instanceof Promise){if(s.async===!1)throw new se;return c.then(l=>r(l,t,s))}return r(c,t,s)}}},{get"~standard"(){return $n(this,"~standard",Cr(this))},set"~standard"(e){Le(this,"~standard",e)}}),Jd=(e,n)=>e.issues.length?{issues:e.issues.map(i=>ce(i,n,G()))}:{value:e.value};async function Kh(e,n){let i={async:!0};return Jd(await e._zod.run({value:n,issues:[]},i),i)}function Cr(e){return{validate:n=>{let i={async:!1};try{let o=e._zod.run({value:n,issues:[]},i);if(!(o instanceof Promise))return Jd(o,i)}catch{}return Kh(e,n)},vendor:"zod",version:1}}var nt=f("$ZodString",(e,n)=>{j.init(e,n),e._zod.pattern=n.pattern??_a,e._zod.parse=(i,o)=>{if(n.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),C=f("$ZodStringFormat",(e,n)=>{Ot.init(e,n),nt.init(e,n)}),Ya=f("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=ra),C.init(e,n)}),Qa=f("$ZodUUID",(e,n)=>{if(n.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(o===void 0)throw new Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=et(o))}else n.pattern??(n.pattern=et());C.init(e,n)}),eu=f("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=ia),C.init(e,n)}),tu=1,zn=2;function nu(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Zr(e,n){return!("normalize"in n)&&!("hostname"in n)&&!("protocol"in n)?nu(e)||zn:Bd(e,n)}function Bd(e,n){if(!n.normalize&&n.protocol?.source===kn.source&&!/^https?:\/\//i.test(e))return tu;try{if(typeof URL<"u"){let i=URL;if(typeof i.parse=="function")return i.parse(e)??zn}return new URL(e)}catch{return zn}}var Wh=/[\t\n\r]/g;function Pn(e){return e.replace(Wh,"")}function Rr(e,n){return n.lastIndex=0,n.test(e.hostname)}function Vr(e,n){return n.lastIndex=0,n.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ru=f("$ZodURL",(e,n)=>{C.init(e,n),e._zod.check=i=>{try{let o=i.value.trim(),t=Zr(o,n);if(t===tu){i.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:i.value,inst:e,continue:!n.abort});return}if(t===zn){i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!n.abort});return}if(t===!0){i.value=Pn(o);return}n.hostname&&!Rr(t,n.hostname)&&i.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:i.value,inst:e,continue:!n.abort}),n.protocol&&!Vr(t,n.protocol)&&i.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:i.value,inst:e,continue:!n.abort}),i.value=n.normalize?t.href:Pn(o);return}catch{i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!n.abort})}}}),iu=f("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=oa()),C.init(e,n)}),ou=f("$ZodNanoID",(e,n)=>{if(n.length!==void 0&&(!Number.isInteger(n.length)||n.length<1))throw new Error(`Invalid nanoid length: ${n.length}`);n.pattern??(n.pattern=n.length===void 0?ea:ta(n.length)),C.init(e,n)}),au=f("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=Ho),C.init(e,n)}),uu=f("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=Xo),C.init(e,n)}),cu=f("$ZodULID",(e,n)=>{n.pattern??(n.pattern=qo),C.init(e,n)}),su=f("$ZodXID",(e,n)=>{n.pattern??(n.pattern=Yo),C.init(e,n)}),lu=f("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=Qo),C.init(e,n)}),du=f("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=ya(n)),C.init(e,n)}),pu=f("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=ha),C.init(e,n)}),mu=f("$ZodISOTime",(e,n)=>{n.pattern??(n.pattern=$a(n)),C.init(e,n)}),fu=f("$ZodISODuration",(e,n)=>{n.pattern??(n.pattern=na),C.init(e,n)}),gu=f("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=aa),C.init(e,n)}),Hh=/^[0-9a-fA-F:.]+$/;function Dn(e){return Hh.test(e)?nu(`http://[${e}]`):!1}var vu=f("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=ua),C.init(e,n),e._zod.check=i=>{Dn(i.value)||i.issues.push({code:"invalid_format",format:"ipv6",input:i.value,inst:e,continue:!n.abort})}}),hu=f("$ZodMAC",(e,n)=>{n.pattern??(n.pattern=ca(n.delimiter)),C.init(e,n)}),$u=f("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=sa),C.init(e,n)});function Mr(e){let n=e.split("/");if(n.length!==2)return!1;let[i,o]=n;if(!o)return!1;let t=Number(o);return`${t}`!==o||t<0||t>128?!1:Dn(i)}var yu=f("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=la),C.init(e,n),e._zod.check=i=>{Mr(i.value)||i.issues.push({code:"invalid_format",format:"cidrv6",input:i.value,inst:e,continue:!n.abort})}});function Nn(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Fr=/^[0-9a-zA-Z+/]*={0,2}$/,_u=f("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=Fr),C.init(e,n),e._zod.check=i=>{Nn(i.value)||i.issues.push({code:"invalid_format",format:"base64",input:i.value,inst:e,continue:!n.abort})}}),On=/^[A-Za-z0-9_-]*$/;function Gr(e){if(!On.test(e))return!1;let n=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),i=n.padEnd(Math.ceil(n.length/4)*4,"=");return Nn(i)}var bu=f("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=On),C.init(e,n),e._zod.check=i=>{Gr(i.value)||i.issues.push({code:"invalid_format",format:"base64url",input:i.value,inst:e,continue:!n.abort})}}),xu=f("$ZodE164",(e,n)=>{n.pattern??(n.pattern=ga),C.init(e,n)}),Xh=/[- ]/g;function qh(e){let n=e.length,i=1,o=0;for(;n;){let t=e.charCodeAt(--n)-48;i^=1,o+=i?[0,2,4,6,8,1,3,5,7,9][t]:t}return o%10===0}function Jr(e){return Pr.test(e)?qh(e.replace(Xh,"")):!1}var ku=f("$ZodCreditCard",(e,n)=>{n.pattern??(n.pattern=Pr),C.init(e,n),e._zod.check=i=>{Jr(i.value)||i.issues.push({code:"invalid_format",format:"credit_card",input:i.value,inst:e,continue:!n.abort})}});function Yh(e){let n=0,i=e.length;for(let o=4;o=65?n*100+(t-55):n*10+(t-48))%97}for(let o=0;o<4;o++){let t=e.charCodeAt(o);n=(t>=65?n*100+(t-55):n*10+(t-48))%97}return n===1}function Br(e){return Dr.test(e)?Yh(e):!1}var Iu=f("$ZodIBAN",(e,n)=>{n.pattern??(n.pattern=Dr),C.init(e,n),e._zod.check=i=>{Br(i.value)||i.issues.push({code:"invalid_format",format:"iban",input:i.value,inst:e,continue:!n.abort})}});function Kr(e,n=null){try{let i=e.split(".");if(i.length!==3)return!1;let[o]=i;if(!o)return!1;let t=JSON.parse(atob(o));return!("typ"in t&&t?.typ!=="JWT"||!t.alg||n&&(!("alg"in t)||t.alg!==n))}catch{return!1}}var wu=f("$ZodJWT",(e,n)=>{C.init(e,n),e._zod.check=i=>{Kr(i.value,n.alg)||i.issues.push({code:"invalid_format",format:"jwt",input:i.value,inst:e,continue:!n.abort})}}),Su=f("$ZodCustomStringFormat",(e,n)=>{C.init(e,n),e._zod.check=i=>{n.fn(i.value)||i.issues.push({code:"invalid_format",format:n.format,input:i.value,inst:e,continue:!n.abort})}}),Wr=f("$ZodNumber",(e,n)=>{j.init(e,n),e._zod.pattern=Oe,e._zod.parse=(i,o)=>{if(n.coerce)try{i.value=Number(i.value)}catch{}let t=i.value;if(typeof t=="number"&&!Number.isNaN(t)&&Number.isFinite(t))return i;let r=typeof t=="number"?Number.isNaN(t)?"NaN":Number.isFinite(t)?void 0:String(t):void 0;return i.issues.push({expected:"number",code:"invalid_type",input:t,inst:e,...r?{received:r}:{}}),i}}),zu=f("$ZodNumberFormat",(e,n)=>{ja.init(e,n),Wr.init(e,n)}),jn=f("$ZodBoolean",(e,n)=>{j.init(e,n),e._zod.pattern=ka,e._zod.parse=(i,o)=>{if(n.coerce)try{i.value=!!i.value}catch{}let t=i.value;return typeof t=="boolean"||i.issues.push({expected:"boolean",code:"invalid_type",input:t,inst:e}),i}}),Hr=f("$ZodBigInt",(e,n)=>{j.init(e,n),e._zod.pattern=xa,e._zod.parse=(i,o)=>{if(n.coerce)try{i.value=BigInt(i.value)}catch{}return typeof i.value=="bigint"||i.issues.push({expected:"bigint",code:"invalid_type",input:i.value,inst:e}),i}}),Pu=f("$ZodBigIntFormat",(e,n)=>{Aa.init(e,n),Hr.init(e,n)}),Du=f("$ZodSymbol",(e,n)=>{j.init(e,n),e._zod.parse=(i,o)=>{let t=i.value;return typeof t=="symbol"||i.issues.push({expected:"symbol",code:"invalid_type",input:t,inst:e}),i}}),Nu=f("$ZodUndefined",(e,n)=>{j.init(e,n),e._zod.pattern=wa,e._zod.values=new Set([void 0]),e._zod.parse=(i,o)=>{let t=i.value;return typeof t>"u"||i.issues.push({expected:"undefined",code:"invalid_type",input:t,inst:e}),i}}),Ou=f("$ZodNull",(e,n)=>{j.init(e,n),e._zod.pattern=Ia,e._zod.values=new Set([null]),e._zod.parse=(i,o)=>{let t=i.value;return t===null||i.issues.push({expected:"null",code:"invalid_type",input:t,inst:e}),i}}),ju=f("$ZodAny",(e,n)=>{j.init(e,n),e._zod.parse=i=>i}),Au=f("$ZodUnknown",(e,n)=>{j.init(e,n),e._zod.parse=i=>i}),Uu=f("$ZodNever",(e,n)=>{j.init(e,n),e._zod.parse=(i,o)=>(i.issues.push({expected:"never",code:"invalid_type",input:i.value,inst:e}),i)}),Tu=f("$ZodVoid",(e,n)=>{j.init(e,n),e._zod.parse=(i,o)=>{let t=i.value;return typeof t>"u"||i.issues.push({expected:"void",code:"invalid_type",input:t,inst:e}),i}}),Eu=f("$ZodDate",(e,n)=>{j.init(e,n),e._zod.parse=(i,o)=>{if(n.coerce)try{i.value=new Date(i.value)}catch{}let t=i.value,r=t instanceof Date;return r&&!Number.isNaN(t.getTime())||i.issues.push({expected:"date",code:"invalid_type",input:t,...r?{received:"Invalid Date"}:{},inst:e}),i}});function Lu(e,n){let i=wt(e._zod.def.checks);if(!i.length)return;let o=Math.min(...i.map(r=>r[0])),t=e._zod.parse;e._zod.parse=(r,a)=>{let u=n(r.value);if(u>o&&!a?.skipChecks&&a?.direction!=="backward"){for(let[s,c]of wt(e._zod.def.checks))if(u>s&&c._zod.def.when(r)){let l=r.issues.length;return c._zod.check(r),r.issues[l].continue=!1,gn(r.issues,l,e),r}}return t(r,a)}}var Qh=e=>Array.isArray(e)?e.length:-1,e$=e=>e instanceof Map?e.size:-1,t$=e=>e instanceof Set?e.size:-1;function Nd(e,n,i){e.issues.length&&n.issues.push(...ue(i,e.issues)),n.value[i]=e.value}var Cu=f("$ZodArray",(e,n)=>{j.init(e,n);let i=q.memoizer;i?.attach(e),e._zod.parse=(o,t)=>{let r=o.value;if(!Array.isArray(r))return o.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),o;o.value=i?i.alloc(e,o,Array(r.length),t):Array(r.length);let a=[],u=t?.abortEarly;for(let s=0;sNd(d,o,s)));else if(Nd(l,o,s),u&&l.issues.length!==0&&ne(l))break}return a.length?Promise.all(a).then(()=>o):o},Lu(e,Qh)});function Lr(e,n,i,o,t,r){let a=i in o,u=r==="optional";if(!(!a&&u&&t==="optional")){if(e.issues.length){if(t!==void 0&&u&&!a)return;n.issues.push(...ue(i,e.issues))}if(!a&&t===void 0){e.issues.length||n.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[i]});return}e.value===void 0?(a||t==="defaulted"&&!u)&&(n.value[i]=void 0):n.value[i]=e.value}}var n$=[];function Kd(e){let n=Object.keys(e.shape),i=Object.getOwnPropertySymbols(e.shape),o=i.length?i:n$,t=o.length?[...n,...o]:n;for(let a of t)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(a)}": expected a Zod schema`);let r=Eo(e.shape);return{...e,allKeys:t,symbolKeys:o,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(r)}}function Wd(e,n,i,o,t,r,a){let u=[],s=t.keySet,c=t.catchall._zod,l=c.def.type,d=c.optin,m=c.optout,p=0;for(let v in n){if(a&&i.issues.length!==p){if(ne(i,p))break;p=i.issues.length}if(s.has(v))continue;if(v==="__proto__"){l==="never"&&u.push(v);continue}if(l==="never"){u.push(v);continue}let b=c.run({value:n[v],issues:[]},o);b instanceof Promise?e.push(b.then(w=>Lr(w,i,v,n,d,m))):Lr(b,i,v,n,d,m)}return u.length&&i.issues.push({code:"unrecognized_keys",keys:u,input:n,inst:r,continue:!0}),e.length?Promise.all(e).then(()=>i):i}var Hd=f("$ZodObject",(e,n)=>{j.init(e,n);let i=Object.getOwnPropertyDescriptor(n,"shape"),o=i?.get?i.get.raw:n.shape??{};if(o){let c=()=>{let l={...o};return Object.defineProperty(n,"shape",{value:l}),c.raw=l,l};c.raw=o,Object.defineProperty(n,"shape",{get:c})}let t=kt(()=>Kd(n));T(e,"propValues",c=>{let l=c.def.shape,d={};for(let m in l){let p=l[m]._zod;if(p.values){Object.prototype.hasOwnProperty.call(d,m)||Y(d,m,new Set);for(let v of p.values)d[m].add(v);p.optin!==void 0&&d[m].add(void 0)}}return d});let r=Ye,a=n.catchall,u,s=q.memoizer;s?.attach(e),e._zod.parse=(c,l)=>{u??(u=t.value);let d=c.value;if(!r(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c;c.value=s?s.alloc(e,c,{},l):{};let m=[],p=u.shape,v=l?.abortEarly,b=c.issues.length;for(let w of u.allKeys){if(v&&c.issues.length!==b){if(ne(c,b))break;b=c.issues.length}if(w==="__proto__")continue;let z=p[w],$=z._zod.optin,S=z._zod.optout,k=z._zod.run({value:d[w],issues:[]},l);k instanceof Promise?m.push(k.then(D=>Lr(D,c,w,d,$,S))):Lr(k,c,w,d,$,S)}return a?Wd(m,d,c,l,t.value,e,v===!0):m.length?Promise.all(m).then(()=>c):c}}),Zu=f("$ZodObjectJIT",(e,n)=>{Hd.init(e,n);let i=e._zod.parse,o=kt(()=>Kd(n)),t=q.memoizer,r=p=>{let v=o.value,b=v.symbolKeys,w=new tt(["payload","ctx"],{shape:p,inst:e,memo:t,syms:b}),z=D=>`shape[${D}]._zod.run({ value: input[${D}], issues: [] }, ctx)`,$=(D,U)=>` - let ${D}_ab = false; - for (let i = 0; i < ${D}.issues.length; i++) { - const iss = ${D}.issues[i]; - iss.path = iss.path ? [${U}, ...iss.path] : [${U}]; +};`)(...Object.values(this.closed))}};var ts={major:4,minor:6,patch:7};var E=g("$ZodType",(e,n)=>{var i;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=ts;let o=e._zod.def.checks,t=e._zod.traits.has("$ZodCheck")?[e,...o??[]]:o?.length?[...o]:[];for(let r of t)for(let a of r._zod.onattach)a(e);if(t.length===0)(i=e._zod).deferred??(i.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let r=(s,u,c)=>{if(s.memo)return s;let l=re(s),d;for(let p of u){if(p._zod.def.when){if(Vo(s)||!p._zod.def.when(s))continue}else if(l)continue;let f=s.issues.length,h=p._zod.check(s);if(h instanceof Promise&&c?.async===!1)throw new le;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,s.issues.length!==f&&($n(s.issues,f,e),l||(l=re(s,f)))});else{if(s.issues.length===f)continue;$n(s.issues,f,e),l||(l=re(s,f))}}return d?d.then(()=>s):s},a=(s,u,c)=>{if(re(s))return s.aborted=!0,s;let l=r(u,t,c);if(l instanceof Promise){if(c.async===!1)throw new le;return l.then(d=>e._zod.parse(d,c))}return e._zod.parse(l,c)};e._zod.run=(s,u)=>{if(u.skipChecks)return e._zod.parse(s,u);if(u.direction==="backward"){let l=e._zod.parse({value:s.value,issues:[]},{...u,skipChecks:!0});return l instanceof Promise?l.then(d=>a(d,s,u)):a(l,s,u)}let c=e._zod.parse(s,u);if(c instanceof Promise){if(u.async===!1)throw new le;return c.then(l=>r(l,t,u))}return r(c,t,u)}}},{get"~standard"(){return bn(this,"~standard",Vr(this))},set"~standard"(e){Ce(this,"~standard",e)}}),Qd=(e,n)=>e.issues.length?{issues:e.issues.map(i=>ce(i,n,B()))}:{value:e.value};async function l$(e,n){let i={async:!0};return Qd(await e._zod.run({value:n,issues:[]},i),i)}function Vr(e){return{validate:n=>{let i={async:!1};try{let o=e._zod.run({value:n,issues:[]},i);if(!(o instanceof Promise))return Qd(o,i)}catch{}return l$(e,n)},vendor:"zod",version:1}}var ot=g("$ZodString",(e,n)=>{E.init(e,n),e._zod.pattern=n.pattern??Sa,e._zod.parse=(i,o)=>{if(n.coerce)try{i.value=String(i.value)}catch{}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),R=g("$ZodStringFormat",(e,n)=>{Ot.init(e,n),ot.init(e,n)}),rs=g("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=ua),R.init(e,n)}),is=g("$ZodUUID",(e,n)=>{if(n.version){let o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(o===void 0)throw new Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=rt(o))}else n.pattern??(n.pattern=rt());R.init(e,n)}),os=g("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=ca),R.init(e,n)}),as=1,Nn=2;function ss(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Fr(e,n){return!("normalize"in n)&&!("hostname"in n)&&!("protocol"in n)?ss(e)||Nn:ep(e,n)}function ep(e,n){if(!n.normalize&&n.protocol?.source===wn.source&&!/^https?:\/\//i.test(e))return as;try{if(typeof URL<"u"){let i=URL;if(typeof i.parse=="function")return i.parse(e)??Nn}return new URL(e)}catch{return Nn}}var d$=/[\t\n\r]/g;function Tn(e){return e.replace(d$,"")}function Gr(e,n){return n.lastIndex=0,n.test(e.hostname)}function Br(e,n){return n.lastIndex=0,n.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var us=g("$ZodURL",(e,n)=>{R.init(e,n),e._zod.check=i=>{try{let o=i.value.trim(),t=Fr(o,n);if(t===as){i.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:i.value,inst:e,continue:!n.abort});return}if(t===Nn){i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!n.abort});return}if(t===!0){i.value=Tn(o);return}n.hostname&&!Gr(t,n.hostname)&&i.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:i.value,inst:e,continue:!n.abort}),n.protocol&&!Br(t,n.protocol)&&i.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:i.value,inst:e,continue:!n.abort}),i.value=n.normalize?t.href:Tn(o);return}catch{i.issues.push({code:"invalid_format",format:"url",input:i.value,inst:e,continue:!n.abort})}}}),cs=g("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=la()),R.init(e,n)}),ls=g("$ZodNanoID",(e,n)=>{if(n.length!==void 0&&(!Number.isInteger(n.length)||n.length<1))throw new Error(`Invalid nanoid length: ${n.length}`);n.pattern??(n.pattern=n.length===void 0?oa:aa(n.length)),R.init(e,n)}),ds=g("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=ea),R.init(e,n)}),ps=g("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=ta),R.init(e,n)}),ms=g("$ZodULID",(e,n)=>{n.pattern??(n.pattern=na),R.init(e,n)}),fs=g("$ZodXID",(e,n)=>{n.pattern??(n.pattern=ra),R.init(e,n)}),gs=g("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=ia),R.init(e,n)}),vs=g("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=Ia(n)),R.init(e,n)}),hs=g("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=xa),R.init(e,n)}),$s=g("$ZodISOTime",(e,n)=>{n.pattern??(n.pattern=ka(n)),R.init(e,n)}),ys=g("$ZodISODuration",(e,n)=>{n.pattern??(n.pattern=sa),R.init(e,n)}),_s=g("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=da),R.init(e,n)}),p$=/^[0-9a-fA-F:.]+$/;function Dn(e){return p$.test(e)?ss(`http://[${e}]`):!1}var bs=g("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=pa),R.init(e,n),e._zod.check=i=>{Dn(i.value)||i.issues.push({code:"invalid_format",format:"ipv6",input:i.value,inst:e,continue:!n.abort})}}),xs=g("$ZodMAC",(e,n)=>{n.pattern??(n.pattern=ma(n.delimiter)),R.init(e,n)}),ks=g("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=fa),R.init(e,n)});function Jr(e){let n=e.split("/");if(n.length!==2)return!1;let[i,o]=n;if(!o)return!1;let t=Number(o);return`${t}`!==o||t<0||t>128?!1:Dn(i)}var Is=g("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=ga),R.init(e,n),e._zod.check=i=>{Jr(i.value)||i.issues.push({code:"invalid_format",format:"cidrv6",input:i.value,inst:e,continue:!n.abort})}});function On(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Kr=/^[0-9a-zA-Z+/]*={0,2}$/,Ss=g("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=Kr),R.init(e,n),e._zod.check=i=>{On(i.value)||i.issues.push({code:"invalid_format",format:"base64",input:i.value,inst:e,continue:!n.abort})}}),En=/^[A-Za-z0-9_-]*$/;function Hr(e){if(!En.test(e))return!1;let n=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),i=n.padEnd(Math.ceil(n.length/4)*4,"=");return On(i)}var ws=g("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=En),R.init(e,n),e._zod.check=i=>{Hr(i.value)||i.issues.push({code:"invalid_format",format:"base64url",input:i.value,inst:e,continue:!n.abort})}}),Ps=g("$ZodE164",(e,n)=>{n.pattern??(n.pattern=_a),R.init(e,n)}),m$=/[- ]/g;function f$(e){let n=e.length,i=1,o=0;for(;n;){let t=e.charCodeAt(--n)-48;i^=1,o+=i?[0,2,4,6,8,1,3,5,7,9][t]:t}return o%10===0}function Wr(e){return Dr.test(e)?f$(e.replace(m$,"")):!1}var zs=g("$ZodCreditCard",(e,n)=>{n.pattern??(n.pattern=Dr),R.init(e,n),e._zod.check=i=>{Wr(i.value)||i.issues.push({code:"invalid_format",format:"credit_card",input:i.value,inst:e,continue:!n.abort})}});function g$(e){let n=0,i=e.length;for(let o=4;o=65?n*100+(t-55):n*10+(t-48))%97}for(let o=0;o<4;o++){let t=e.charCodeAt(o);n=(t>=65?n*100+(t-55):n*10+(t-48))%97}return n===1}function Xr(e){return Or.test(e)?g$(e):!1}var As=g("$ZodIBAN",(e,n)=>{n.pattern??(n.pattern=Or),R.init(e,n),e._zod.check=i=>{Xr(i.value)||i.issues.push({code:"invalid_format",format:"iban",input:i.value,inst:e,continue:!n.abort})}});function qr(e,n=null){try{let i=e.split(".");if(i.length!==3)return!1;let[o]=i;if(!o)return!1;let t=JSON.parse(atob(o));return!("typ"in t&&t?.typ!=="JWT"||!t.alg||n&&(!("alg"in t)||t.alg!==n))}catch{return!1}}var Ns=g("$ZodJWT",(e,n)=>{R.init(e,n),e._zod.check=i=>{qr(i.value,n.alg)||i.issues.push({code:"invalid_format",format:"jwt",input:i.value,inst:e,continue:!n.abort})}}),Ts=g("$ZodCustomStringFormat",(e,n)=>{R.init(e,n),e._zod.check=i=>{n.fn(i.value)||i.issues.push({code:"invalid_format",format:n.format,input:i.value,inst:e,continue:!n.abort})}}),Yr=g("$ZodNumber",(e,n)=>{E.init(e,n),e._zod.pattern=Oe,e._zod.parse=(i,o)=>{if(n.coerce)try{i.value=Number(i.value)}catch{}let t=i.value;if(typeof t=="number"&&!Number.isNaN(t)&&Number.isFinite(t))return i;let r=typeof t=="number"?Number.isNaN(t)?"NaN":Number.isFinite(t)?void 0:String(t):void 0;return i.issues.push({expected:"number",code:"invalid_type",input:t,inst:e,...r?{received:r}:{}}),i}}),Ds=g("$ZodNumberFormat",(e,n)=>{La.init(e,n),Yr.init(e,n)}),jn=g("$ZodBoolean",(e,n)=>{E.init(e,n),e._zod.pattern=za,e._zod.parse=(i,o)=>{if(n.coerce)try{i.value=!!i.value}catch{}let t=i.value;return typeof t=="boolean"||i.issues.push({expected:"boolean",code:"invalid_type",input:t,inst:e}),i}}),Qr=g("$ZodBigInt",(e,n)=>{E.init(e,n),e._zod.pattern=Pa,e._zod.parse=(i,o)=>{if(n.coerce)try{i.value=BigInt(i.value)}catch{}return typeof i.value=="bigint"||i.issues.push({expected:"bigint",code:"invalid_type",input:i.value,inst:e}),i}}),Os=g("$ZodBigIntFormat",(e,n)=>{Ca.init(e,n),Qr.init(e,n)}),Es=g("$ZodSymbol",(e,n)=>{E.init(e,n),e._zod.parse=(i,o)=>{let t=i.value;return typeof t=="symbol"||i.issues.push({expected:"symbol",code:"invalid_type",input:t,inst:e}),i}}),js=g("$ZodUndefined",(e,n)=>{E.init(e,n),e._zod.pattern=Na,e._zod.values=new Set([void 0]),e._zod.parse=(i,o)=>{let t=i.value;return typeof t>"u"||i.issues.push({expected:"undefined",code:"invalid_type",input:t,inst:e}),i}}),Us=g("$ZodNull",(e,n)=>{E.init(e,n),e._zod.pattern=Aa,e._zod.values=new Set([null]),e._zod.parse=(i,o)=>{let t=i.value;return t===null||i.issues.push({expected:"null",code:"invalid_type",input:t,inst:e}),i}}),Ls=g("$ZodAny",(e,n)=>{E.init(e,n),e._zod.parse=i=>i}),Cs=g("$ZodUnknown",(e,n)=>{E.init(e,n),e._zod.parse=i=>i}),Rs=g("$ZodNever",(e,n)=>{E.init(e,n),e._zod.parse=(i,o)=>(i.issues.push({expected:"never",code:"invalid_type",input:i.value,inst:e}),i)}),Zs=g("$ZodVoid",(e,n)=>{E.init(e,n),e._zod.parse=(i,o)=>{let t=i.value;return typeof t>"u"||i.issues.push({expected:"void",code:"invalid_type",input:t,inst:e}),i}}),Ms=g("$ZodDate",(e,n)=>{E.init(e,n),e._zod.parse=(i,o)=>{if(n.coerce)try{i.value=new Date(i.value)}catch{}let t=i.value,r=t instanceof Date;return r&&!Number.isNaN(t.getTime())||i.issues.push({expected:"date",code:"invalid_type",input:t,...r?{received:"Invalid Date"}:{},inst:e}),i}});function Vs(e,n){let i=Pt(e._zod.def.checks);if(!i.length)return;let o=Math.min(...i.map(r=>r[0])),t=e._zod.parse;e._zod.parse=(r,a)=>{let s=n(r.value);if(s>o&&!a?.skipChecks&&a?.direction!=="backward"){for(let[u,c]of Pt(e._zod.def.checks))if(s>u&&c._zod.def.when(r)){let l=r.issues.length;return c._zod.check(r),r.issues[l].continue=!1,$n(r.issues,l,e),r}}return t(r,a)}}var v$=e=>Array.isArray(e)?e.length:-1,h$=e=>e instanceof Map?e.size:-1,$$=e=>e instanceof Set?e.size:-1;function Cd(e,n,i){e.issues.length&&n.issues.push(...ue(i,e.issues)),n.value[i]=e.value}var Fs=g("$ZodArray",(e,n)=>{E.init(e,n);let i=Y.memoizer;i?.attach(e),e._zod.parse=(o,t)=>{let r=o.value;if(!Array.isArray(r))return o.issues.push({expected:"array",code:"invalid_type",input:r,inst:e}),o;o.value=i?i.alloc(e,o,Array(r.length),t):Array(r.length);let a=[],s=t?.abortEarly;for(let u=0;uCd(d,o,u)));else if(Cd(l,o,u),s&&l.issues.length!==0&&re(l))break}return a.length?Promise.all(a).then(()=>o):o},Vs(e,v$)});function Mr(e,n,i,o,t,r){let a=i in o,s=r==="optional";if(!(!a&&s&&t==="optional")){if(e.issues.length){if(t!==void 0&&s&&!a)return;n.issues.push(...ue(i,e.issues))}if(!a&&t===void 0){e.issues.length||n.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[i]});return}e.value===void 0?(a||t==="defaulted"&&!s)&&(n.value[i]=void 0):n.value[i]=e.value}}var y$=[];function tp(e){let n=Object.keys(e.shape),i=Object.getOwnPropertySymbols(e.shape),o=i.length?i:y$,t=o.length?[...n,...o]:n;for(let a of t)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(a)}": expected a Zod schema`);let r=Mo(e.shape);return{...e,allKeys:t,symbolKeys:o,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(r)}}function np(e,n,i,o,t,r,a){let s=[],u=t.keySet,c=t.catchall._zod,l=c.def.type,d=c.optin,p=c.optout,f=0;for(let h in n){if(a&&i.issues.length!==f){if(re(i,f))break;f=i.issues.length}if(u.has(h))continue;if(h==="__proto__"){l==="never"&&s.push(h);continue}if(l==="never"){s.push(h);continue}let y=c.run({value:n[h],issues:[]},o);y instanceof Promise?e.push(y.then(k=>Mr(k,i,h,n,d,p))):Mr(y,i,h,n,d,p)}return s.length&&i.issues.push({code:"unrecognized_keys",keys:s,input:n,inst:r,continue:!0}),e.length?Promise.all(e).then(()=>i):i}var rp=g("$ZodObject",(e,n)=>{E.init(e,n);let i=Object.getOwnPropertyDescriptor(n,"shape"),o=i?.get?i.get.raw:n.shape??{};if(o){let c=()=>{let l={...o};return Object.defineProperty(n,"shape",{value:l}),c.raw=l,l};c.raw=o,Object.defineProperty(n,"shape",{get:c})}let t=St(()=>tp(n));U(e,"propValues",c=>{let l=c.def.shape,d={};for(let p in l){let f=l[p]._zod;if(f.values){Object.prototype.hasOwnProperty.call(d,p)||Q(d,p,new Set);for(let h of f.values)d[p].add(h);f.optin!==void 0&&d[p].add(void 0)}}return d});let r=tt,a=n.catchall,s,u=Y.memoizer;u?.attach(e),e._zod.parse=(c,l)=>{s??(s=t.value);let d=c.value;if(!r(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c;c.value=u?u.alloc(e,c,{},l):{};let p=[],f=s.shape,h=l?.abortEarly,y=c.issues.length;for(let k of s.allKeys){if(h&&c.issues.length!==y){if(re(c,y))break;y=c.issues.length}if(k==="__proto__")continue;let P=f[k],S=P._zod.optin,N=P._zod.optout,x=P._zod.run({value:d[k],issues:[]},l);x instanceof Promise?p.push(x.then(A=>Mr(A,c,k,d,S,N))):Mr(x,c,k,d,S,N)}return a?np(p,d,c,l,t.value,e,h===!0):p.length?Promise.all(p).then(()=>c):c}}),Gs=g("$ZodObjectJIT",(e,n)=>{rp.init(e,n);let i=e._zod.parse,o=St(()=>tp(n)),t=Y.memoizer,r=f=>{let h=o.value,y=h.symbolKeys,k=new it(["payload","ctx"],{shape:f,inst:e,memo:t,syms:y}),P=A=>`shape[${A}]._zod.run({ value: input[${A}], issues: [] }, ctx)`,S=(A,w)=>` + let ${A}_ab = false; + for (let i = 0; i < ${A}.issues.length; i++) { + const iss = ${A}.issues[i]; + iss.path = iss.path ? [${w}, ...iss.path] : [${w}]; payload.issues.push(iss); - if (iss.continue !== true) ${D}_ab = true; + if (iss.continue !== true) ${A}_ab = true; } - if (${D}_ab && ctx && ctx.abortEarly) { + if (${A}_ab && ctx && ctx.abortEarly) { payload.value = newResult; return payload; - }`;w.write("const input = payload.value;");let S=Object.create(null),k=0;for(let D of v.allKeys)S[D]=`key_${k++}`;w.write(t?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let D of v.allKeys){if(D==="__proto__")continue;let U=S[D],J=typeof D=="symbol"?`syms[${b.indexOf(D)}]`:te(D),Te=`${J} in input`,dr=p[D],Xe=dr?._zod?.optin,pr=Xe!==void 0,Po=dr?._zod?.optout==="optional";if(w.write(`const ${U} = ${z(J)};`),pr&&Po){let pe=Xe==="optional"?`${U}_present`:`${U}.value !== undefined || ${U}_present`;w.write(` - const ${U}_present = ${Te}; - if (!${U}.issues.length || ${U}_present) { - if (${U}.issues.length) {${$(U,J)} + }`;k.write("const input = payload.value;");let N=Object.create(null),x=0;for(let A of h.allKeys)N[A]=`key_${x++}`;k.write(t?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let A of h.allKeys){if(A==="__proto__")continue;let w=N[A],O=typeof A=="symbol"?`syms[${y.indexOf(A)}]`:ne(A),ye=`${O} in input`,gr=f[A],Qe=gr?._zod?.optin,vr=Qe!==void 0,Oo=gr?._zod?.optout==="optional";if(k.write(`const ${w} = ${P(O)};`),vr&&Oo){let me=Qe==="optional"?`${w}_present`:`${w}.value !== undefined || ${w}_present`;k.write(` + const ${w}_present = ${ye}; + if (!${w}.issues.length || ${w}_present) { + if (${w}.issues.length) {${S(w,O)} } - if (${pe}) { - newResult[${J}] = ${U}.value; + if (${me}) { + newResult[${O}] = ${w}.value; } } - `)}else pr?(w.write(` - if (${U}.issues.length) {${$(U,J)} + `)}else vr?(k.write(` + if (${w}.issues.length) {${S(w,O)} } - `),Xe==="defaulted"?w.write(`newResult[${J}] = ${U}.value;`):w.write(` - if (${U}.value !== undefined || ${Te}) { - newResult[${J}] = ${U}.value; + `),Qe==="defaulted"?k.write(`newResult[${O}] = ${w}.value;`):k.write(` + if (${w}.value !== undefined || ${ye}) { + newResult[${O}] = ${w}.value; } - `)):w.write(` - const ${U}_present = ${Te}; - if (${U}.issues.length) {${$(U,J)} + `)):k.write(` + const ${w}_present = ${ye}; + if (${w}.issues.length) {${S(w,O)} } - if (!${U}_present && !${U}.issues.length) { + if (!${w}_present && !${w}.issues.length) { payload.issues.push({ code: "invalid_type", expected: "nonoptional", input: undefined, - path: [${J}] + path: [${O}] }); if (ctx && ctx.abortEarly) { payload.value = newResult; @@ -51,14 +51,14 @@ ${i.join(` } } - if (${U}_present) { - newResult[${J}] = ${U}.value; + if (${w}_present) { + newResult[${O}] = ${w}.value; } - `)}return w.write("payload.value = newResult;"),w.write("return payload;"),w.compile()},a,u=Ye,s=!q.jitless,l=s&&Uo.value,d=n.catchall,m;e._zod.parse=(p,v)=>{m??(m=o.value);let b=p.value;return u(b)?s&&l&&v?.async===!1&&v.jitless!==!0?(a||(a=r(n.shape)),p=a(p,v),d?Wd([],b,p,v,m,e,v?.abortEarly===!0):p):i(p,v):(p.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),p)}});function Od(e,n,i,o){for(let r of e)if(r.issues.length===0)return n.value=r.value,n;let t=e.filter(r=>!ne(r));return t.length===1?(n.value=t[0].value,t[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:i,errors:e.map(r=>r.issues.map(a=>ce(a,o,G())))}),n)}var An=f("$ZodUnion",(e,n)=>{j.init(e,n),T(e,"optin",o=>o.def.options.some(t=>t._zod.optin==="defaulted")?"defaulted":o.def.options.some(t=>t._zod.optin!==void 0)?"optional":void 0),T(e,"optout",o=>o.def.options.some(t=>t._zod.optout==="optional")?"optional":void 0),T(e,"values",o=>{if(o.def.options.every(t=>t._zod.values))return new Set(o.def.options.flatMap(t=>Array.from(t._zod.values)))}),T(e,"pattern",o=>{if(o.def.options.every(t=>t._zod.pattern)){let t=o.def.options.map(r=>r._zod.pattern);return new RegExp(`^(${t.map(r=>Ne(r.source)).join("|")})$`)}});let i=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(o,t)=>{if(i)return i(o,t);let r=!1,a=[];for(let u of n.options){let s=u._zod.run({value:o.value,issues:[]},t);if(s instanceof Promise)a.push(s),r=!0;else{if(s.issues.length===0)return s;a.push(s)}}return r?Promise.all(a).then(u=>Od(u,o,e,t)):Od(a,o,e,t)}});function jd(e,n,i,o){let t=[];for(let r=0;rr.issues.map(a=>ce(a,o,G())))}):n.issues.push({code:"invalid_union",input:n.value,inst:i,errors:[],inclusive:!1,matches:t}),n)}var Ru=f("$ZodXor",(e,n)=>{An.init(e,n),n.inclusive=!1;let i=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(o,t)=>{if(i)return i(o,t);let r=!1,a=[];for(let u of n.options){let s=u._zod.run({value:o.value,issues:[]},t);s instanceof Promise?(a.push(s),r=!0):a.push(s)}return r?Promise.all(a).then(u=>jd(u,o,e,t)):jd(a,o,e,t)}});function Vu(e,n){let i=e._zod,o=i.bag.optionsMap;o||(o=Xd(i.def),i.bag.optionsMap=o);let t=o.get(n);if(t===null)throw new Error(`Ambiguous discriminator value "${String(n)}"`);return t}function Xd(e){let n=new Map;for(let i of e.options){let o=i._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let t of o)if(n.has(t)){if(t!==void 0)throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,null)}else n.set(t,i)}return n}var Mu=f("$ZodDiscriminatedUnion",(e,n)=>{n.inclusive=!1,An.init(e,n);let i=e._zod.parse;T(e,"propValues",t=>{let r={},a=0;for(let u of t.def.options){let s=u._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.def.options.indexOf(u)}"`);s[t.def.discriminator]?.has(void 0)&&a++;for(let[c,l]of Object.entries(s)){Object.prototype.hasOwnProperty.call(r,c)||Y(r,c,new Set);for(let d of l)r[c].add(d)}}return!t.def.unionFallback&&a>1&&r[t.def.discriminator]?.delete(void 0),r}),n.options.forEach((t,r)=>{let a=It(t._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,n.discriminator))throw new Error(`Invalid discriminated union option at index "${r}"`)});let o=kt(()=>Xd(n));e._zod.parse=(t,r)=>{let a=t.value;if(!Ye(a))return t.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),t;let u=a?.[n.discriminator],s=o.value.get(u);return s&&(u!==void 0||r.direction!=="backward")?s._zod.run(t,r):n.unionFallback||r.direction==="backward"?i(t,r):(t.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,options:Array.from(o.value.keys()).filter(c=>o.value.get(c)!==null),input:a,path:[n.discriminator],inst:e}),t)}}),Fu=f("$ZodIntersection",(e,n)=>{j.init(e,n),e._zod.parse=(i,o)=>{let t=i.value,r=n.left._zod.run({value:t,issues:[]},o),a=n.right._zod.run({value:t,issues:[]},o);return r instanceof Promise||a instanceof Promise?Promise.all([r,a]).then(([s,c])=>Ad(i,s,c)):Ad(i,r,a)}});function jt(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(ge(e)&&ge(n)){let i=Object.keys(n),o=Object.keys(e).filter(r=>i.indexOf(r)!==-1),t={...e,...n};Object.prototype.hasOwnProperty.call(t,"__proto__")&&delete t.__proto__;for(let r of o){if(r==="__proto__")continue;let a=jt(e[r],n[r]);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};t[r]=a.data}return{valid:!0,data:t}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};let i=[];for(let o=0;o{let d;if(c.code==="unrecognized_keys"&&!c.path?.length)t??(t=c),d=c.keys;else if(c.code==="invalid_key"&&c.origin==="record"&&c.path?.length===1){let m=String(c.path[0]);r.has(m)||r.set(m,c),d=[m]}else return!1;for(let m of d)o.has(m)||o.set(m,{}),o.get(m)[l]=!0;return!0};for(let c of n.issues)a(c,"l")||e.issues.push(c);for(let c of i.issues)a(c,"r")||e.issues.push(c);let u=[...o].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(u.length){let c=t?u.filter(l=>t.keys.includes(l)):[];c.length&&e.issues.push({...t,keys:c});for(let l of u)!c.includes(l)&&r.has(l)&&e.issues.push(r.get(l))}let s=jt(n.value,i.value);if(!s.valid){if(ne(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`)}return e.value=s.data,e}var Xr=f("$ZodTuple",(e,n)=>{j.init(e,n);let i=n.items,o=q.memoizer;o?.attach(e),e._zod.parse=(t,r)=>{let a=t.value;if(!Array.isArray(a))return t.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),t;t.value=o?o.alloc(e,t,[],r):[];let u=[],s=Ud(i,"optin"),c=Ud(i,"optout");if(!n.rest){if(a.lengthi.length&&t.issues.push({code:"too_big",maximum:i.length,inclusive:!0,input:a,inst:e,origin:"array"})}let l=new Array(i.length),d=n.rest?r?.abortEarly:void 0,m=!1;for(let p=0;p{l[p]=b})):(l[p]=v,d&&!m&&v.issues.length&&(m=ne(v)))}if(n.rest&&!m){let p=i.length-1,v=a.slice(i.length),b=t.issues.length;for(let w of v){if(d&&t.issues.length!==b){if(ne(t,b))break;b=t.issues.length}p++;let z=n.rest._zod.run({value:w,issues:[]},r);z instanceof Promise?u.push(z.then($=>Td($,t,p))):Td(z,t,p)}}return u.length?Promise.all(u).then(()=>Ed(l,t,i,a,c)):Ed(l,t,i,a,c)}});function Ud(e,n){for(let i=e.length-1;i>=0;i--)if(!(n==="optin"?e[i]._zod.optin!==void 0:e[i]._zod.optout==="optional"))return i+1;return 0}function Td(e,n,i){e.issues.length&&n.issues.push(...ue(i,e.issues)),n.value[i]=e.value}function Ed(e,n,i,o,t){for(let r=0;r=t&&i[r]._zod.optin==="optional"){n.value.length=r;break}if(a.issues.length){if(!u&&r>=t){n.value.length=r;break}n.issues.push(...ue(r,a.issues))}n.value[r]=a.value}for(let r=n.value.length-1;r>=o.length&&(i[r]._zod.optout==="optional"&&n.value[r]===void 0);r--)n.value.length=r;return n}var Gu=f("$ZodRecord",(e,n)=>{j.init(e,n);let i=q.memoizer;i?.attach(e),e._zod.parse=(o,t)=>{let r=o.value;if(!ge(r))return o.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),o;let a=[],u=n.keyType._zod.values;if(u&&!n.partial){o.value=i?i.alloc(e,o,{},t):{};let s=new Set;for(let l of u)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(s.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let d=n.keyType._zod.run({value:l,issues:[]},t);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(v=>ce(v,t,G())),input:l,path:[l],inst:e});continue}let m=d.value;if(m==="__proto__")continue;let p=n.valueType._zod.run({value:r[l],issues:[]},t);p instanceof Promise?a.push(p.then(v=>{v.issues.length&&o.issues.push(...ue(l,v.issues)),o.value[m]=v.value})):(p.issues.length&&o.issues.push(...ue(l,p.issues)),o.value[m]=p.value)}let c;for(let l in r)if(!s.has(l))if(n.mode==="loose"){if(l==="__proto__")continue;o.value[l]=r[l]}else c=c??[],c.push(l);c&&c.length>0&&o.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:c,continue:!0})}else{o.value=i?i.alloc(e,o,{},t):{};let s;for(let c of Reflect.ownKeys(r)){if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(r,c))continue;let l=n.keyType._zod.run({value:c,issues:[]},t);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&Oe.test(c)&&l.issues.length){let v=n.keyType._zod.run({value:Number(c),issues:[]},t);if(v instanceof Promise)throw new Error("Async schemas not supported in object keys currently");v.issues.length===0&&(l=v)}if(l.issues.length){n.mode==="loose"?o.value[c]=r[c]:u?(s=s??[],s.push(c)):o.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(v=>ce(v,t,G())),input:c,path:[c],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let p=n.valueType._zod.run({value:r[c],issues:[]},t);p instanceof Promise?a.push(p.then(v=>{v.issues.length&&o.issues.push(...ue(c,v.issues)),o.value[m]=v.value})):(p.issues.length&&o.issues.push(...ue(c,p.issues)),o.value[m]=p.value)}s&&s.length>0&&o.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:s,continue:!0})}return a.length?Promise.all(a).then(()=>o):o}}),Ju=f("$ZodMap",(e,n)=>{j.init(e,n);let i=q.memoizer;i?.attach(e),e._zod.parse=(o,t)=>{let r=o.value;if(!(r instanceof Map))return o.issues.push({expected:"map",code:"invalid_type",input:r,inst:e}),o;let a=[];o.value=i?i.alloc(e,o,new Map,t):new Map;let u=t?.abortEarly,s=o.issues.length;for(let[c,l]of r){if(u&&o.issues.length!==s){if(ne(o,s))break;s=o.issues.length}let d=n.keyType._zod.run({value:c,issues:[]},t),m=n.valueType._zod.run({value:l,issues:[]},t);d instanceof Promise||m instanceof Promise?a.push(Promise.all([d,m]).then(([p,v])=>{Ld(p,v,o,c,r,e,t)})):Ld(d,m,o,c,r,e,t)}return a.length?Promise.all(a).then(()=>o):o},Lu(e,e$)});function Ld(e,n,i,o,t,r,a){e.issues.length&&(pn.has(typeof o)?i.issues.push(...ue(o,e.issues)):i.issues.push({code:"invalid_key",origin:"map",input:t,inst:r,issues:e.issues.map(u=>ce(u,a,G()))})),n.issues.length&&(pn.has(typeof o)?i.issues.push(...ue(o,n.issues)):i.issues.push({origin:"map",code:"invalid_element",input:t,inst:r,key:o,issues:n.issues.map(u=>ce(u,a,G()))})),i.value.set(e.value,n.value)}var Bu=f("$ZodSet",(e,n)=>{j.init(e,n);let i=q.memoizer;i?.attach(e),e._zod.parse=(o,t)=>{let r=o.value;if(!(r instanceof Set))return o.issues.push({input:r,inst:e,expected:"set",code:"invalid_type"}),o;let a=[];o.value=i?i.alloc(e,o,new Set,t):new Set;let u=t?.abortEarly,s=o.issues.length;for(let c of r){if(u&&o.issues.length!==s){if(ne(o,s))break;s=o.issues.length}let l=n.valueType._zod.run({value:c,issues:[]},t);l instanceof Promise?a.push(l.then(d=>Cd(d,o))):Cd(l,o)}return a.length?Promise.all(a).then(()=>o):o},Lu(e,t$)});function Cd(e,n){e.issues.length&&n.issues.push(...e.issues),n.value.add(e.value)}var Ku=f("$ZodEnum",(e,n)=>{j.init(e,n);let i=bt(n.entries),o=new Set(i);e._zod.values=o,T(e,"pattern",t=>{let r=bt(t.def.entries).filter(a=>pn.has(typeof a));return new RegExp(r.length?`^(${r.map(a=>ve(a.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(t,r)=>{let a=t.value;return o.has(a)||t.issues.push({code:"invalid_value",values:i,input:a,inst:e}),t}}),Wu=f("$ZodLiteral",(e,n)=>{j.init(e,n);let i=new Set(n.values);e._zod.values=i,T(e,"pattern",o=>{let t=o.def.values;return new RegExp(t.length?`^(${t.map(r=>typeof r=="string"?ve(r):r?ve(r.toString()):String(r)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,t)=>{let r=o.value;return i.has(r)||o.issues.push({code:"invalid_value",values:n.values,input:r,inst:e}),o}}),Hu=f("$ZodFile",(e,n)=>{j.init(e,n),e._zod.parse=(i,o)=>{let t=i.value;return t instanceof File||i.issues.push({expected:"file",code:"invalid_type",input:t,inst:e}),i}}),Xu=f("$ZodTransform",(e,n)=>{j.init(e,n),e._zod.optin="optional",q.memoizer?.guard(e),e._zod.parse=(i,o)=>{if(o.direction==="backward")throw new Ce(e.constructor.name);let t=n.transform(i.value,i);if(o.async)return(t instanceof Promise?t:Promise.resolve(t)).then(a=>(i.value=a,i));if(t instanceof Promise)throw new se;return i.value=t,i}});function Zd(e,n){return e.value=n.issues.length?void 0:n.value,e}var qr=f("$ZodOptional",(e,n)=>{j.init(e,n),T(e,"optin",i=>i.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",T(e,"values",i=>{let o=i.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),T(e,"pattern",i=>{let o=i.def.innerType._zod.pattern;return o?new RegExp(`^(${Ne(o.source)})?$`):void 0}),e._zod.parse=(i,o)=>{if(i.value===void 0){if(n.innerType._zod.optin!=="defaulted")return i;let t=n.innerType._zod.run({value:i.value,issues:[]},o);return t instanceof Promise?t.then(r=>Zd(i,r)):Zd(i,t)}return n.innerType._zod.run(i,o)}}),qu=f("$ZodExactOptional",(e,n)=>{qr.init(e,n),T(e,"values",i=>i.def.innerType._zod.values),T(e,"pattern",i=>i.def.innerType._zod.pattern),e._zod.parse=(i,o)=>n.innerType._zod.run(i,o)}),Yu=f("$ZodNullable",(e,n)=>{j.init(e,n),T(e,"optin",i=>i.def.innerType._zod.optin),T(e,"optout",i=>i.def.innerType._zod.optout),T(e,"pattern",i=>{let o=i.def.innerType._zod.pattern;return o?new RegExp(`^(${Ne(o.source)}|null)$`):void 0}),T(e,"values",i=>i.def.innerType._zod.values?new Set([...i.def.innerType._zod.values,null]):void 0),e._zod.parse=(i,o)=>i.value===null?i:n.innerType._zod.run(i,o)}),Qu=f("$ZodDefault",(e,n)=>{j.init(e,n),e._zod.optin="defaulted",T(e,"values",i=>i.def.innerType._zod.values),e._zod.parse=(i,o)=>{if(o.direction==="backward")return n.innerType._zod.run(i,o);if(i.value===void 0)return i.value=n.defaultValue,i;let t=n.innerType._zod.run(i,o);return t instanceof Promise?t.then(r=>Rd(r,n)):Rd(t,n)}});function Rd(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}var ec=f("$ZodPrefault",(e,n)=>{j.init(e,n),e._zod.optin="defaulted",T(e,"values",i=>i.def.innerType._zod.values),e._zod.parse=(i,o)=>(o.direction==="backward"||i.value===void 0&&(i.value=n.defaultValue),n.innerType._zod.run(i,o))}),tc=f("$ZodNonOptional",(e,n)=>{j.init(e,n),T(e,"values",i=>{let o=i.def.innerType._zod.values;return o?new Set([...o].filter(t=>t!==void 0)):void 0}),e._zod.parse=(i,o)=>{let t=n.innerType._zod.run(i,o);return t instanceof Promise?t.then(r=>Vd(r,e)):Vd(t,e)}});function Vd(e,n){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}var nc=f("$ZodSuccess",(e,n)=>{j.init(e,n),e._zod.parse=(i,o)=>{if(o.direction==="backward")throw new Ce("ZodSuccess");let t=n.innerType._zod.run(i,o);return t instanceof Promise?t.then(r=>(i.value=r.issues.length===0,i)):(i.value=t.issues.length===0,i)}});function Md(e,n,i,o){return n.issues.length?(e.value=i.catchValue({...n,value:e.value,error:{issues:n.issues.map(t=>ce(t,o,G()))},input:e.value}),e):(e.value=n.value,n.memo&&(e.memo=!0),e)}var rc=f("$ZodCatch",(e,n)=>{j.init(e,n),T(e,"optin",i=>i.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),T(e,"optout",i=>i.def.innerType._zod.optout),T(e,"values",i=>i.def.innerType._zod.values),e._zod.parse=(i,o)=>{if(o.direction==="backward")return n.innerType._zod.run(i,o);let t=n.innerType._zod.run({value:i.value,issues:[]},o);return t instanceof Promise?t.then(r=>Md(i,r,n,o)):Md(i,t,n,o)}}),ic=f("$ZodNaN",(e,n)=>{j.init(e,n),e._zod.parse=(i,o)=>((typeof i.value!="number"||!Number.isNaN(i.value))&&i.issues.push({input:i.value,inst:e,expected:"nan",code:"invalid_type"}),i)}),Yr=f("$ZodPipe",(e,n)=>{j.init(e,n),T(e,"values",i=>i.def.in._zod.values),T(e,"optin",i=>i.def.in._zod.optin),T(e,"optout",i=>i.def.out._zod.optout),T(e,"propValues",i=>i.def.in._zod.propValues),e._zod.parse=(i,o)=>{if(o.direction==="backward"){let r=n.out._zod.run(i,o);return r instanceof Promise?r.then(a=>Ur(a,n.in,o)):Ur(r,n.in,o)}let t=n.in._zod.run(i,o);return t instanceof Promise?t.then(r=>Ur(r,n.out,o)):Ur(t,n.out,o)}});function Ur(e,n,i){return e.issues.some(o=>o.code!=="unrecognized_keys")?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues},i)}var Un=f("$ZodCodec",(e,n)=>{j.init(e,n),T(e,"values",i=>i.def.in._zod.values),T(e,"optin",i=>i.def.in._zod.optin),T(e,"optout",i=>i.def.out._zod.optout),T(e,"propValues",i=>i.def.in._zod.propValues),e._zod.parse=(i,o)=>{if((o.direction||"forward")==="forward"){let r=n.in._zod.run(i,o);return r instanceof Promise?r.then(a=>Tr(a,n,o)):Tr(r,n,o)}else{let r=n.out._zod.run(i,o);return r instanceof Promise?r.then(a=>Tr(a,n,o)):Tr(r,n,o)}}});function Tr(e,n,i){if(e.issues.length)return e.aborted=!0,e;if((i.direction||"forward")==="forward"){let t=n.transform(e.value,e);return t instanceof Promise?t.then(r=>Er(e,r,n.out,i)):Er(e,t,n.out,i)}else{let t=n.reverseTransform(e.value,e);return t instanceof Promise?t.then(r=>Er(e,r,n.in,i)):Er(e,t,n.in,i)}}function Er(e,n,i,o){return e.issues.length?(e.aborted=!0,e):i._zod.run({value:n,issues:e.issues},o)}var oc=f("$ZodPreprocess",(e,n)=>{Yr.init(e,n)}),ac=f("$ZodReadonly",(e,n)=>{j.init(e,n),T(e,"propValues",i=>i.def.innerType._zod.propValues),T(e,"values",i=>i.def.innerType._zod.values),T(e,"optin",i=>i.def.innerType?._zod?.optin),T(e,"optout",i=>i.def.innerType?._zod?.optout),e._zod.parse=(i,o)=>{if(o.direction==="backward")return n.innerType._zod.run(i,o);let t=n.innerType._zod.run(i,o);return t instanceof Promise?t.then(Fd):Fd(t)}});function Fd(e){return e.memo||(e.value=Object.freeze(e.value)),e}function r$(e){let n=e._zod.def,i=n.pattern,o=!!n.format?.includes("int"),t,r;for(let u of n.checks??[]){let s=u._zod.def;s.pattern&&(i=s.pattern),o||(o=!!s.format?.includes("int"));let c=s.minimum??s.length,l=s.maximum??s.length;c!==void 0&&(t===void 0||c>t)&&(t=c),l!==void 0&&(r===void 0||lr)return"(?!)";if(t!==void 0||r!==void 0)return ba({minimum:t,maximum:r}).source;let a=e._zod.pattern;return(o&&a===Oe?In:a)?.source}function qa(e){let n=e._zod.def,i=e._zod.pattern?.source,o=n.innerType??e._zod.innerType;if(o){let t=o._zod.pattern?.source,r=qa(o);return i&&t&&r&&r!==t?i.replace(Ne(t),()=>Ne(r)):i}if(n.options){let t=n.options.map(qa);if(t.every(Boolean))return`^(${t.map(r=>Ne(r)).join("|")})$`}return r$(e)}var uc=f("$ZodTemplateLiteral",(e,n)=>{j.init(e,n);let i=[];for(let o of n.parts)if(typeof o=="object"&&o!==null){let t=qa(o);if(!t)throw new Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);i.push(Ne(t))}else if(o===null||To.has(typeof o))i.push(ve(`${o}`));else throw new Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${i.join("")}$`),e._zod.parse=(o,t)=>typeof o.value!="string"?(o.issues.push({input:o.value,inst:e,expected:"string",code:"invalid_type"}),o):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(o.value)||o.issues.push({input:o.value,inst:e,code:"invalid_format",format:n.format??"template_literal",pattern:e._zod.pattern.source}),o)}),cc=f("$ZodFunction",(e,n)=>(j.init(e,n),Object.defineProperty(e,"_def",{value:n}),e._zod.def=n,e.implement=i=>{if(typeof i!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...o){let t=e._def.input?$r(e._def.input,o):o,r=Reflect.apply(i,this,t);return e._def.output?$r(e._def.output,r):r},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=i=>{if(typeof i!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...o){let t=e._def.input?await yr(e._def.input,o):o,r=await Reflect.apply(i,this,t);return e._def.output?await yr(e._def.output,r):r},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(i,o)=>typeof i.value!="function"?(i.issues.push({code:"invalid_type",expected:"function",input:i.value,inst:e}),i):(e._def.output&&e._def.output._zod.def.type==="promise"?i.value=e.implementAsync(i.value):i.value=e.implement(i.value),i),e.input=(...i)=>{let o=e.constructor;return Array.isArray(i[0])?new o({type:"function",input:new Xr({type:"tuple",items:i[0],rest:i[1]}),output:e._def.output}):new o({type:"function",input:i[0],output:e._def.output})},e.output=i=>{let o=e.constructor;return new o({type:"function",input:e._def.input,output:i})},e)),sc=f("$ZodPromise",(e,n)=>{j.init(e,n),e._zod.parse=(i,o)=>Promise.resolve(i.value).then(t=>n.innerType._zod.run({value:t,issues:[]},o))}),Tn=f("$ZodLazy",(e,n)=>{j.init(e,n),jo(e._zod,"innerType",()=>{let i=n;return i._cachedInner||(i._cachedInner=n.getter()),i._cachedInner}),T(e,"pattern",i=>i.innerType?._zod?.pattern),T(e,"propValues",i=>i.innerType?._zod?.propValues),T(e,"optin",i=>i.innerType?._zod?.optin??void 0),T(e,"optout",i=>i.innerType?._zod?.optout??void 0),e._zod.parse=(i,o)=>e._zod.innerType._zod.run(i,o)}),lc=f("$ZodCustom",(e,n)=>{M.init(e,n),j.init(e,n),e._zod.parse=(i,o)=>i,e._zod.check=i=>{let o=i.value,t=n.fn(o);if(t instanceof Promise)return t.then(r=>Gd(r,i,o,e));Gd(t,i,o,e)}});function Gd(e,n,i,o){if(!e){let t={code:"custom",input:i,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(t.params=o._zod.def.params),n.issues.push(St(t))}}var ni=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},pc="~memo",Yd=[];function Qd(e){return e!==null&&typeof e=="object"}function dc(e){return e.map(n=>n.path?{...n,path:n.path.slice()}:{...n})}var ep=new WeakMap,At=0,ti=1,En=2;function Ln(e,n,i){let o=ep.get(e);if(o!==void 0)return o?En:At;if(n.has(e))return En;n.add(e);let t=At,r=l=>{if(t!==En&&l?._zod){let d=Ln(l,n,i);d>t&&(t=d)}},a=(l,d)=>{let m=At;for(let p of Reflect.ownKeys(l)){let v=Object.getOwnPropertyDescriptor(l,p);if(d&&!v.enumerable)continue;let b=v.get?ti:v.value?._zod?Ln(v.value,n,i):At;b>m&&(m=b)}return m},u=l=>{l>t&&(t=l)},s=e._zod.def,c=s.type;switch(c){case"object":{let l=It(s);u(l?a(l,!0):ti),r(s.catchall);break}case"array":r(s.element);break;case"tuple":for(let l of s.items)r(l);r(s.rest);break;case"record":case"map":r(s.keyType),r(s.valueType);break;case"set":r(s.valueType);break;case"union":for(let l of s.options)r(l);break;case"intersection":r(s.left),r(s.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":r(s.innerType);break;case"pipe":r(s.in),r(s.out);break;case"function":r(s.input),r(s.output);break;case"lazy":{let l=s._cachedInner??(i?e._zod.innerType:void 0);u(l?Ln(l,n,!1):ti);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in s){let d=Object.getOwnPropertyDescriptor(s,l);if(!d||d.get)continue;let m=d.value;if(!(!m||typeof m!="object")){if(m._zod)r(m);else if(Array.isArray(m))for(let p of m)r(p)}}}return n.delete(e),i$(e,t)}function i$(e,n){return n!==ti&&ep.set(e,n===En),n}function ri(e){return Ln(e,new Set,!0)!==At}function o$(e,n){let i=e.buckets.get(n);return i||(i=new WeakMap,e.buckets.set(n,i)),i}var Qr,ei=[],a$={alloc(e,n,i){let o=Qr;if(!o)return i;Qr=void 0;let t={value:i,issues:null};return o.set(n.value,t),ei.push(t),i},guard(e){var n;(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,o=(t,r)=>{if(r.direction!=="backward"&&ii(r,t.value))throw new ni;return i(t,r)};e._zod.parse=o,e._zod.run===i&&(e._zod.run=o)})},attach(e){var n;let i,o=!1,t,r;(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred.push(()=>{let a=e._zod.parse,u=(s,c)=>{if(i===void 0){let z=Ln(e,new Set,!1);if(z===At)return e._zod.parse=a,e._zod.run===u&&(e._zod.run=a),a(s,c);z===En||o?i=!0:o=!0}let l=s.value;if(!Qd(l))return a(s,c);let d=c[pc];d||(d={buckets:new WeakMap,backEdges:void 0},c[pc]=d);let m;t===c?m=r:(m=o$(d,e),t=c,r=m);let p=m.get(l);if(p)return s.value=p.value,p.issues?p.issues.length&&s.issues.push(...dc(p.issues)):(s.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(p.value)),s;Qr=m;let v=ei.length,b=a(s,c);Qr=void 0;let w=ei.length>v?ei.pop():void 0;return b instanceof Promise?b.then(z=>(w&&(w.issues=z.issues.length?dc(z.issues):Yd),z)):(w&&(w.issues=b.issues.length?dc(b.issues):Yd),b)};e._zod.parse=u,e._zod.run===a&&(e._zod.run=u)})}};function Cn(){return a$}function ii(e,n){let i=e[pc]?.backEdges;return i!==void 0&&Qd(n)&&i.has(n)}var Rn={};Pe(Rn,{ar:()=>tp,az:()=>np,be:()=>ip,bg:()=>op,bn:()=>ap,ca:()=>up,ckb:()=>cp,cs:()=>sp,da:()=>lp,de:()=>dp,el:()=>pp,en:()=>oi,eo:()=>mp,es:()=>fp,fa:()=>gp,fi:()=>vp,fr:()=>hp,frCA:()=>$p,gu:()=>yp,he:()=>_p,hi:()=>bp,hr:()=>xp,hu:()=>kp,hy:()=>wp,id:()=>Sp,is:()=>zp,it:()=>Pp,ja:()=>Dp,ka:()=>Np,kh:()=>Op,km:()=>ai,kn:()=>jp,ko:()=>Ap,lt:()=>Tp,mk:()=>Ep,ms:()=>Lp,ne:()=>Cp,nl:()=>Zp,nn:()=>Rp,no:()=>Vp,ota:()=>Mp,pl:()=>Gp,ps:()=>Fp,pt:()=>Jp,ptBR:()=>Bp,ro:()=>Kp,ru:()=>Hp,sk:()=>Xp,sl:()=>qp,sv:()=>Yp,ta:()=>Qp,tg:()=>em,th:()=>tm,tk:()=>nm,tr:()=>rm,ua:()=>im,uk:()=>ui,ur:()=>om,uz:()=>am,vi:()=>um,yo:()=>lm,zhCN:()=>cm,zhTW:()=>sm});var u$=()=>{let e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"},map:{unit:"عنصر",verb:"أن يحوي"}};function n(t){return e[t]??null}let i={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",mac:"عنوان MAC",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",credit_card:"رقم بطاقة الائتمان",currency_code:"رمز العملة",iban:"IBAN",jwt:"JWT",template_literal:"مدخل"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`مدخلات غير مقبولة: يفترض إدخال instanceof ${t.expected}، ولكن تم إدخال ${u}`:`مدخلات غير مقبولة: يفترض إدخال ${r}، ولكن تم إدخال ${u}`}case"invalid_value":return t.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${_(t.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?` أكبر من اللازم: يفترض أن تكون ${t.origin??"القيمة"} ${r} ${t.maximum.toString()} ${a.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${t.origin??"القيمة"} ${r} ${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`أصغر من اللازم: يفترض لـ ${t.origin} أن يكون ${r} ${t.minimum.toString()} ${a.unit}`:`أصغر من اللازم: يفترض لـ ${t.origin} أن يكون ${r} ${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${t.prefix}"`:r.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${r.suffix}"`:r.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${r.includes}"`:r.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${r.pattern}`:`${i[r.format]??t.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${t.divisor}`;case"unrecognized_keys":return`معرف${t.keys.length>1?"ات":""} غريب${t.keys.length>1?"ة":""}: ${g(t.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${t.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${t.origin}`;default:return"مدخل غير مقبول"}}};function tp(){return{localeError:u$()}}var c$=()=>{let e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"},map:{unit:"element",verb:"olmalıdır"}};function n(t){return e[t]??null}let i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"kredit kartı nömrəsi",currency_code:"valyuta kodu",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Yanlış dəyər: gözlənilən instanceof ${t.expected}, daxil olan ${u}`:`Yanlış dəyər: gözlənilən ${r}, daxil olan ${u}`}case"invalid_value":return t.values.length===1?`Yanlış dəyər: gözlənilən ${_(t.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Çox böyük: gözlənilən ${t.origin??"dəyər"} ${r}${t.maximum.toString()} ${a.unit??"element"}`:`Çox böyük: gözlənilən ${t.origin??"dəyər"} ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Çox kiçik: gözlənilən ${t.origin} ${r}${t.minimum.toString()} ${a.unit}`:`Çox kiçik: gözlənilən ${t.origin} ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Yanlış mətn: "${r.prefix}" ilə başlamalıdır`:r.format==="ends_with"?`Yanlış mətn: "${r.suffix}" ilə bitməlidir`:r.format==="includes"?`Yanlış mətn: "${r.includes}" daxil olmalıdır`:r.format==="regex"?`Yanlış mətn: ${r.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${i[r.format]??t.format}`}case"not_multiple_of":return`Yanlış ədəd: ${t.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${t.keys.length>1?"lar":""}: ${g(t.keys,", ")}`;case"invalid_key":return`${t.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${t.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function np(){return{localeError:c$()}}function rp(e,n,i,o){let t=Math.abs(e),r=t%10,a=t%100;return a>=11&&a<=19?o:r===1?n:r>=2&&r<=4?i:o}var s$=()=>{let e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},map:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function n(t){return e[t]??null}let i={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",mac:"MAC адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",credit_card:"нумар крэдытнай карты",currency_code:"код валюты",iban:"IBAN",jwt:"JWT",template_literal:"увод"},o={nan:"NaN",number:"лік",array:"масіў"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Няправільны ўвод: чакаўся instanceof ${t.expected}, атрымана ${u}`:`Няправільны ўвод: чакаўся ${r}, атрымана ${u}`}case"invalid_value":return t.values.length===1?`Няправільны ўвод: чакалася ${_(t.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);if(a){let u=Number(t.maximum),s=rp(u,a.unit.one,a.unit.few,a.unit.many);return`Занадта вялікі: чакалася, што ${t.origin??"значэнне"} павінна ${a.verb} ${r}${t.maximum.toString()} ${s}`}return`Занадта вялікі: чакалася, што ${t.origin??"значэнне"} павінна быць ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);if(a){let u=Number(t.minimum),s=rp(u,a.unit.one,a.unit.few,a.unit.many);return`Занадта малы: чакалася, што ${t.origin} павінна ${a.verb} ${r}${t.minimum.toString()} ${s}`}return`Занадта малы: чакалася, што ${t.origin} павінна быць ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${r.prefix}"`:r.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${r.suffix}"`:r.format==="includes"?`Няправільны радок: павінен змяшчаць "${r.includes}"`:r.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${r.pattern}`:`Няправільны ${i[r.format]??t.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${t.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${t.keys.length>1?"ключы":"ключ"}: ${g(t.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${t.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${t.origin}`;default:return"Няправільны ўвод"}}};function ip(){return{localeError:s$()}}var l$=()=>{let e={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"},map:{unit:"елемента",verb:"да съдържа"}};function n(t){return e[t]??null}let i={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",mac:"MAC адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",credit_card:"номер на кредитна карта",currency_code:"код на валута",iban:"IBAN",jwt:"JWT",template_literal:"вход"},o={nan:"NaN",number:"число",array:"масив"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Невалиден вход: очакван instanceof ${t.expected}, получен ${u}`:`Невалиден вход: очакван ${r}, получен ${u}`}case"invalid_value":return t.values.length===1?`Невалиден вход: очакван ${_(t.values[0])}`:`Невалидна опция: очаквано едно от ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Твърде голямо: очаква се ${t.origin??"стойност"} да съдържа ${r}${t.maximum.toString()} ${a.unit??"елемента"}`:`Твърде голямо: очаква се ${t.origin??"стойност"} да бъде ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Твърде малко: очаква се ${t.origin} да съдържа ${r}${t.minimum.toString()} ${a.unit}`:`Твърде малко: очаква се ${t.origin} да бъде ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;if(r.format==="starts_with")return`Невалиден низ: трябва да започва с "${r.prefix}"`;if(r.format==="ends_with")return`Невалиден низ: трябва да завършва с "${r.suffix}"`;if(r.format==="includes")return`Невалиден низ: трябва да включва "${r.includes}"`;if(r.format==="regex")return`Невалиден низ: трябва да съвпада с ${r.pattern}`;let a="Невалиден";return r.format==="emoji"&&(a="Невалидно"),r.format==="datetime"&&(a="Невалидно"),r.format==="date"&&(a="Невалидна"),r.format==="time"&&(a="Невалидно"),r.format==="duration"&&(a="Невалидна"),`${a} ${i[r.format]??t.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${t.divisor}`;case"unrecognized_keys":return`Неразпознат${t.keys.length>1?"и":""} ключ${t.keys.length>1?"ове":""}: ${g(t.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${t.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${t.origin}`;default:return"Невалиден вход"}}};function op(){return{localeError:l$()}}var d$=()=>{let e={string:{unit:"অক্ষর",verb:"থাকতে হবে"},file:{unit:"বাইট",verb:"থাকতে হবে"},array:{unit:"আইটেম",verb:"থাকতে হবে"},set:{unit:"আইটেম",verb:"থাকতে হবে"},map:{unit:"এন্ট্রি",verb:"থাকতে হবে"}};function n(t){return e[t]??null}let i={regex:"ইনপুট",email:"ইমেইল ঠিকানা",url:"URL",emoji:"ইমোজি",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO তারিখ ও সময়",date:"ISO তারিখ",time:"ISO সময়",duration:"ISO সময়কাল",ipv4:"IPv4 ঠিকানা",ipv6:"IPv6 ঠিকানা",mac:"MAC ঠিকানা",cidrv4:"IPv4 রেঞ্জ",cidrv6:"IPv6 রেঞ্জ",base64:"base64-এনকোডেড স্ট্রিং",base64url:"base64url-এনকোডেড স্ট্রিং",json_string:"JSON স্ট্রিং",e164:"E.164 নম্বর",credit_card:"ক্রেডিট কার্ড নম্বর",currency_code:"মুদ্রা কোড",iban:"IBAN",jwt:"JWT",template_literal:"ইনপুট"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return`অবৈধ ইনপুট: প্রত্যাশিত ${r}, প্রাপ্ত ${u}`}case"invalid_value":return t.values.length===1?`অবৈধ ইনপুট: প্রত্যাশিত ${_(t.values[0])}`:`অবৈধ অপশন: ${g(t.values," | ")} এর মধ্যে একটি প্রত্যাশিত`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`অনেক বড়: ${t.origin??"মান"} ${r}${t.maximum.toString()} ${a.unit??"এলিমেন্ট"} হতে হবে`:`অনেক বড়: ${t.origin??"মান"} ${r}${t.maximum.toString()} হতে হবে`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`অনেক ছোট: ${t.origin} ${r}${t.minimum.toString()} ${a.unit} হতে হবে`:`অনেক ছোট: ${t.origin} ${r}${t.minimum.toString()} হতে হবে`}case"invalid_format":{let r=t;return r.format==="starts_with"?`অবৈধ স্ট্রিং: "${r.prefix}" দিয়ে শুরু হতে হবে`:r.format==="ends_with"?`অবৈধ স্ট্রিং: "${r.suffix}" দিয়ে শেষ হতে হবে`:r.format==="includes"?`অবৈধ স্ট্রিং: "${r.includes}" অন্তর্ভুক্ত থাকতে হবে`:r.format==="regex"?`অবৈধ স্ট্রিং: ${r.pattern} প্যাটার্ন মিলতে হবে`:`অবৈধ ${i[r.format]??t.format}`}case"not_multiple_of":return`অবৈধ নম্বর: ${t.divisor} এর গুণিতক হতে হবে`;case"unrecognized_keys":return`অচেনা কী${t.keys.length>1?"গুলো":""}: ${g(t.keys,", ")}`;case"invalid_key":return`${t.origin} এ অবৈধ কী`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`অবৈধ ডিসক্রিমিনেটর মান। প্রত্যাশিত ${t.options.map(a=>`'${a}'`).join(" | ")}`:"অবৈধ ইনপুট";case"invalid_element":return`${t.origin} এ অবৈধ মান`;default:return"অবৈধ ইনপুট"}}};function ap(){return{localeError:d$()}}var p$=()=>{let e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"},map:{unit:"elements",verb:"contenir"}};function n(t){return e[t]??null}let i={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",mac:"adreça MAC",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",credit_card:"número de targeta de crèdit",currency_code:"codi de moneda",iban:"IBAN",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Tipus invàlid: s'esperava instanceof ${t.expected}, s'ha rebut ${u}`:`Tipus invàlid: s'esperava ${r}, s'ha rebut ${u}`}case"invalid_value":return t.values.length===1?`Valor invàlid: s'esperava ${_(t.values[0])}`:`Opció invàlida: s'esperava una de ${g(t.values," o ")}`;case"too_big":{let r=t.inclusive?"com a màxim":"menys de",a=n(t.origin);return a?`Massa gran: s'esperava que ${t.origin??"el valor"} contingués ${r} ${t.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${t.origin??"el valor"} fos ${r} ${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?"com a mínim":"més de",a=n(t.origin);return a?`Massa petit: s'esperava que ${t.origin} contingués ${r} ${t.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${t.origin} fos ${r} ${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Format invàlid: ha de començar amb "${r.prefix}"`:r.format==="ends_with"?`Format invàlid: ha d'acabar amb "${r.suffix}"`:r.format==="includes"?`Format invàlid: ha d'incloure "${r.includes}"`:r.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${r.pattern}`:`Format invàlid per a ${i[r.format]??t.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${t.divisor}`;case"unrecognized_keys":return`Clau${t.keys.length>1?"s":""} no reconeguda${t.keys.length>1?"s":""}: ${g(t.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${t.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${t.origin}`;default:return"Entrada invàlida"}}};function up(){return{localeError:p$()}}var m$=()=>{let e={string:{unit:"پیت",verb:"بێت"},file:{unit:"بایت",verb:"بێت"},array:{unit:"دانە",verb:"بێت"},set:{unit:"دانە",verb:"بێت"},map:{unit:"دانە",verb:"بێت"}};function n(t){return e[t]??null}let i={regex:"regex",email:"ئیمەیڵ",url:"بەستەر (URL)",emoji:"ئیمۆجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ڕێکەوت و کات",date:"ڕێکەوت",time:"کات",duration:"ماوە",ipv4:"ناونیشانی IPv4",ipv6:"ناونیشانی IPv6",mac:"ناونیشانی MAC",cidrv4:"مەودای IPv4",cidrv6:"مەودای IPv6",base64:"دەقی base64",base64url:"دەقی base64url",json_string:"دەقی JSON",e164:"ژمارەی E.164",credit_card:"ژمارەی کارتی کرێدیت",currency_code:"کۆدی دراو",iban:"IBAN",jwt:"JWT",template_literal:"تێکردە"},o={nan:"NaN",string:"نووسین",number:"ژمارە",boolean:"boolean",array:"array",object:"object",date:"ڕێکەوت",integer:"ژمارە",float:"ژمارە",null:"null",undefined:"undefined",function:"function",symbol:"symbol",unknown:"unknown",promise:"promise",void:"void",never:"never",map:"map",set:"set"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a,s=["ا","و","ۆ","وو","ە","ی","ێ"].some(l=>u.endsWith(l))?"یە":"ە",c=/^[a-zA-Z]+$/.test(u);return a==="null"||a==="undefined"?"داواکراوە":`چاوەڕوانکراوە ${r} بێت، بەڵام ${u}${c?"":s}`}case"invalid_value":return t.values.length===1?`بەهاکە نادرووستە: چاوەڕوانکراوە ${_(t.values[0])} بێت`:`هەڵبژاردەی نادروست: چاوەڕوانکراوە یەکێک بێت لە ${g(t.values,"|")}`;case"too_big":{let r=n(t.origin);return r?`پێویستە بە لایەنی زۆرەوە ${t.maximum.toString()} ${r.unit} ${r.verb}`:`پێویستە بە لایەنی زۆرەوە ${t.maximum.toString()} بێت`}case"too_small":{let r=n(t.origin);return r?`پێویستە بە لایەنی کەمەوە ${t.minimum.toString()} ${r.unit} ${r.verb}`:`پێویستە بە لایەنی کەمەوە ${t.minimum.toString()} بێت`}case"invalid_format":{let r=t;return r.format==="starts_with"?`دەقی نادروست: پێویستە دەستپێبکات بە "${r.prefix}"`:r.format==="ends_with"?`دەقی نادروست: پێویستە کۆتاییبێت بە "${r.suffix}"`:r.format==="includes"?`دەقی نادروست: پێویستە "${r.includes}" لەخۆبگرێت`:r.format==="regex"?`دەقی نادروست: پێویستە لەگەڵ پاتێرنی ${r.pattern} بگونجێت`:`بەهای ${i[r.format]??t.format} نادروستە`}case"not_multiple_of":return`ژمارەی نادروست: دەبێت چەند هێندە بێت بۆ ${t.divisor}`;case"unrecognized_keys":return`کلیلی نەناسراو: ${g(t.keys,", ")}`;case"invalid_key":return`کلیلی نادروست لە ${t.origin}`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`بەهای نەناسراو هەیە. بەهای چاوەڕوانکراو: ${t.options.map(a=>`'${a}'`).join(" | ")}`:"یەکگرتنی نادروست";case"invalid_element":return`${t.origin} بەهاکە نادروستە`;default:return"تێکردەی نادروست"}}};function cp(){return{localeError:m$()}}var f$=()=>{let e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"},map:{unit:"prvků",verb:"mít"}};function n(t){return e[t]??null}let i={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",credit_card:"číslo kreditní karty",currency_code:"kód měny",iban:"IBAN",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Neplatný vstup: očekáváno instanceof ${t.expected}, obdrženo ${u}`:`Neplatný vstup: očekáváno ${r}, obdrženo ${u}`}case"invalid_value":return t.values.length===1?`Neplatný vstup: očekáváno ${_(t.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Hodnota je příliš velká: ${t.origin??"hodnota"} musí mít ${r}${t.maximum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš velká: ${t.origin??"hodnota"} musí být ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Hodnota je příliš malá: ${t.origin??"hodnota"} musí mít ${r}${t.minimum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš malá: ${t.origin??"hodnota"} musí být ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Neplatný řetězec: musí začínat na "${r.prefix}"`:r.format==="ends_with"?`Neplatný řetězec: musí končit na "${r.suffix}"`:r.format==="includes"?`Neplatný řetězec: musí obsahovat "${r.includes}"`:r.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${r.pattern}`:`Neplatný formát ${i[r.format]??t.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${t.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${g(t.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${t.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${t.origin}`;default:return"Neplatný vstup"}}};function sp(){return{localeError:f$()}}var g$=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"},map:{unit:"elementer",verb:"indeholdt"}};function n(t){return e[t]??null}let i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kreditkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ugyldigt input: forventede instanceof ${t.expected}, fik ${u}`:`Ugyldigt input: forventede ${r}, fik ${u}`}case"invalid_value":return t.values.length===1?`Ugyldig værdi: forventede ${_(t.values[0])}`:`Ugyldigt valg: forventede en af følgende ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin),u=o[t.origin]??t.origin;return a?`For stor: forventede ${u??"value"} ${a.verb} ${r} ${t.maximum.toString()} ${a.unit??"elementer"}`:`For stor: forventede ${u??"value"} havde ${r} ${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin),u=o[t.origin]??t.origin;return a?`For lille: forventede ${u} ${a.verb} ${r} ${t.minimum.toString()} ${a.unit}`:`For lille: forventede ${u} havde ${r} ${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ugyldig streng: skal starte med "${r.prefix}"`:r.format==="ends_with"?`Ugyldig streng: skal ende med "${r.suffix}"`:r.format==="includes"?`Ugyldig streng: skal indeholde "${r.includes}"`:r.format==="regex"?`Ugyldig streng: skal matche mønsteret ${r.pattern}`:`Ugyldig ${i[r.format]??t.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${g(t.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${t.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${t.origin}`;default:return"Ugyldigt input"}}};function lp(){return{localeError:g$()}}var v$=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"},map:{unit:"Elemente",verb:"zu haben"}};function n(t){return e[t]??null}let i={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",mac:"MAC-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",credit_card:"Kreditkartennummer",currency_code:"Währungscode",iban:"IBAN",jwt:"JWT",template_literal:"Eingabe"},o={nan:"NaN",number:"Zahl",array:"Array"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ungültige Eingabe: erwartet instanceof ${t.expected}, erhalten ${u}`:`Ungültige Eingabe: erwartet ${r}, erhalten ${u}`}case"invalid_value":return t.values.length===1?`Ungültige Eingabe: erwartet ${_(t.values[0])}`:`Ungültige Option: erwartet eine von ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Zu groß: erwartet, dass ${t.origin??"Wert"} ${r}${t.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${t.origin??"Wert"} ${r}${t.maximum.toString()} ist`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Zu klein: erwartet, dass ${t.origin} ${r}${t.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${t.origin} ${r}${t.minimum.toString()} ist`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ungültiger String: muss mit "${r.prefix}" beginnen`:r.format==="ends_with"?`Ungültiger String: muss mit "${r.suffix}" enden`:r.format==="includes"?`Ungültiger String: muss "${r.includes}" enthalten`:r.format==="regex"?`Ungültiger String: muss dem Muster ${r.pattern} entsprechen`:`Ungültig: ${i[r.format]??t.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${t.divisor} sein`;case"unrecognized_keys":return`${t.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${g(t.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${t.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${t.origin}`;default:return"Ungültige Eingabe"}}};function dp(){return{localeError:v$()}}var h$=()=>{let e={string:{unit:"χαρακτήρες",verb:"να έχει"},file:{unit:"bytes",verb:"να έχει"},array:{unit:"στοιχεία",verb:"να έχει"},set:{unit:"στοιχεία",verb:"να έχει"},map:{unit:"καταχωρήσεις",verb:"να έχει"}};function n(t){return e[t]??null}let i={regex:"είσοδος",email:"διεύθυνση email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ημερομηνία και ώρα",date:"ISO ημερομηνία",time:"ISO ώρα",duration:"ISO διάρκεια",ipv4:"διεύθυνση IPv4",ipv6:"διεύθυνση IPv6",mac:"διεύθυνση MAC",cidrv4:"εύρος IPv4",cidrv6:"εύρος IPv6",base64:"συμβολοσειρά κωδικοποιημένη σε base64",base64url:"συμβολοσειρά κωδικοποιημένη σε base64url",json_string:"συμβολοσειρά JSON",e164:"αριθμός E.164",credit_card:"αριθμός πιστωτικής κάρτας",currency_code:"κωδικός νομίσματος",iban:"IBAN",jwt:"JWT",template_literal:"είσοδος"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return typeof t.expected=="string"&&/^[A-Z]/.test(t.expected)?`Μη έγκυρη είσοδος: αναμενόταν instanceof ${t.expected}, λήφθηκε ${u}`:`Μη έγκυρη είσοδος: αναμενόταν ${r}, λήφθηκε ${u}`}case"invalid_value":return t.values.length===1?`Μη έγκυρη είσοδος: αναμενόταν ${_(t.values[0])}`:`Μη έγκυρη επιλογή: αναμενόταν ένα από ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Πολύ μεγάλο: αναμενόταν ${t.origin??"τιμή"} να έχει ${r}${t.maximum.toString()} ${a.unit??"στοιχεία"}`:`Πολύ μεγάλο: αναμενόταν ${t.origin??"τιμή"} να είναι ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Πολύ μικρό: αναμενόταν ${t.origin} να έχει ${r}${t.minimum.toString()} ${a.unit}`:`Πολύ μικρό: αναμενόταν ${t.origin} να είναι ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${r.prefix}"`:r.format==="ends_with"?`Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${r.suffix}"`:r.format==="includes"?`Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${r.includes}"`:r.format==="regex"?`Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${r.pattern}`:`Μη έγκυρο: ${i[r.format]??t.format}`}case"not_multiple_of":return`Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${t.divisor}`;case"unrecognized_keys":return`Άγνωστ${t.keys.length>1?"α":"ο"} κλειδ${t.keys.length>1?"ιά":"ί"}: ${g(t.keys,", ")}`;case"invalid_key":return`Μη έγκυρο κλειδί στο ${t.origin}`;case"invalid_union":return"Μη έγκυρη είσοδος";case"invalid_element":return`Μη έγκυρη τιμή στο ${t.origin}`;default:return"Μη έγκυρη είσοδος"}}};function pp(){return{localeError:h$()}}var $$=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function n(r){return e[r]??null}let i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function t(r,a){return r==="number"&&typeof a=="number"&&!Number.isFinite(a)?String(a):o[r]??r}return r=>{switch(r.code){case"invalid_type":{let a=t(r.expected),u=x(r.input),s=t(u,r.input);return`Invalid input: expected ${a}, received ${s}`}case"invalid_value":return r.values.length===1?`Invalid input: expected ${_(r.values[0])}`:`Invalid option: expected one of ${g(r.values,"|")}`;case"too_big":{let a=r.exact?"exactly ":r.inclusive?"<=":"<",u=n(r.origin);return u?`Too big: expected ${r.origin??"value"} to have ${a}${r.maximum.toString()} ${u.unit??"elements"}`:`Too big: expected ${r.origin??"value"} to be ${a}${r.maximum.toString()}`}case"too_small":{let a=r.exact?"exactly ":r.inclusive?">=":">",u=n(r.origin);return u?`Too small: expected ${r.origin} to have ${a}${r.minimum.toString()} ${u.unit}`:`Too small: expected ${r.origin} to be ${a}${r.minimum.toString()}`}case"invalid_format":{let a=r;return a.format==="starts_with"?`Invalid string: must start with "${a.prefix}"`:a.format==="ends_with"?`Invalid string: must end with "${a.suffix}"`:a.format==="includes"?`Invalid string: must include "${a.includes}"`:a.format==="regex"?`Invalid string: must match pattern ${a.pattern}`:`Invalid ${i[a.format]??r.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${g(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":return r.options&&Array.isArray(r.options)&&r.options.length>0?`Invalid discriminator value. Expected ${r.options.map(u=>`'${u}'`).join(" | ")}`:r.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}};function oi(){return{localeError:$$()}}var y$=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"},map:{unit:"elementojn",verb:"havi"}};function n(t){return e[t]??null}let i={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",mac:"MAC-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",credit_card:"kreditkarta numero",currency_code:"valuta kodo",iban:"IBAN",jwt:"JWT",template_literal:"enigo"},o={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Nevalida enigo: atendiĝis instanceof ${t.expected}, riceviĝis ${u}`:`Nevalida enigo: atendiĝis ${r}, riceviĝis ${u}`}case"invalid_value":return t.values.length===1?`Nevalida enigo: atendiĝis ${_(t.values[0])}`:`Nevalida opcio: atendiĝis unu el ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Tro granda: atendiĝis ke ${t.origin??"valoro"} havu ${r}${t.maximum.toString()} ${a.unit??"elementojn"}`:`Tro granda: atendiĝis ke ${t.origin??"valoro"} havu ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Tro malgranda: atendiĝis ke ${t.origin} havu ${r}${t.minimum.toString()} ${a.unit}`:`Tro malgranda: atendiĝis ke ${t.origin} estu ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Nevalida karaktraro: devas komenciĝi per "${r.prefix}"`:r.format==="ends_with"?`Nevalida karaktraro: devas finiĝi per "${r.suffix}"`:r.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${r.includes}"`:r.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${r.pattern}`:`Nevalida ${i[r.format]??t.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${t.divisor}`;case"unrecognized_keys":return`Nekonata${t.keys.length>1?"j":""} ŝlosilo${t.keys.length>1?"j":""}: ${g(t.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${t.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${t.origin}`;default:return"Nevalida enigo"}}};function mp(){return{localeError:y$()}}var _$=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function n(t){return e[t]??null}let i={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",mac:"dirección MAC",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",credit_card:"número de tarjeta de crédito",currency_code:"código de moneda",iban:"IBAN",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Entrada inválida: se esperaba instanceof ${t.expected}, recibido ${u}`:`Entrada inválida: se esperaba ${r}, recibido ${u}`}case"invalid_value":return t.values.length===1?`Entrada inválida: se esperaba ${_(t.values[0])}`:`Opción inválida: se esperaba una de ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin),u=o[t.origin]??t.origin;return a?`Demasiado grande: se esperaba que ${u??"valor"} tuviera ${r}${t.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${u??"valor"} fuera ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin),u=o[t.origin]??t.origin;return a?`Demasiado pequeño: se esperaba que ${u} tuviera ${r}${t.minimum.toString()} ${a.unit}`:`Demasiado pequeño: se esperaba que ${u} fuera ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Cadena inválida: debe comenzar con "${r.prefix}"`:r.format==="ends_with"?`Cadena inválida: debe terminar en "${r.suffix}"`:r.format==="includes"?`Cadena inválida: debe incluir "${r.includes}"`:r.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${r.pattern}`:`Inválido ${i[r.format]??t.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${t.divisor}`;case"unrecognized_keys":return`Llave${t.keys.length>1?"s":""} desconocida${t.keys.length>1?"s":""}: ${g(t.keys,", ")}`;case"invalid_key":return`Llave inválida en ${o[t.origin]??t.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${o[t.origin]??t.origin}`;default:return"Entrada inválida"}}};function fp(){return{localeError:_$()}}var b$=()=>{let e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"},map:{unit:"آیتم",verb:"داشته باشد"}};function n(t){return e[t]??null}let i={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",mac:"MAC آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",credit_card:"شماره کارت اعتباری",currency_code:"کد ارز",iban:"IBAN",jwt:"JWT",template_literal:"ورودی"},o={nan:"NaN",number:"عدد",array:"آرایه"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`ورودی نامعتبر: می‌بایست instanceof ${t.expected} می‌بود، ${u} دریافت شد`:`ورودی نامعتبر: می‌بایست ${r} می‌بود، ${u} دریافت شد`}case"invalid_value":return t.values.length===1?`ورودی نامعتبر: می‌بایست ${_(t.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${g(t.values,"|")} می‌بود`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`خیلی بزرگ: ${t.origin??"مقدار"} باید ${r}${t.maximum.toString()} ${a.unit??"عنصر"} باشد`:`خیلی بزرگ: ${t.origin??"مقدار"} باید ${r}${t.maximum.toString()} باشد`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`خیلی کوچک: ${t.origin} باید ${r}${t.minimum.toString()} ${a.unit} باشد`:`خیلی کوچک: ${t.origin} باید ${r}${t.minimum.toString()} باشد`}case"invalid_format":{let r=t;return r.format==="starts_with"?`رشته نامعتبر: باید با "${r.prefix}" شروع شود`:r.format==="ends_with"?`رشته نامعتبر: باید با "${r.suffix}" تمام شود`:r.format==="includes"?`رشته نامعتبر: باید شامل "${r.includes}" باشد`:r.format==="regex"?`رشته نامعتبر: باید با الگوی ${r.pattern} مطابقت داشته باشد`:`${i[r.format]??t.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${t.divisor} باشد`;case"unrecognized_keys":return`کلید${t.keys.length>1?"های":""} ناشناس: ${g(t.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${t.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${t.origin}`;default:return"ورودی نامعتبر"}}};function gp(){return{localeError:b$()}}var x$=()=>{let e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},map:{unit:"alkiota",subject:"kuvauksen"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function n(t){return e[t]??null}let i={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",mac:"MAC-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",credit_card:"luottokortin numero",currency_code:"valuuttakoodi",iban:"IBAN",jwt:"JWT",template_literal:"templaattimerkkijono"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Virheellinen tyyppi: odotettiin instanceof ${t.expected}, oli ${u}`:`Virheellinen tyyppi: odotettiin ${r}, oli ${u}`}case"invalid_value":return t.values.length===1?`Virheellinen syöte: täytyy olla ${_(t.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Liian suuri: ${a.subject} täytyy olla ${r}${t.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon täytyy olla ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Liian pieni: ${a.subject} täytyy olla ${r}${t.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon täytyy olla ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${r.prefix}"`:r.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${r.suffix}"`:r.format==="includes"?`Virheellinen syöte: täytyy sisältää "${r.includes}"`:r.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${r.pattern}`:`Virheellinen ${i[r.format]??t.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${t.divisor} monikerta`;case"unrecognized_keys":return`${t.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${g(t.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function vp(){return{localeError:x$()}}var k$=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function n(t){return e[t]??null}let i={regex:"expression régulière",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",mac:"adresse MAC",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne de caractères encodée en base64",base64url:"chaîne de caractères encodée en base64url",json_string:"chaîne de caractères JSON",e164:"numéro au format E.164",credit_card:"numéro de carte de crédit",currency_code:"code de devise",iban:"IBAN",jwt:"JWT",template_literal:"entrée"},o={string:"chaîne de caractères",number:"nombre",int:"entier",boolean:"booléen",bigint:"grand entier",symbol:"symbole",undefined:"indéfini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"record",map:"map",set:"ensemble",file:"fichier",nonoptional:"non optionnel",nan:"NaN",function:"fonction"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Entrée invalide : instance de ${t.expected} attendu, ${u} reçu`:`Entrée invalide : ${r} attendu, ${u} reçu`}case"invalid_value":return t.values.length===1?`Entrée invalide : ${_(t.values[0])} attendu`:`Option invalide : une valeur parmi ${g(t.values,"|")} attendue`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Trop grand : ${o[t.origin]??"valeur"} doit ${a.verb} ${r}${t.maximum.toString()} ${a.unit??"élément(s)"}`:`Trop grand : ${o[t.origin]??"valeur"} doit être ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Trop petit : ${o[t.origin]??"valeur"} doit ${a.verb} ${r}${t.minimum.toString()} ${a.unit}`:`Trop petit : ${o[t.origin]??"valeur"} doit être ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Chaîne de caractères invalide : doit commencer par "${r.prefix}"`:r.format==="ends_with"?`Chaîne de caractères invalide : doit se terminer par "${r.suffix}"`:r.format==="includes"?`Chaîne de caractères invalide : doit inclure "${r.includes}"`:r.format==="regex"?`Chaîne de caractères invalide : doit correspondre au motif ${r.pattern}`:`${i[r.format]??t.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${t.divisor}`;case"unrecognized_keys":return`Clé${t.keys.length>1?"s":""} non reconnue${t.keys.length>1?"s":""} : ${g(t.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${t.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${t.origin}`;default:return"Entrée invalide"}}};function hp(){return{localeError:k$()}}var I$=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"},map:{unit:"éléments",verb:"avoir"}};function n(t){return e[t]??null}let i={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",mac:"adresse MAC",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",credit_card:"numéro de carte de crédit",currency_code:"code de devise",iban:"IBAN",jwt:"JWT",template_literal:"entrée"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Entrée invalide : attendu instanceof ${t.expected}, reçu ${u}`:`Entrée invalide : attendu ${r}, reçu ${u}`}case"invalid_value":return t.values.length===1?`Entrée invalide : attendu ${_(t.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"≤":"<",a=n(t.origin);return a?`Trop grand : attendu que ${t.origin??"la valeur"} ait ${r}${t.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${t.origin??"la valeur"} soit ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?"≥":">",a=n(t.origin);return a?`Trop petit : attendu que ${t.origin} ait ${r}${t.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${t.origin} soit ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Chaîne invalide : doit commencer par "${r.prefix}"`:r.format==="ends_with"?`Chaîne invalide : doit se terminer par "${r.suffix}"`:r.format==="includes"?`Chaîne invalide : doit inclure "${r.includes}"`:r.format==="regex"?`Chaîne invalide : doit correspondre au motif ${r.pattern}`:`${i[r.format]??t.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${t.divisor}`;case"unrecognized_keys":return`Clé${t.keys.length>1?"s":""} non reconnue${t.keys.length>1?"s":""} : ${g(t.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${t.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${t.origin}`;default:return"Entrée invalide"}}};function $p(){return{localeError:I$()}}var w$=()=>{let e={string:{unit:"અક્ષર",verb:"હોવા જોઈએ"},file:{unit:"બાયટ",verb:"હોવા જોઈએ"},array:{unit:"આઇટમ",verb:"હોવા જોઈએ"},set:{unit:"આઇટમ",verb:"હોવા જોઈએ"},map:{unit:"એન્ટ્રી",verb:"હોવા જોઈએ"}};function n(t){return e[t]??null}let i={regex:"ઇનપુટ",email:"ઈમેઇલ એડ્રેસ",url:"URL",emoji:"ઇમોજી",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO તારીખ અને સમય",date:"ISO તારીખ",time:"ISO સમય",duration:"ISO અવધિ",ipv4:"IPv4 એડ્રેસ",ipv6:"IPv6 એડ્રેસ",mac:"MAC એડ્રેસ",cidrv4:"IPv4 શ્રેણી",cidrv6:"IPv6 શ્રેણી",base64:"base64-એન્કોડેડ સ્ટ્રિંગ",base64url:"base64url-એન્કોડેડ સ્ટ્રિંગ",json_string:"JSON સ્ટ્રિંગ",e164:"E.164 નંબર",credit_card:"ક્રેડિટ કાર્ડ નંબર",currency_code:"ચલણ કોડ",iban:"IBAN",jwt:"JWT",template_literal:"ઇનપુટ"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return`અમાન્ય ઇનપુટ: અપેક્ષિત ${r}, પ્રાપ્ત ${u}`}case"invalid_value":return t.values.length===1?`અમાન્ય ઇનપુટ: અપેક્ષિત ${_(t.values[0])}`:`અમાન્ય વિકલ્પ: ${g(t.values," | ")} માધ્યમથી એક અપેક્ષિત`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`ખૂબ મોટું: ${t.origin??"મૂલ્ય"} ${r}${t.maximum.toString()} ${a.unit??"એલિમેન્ટ"} હોવા જોઈએ`:`ખૂબ મોટું: ${t.origin??"મૂલ્ય"} ${r}${t.maximum.toString()} હોવું જોઈએ`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`ખૂબ નાનું: ${t.origin} ${r}${t.minimum.toString()} ${a.unit} હોવા જોઈએ`:`ખૂબ નાનું: ${t.origin} ${r}${t.minimum.toString()} હોવું જોઈએ`}case"invalid_format":{let r=t;return r.format==="starts_with"?`અમાન્ય સ્ટ્રિંગ: "${r.prefix}" થી શરૂ થવું જોઈએ`:r.format==="ends_with"?`અમાન્ય સ્ટ્રિંગ: "${r.suffix}" પર સમાપ્ત થવું જોઈએ`:r.format==="includes"?`અમાન્ય સ્ટ્રિંગ: "${r.includes}" શામેલ હોવું જોઈએ`:r.format==="regex"?`અમાન્ય સ્ટ્રિંગ: પેટર્ન ${r.pattern} સાથે મેળ ખાવું જોઈએ`:`અમાન્ય ${i[r.format]??t.format}`}case"not_multiple_of":return`અમાન્ય નંબર: ${t.divisor} નો ગુણાંક હોવો જોઈએ`;case"unrecognized_keys":return`ઓળખી શકાતા નહીં તે કી${t.keys.length>1?"ઓ":""}: ${g(t.keys,", ")}`;case"invalid_key":return`${t.origin} માં અમાન્ય કી`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`અમાન્ય ડિસ્ક્રિમિનેટર મૂલ્ય. અપેક્ષિત ${t.options.map(a=>`'${a}'`).join(" | ")}`:"અમાન્ય ઇનપુટ";case"invalid_element":return`${t.origin} માં અમાન્ય મૂલ્ય`;default:return"અમાન્ય ઇનપુટ"}}};function yp(){return{localeError:w$()}}var S$=()=>{let e={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},n={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},i=c=>c?e[c]:void 0,o=c=>{let l=i(c);return l?l.label:c??e.unknown.label},t=c=>`ה${o(c)}`,r=c=>(i(c)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות",a=c=>c?n[c]??null:null,u={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},uuidv4:{label:"UUIDv4",gender:"m"},uuidv6:{label:"UUIDv6",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},mac:{label:"כתובת MAC",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},credit_card:{label:"מספר כרטיס אשראי",gender:"m"},currency_code:{label:"קוד מטבע",gender:"m"},iban:{label:"IBAN",gender:"m"},jwt:{label:"JWT",gender:"m"},template_literal:{label:"קלט",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},s={nan:"NaN"};return c=>{switch(c.code){case"invalid_type":{let l=c.expected,d=s[l??""]??o(l),m=x(c.input),p=s[m]??e[m]?.label??m;return/^[A-Z]/.test(c.expected)?`קלט לא תקין: צריך להיות instanceof ${c.expected}, התקבל ${p}`:`קלט לא תקין: צריך להיות ${d}, התקבל ${p}`}case"invalid_value":{if(c.values.length===1)return`ערך לא תקין: הערך חייב להיות ${_(c.values[0])}`;let l=c.values.map(p=>_(p));if(c.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${l[0]} או ${l[1]}`;let d=l[l.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${l.slice(0,-1).join(", ")} או ${d}`}case"too_big":{let l=a(c.origin),d=t(c.origin??"value");if(c.origin==="string")return`${l?.longLabel??"ארוך"} מדי: ${d} צריכה להכיל ${c.maximum.toString()} ${l?.unit??""} ${c.inclusive?"או פחות":"לכל היותר"}`.trim();if(c.origin==="number"){let v=c.inclusive?`קטן או שווה ל-${c.maximum}`:`קטן מ-${c.maximum}`;return`גדול מדי: ${d} צריך להיות ${v}`}if(c.origin==="array"||c.origin==="set"){let v=c.origin==="set"?"צריכה":"צריך",b=c.inclusive?`${c.maximum} ${l?.unit??""} או פחות`:`פחות מ-${c.maximum} ${l?.unit??""}`;return`גדול מדי: ${d} ${v} להכיל ${b}`.trim()}let m=c.inclusive?"<=":"<",p=r(c.origin??"value");return l?.unit?`${l.longLabel} מדי: ${d} ${p} ${m}${c.maximum.toString()} ${l.unit}`:`${l?.longLabel??"גדול"} מדי: ${d} ${p} ${m}${c.maximum.toString()}`}case"too_small":{let l=a(c.origin),d=t(c.origin??"value");if(c.origin==="string")return`${l?.shortLabel??"קצר"} מדי: ${d} צריכה להכיל ${c.minimum.toString()} ${l?.unit??""} ${c.inclusive?"או יותר":"לפחות"}`.trim();if(c.origin==="number"){let v=c.inclusive?`גדול או שווה ל-${c.minimum}`:`גדול מ-${c.minimum}`;return`קטן מדי: ${d} צריך להיות ${v}`}if(c.origin==="array"||c.origin==="set"){let v=c.origin==="set"?"צריכה":"צריך";if(c.minimum===1&&c.inclusive){let w=(c.origin==="set","לפחות פריט אחד");return`קטן מדי: ${d} ${v} להכיל ${w}`}let b=c.inclusive?`${c.minimum} ${l?.unit??""} או יותר`:`יותר מ-${c.minimum} ${l?.unit??""}`;return`קטן מדי: ${d} ${v} להכיל ${b}`.trim()}let m=c.inclusive?">=":">",p=r(c.origin??"value");return l?.unit?`${l.shortLabel} מדי: ${d} ${p} ${m}${c.minimum.toString()} ${l.unit}`:`${l?.shortLabel??"קטן"} מדי: ${d} ${p} ${m}${c.minimum.toString()}`}case"invalid_format":{let l=c;if(l.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${l.prefix}"`;if(l.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${l.suffix}"`;if(l.format==="includes")return`המחרוזת חייבת לכלול "${l.includes}"`;if(l.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${l.pattern}`;let d=u[l.format],m=d?.label??l.format,v=(d?.gender??"m")==="f"?"תקינה":"תקין";return`${m} לא ${v}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${c.divisor}`;case"unrecognized_keys":return`מפתח${c.keys.length>1?"ות":""} לא מזוה${c.keys.length>1?"ים":"ה"}: ${g(c.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${t(c.origin??"array")}`;default:return"קלט לא תקין"}}};function _p(){return{localeError:S$()}}var z$=()=>{let e={string:{unit:"अक्षर",verb:"रखने के लिए"},file:{unit:"बाइट्स",verb:"रखने के लिए"},array:{unit:"तत्व",verb:"रखने के लिए"},set:{unit:"तत्व",verb:"रखने के लिए"},map:{unit:"प्रविष्टियाँ",verb:"रखने के लिए"}};function n(t){return e[t]??null}let i={regex:"इनपुट",email:"ईमेल पता",url:"URL",emoji:"इमोजी",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO तिथि और समय",date:"ISO तिथि",time:"ISO समय",duration:"ISO अवधि",ipv4:"IPv4 पता",ipv6:"IPv6 पता",mac:"MAC पता",cidrv4:"IPv4 श्रेणी",cidrv6:"IPv6 श्रेणी",base64:"Base64-एन्कोडेड स्ट्रिंग",base64url:"Base64URL-एन्कोडेड स्ट्रिंग",json_string:"JSON स्ट्रिंग",e164:"E.164 संख्या",credit_card:"क्रेडिट कार्ड संख्या",currency_code:"मुद्रा कोड",iban:"IBAN",jwt:"JWT",template_literal:"इनपुट"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return`अमान्य इनपुट: अपेक्षित ${r}, प्राप्त ${u}`}case"invalid_value":return t.values.length===1?`अमान्य इनपुट: अपेक्षित ${_(t.values[0])}`:`अमान्य विकल्प: अपेक्षित मानों में से एक ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`बहुत बड़ा: अपेक्षित था कि ${t.origin??"मान"} में ${r}${t.maximum} ${a.unit} हों`:`बहुत बड़ा: अपेक्षित था कि ${t.origin??"मान"} ${r}${t.maximum} हो`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`बहुत छोटा: अपेक्षित था कि ${t.origin} में ${r}${t.minimum} ${a.unit} हों`:`बहुत छोटा: अपेक्षित था कि ${t.origin} ${r}${t.minimum} हो`}case"invalid_format":{let r=t;return r.format==="starts_with"?`अमान्य स्ट्रिंग: "${r.prefix}" से शुरू होना चाहिए`:r.format==="ends_with"?`अमान्य स्ट्रिंग: "${r.suffix}" पर समाप्त होना चाहिए`:r.format==="includes"?`अमान्य स्ट्रिंग: इसमें "${r.includes}" शामिल होना चाहिए`:r.format==="regex"?`अमान्य स्ट्रिंग: पैटर्न ${r.pattern} से मेल खाना चाहिए`:`अमान्य ${i[r.format]??t.format}`}case"not_multiple_of":return`अमान्य संख्या: यह ${t.divisor} का गुणज होना चाहिए`;case"unrecognized_keys":return`अपरिचित कुंजी${t.keys.length>1?"याँ":""}: ${g(t.keys,", ")}`;case"invalid_key":return`अमान्य कुंजी: ${t.origin} में`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`अमान्य डिस्क्रिमिनेटर मान: अपेक्षित ${t.options.map(a=>`'${a}'`).join(" | ")}`:"अमान्य इनपुट";case"invalid_element":return`अमान्य मान: ${t.origin} में`;default:return"अमान्य इनपुट"}}};function bp(){return{localeError:z$()}}var P$=()=>{let e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function n(t){return e[t]??null}let i={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",credit_card:"broj kreditne kartice",currency_code:"kod valute",iban:"IBAN",jwt:"JWT",template_literal:"unos"},o={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Neispravan unos: očekuje se instanceof ${t.expected}, a primljeno je ${u}`:`Neispravan unos: očekuje se ${r}, a primljeno je ${u}`}case"invalid_value":return t.values.length===1?`Neispravna vrijednost: očekivano ${_(t.values[0])}`:`Neispravna opcija: očekivano jedno od ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin),u=o[t.origin]??t.origin;return a?`Preveliko: očekivano da ${u??"vrijednost"} ima ${r}${t.maximum.toString()} ${a.unit??"elemenata"}`:`Preveliko: očekivano da ${u??"vrijednost"} bude ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin),u=o[t.origin]??t.origin;return a?`Premalo: očekivano da ${u} ima ${r}${t.minimum.toString()} ${a.unit}`:`Premalo: očekivano da ${u} bude ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Neispravan tekst: mora započinjati s "${r.prefix}"`:r.format==="ends_with"?`Neispravan tekst: mora završavati s "${r.suffix}"`:r.format==="includes"?`Neispravan tekst: mora sadržavati "${r.includes}"`:r.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${r.pattern}`:`Neispravna ${i[r.format]??t.format}`}case"not_multiple_of":return`Neispravan broj: mora biti višekratnik od ${t.divisor}`;case"unrecognized_keys":return`Neprepoznat${t.keys.length>1?"i ključevi":" ključ"}: ${g(t.keys,", ")}`;case"invalid_key":return`Neispravan ključ u ${o[t.origin]??t.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${o[t.origin]??t.origin}`;default:return"Neispravan unos"}}};function xp(){return{localeError:P$()}}var D$=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"},map:{unit:"elem",verb:"legyen"}};function n(t){return e[t]??null}let i={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",mac:"MAC cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",credit_card:"hitelkártyaszám",currency_code:"pénznemkód",iban:"IBAN",jwt:"JWT",template_literal:"bemenet"},o={nan:"NaN",number:"szám",array:"tömb"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Érvénytelen bemenet: a várt érték instanceof ${t.expected}, a kapott érték ${u}`:`Érvénytelen bemenet: a várt érték ${r}, a kapott érték ${u}`}case"invalid_value":return t.values.length===1?`Érvénytelen bemenet: a várt érték ${_(t.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Túl nagy: ${t.origin??"érték"} mérete túl nagy ${r}${t.maximum.toString()} ${a.unit??"elem"}`:`Túl nagy: a bemeneti érték ${t.origin??"érték"} túl nagy: ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Túl kicsi: a bemeneti érték ${t.origin} mérete túl kicsi ${r}${t.minimum.toString()} ${a.unit}`:`Túl kicsi: a bemeneti érték ${t.origin} túl kicsi ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Érvénytelen string: "${r.prefix}" értékkel kell kezdődnie`:r.format==="ends_with"?`Érvénytelen string: "${r.suffix}" értékkel kell végződnie`:r.format==="includes"?`Érvénytelen string: "${r.includes}" értéket kell tartalmaznia`:r.format==="regex"?`Érvénytelen string: ${r.pattern} mintának kell megfelelnie`:`Érvénytelen ${i[r.format]??t.format}`}case"not_multiple_of":return`Érvénytelen szám: ${t.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${t.keys.length>1?"s":""}: ${g(t.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${t.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${t.origin}`;default:return"Érvénytelen bemenet"}}};function kp(){return{localeError:D$()}}function Ip(e,n,i){return Math.abs(e)===1?n:i}function Ut(e){if(!e)return"";let n=["ա","ե","ը","ի","ո","ու","օ"],i=e[e.length-1];return e+(n.includes(i)?"ն":"ը")}var N$=()=>{let e={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},map:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function n(t){return e[t]??null}let i={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",mac:"MAC հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",credit_card:"կրեդիտ քարտի համար",currency_code:"արժույթի կոդ",iban:"IBAN",jwt:"JWT",template_literal:"մուտք"},o={nan:"NaN",number:"թիվ",array:"զանգված"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Սխալ մուտքագրում․ սպասվում էր instanceof ${t.expected}, ստացվել է ${u}`:`Սխալ մուտքագրում․ սպասվում էր ${r}, ստացվել է ${u}`}case"invalid_value":return t.values.length===1?`Սխալ մուտքագրում․ սպասվում էր ${_(t.values[1])}`:`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);if(a){let u=Number(t.maximum),s=Ip(u,a.unit.one,a.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${Ut(t.origin??"արժեք")} կունենա ${r}${t.maximum.toString()} ${s}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${Ut(t.origin??"արժեք")} լինի ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);if(a){let u=Number(t.minimum),s=Ip(u,a.unit.one,a.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${Ut(t.origin)} կունենա ${r}${t.minimum.toString()} ${s}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${Ut(t.origin)} լինի ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Սխալ տող․ պետք է սկսվի "${r.prefix}"-ով`:r.format==="ends_with"?`Սխալ տող․ պետք է ավարտվի "${r.suffix}"-ով`:r.format==="includes"?`Սխալ տող․ պետք է պարունակի "${r.includes}"`:r.format==="regex"?`Սխալ տող․ պետք է համապատասխանի ${r.pattern} ձևաչափին`:`Սխալ ${i[r.format]??t.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${t.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${t.keys.length>1?"ներ":""}. ${g(t.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${Ut(t.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${Ut(t.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function wp(){return{localeError:N$()}}var O$=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"},map:{unit:"item",verb:"memiliki"}};function n(t){return e[t]??null}let i={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",mac:"alamat MAC",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",credit_card:"nomor kartu kredit",currency_code:"kode mata uang",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Input tidak valid: diharapkan instanceof ${t.expected}, diterima ${u}`:`Input tidak valid: diharapkan ${r}, diterima ${u}`}case"invalid_value":return t.values.length===1?`Input tidak valid: diharapkan ${_(t.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Terlalu besar: diharapkan ${t.origin??"value"} memiliki ${r}${t.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${t.origin??"value"} menjadi ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Terlalu kecil: diharapkan ${t.origin} memiliki ${r}${t.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${t.origin} menjadi ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`String tidak valid: harus dimulai dengan "${r.prefix}"`:r.format==="ends_with"?`String tidak valid: harus berakhir dengan "${r.suffix}"`:r.format==="includes"?`String tidak valid: harus menyertakan "${r.includes}"`:r.format==="regex"?`String tidak valid: harus sesuai pola ${r.pattern}`:`${i[r.format]??t.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${t.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${t.keys.length>1?"s":""}: ${g(t.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${t.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${t.origin}`;default:return"Input tidak valid"}}};function Sp(){return{localeError:O$()}}var j$=()=>{let e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"},map:{unit:"hluti",verb:"að hafa"}};function n(t){return e[t]??null}let i={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",credit_card:"kreditkortanúmer",currency_code:"gjaldmiðilskóði",iban:"IBAN",jwt:"JWT",template_literal:"gildi"},o={nan:"NaN",number:"númer",array:"fylki"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Rangt gildi: Þú slóst inn ${u} þar sem á að vera instanceof ${t.expected}`:`Rangt gildi: Þú slóst inn ${u} þar sem á að vera ${r}`}case"invalid_value":return t.values.length===1?`Rangt gildi: gert ráð fyrir ${_(t.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Of stórt: gert er ráð fyrir að ${t.origin??"gildi"} hafi ${r}${t.maximum.toString()} ${a.unit??"hluti"}`:`Of stórt: gert er ráð fyrir að ${t.origin??"gildi"} sé ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Of lítið: gert er ráð fyrir að ${t.origin} hafi ${r}${t.minimum.toString()} ${a.unit}`:`Of lítið: gert er ráð fyrir að ${t.origin} sé ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ógildur strengur: verður að byrja á "${r.prefix}"`:r.format==="ends_with"?`Ógildur strengur: verður að enda á "${r.suffix}"`:r.format==="includes"?`Ógildur strengur: verður að innihalda "${r.includes}"`:r.format==="regex"?`Ógildur strengur: verður að fylgja mynstri ${r.pattern}`:`Rangt ${i[r.format]??t.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${t.divisor}`;case"unrecognized_keys":return`Óþekkt ${t.keys.length>1?"ir lyklar":"ur lykill"}: ${g(t.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${t.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${t.origin}`;default:return"Rangt gildi"}}};function zp(){return{localeError:j$()}}var A$=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"},map:{unit:"elementi",verb:"avere"}};function n(t){return e[t]??null}let i={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",mac:"indirizzo MAC",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",credit_card:"numero di carta di credito",currency_code:"codice valuta",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"numero",array:"vettore"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Input non valido: atteso instanceof ${t.expected}, ricevuto ${u}`:`Input non valido: atteso ${r}, ricevuto ${u}`}case"invalid_value":return t.values.length===1?`Input non valido: atteso ${_(t.values[0])}`:`Opzione non valida: atteso uno tra ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Troppo grande: ${t.origin??"valore"} deve avere ${r}${t.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${t.origin??"valore"} deve essere ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Troppo piccolo: ${t.origin} deve avere ${r}${t.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${t.origin} deve essere ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Stringa non valida: deve iniziare con "${r.prefix}"`:r.format==="ends_with"?`Stringa non valida: deve terminare con "${r.suffix}"`:r.format==="includes"?`Stringa non valida: deve includere "${r.includes}"`:r.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${r.pattern}`:`Input non valido: ${i[r.format]??t.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${t.divisor}`;case"unrecognized_keys":return`Chiav${t.keys.length>1?"i":"e"} non riconosciut${t.keys.length>1?"e":"a"}: ${g(t.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${t.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${t.origin}`;default:return"Input non valido"}}};function Pp(){return{localeError:A$()}}var U$=()=>{let e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"},map:{unit:"要素",verb:"である"}};function n(t){return e[t]??null}let i={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",mac:"MACアドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",credit_card:"クレジットカード番号",currency_code:"通貨コード",iban:"IBAN",jwt:"JWT",template_literal:"入力値"},o={nan:"NaN",number:"数値",array:"配列"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`無効な入力: instanceof ${t.expected}が期待されましたが、${u}が入力されました`:`無効な入力: ${r}が期待されましたが、${u}が入力されました`}case"invalid_value":return t.values.length===1?`無効な入力: ${_(t.values[0])}が期待されました`:`無効な選択: ${g(t.values,"、")}のいずれかである必要があります`;case"too_big":{let r=t.inclusive?"以下である":"より小さい",a=n(t.origin);return a?`大きすぎる値: ${t.origin??"値"}は${t.maximum.toString()}${a.unit??"要素"}${r}必要があります`:`大きすぎる値: ${t.origin??"値"}は${t.maximum.toString()}${r}必要があります`}case"too_small":{let r=t.inclusive?"以上である":"より大きい",a=n(t.origin);return a?`小さすぎる値: ${t.origin}は${t.minimum.toString()}${a.unit}${r}必要があります`:`小さすぎる値: ${t.origin}は${t.minimum.toString()}${r}必要があります`}case"invalid_format":{let r=t;return r.format==="starts_with"?`無効な文字列: "${r.prefix}"で始まる必要があります`:r.format==="ends_with"?`無効な文字列: "${r.suffix}"で終わる必要があります`:r.format==="includes"?`無効な文字列: "${r.includes}"を含む必要があります`:r.format==="regex"?`無効な文字列: パターン${r.pattern}に一致する必要があります`:`無効な${i[r.format]??t.format}`}case"not_multiple_of":return`無効な数値: ${t.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${t.keys.length>1?"群":""}: ${g(t.keys,"、")}`;case"invalid_key":return`${t.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${t.origin}内の無効な値`;default:return"無効な入力"}}};function Dp(){return{localeError:U$()}}var T$=()=>{let e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},map:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function n(t){return e[t]??null}let i={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",mac:"MAC მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული ველი",base64url:"base64url-კოდირებული ველი",json_string:"JSON ველი",e164:"E.164 ნომერი",credit_card:"საკრედიტო ბარათის ნომერი",currency_code:"ვალუტის კოდი",iban:"IBAN",jwt:"JWT",template_literal:"შეყვანა"},o={nan:"NaN",number:"რიცხვი",string:"ველი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`არასწორი შეყვანა: მოსალოდნელი instanceof ${t.expected}, მიღებული ${u}`:`არასწორი შეყვანა: მოსალოდნელი ${r}, მიღებული ${u}`}case"invalid_value":return t.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${_(t.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${g(t.values,"|")}-დან`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`ზედმეტად დიდი: მოსალოდნელი ${t.origin??"მნიშვნელობა"} ${a.verb} ${r}${t.maximum.toString()} ${a.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${t.origin??"მნიშვნელობა"} იყოს ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`ზედმეტად პატარა: მოსალოდნელი ${t.origin} ${a.verb} ${r}${t.minimum.toString()} ${a.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${t.origin} იყოს ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`არასწორი ველი: უნდა იწყებოდეს "${r.prefix}"-ით`:r.format==="ends_with"?`არასწორი ველი: უნდა მთავრდებოდეს "${r.suffix}"-ით`:r.format==="includes"?`არასწორი ველი: უნდა შეიცავდეს "${r.includes}"-ს`:r.format==="regex"?`არასწორი ველი: უნდა შეესაბამებოდეს შაბლონს ${r.pattern}`:`არასწორი ${i[r.format]??t.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${t.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${t.keys.length>1?"ები":"ი"}: ${g(t.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${t.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${t.origin}-ში`;default:return"არასწორი შეყვანა"}}};function Np(){return{localeError:T$()}}var E$=()=>{let e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"},map:{unit:"ធាតុ",verb:"គួរមាន"}};function n(t){return e[t]??null}let i={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",mac:"អាសយដ្ឋាន MAC",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",credit_card:"លេខប័ណ្ណឥណទាន",currency_code:"កូដរូបិយប័ណ្ណ",iban:"IBAN",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},o={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${t.expected} ប៉ុន្តែទទួលបាន ${u}`:`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${r} ប៉ុន្តែទទួលបាន ${u}`}case"invalid_value":return t.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${_(t.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`ធំពេក៖ ត្រូវការ ${t.origin??"តម្លៃ"} ${r} ${t.maximum.toString()} ${a.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${t.origin??"តម្លៃ"} ${r} ${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`តូចពេក៖ ត្រូវការ ${t.origin} ${r} ${t.minimum.toString()} ${a.unit}`:`តូចពេក៖ ត្រូវការ ${t.origin} ${r} ${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${r.prefix}"`:r.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${r.suffix}"`:r.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${r.includes}"`:r.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${r.pattern}`:`មិនត្រឹមត្រូវ៖ ${i[r.format]??t.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${t.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${g(t.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${t.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${t.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function ai(){return{localeError:E$()}}function Op(){return ai()}var L$=()=>{let e={string:{unit:"ಅಕ್ಷರಗಳು",verb:"ಹೊಂದಲು"},file:{unit:"ಬೈಟ್‌ಗಳು",verb:"ಹೊಂದಲು"},array:{unit:"ವಸ್ತುಗಳು",verb:"ಹೊಂದಲು"},set:{unit:"ವಸ್ತುಗಳು",verb:"ಹೊಂದಲು"},map:{unit:"entries",verb:"ಹೊಂದಲು"}};function n(t){return e[t]??null}let i={regex:"ಇನ್ಪುಟ್",email:"email ವಿಳಾಸ",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ದಿನಾಂಕದ ಸಮಯ",date:"ISO ದಿನಾಂಕ",time:"ISO ಸಮಯ",duration:"ISO ಅವಧಿ",ipv4:"IPv4 ವಿಳಾಸ",ipv6:"IPv6 ವಿಳಾಸ",mac:"MAC ವಿಳಾಸ",cidrv4:"IPv4 ವ್ಯಾಪ್ತಿಯ",cidrv6:"IPv6 ವ್ಯಾಪ್ತಿಯ",base64:"base64-encodedಸ್ಟ್ರಿಂಗ್",base64url:"base64url-encodedಸ್ಟ್ರಿಂಗ್",json_string:"JSONಸ್ಟ್ರಿಂಗ್",e164:"E.164 ಸಂಖ್ಯೆ",credit_card:"ಕ್ರೆಡಿಟ್ ಕಾರ್ಡ್ ಸಂಖ್ಯೆ",currency_code:"ಕರೆನ್ಸಿ ಕೋಡ್",iban:"IBAN",jwt:"JWT",template_literal:"ಇನ್ಪುಟ್"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return`ಅಮಾನ್ಯ ಇನ್‌ಪುಟ್: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${r}, ಸ್ವೀಕರಿಸಿದನು ${u}`}case"invalid_value":return t.values.length===1?`ಅಮಾನ್ಯ ಇನ್‌ಪುಟ್: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${_(t.values[0])}`:`ಅಮಾನ್ಯ ಆಯ್ಕೆ: ಇವುಗಳಲ್ಲಿ ಒಂದನ್ನು ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`ತುಂಬಾ ದೊಡ್ಡದು: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${t.origin??"value"} ಹೊಂದಲು ${r}${t.maximum.toString()} ${a.unit??"ಅಂಶಗಳು"}`:`ತುಂಬಾ ದೊಡ್ಡದು: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${t.origin??"value"} ಎಂದು ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`ತುಂಬಾ ಚಿಕ್ಕದು: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${t.origin} ಹೊಂದಲು ${r}${t.minimum.toString()} ${a.unit}`:`ತುಂಬಾ ಚಿಕ್ಕದು: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${t.origin} ಎಂದು ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`ಅಮಾನ್ಯವಾದ ಸ್ಟ್ರಿಂಗ್: ಇದರೊಂದಿಗೆ ಪ್ರಾರಂಭಿಸಬೇಕು "${r.prefix}"`:r.format==="ends_with"?`ಅಮಾನ್ಯವಾದ ಸ್ಟ್ರಿಂಗ್: ಇದರೊಂದಿಗೆ ಕೊನೆಗೊಳ್ಳಬೇಕು "${r.suffix}"`:r.format==="includes"?`ಅಮಾನ್ಯ ಸ್ಟ್ರಿಂಗ್: ಒಳಗೊಂಡಿರಬೇಕು "${r.includes}"`:r.format==="regex"?`ಅಮಾನ್ಯವಾದ ಸ್ಟ್ರಿಂಗ್: ಮಾದರಿಗೆ ಹೊಂದಿಕೆಯಾಗಬೇಕು ${r.pattern}`:`ಅಮಾನ್ಯ ${i[r.format]??t.format}`}case"not_multiple_of":return`ಅಮಾನ್ಯ ಸಂಖ್ಯೆ: ಬಹುಸಂಖ್ಯೆಯಾಗಿರಬೇಕು ${t.divisor}`;case"unrecognized_keys":return`ಗುರುತಿಸಲಾಗದ ಕೀ ${t.keys.length>1?"s":""}: ${g(t.keys,", ")}`;case"invalid_key":return`ಅಮಾನ್ಯವಾದ ಕೀ ಇನ್ ${t.origin}`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`ಅಮಾನ್ಯ ತಾರತಮ್ಯ ಮೌಲ್ಯ. ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${t.options.map(a=>`'${a}'`).join(" | ")}`:"ಅಮಾನ್ಯ ಇನ್‌ಪುಟ್";case"invalid_element":return`ರಲ್ಲಿ ಅಮಾನ್ಯ ಮೌಲ್ಯ ${t.origin}`;default:return"ಅಮಾನ್ಯ ಇನ್‌ಪುಟ್"}}};function jp(){return{localeError:L$()}}var C$=()=>{let e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"},map:{unit:"개",verb:"to have"}};function n(t){return e[t]??null}let i={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",mac:"MAC 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",credit_card:"신용카드 번호",currency_code:"통화 코드",iban:"IBAN",jwt:"JWT",template_literal:"입력"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`잘못된 입력: 예상 타입은 instanceof ${t.expected}, 받은 타입은 ${u}입니다`:`잘못된 입력: 예상 타입은 ${r}, 받은 타입은 ${u}입니다`}case"invalid_value":return t.values.length===1?`잘못된 입력: 값은 ${_(t.values[0])} 이어야 합니다`:`잘못된 옵션: ${g(t.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let r=t.inclusive?"이하":"미만",a=r==="미만"?"이어야 합니다":"여야 합니다",u=n(t.origin),s=u?.unit??"요소";return u?`${t.origin??"값"}이 너무 큽니다: ${t.maximum.toString()}${s} ${r}${a}`:`${t.origin??"값"}이 너무 큽니다: ${t.maximum.toString()} ${r}${a}`}case"too_small":{let r=t.inclusive?"이상":"초과",a=r==="이상"?"이어야 합니다":"여야 합니다",u=n(t.origin),s=u?.unit??"요소";return u?`${t.origin??"값"}이 너무 작습니다: ${t.minimum.toString()}${s} ${r}${a}`:`${t.origin??"값"}이 너무 작습니다: ${t.minimum.toString()} ${r}${a}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`잘못된 문자열: "${r.prefix}"(으)로 시작해야 합니다`:r.format==="ends_with"?`잘못된 문자열: "${r.suffix}"(으)로 끝나야 합니다`:r.format==="includes"?`잘못된 문자열: "${r.includes}"을(를) 포함해야 합니다`:r.format==="regex"?`잘못된 문자열: 정규식 ${r.pattern} 패턴과 일치해야 합니다`:`잘못된 ${i[r.format]??t.format}`}case"not_multiple_of":return`잘못된 숫자: ${t.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${g(t.keys,", ")}`;case"invalid_key":return`잘못된 키: ${t.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${t.origin}`;default:return"잘못된 입력"}}};function Ap(){return{localeError:C$()}}var Zn=e=>e.charAt(0).toUpperCase()+e.slice(1);function Up(e){let n=Math.abs(e),i=n%10,o=n%100;return o>=11&&o<=19||i===0?"many":i===1?"one":"few"}var Z$=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function n(t,r,a,u){let s=e[t]??null;return s===null?s:{unit:s.unit[r],verb:s.verb[u][a?"inclusive":"notInclusive"]}}let i={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",mac:"MAC adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",credit_card:"kredito kortelės numeris",currency_code:"valiutos kodas",iban:"IBAN",jwt:"JWT",template_literal:"įvestis"},o={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Gautas tipas ${u}, o tikėtasi - instanceof ${t.expected}`:`Gautas tipas ${u}, o tikėtasi - ${r}`}case"invalid_value":return t.values.length===1?`Privalo būti ${_(t.values[0])}`:`Privalo būti vienas iš ${g(t.values,"|")} pasirinkimų`;case"too_big":{let r=o[t.origin]??t.origin,a=n(t.origin,Up(Number(t.maximum)),t.inclusive??!1,"smaller");if(a?.verb)return`${Zn(r??t.origin??"reikšmė")} ${a.verb} ${t.maximum.toString()} ${a.unit??"elementų"}`;let u=t.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${Zn(r??t.origin??"reikšmė")} turi būti ${u} ${t.maximum.toString()} ${a?.unit}`}case"too_small":{let r=o[t.origin]??t.origin,a=n(t.origin,Up(Number(t.minimum)),t.inclusive??!1,"bigger");if(a?.verb)return`${Zn(r??t.origin??"reikšmė")} ${a.verb} ${t.minimum.toString()} ${a.unit??"elementų"}`;let u=t.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${Zn(r??t.origin??"reikšmė")} turi būti ${u} ${t.minimum.toString()} ${a?.unit}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Eilutė privalo prasidėti "${r.prefix}"`:r.format==="ends_with"?`Eilutė privalo pasibaigti "${r.suffix}"`:r.format==="includes"?`Eilutė privalo įtraukti "${r.includes}"`:r.format==="regex"?`Eilutė privalo atitikti ${r.pattern}`:`Neteisingas ${i[r.format]??t.format}`}case"not_multiple_of":return`Skaičius privalo būti ${t.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${t.keys.length>1?"i":"as"} rakt${t.keys.length>1?"ai":"as"}: ${g(t.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let r=o[t.origin]??t.origin;return`${Zn(r??t.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function Tp(){return{localeError:Z$()}}var R$=()=>{let e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"},map:{unit:"ставки",verb:"да имаат"}};function n(t){return e[t]??null}let i={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",mac:"MAC адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",credit_card:"број на кредитна картичка",currency_code:"код на валута",iban:"IBAN",jwt:"JWT",template_literal:"внес"},o={nan:"NaN",number:"број",array:"низа"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Грешен внес: се очекува instanceof ${t.expected}, примено ${u}`:`Грешен внес: се очекува ${r}, примено ${u}`}case"invalid_value":return t.values.length===1?`Invalid input: expected ${_(t.values[0])}`:`Грешана опција: се очекува една ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Премногу голем: се очекува ${t.origin??"вредноста"} да има ${r}${t.maximum.toString()} ${a.unit??"елементи"}`:`Премногу голем: се очекува ${t.origin??"вредноста"} да биде ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Премногу мал: се очекува ${t.origin} да има ${r}${t.minimum.toString()} ${a.unit}`:`Премногу мал: се очекува ${t.origin} да биде ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Неважечка низа: мора да започнува со "${r.prefix}"`:r.format==="ends_with"?`Неважечка низа: мора да завршува со "${r.suffix}"`:r.format==="includes"?`Неважечка низа: мора да вклучува "${r.includes}"`:r.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${r.pattern}`:`Invalid ${i[r.format]??t.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${g(t.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${t.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${t.origin}`;default:return"Грешен внес"}}};function Ep(){return{localeError:R$()}}var V$=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"},map:{unit:"elemen",verb:"mempunyai"}};function n(t){return e[t]??null}let i={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",mac:"alamat MAC",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",credit_card:"nombor kad kredit",currency_code:"kod mata wang",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"nombor"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Input tidak sah: dijangka instanceof ${t.expected}, diterima ${u}`:`Input tidak sah: dijangka ${r}, diterima ${u}`}case"invalid_value":return t.values.length===1?`Input tidak sah: dijangka ${_(t.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Terlalu besar: dijangka ${t.origin??"nilai"} ${a.verb} ${r}${t.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${t.origin??"nilai"} adalah ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Terlalu kecil: dijangka ${t.origin} ${a.verb} ${r}${t.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${t.origin} adalah ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`String tidak sah: mesti bermula dengan "${r.prefix}"`:r.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${r.suffix}"`:r.format==="includes"?`String tidak sah: mesti mengandungi "${r.includes}"`:r.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${r.pattern}`:`${i[r.format]??t.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${t.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${g(t.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${t.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${t.origin}`;default:return"Input tidak sah"}}};function Lp(){return{localeError:V$()}}var M$=()=>{let e={string:{unit:"अक्षर",verb:"हुनुपर्छ"},file:{unit:"बाइट",verb:"हुनुपर्छ"},array:{unit:"तत्व",verb:"हुनुपर्छ"},set:{unit:"तत्व",verb:"हुनुपर्छ"},map:{unit:"प्रविष्टि",verb:"हुनुपर्छ"}};function n(t){return e[t]??null}let i={regex:"इनपुट",email:"इमेल ठेगाना",url:"URL",emoji:"इमोजी",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO मिति र समय",date:"ISO मिति",time:"ISO समय",duration:"ISO अवधि",ipv4:"IPv4 ठेगाना",ipv6:"IPv6 ठेगाना",mac:"MAC ठेगाना",cidrv4:"IPv4 दायरा",cidrv6:"IPv6 दायरा",base64:"base64-इन्कोड गरिएको स्ट्रिङ",base64url:"base64url-इन्कोड गरिएको स्ट्रिङ",json_string:"JSON स्ट्रिङ",e164:"E.164 नम्बर",credit_card:"क्रेडिट कार्ड नम्बर",currency_code:"मुद्रा कोड",iban:"IBAN",jwt:"JWT",template_literal:"इनपुट"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return`अमान्य इनपुट: अपेक्षित ${r}, प्राप्त ${u}`}case"invalid_value":return t.values.length===1?`अमान्य इनपुट: अपेक्षित ${_(t.values[0])}`:`अमान्य विकल्प: अपेक्षित मानहरू मध्ये एक ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`धेरै ठूलो: ${t.origin??"मान"} मा ${r}${t.maximum.toString()} ${a.unit} ${a.verb}`:`धेरै ठूलो: ${t.origin??"मान"} ${r}${t.maximum.toString()} हुनुपर्छ`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`धेरै सानो: ${t.origin} मा ${r}${t.minimum.toString()} ${a.unit} ${a.verb}`:`धेरै सानो: ${t.origin} ${r}${t.minimum.toString()} हुनुपर्छ`}case"invalid_format":{let r=t;return r.format==="starts_with"?`अमान्य स्ट्रिङ: "${r.prefix}" बाट सुरु हुनुपर्छ`:r.format==="ends_with"?`अमान्य स्ट्रिङ: "${r.suffix}" मा समाप्त हुनुपर्छ`:r.format==="includes"?`अमान्य स्ट्रिङ: "${r.includes}" समावेश हुनुपर्छ`:r.format==="regex"?`अमान्य स्ट्रिङ: ढाँचा ${r.pattern} सँग मेल खानुपर्छ`:`अमान्य ${i[r.format]??t.format}`}case"not_multiple_of":return`अमान्य संख्या: ${t.divisor} को गुणज हुनुपर्छ`;case"unrecognized_keys":return`अपरिचित कुञ्जी${t.keys.length>1?"हरू":""}: ${g(t.keys,", ")}`;case"invalid_key":return`अमान्य कुञ्जी: ${t.origin} मा`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`अमान्य डिस्क्रिमिनेटर मान: अपेक्षित ${t.options.map(a=>`'${a}'`).join(" | ")}`:"अमान्य इनपुट";case"invalid_element":return`अमान्य मान: ${t.origin} मा`;default:return"अमान्य इनपुट"}}};function Cp(){return{localeError:M$()}}var F$=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"},map:{unit:"elementen",verb:"heeft"}};function n(t){return e[t]??null}let i={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",mac:"MAC-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",credit_card:"creditcardnummer",currency_code:"valutacode",iban:"IBAN",jwt:"JWT",template_literal:"invoer"},o={nan:"NaN",number:"getal"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ongeldige invoer: verwacht instanceof ${t.expected}, ontving ${u}`:`Ongeldige invoer: verwacht ${r}, ontving ${u}`}case"invalid_value":return t.values.length===1?`Ongeldige invoer: verwacht ${_(t.values[0])}`:`Ongeldige optie: verwacht één van ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin),u=t.origin==="date"?"laat":t.origin==="string"?"lang":"groot";return a?`Te ${u}: verwacht dat ${t.origin??"waarde"} ${r}${t.maximum.toString()} ${a.unit??"elementen"} ${a.verb}`:`Te ${u}: verwacht dat ${t.origin??"waarde"} ${r}${t.maximum.toString()} is`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin),u=t.origin==="date"?"vroeg":t.origin==="string"?"kort":"klein";return a?`Te ${u}: verwacht dat ${t.origin} ${r}${t.minimum.toString()} ${a.unit} ${a.verb}`:`Te ${u}: verwacht dat ${t.origin} ${r}${t.minimum.toString()} is`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ongeldige tekst: moet met "${r.prefix}" beginnen`:r.format==="ends_with"?`Ongeldige tekst: moet op "${r.suffix}" eindigen`:r.format==="includes"?`Ongeldige tekst: moet "${r.includes}" bevatten`:r.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${r.pattern}`:`Ongeldig: ${i[r.format]??t.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${t.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${t.keys.length>1?"s":""}: ${g(t.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${t.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${t.origin}`;default:return"Ongeldige invoer"}}};function Zp(){return{localeError:F$()}}var G$=()=>{let e={string:{unit:"teikn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"element",verb:"å innehalde"},set:{unit:"element",verb:"å innehalde"},map:{unit:"element",verb:"å innehalde"}};function n(t){return e[t]??null}let i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varigheit",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkoda streng",base64url:"base64url-enkoda streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kredittkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tal",array:"liste"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ugyldig input: forventa instanceof ${t.expected}, fekk ${u}`:`Ugyldig input: forventa ${r}, fekk ${u}`}case"invalid_value":return t.values.length===1?`Ugyldig verdi: forventa ${_(t.values[0])}`:`Ugyldig val: forventa eitt av ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`For stor(t): forventa ${t.origin??"value"} til å ha ${r}${t.maximum.toString()} ${a.unit??"element"}`:`For stor(t): forventa ${t.origin??"value"} til å ha ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`For lite(n): forventa ${t.origin} til å ha ${r}${t.minimum.toString()} ${a.unit}`:`For lite(n): forventa ${t.origin} til å ha ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ugyldig streng: må starte med "${r.prefix}"`:r.format==="ends_with"?`Ugyldig streng: må slutte med "${r.suffix}"`:r.format==="includes"?`Ugyldig streng: må innehalde "${r.includes}"`:r.format==="regex"?`Ugyldig streng: må matche mønsteret ${r.pattern}`:`Ugyldig ${i[r.format]??t.format}`}case"not_multiple_of":return`Ugyldig tal: må vere eit multiplum av ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Ukjende nøklar":"Ukjend nøkkel"}: ${g(t.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${t.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${t.origin}`;default:return"Ugyldig input"}}};function Rp(){return{localeError:G$()}}var J$=()=>{let e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"},map:{unit:"elementer",verb:"å inneholde"}};function n(t){return e[t]??null}let i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kredittkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tall",array:"liste"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ugyldig input: forventet instanceof ${t.expected}, fikk ${u}`:`Ugyldig input: forventet ${r}, fikk ${u}`}case"invalid_value":return t.values.length===1?`Ugyldig verdi: forventet ${_(t.values[0])}`:`Ugyldig valg: forventet en av ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`For stor(t): forventet ${t.origin??"value"} til å ha ${r}${t.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${t.origin??"value"} til å ha ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`For lite(n): forventet ${t.origin} til å ha ${r}${t.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${t.origin} til å ha ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ugyldig streng: må starte med "${r.prefix}"`:r.format==="ends_with"?`Ugyldig streng: må ende med "${r.suffix}"`:r.format==="includes"?`Ugyldig streng: må inneholde "${r.includes}"`:r.format==="regex"?`Ugyldig streng: må matche mønsteret ${r.pattern}`:`Ugyldig ${i[r.format]??t.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${g(t.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${t.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${t.origin}`;default:return"Ugyldig input"}}};function Vp(){return{localeError:J$()}}var B$=()=>{let e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"},map:{unit:"unsur",verb:"olmalıdır"}};function n(t){return e[t]??null}let i={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",mac:"MAC nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",credit_card:"i'tibâr kartı numarası",currency_code:"para birimi kodu",iban:"IBAN",jwt:"JWT",template_literal:"giren"},o={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Fâsit giren: umulan instanceof ${t.expected}, alınan ${u}`:`Fâsit giren: umulan ${r}, alınan ${u}`}case"invalid_value":return t.values.length===1?`Fâsit giren: umulan ${_(t.values[0])}`:`Fâsit tercih: mûteberler ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Fazla büyük: ${t.origin??"value"}, ${r}${t.maximum.toString()} ${a.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${t.origin??"value"}, ${r}${t.maximum.toString()} olmalıydı.`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Fazla küçük: ${t.origin}, ${r}${t.minimum.toString()} ${a.unit} sahip olmalıydı.`:`Fazla küçük: ${t.origin}, ${r}${t.minimum.toString()} olmalıydı.`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Fâsit metin: "${r.prefix}" ile başlamalı.`:r.format==="ends_with"?`Fâsit metin: "${r.suffix}" ile bitmeli.`:r.format==="includes"?`Fâsit metin: "${r.includes}" ihtivâ etmeli.`:r.format==="regex"?`Fâsit metin: ${r.pattern} nakşına uymalı.`:`Fâsit ${i[r.format]??t.format}`}case"not_multiple_of":return`Fâsit sayı: ${t.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${t.keys.length>1?"s":""}: ${g(t.keys,", ")}`;case"invalid_key":return`${t.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${t.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function Mp(){return{localeError:B$()}}var K$=()=>{let e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"},map:{unit:"توکي",verb:"ولري"}};function n(t){return e[t]??null}let i={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",mac:"د MAC پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",credit_card:"د کریډیټ کارت شمیره",currency_code:"د اسعارو کوډ",iban:"IBAN",jwt:"JWT",template_literal:"ورودي"},o={nan:"NaN",number:"عدد",array:"ارې"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`ناسم ورودي: باید instanceof ${t.expected} وای, مګر ${u} ترلاسه شو`:`ناسم ورودي: باید ${r} وای, مګر ${u} ترلاسه شو`}case"invalid_value":return t.values.length===1?`ناسم ورودي: باید ${_(t.values[0])} وای`:`ناسم انتخاب: باید یو له ${g(t.values,"|")} څخه وای`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`ډیر لوی: ${t.origin??"ارزښت"} باید ${r}${t.maximum.toString()} ${a.unit??"عنصرونه"} ولري`:`ډیر لوی: ${t.origin??"ارزښت"} باید ${r}${t.maximum.toString()} وي`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`ډیر کوچنی: ${t.origin} باید ${r}${t.minimum.toString()} ${a.unit} ولري`:`ډیر کوچنی: ${t.origin} باید ${r}${t.minimum.toString()} وي`}case"invalid_format":{let r=t;return r.format==="starts_with"?`ناسم متن: باید د "${r.prefix}" سره پیل شي`:r.format==="ends_with"?`ناسم متن: باید د "${r.suffix}" سره پای ته ورسيږي`:r.format==="includes"?`ناسم متن: باید "${r.includes}" ولري`:r.format==="regex"?`ناسم متن: باید د ${r.pattern} سره مطابقت ولري`:`${i[r.format]??t.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${t.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${t.keys.length>1?"کلیډونه":"کلیډ"}: ${g(t.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${t.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${t.origin} کې`;default:return"ناسمه ورودي"}}};function Fp(){return{localeError:K$()}}var W$=()=>{let e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"},map:{unit:"elementów",verb:"mieć"}};function n(t){return e[t]??null}let i={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",mac:"adres MAC",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",credit_card:"numer karty kredytowej",currency_code:"kod waluty",iban:"IBAN",jwt:"JWT",template_literal:"wejście"},o={nan:"NaN",number:"liczba",array:"tablica"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${t.expected}, otrzymano ${u}`:`Nieprawidłowe dane wejściowe: oczekiwano ${r}, otrzymano ${u}`}case"invalid_value":return t.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${_(t.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Za duża wartość: oczekiwano, że ${t.origin??"wartość"} będzie mieć ${r}${t.maximum.toString()} ${a.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${t.origin??"wartość"} będzie wynosić ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Za mała wartość: oczekiwano, że ${t.origin??"wartość"} będzie mieć ${r}${t.minimum.toString()} ${a.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${t.origin??"wartość"} będzie wynosić ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${r.prefix}"`:r.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${r.suffix}"`:r.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${r.includes}"`:r.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${r.pattern}`:`Nieprawidłow(y/a/e) ${i[r.format]??t.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${t.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${t.keys.length>1?"s":""}: ${g(t.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${t.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${t.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Gp(){return{localeError:W$()}}var H$=()=>{let e={string:{unit:"caracteres"},file:{unit:"bytes"},array:{unit:"elementos"},set:{unit:"elementos"},map:{unit:"entradas"}};function n(a){return e[a]??null}let i={regex:"a entrada",email:"o endereço de e-mail",url:"o URL",emoji:"o emoji",uuid:"o UUID",uuidv4:"o UUIDv4",uuidv6:"o UUIDv6",nanoid:"o nanoid",guid:"o GUID",cuid:"o cuid",cuid2:"o cuid2",ulid:"o ULID",xid:"o XID",ksuid:"o KSUID",datetime:"a data e hora ISO",date:"a data ISO",time:"a hora ISO",duration:"a duração ISO",ipv4:"o endereço IPv4",ipv6:"o endereço IPv6",mac:"o endereço MAC",cidrv4:"o intervalo de endereços IPv4",cidrv6:"o intervalo de endereços IPv6",base64:"o texto codificado em base64",base64url:"o texto codificado em base64url",json_string:"o texto JSON",e164:"o número E.164",credit_card:"o número de cartão de crédito",currency_code:"o código de moeda",iban:"o IBAN",jwt:"o JWT",template_literal:"a entrada"},o={masculine:{definite:"o",indefinite:"um"},feminine:{definite:"a",indefinite:"uma"}},t={string:{name:"texto",articles:o.masculine},number:{name:"número",articles:o.masculine},int:{name:"número inteiro",articles:o.masculine},boolean:{name:"valor booleano",articles:o.masculine},bigint:{name:"número bigint",articles:o.masculine},symbol:{name:"símbolo",articles:o.masculine},undefined:{name:'valor "undefined"',articles:o.masculine},null:{name:'valor "nulo"',articles:o.masculine},never:{name:'valor "never"',articles:o.masculine},void:{name:'valor "void"',articles:o.masculine},date:{name:"data",articles:o.feminine},array:{name:"vetor",articles:o.masculine},object:{name:"objeto",articles:o.masculine},tuple:{name:"tuplo",articles:o.masculine},record:{name:"registo",articles:o.masculine},map:{name:"mapa",articles:o.masculine},set:{name:"conjunto",articles:o.masculine},file:{name:"ficheiro",articles:o.masculine},nonoptional:{name:"valor não opcional",articles:o.masculine},nan:{name:'valor "NaN"',articles:o.masculine},function:{name:"função",articles:o.feminine}};function r(a,u){let s=t[a]??{name:`valor "${a}"`,articles:o.masculine};return`${s.articles[u]} ${s.name}`}return a=>{switch(a.code){case"invalid_type":{let u=r(a.expected,"indefinite"),s=x(a.input),c=r(s,"indefinite");return`Entrada inválida: esperava ${u}, recebeu ${c}`}case"invalid_value":return a.values.length===1?`Entrada inválida: esperava ${_(a.values[0])}`:`Opção inválida: esperava uma das seguintes opções: ${g(a.values,"|")}`;case"too_big":{let u=a.inclusive?"<=":"<",s=n(a.origin);return s?`Demasiado grande: esperava que ${r(a.origin,"definite")} tivesse ${u} ${a.maximum.toString()} ${s.unit??"elementos"}`:`Demasiado grande: esperava que ${r(a.origin,"definite")} fosse ${u} ${a.maximum.toString()}`}case"too_small":{let u=a.inclusive?">=":">",s=n(a.origin);return s?`Demasiado pequeno: esperava que ${r(a.origin,"definite")} tivesse ${u} ${a.minimum.toString()} ${s.unit??"elementos"}`:`Demasiado pequeno: esperava que ${r(a.origin,"definite")} fosse ${u} ${a.minimum.toString()}`}case"invalid_format":{let u=a;return u.format==="starts_with"?`Texto inválido: deve começar por "${u.prefix}"`:u.format==="ends_with"?`Texto inválido: deve terminar em "${u.suffix}"`:u.format==="includes"?`Texto inválido: deve incluir "${u.includes}"`:u.format==="regex"?`Texto inválido: deve corresponder ao padrão ${u.pattern}`:`Formato d${i[u.format]??a.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${a.divisor}`;case"unrecognized_keys":{let u=a.keys.length>1?"s":"";return`Chave${u} inválida${u}: ${g(a.keys,", ")}`}case"invalid_key":return`Entrada inválida n${r(a.origin,"definite")}`;case"invalid_union":return a.options&&Array.isArray(a.options)&&a.options.length>0?`Valor de discriminação inválido. Esperava ${a.options.map(s=>`'${s}'`).join(" | ")}`:"Entrada inválida";case"invalid_element":return`Entrada inválida n${r(a.origin,"definite")}`;default:return"Entrada inválida"}}};function Jp(){return{localeError:H$()}}var X$=()=>{let e={string:{unit:"caracteres"},file:{unit:"bytes"},array:{unit:"elementos"},set:{unit:"elementos"},map:{unit:"entradas"}};function n(a){return e[a]??null}let i={regex:"a entrada",email:"o endereço de e-mail",url:"o URL",emoji:"o emoji",uuid:"o UUID",uuidv4:"o UUIDv4",uuidv6:"o UUIDv6",nanoid:"o nanoid",guid:"o GUID",cuid:"o cuid",cuid2:"o cuid2",ulid:"o ULID",xid:"o XID",ksuid:"o KSUID",datetime:"a data e hora ISO",date:"a data ISO",time:"a hora ISO",duration:"a duração ISO",ipv4:"o endereço IPv4",ipv6:"o endereço IPv6",mac:"o endereço MAC",cidrv4:"a faixa de endereços IPv4",cidrv6:"a faixa de endereços IPv6",base64:"o texto codificado em base64",base64url:"o texto codificado em base64url",json_string:"o texto JSON",e164:"o número E.164",credit_card:"o número de cartão de crédito",currency_code:"o código de moeda",iban:"o IBAN",jwt:"o JWT",template_literal:"a entrada"},o={masculine:{definite:"o",indefinite:"um"},feminine:{definite:"a",indefinite:"uma"}},t={string:{name:"texto",articles:o.masculine},number:{name:"número",articles:o.masculine},int:{name:"número inteiro",articles:o.masculine},boolean:{name:"valor booleano",articles:o.masculine},bigint:{name:"número bigint",articles:o.masculine},symbol:{name:"símbolo",articles:o.masculine},undefined:{name:'valor "undefined"',articles:o.masculine},null:{name:'valor "nulo"',articles:o.masculine},never:{name:'valor "never"',articles:o.masculine},void:{name:'valor "void"',articles:o.masculine},date:{name:"data",articles:o.feminine},array:{name:"vetor",articles:o.masculine},object:{name:"objeto",articles:o.masculine},tuple:{name:"tupla",articles:o.feminine},record:{name:"registro",articles:o.masculine},map:{name:"mapa",articles:o.masculine},set:{name:"conjunto",articles:o.masculine},file:{name:"arquivo",articles:o.masculine},nonoptional:{name:"valor não opcional",articles:o.masculine},nan:{name:'valor "NaN"',articles:o.masculine},function:{name:"função",articles:o.feminine}};function r(a,u){let s=t[a]??{name:`valor "${a}"`,articles:o.masculine};return`${s.articles[u]} ${s.name}`}return a=>{switch(a.code){case"invalid_type":{let u=r(a.expected,"indefinite"),s=x(a.input),c=r(s,"indefinite");return`Entrada inválida: esperava ${u}, recebeu ${c}`}case"invalid_value":return a.values.length===1?`Entrada inválida: esperava ${_(a.values[0])}`:`Opção inválida: esperava uma das seguintes opções: ${g(a.values,"|")}`;case"too_big":{let u=a.inclusive?"<=":"<",s=n(a.origin);return s?`Grande demais: esperava que ${r(a.origin,"definite")} tivesse ${u} ${a.maximum.toString()} ${s.unit??"elementos"}`:`Grande demais: esperava que ${r(a.origin,"definite")} fosse ${u} ${a.maximum.toString()}`}case"too_small":{let u=a.inclusive?">=":">",s=n(a.origin);return s?`Pequeno demais: esperava que ${r(a.origin,"definite")} tivesse ${u} ${a.minimum.toString()} ${s.unit??"elementos"}`:`Pequeno demais: esperava que ${r(a.origin,"definite")} fosse ${u} ${a.minimum.toString()}`}case"invalid_format":{let u=a;return u.format==="starts_with"?`Texto inválido: deve começar com "${u.prefix}"`:u.format==="ends_with"?`Texto inválido: deve terminar com "${u.suffix}"`:u.format==="includes"?`Texto inválido: deve incluir "${u.includes}"`:u.format==="regex"?`Texto inválido: deve corresponder ao padrão ${u.pattern}`:`Formato d${i[u.format]??a.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${a.divisor}`;case"unrecognized_keys":{let u=a.keys.length>1?"s":"";return`Chave${u} inválida${u}: ${g(a.keys,", ")}`}case"invalid_key":return`Entrada inválida n${r(a.origin,"definite")}`;case"invalid_union":return a.options&&Array.isArray(a.options)&&a.options.length>0?`Valor de discriminação inválido. Esperava ${a.options.map(s=>`'${s}'`).join(" | ")}`:"Entrada inválida";case"invalid_element":return`Entrada inválida n${r(a.origin,"definite")}`;default:return"Entrada inválida"}}};function Bp(){return{localeError:X$()}}var q$=()=>{let e={string:{unit:"caractere",verb:"să aibă"},file:{unit:"octeți",verb:"să aibă"},array:{unit:"elemente",verb:"să aibă"},set:{unit:"elemente",verb:"să aibă"},map:{unit:"intrări",verb:"să aibă"}};function n(t){return e[t]??null}let i={regex:"intrare",email:"adresă de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dată și oră ISO",date:"dată ISO",time:"oră ISO",duration:"durată ISO",ipv4:"adresă IPv4",ipv6:"adresă IPv6",mac:"adresă MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"șir codat base64",base64url:"șir codat base64url",json_string:"șir JSON",e164:"număr E.164",credit_card:"număr de card de credit",currency_code:"cod valutar",iban:"IBAN",jwt:"JWT",template_literal:"intrare"},o={nan:"NaN",string:"șir",number:"număr",boolean:"boolean",function:"funcție",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"număr mare",void:"void",never:"never",map:"hartă",set:"set"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return`Intrare invalidă: așteptat ${r}, primit ${u}`}case"invalid_value":return t.values.length===1?`Intrare invalidă: așteptat ${_(t.values[0])}`:`Opțiune invalidă: așteptat una dintre ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Prea mare: așteptat ca ${t.origin??"valoarea"} ${a.verb} ${r}${t.maximum.toString()} ${a.unit??"elemente"}`:`Prea mare: așteptat ca ${t.origin??"valoarea"} să fie ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Prea mic: așteptat ca ${t.origin} ${a.verb} ${r}${t.minimum.toString()} ${a.unit}`:`Prea mic: așteptat ca ${t.origin} să fie ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Șir invalid: trebuie să înceapă cu "${r.prefix}"`:r.format==="ends_with"?`Șir invalid: trebuie să se termine cu "${r.suffix}"`:r.format==="includes"?`Șir invalid: trebuie să includă "${r.includes}"`:r.format==="regex"?`Șir invalid: trebuie să se potrivească cu modelul ${r.pattern}`:`Format invalid: ${i[r.format]??t.format}`}case"not_multiple_of":return`Număr invalid: trebuie să fie multiplu de ${t.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${g(t.keys,", ")}`;case"invalid_key":return`Cheie invalidă în ${t.origin}`;case"invalid_union":return"Intrare invalidă";case"invalid_element":return`Valoare invalidă în ${t.origin}`;default:return"Intrare invalidă"}}};function Kp(){return{localeError:q$()}}function Wp(e,n,i,o){let t=Math.abs(e),r=t%10,a=t%100;return a>=11&&a<=19?o:r===1?n:r>=2&&r<=4?i:o}var Y$=()=>{let e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},map:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function n(t){return e[t]??null}let i={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",mac:"MAC адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",credit_card:"номер кредитной карты",currency_code:"код валюты",iban:"IBAN",jwt:"JWT",template_literal:"ввод"},o={nan:"NaN",number:"число",array:"массив"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Неверный ввод: ожидалось instanceof ${t.expected}, получено ${u}`:`Неверный ввод: ожидалось ${r}, получено ${u}`}case"invalid_value":return t.values.length===1?`Неверный ввод: ожидалось ${_(t.values[0])}`:`Неверный вариант: ожидалось одно из ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);if(a){let u=Number(t.maximum),s=Wp(u,a.unit.one,a.unit.few,a.unit.many);return`Слишком большое значение: ожидалось, что ${t.origin??"значение"} будет иметь ${r}${t.maximum.toString()} ${s}`}return`Слишком большое значение: ожидалось, что ${t.origin??"значение"} будет ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);if(a){let u=Number(t.minimum),s=Wp(u,a.unit.one,a.unit.few,a.unit.many);return`Слишком маленькое значение: ожидалось, что ${t.origin} будет иметь ${r}${t.minimum.toString()} ${s}`}return`Слишком маленькое значение: ожидалось, что ${t.origin} будет ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Неверная строка: должна начинаться с "${r.prefix}"`:r.format==="ends_with"?`Неверная строка: должна заканчиваться на "${r.suffix}"`:r.format==="includes"?`Неверная строка: должна содержать "${r.includes}"`:r.format==="regex"?`Неверная строка: должна соответствовать шаблону ${r.pattern}`:`Неверный ${i[r.format]??t.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${t.divisor}`;case"unrecognized_keys":return`Нераспознанн${t.keys.length>1?"ые":"ый"} ключ${t.keys.length>1?"и":""}: ${g(t.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${t.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${t.origin}`;default:return"Неверные входные данные"}}};function Hp(){return{localeError:Y$()}}var Q$=()=>{let e={string:{unit:"znakov",verb:"mať"},file:{unit:"bajtov",verb:"mať"},array:{unit:"prvkov",verb:"mať"},set:{unit:"prvkov",verb:"mať"},map:{unit:"položiek",verb:"mať"}};function n(t){return e[t]??null}let i={regex:"regulárny výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dátum a čas vo formáte ISO",date:"dátum vo formáte ISO",time:"čas vo formáte ISO",duration:"doba trvania ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"reťazec zakódovaný vo formáte base64",base64url:"reťazec zakódovaný vo formáte base64url",json_string:"reťazec vo formáte JSON",e164:"číslo E.164",credit_card:"číslo kreditnej karty",currency_code:"kód meny",iban:"IBAN",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"číslo",string:"reťazec",function:"funkcia",array:"pole"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Neplatný vstup: očakávané instanceof ${t.expected}, obdržané ${u}`:`Neplatný vstup: očakávané ${r}, obdržané ${u}`}case"invalid_value":return t.values.length===1?`Neplatný vstup: očakávané ${_(t.values[0])}`:`Neplatný vstup: očakávaná jedna z hodnôt ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Hodnota je príliš veľká: ${t.origin??"hodnota"} musí mať ${r}${t.maximum.toString()} ${a.unit??"prvkov"}`:`Hodnota je príliš veľká: ${t.origin??"hodnota"} musí byť ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Hodnota je príliš malá: ${t.origin??"hodnota"} musí mať ${r}${t.minimum.toString()} ${a.unit??"prvkov"}`:`Hodnota je príliš malá: ${t.origin??"hodnota"} musí byť ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Neplatný reťazec: musí začínať na "${r.prefix}"`:r.format==="ends_with"?`Neplatný reťazec: musí končiť na "${r.suffix}"`:r.format==="includes"?`Neplatný reťazec: musí obsahovať "${r.includes}"`:r.format==="regex"?`Neplatný reťazec: musí zodpovedať vzoru ${r.pattern}`:`Neplatný formát ${i[r.format]??t.format}`}case"not_multiple_of":return`Neplatné číslo: musí byť násobkom ${t.divisor}`;case"unrecognized_keys":return`Neznáme klúče: ${g(t.keys,", ")}`;case"invalid_key":return`Neplatný klúč v ${t.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${t.origin}`;default:return"Neplatný vstup"}}};function Xp(){return{localeError:Q$()}}var ey=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"},map:{unit:"elementov",verb:"imeti"}};function n(t){return e[t]??null}let i={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",mac:"MAC naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",credit_card:"številka kreditne kartice",currency_code:"koda valute",iban:"IBAN",jwt:"JWT",template_literal:"vnos"},o={nan:"NaN",number:"število",array:"tabela"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Neveljaven vnos: pričakovano instanceof ${t.expected}, prejeto ${u}`:`Neveljaven vnos: pričakovano ${r}, prejeto ${u}`}case"invalid_value":return t.values.length===1?`Neveljaven vnos: pričakovano ${_(t.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Preveliko: pričakovano, da bo ${t.origin??"vrednost"} imelo ${r}${t.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${t.origin??"vrednost"} ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Premajhno: pričakovano, da bo ${t.origin} imelo ${r}${t.minimum.toString()} ${a.unit}`:`Premajhno: pričakovano, da bo ${t.origin} ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Neveljaven niz: mora se začeti z "${r.prefix}"`:r.format==="ends_with"?`Neveljaven niz: mora se končati z "${r.suffix}"`:r.format==="includes"?`Neveljaven niz: mora vsebovati "${r.includes}"`:r.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${r.pattern}`:`Neveljaven ${i[r.format]??t.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${t.divisor}`;case"unrecognized_keys":return`Neprepoznan${t.keys.length>1?"i ključi":" ključ"}: ${g(t.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${t.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${t.origin}`;default:return"Neveljaven vnos"}}};function qp(){return{localeError:ey()}}var ty=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"},map:{unit:"objekt",verb:"att innehålla"}};function n(t){return e[t]??null}let i={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-adress",ipv6:"IPv6-adress",mac:"MAC-adress",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",credit_card:"kreditkortsnummer",currency_code:"valutakod",iban:"IBAN",jwt:"JWT",template_literal:"mall-literal"},o={nan:"NaN",number:"antal",array:"lista"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ogiltig inmatning: förväntat instanceof ${t.expected}, fick ${u}`:`Ogiltig inmatning: förväntat ${r}, fick ${u}`}case"invalid_value":return t.values.length===1?`Ogiltig inmatning: förväntat ${_(t.values[0])}`:`Ogiltigt val: förväntade en av ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`För stor(t): förväntade ${t.origin??"värdet"} att ha ${r}${t.maximum.toString()} ${a.unit??"element"}`:`För stor(t): förväntat ${t.origin??"värdet"} att ha ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`För lite(t): förväntade ${t.origin??"värdet"} att ha ${r}${t.minimum.toString()} ${a.unit}`:`För lite(t): förväntade ${t.origin??"värdet"} att ha ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ogiltig sträng: måste börja med "${r.prefix}"`:r.format==="ends_with"?`Ogiltig sträng: måste sluta med "${r.suffix}"`:r.format==="includes"?`Ogiltig sträng: måste innehålla "${r.includes}"`:r.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${r.pattern}"`:`Ogiltig(t) ${i[r.format]??t.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${g(t.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${t.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${t.origin??"värdet"}`;default:return"Ogiltig input"}}};function Yp(){return{localeError:ty()}}var ny=()=>{let e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},map:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function n(t){return e[t]??null}let i={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",mac:"MAC முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",credit_card:"கடன் அட்டை எண்",currency_code:"நாணயக் குறியீடு",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${t.expected}, பெறப்பட்டது ${u}`:`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${r}, பெறப்பட்டது ${u}`}case"invalid_value":return t.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${_(t.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${g(t.values,"|")} இல் ஒன்று`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${t.origin??"மதிப்பு"} ${r}${t.maximum.toString()} ${a.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${t.origin??"மதிப்பு"} ${r}${t.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${t.origin} ${r}${t.minimum.toString()} ${a.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${t.origin} ${r}${t.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let r=t;return r.format==="starts_with"?`தவறான சரம்: "${r.prefix}" இல் தொடங்க வேண்டும்`:r.format==="ends_with"?`தவறான சரம்: "${r.suffix}" இல் முடிவடைய வேண்டும்`:r.format==="includes"?`தவறான சரம்: "${r.includes}" ஐ உள்ளடக்க வேண்டும்`:r.format==="regex"?`தவறான சரம்: ${r.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${i[r.format]??t.format}`}case"not_multiple_of":return`தவறான எண்: ${t.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${t.keys.length>1?"கள்":""}: ${g(t.keys,", ")}`;case"invalid_key":return`${t.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${t.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function Qp(){return{localeError:ny()}}var ry=()=>{let e={string:{unit:"аломат",verb:"дошта бошад"},file:{unit:"байт",verb:"дошта бошад"},array:{unit:"унсур",verb:"дошта бошад"},set:{unit:"унсур",verb:"дошта бошад"},map:{unit:"сабт",verb:"дошта бошад"}};function n(t){return e[t]??null}let i={regex:"вуруд",email:"суроғаи email",url:"URL",emoji:"эмоҷи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"санаву вақти ISO",date:"санаи ISO",time:"вақти ISO",duration:"давомнокии ISO",ipv4:"суроғаи IPv4",ipv6:"суроғаи IPv6",mac:"суроғаи MAC",cidrv4:"маҳдудаи IPv4",cidrv6:"маҳдудаи IPv6",base64:"сатри дар формати base64",base64url:"сатри дар формати base64url",json_string:"сатри JSON",e164:"рақами E.164",credit_card:"рақами корти кредитӣ",currency_code:"рамзи асъор",iban:"IBAN",jwt:"JWT",template_literal:"вуруд"},o={nan:"NaN",number:"рақам",string:"сатр",array:"массив",object:"объект",date:"сана"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return`Вуруди нодуруст: ${r} интизор мерафт, ${u} гирифта шуд`}case"invalid_value":return t.values.length===1?`Вуруди нодуруст: ${_(t.values[0])} интизор мерафт`:`Интихоби нодуруст: яке аз ${g(t.values,"|")} интизор мерафт`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Хеле калон: ${t.origin??"қимат"} бояд ${r}${t.maximum.toString()} ${a.unit} ${a.verb}`:`Хеле калон: ${t.origin??"қимат"} бояд ${r}${t.maximum.toString()} бошад`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Хеле хурд: ${t.origin} бояд ${r}${t.minimum.toString()} ${a.unit} ${a.verb}`:`Хеле хурд: ${t.origin} бояд ${r}${t.minimum.toString()} бошад`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Сатри нодуруст: бояд бо "${r.prefix}" оғоз шавад`:r.format==="ends_with"?`Сатри нодуруст: бояд бо "${r.suffix}" анҷом ёбад`:r.format==="includes"?`Сатри нодуруст: бояд "${r.includes}"-ро дар бар гирад`:r.format==="regex"?`Сатри нодуруст: бояд ба намунаи ${r.pattern} мувофиқат кунад`:`${i[r.format]??t.format}-и нодуруст`}case"not_multiple_of":return`Рақами нодуруст: бояд ба ${t.divisor} бе бақия тақсим шавад`;case"unrecognized_keys":return`Калид${t.keys.length>1?"ҳои":"и"} номаълум: ${g(t.keys,", ")}`;case"invalid_key":return`Калиди нодуруст дар ${t.origin}`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`Қимати нодурусти дискриминатор: ${t.options.map(a=>`'${a}'`).join(" | ")} интизор мерафт`:"Вуруди нодуруст";case"invalid_element":return`Қимати нодуруст дар ${t.origin}`;default:return"Вуруди нодуруст"}}};function em(){return{localeError:ry()}}var iy=()=>{let e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"},map:{unit:"รายการ",verb:"ควรมี"}};function n(t){return e[t]??null}let i={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",mac:"ที่อยู่ MAC",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",credit_card:"หมายเลขบัตรเครดิต",currency_code:"รหัสสกุลเงิน",iban:"IBAN",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},o={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${t.expected} แต่ได้รับ ${u}`:`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${r} แต่ได้รับ ${u}`}case"invalid_value":return t.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${_(t.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"ไม่เกิน":"น้อยกว่า",a=n(t.origin);return a?`เกินกำหนด: ${t.origin??"ค่า"} ควรมี${r} ${t.maximum.toString()} ${a.unit??"รายการ"}`:`เกินกำหนด: ${t.origin??"ค่า"} ควรมี${r} ${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?"อย่างน้อย":"มากกว่า",a=n(t.origin);return a?`น้อยกว่ากำหนด: ${t.origin} ควรมี${r} ${t.minimum.toString()} ${a.unit}`:`น้อยกว่ากำหนด: ${t.origin} ควรมี${r} ${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${r.prefix}"`:r.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${r.suffix}"`:r.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${r.includes}" อยู่ในข้อความ`:r.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${r.pattern}`:`รูปแบบไม่ถูกต้อง: ${i[r.format]??t.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${t.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${g(t.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${t.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${t.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function tm(){return{localeError:iy()}}var oy=()=>{let e={string:{unit:"simwol",verb:"bolmaly"},file:{unit:"baýt",verb:"bolmaly"},array:{unit:"elementler",verb:"bolmaly"},set:{unit:"elementler",verb:"bolmaly"},map:{unit:"elementler",verb:"bolmaly"}};function n(t){return e[t]??null}let i={regex:"giriş",email:"e-poçta salgysy",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sene we wagt",date:"ISO sene",time:"ISO wagt",duration:"ISO wagt aralygy",ipv4:"IPv4 salgysy",ipv6:"IPv6 salgysy",mac:"MAC salgysy",cidrv4:"IPv4 aralygy",cidrv6:"IPv6 aralygy",base64:"base64 bilen şifrlenen setir",base64url:"base64url bilen şifrlenen setir",json_string:"JSON setiri",e164:"E.164 nomeri",credit_card:"kredit kartynyň nomeri",currency_code:"walýuta kody",iban:"IBAN",jwt:"JWT",template_literal:"şablon"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return`Nädogry baha: garaşylan ${r} ýerine ${u} alyndy`}case"invalid_value":return t.values.length===1?`Nädogry baha: ${_(t.values[0])} bolmaly`:`Nädogry saýlaw: aşakdakylardan biri bolmaly: ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Has uly: garaşylýan ${t.origin??"baha"} ${r} ${t.maximum.toString()} ${a.unit??"element"}`:`Has uly: garaşylýan ${t.origin??"baha"} ${r} ${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Has kiçi: garaşylýan ${t.origin} ${r} ${t.minimum.toString()} ${a.unit}`:`Has kiçi: garaşylýan ${t.origin} ${r} ${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Nädogry setir: "${r.prefix}" bilen başlamaly`:r.format==="ends_with"?`Nädogry setir: "${r.suffix}" bilen gutarmaly`:r.format==="includes"?`Nädogry setir: "${r.includes}" saklamaly`:r.format==="regex"?`Nädogry setir: ${r.pattern} nusga laýyk bolmaly`:`Nädogry ${i[r.format]??t.format}`}case"not_multiple_of":return`Nädogry san: ${t.divisor} bilen galyndysyz bölünmeli`;case"unrecognized_keys":return`Tanalmaýan açar${t.keys.length>1?"lar":""}: ${g(t.keys,", ")}`;case"invalid_key":return`${t.origin} içinde nädogry açar`;case"invalid_union":return"Nädogry baha";case"invalid_element":return`${t.origin} içinde nädogry baha`;default:return"Nädogry baha"}}};function nm(){return{localeError:oy()}}var ay=()=>{let e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"},map:{unit:"öğe",verb:"olmalı"}};function n(t){return e[t]??null}let i={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",mac:"MAC adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",credit_card:"kredi kartı numarası",currency_code:"para birimi kodu",iban:"IBAN",jwt:"JWT",template_literal:"Şablon dizesi"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Geçersiz değer: beklenen instanceof ${t.expected}, alınan ${u}`:`Geçersiz değer: beklenen ${r}, alınan ${u}`}case"invalid_value":return t.values.length===1?`Geçersiz değer: beklenen ${_(t.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Çok büyük: beklenen ${t.origin??"değer"} ${r}${t.maximum.toString()} ${a.unit??"öğe"}`:`Çok büyük: beklenen ${t.origin??"değer"} ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Çok küçük: beklenen ${t.origin} ${r}${t.minimum.toString()} ${a.unit}`:`Çok küçük: beklenen ${t.origin} ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Geçersiz metin: "${r.prefix}" ile başlamalı`:r.format==="ends_with"?`Geçersiz metin: "${r.suffix}" ile bitmeli`:r.format==="includes"?`Geçersiz metin: "${r.includes}" içermeli`:r.format==="regex"?`Geçersiz metin: ${r.pattern} desenine uymalı`:`Geçersiz ${i[r.format]??t.format}`}case"not_multiple_of":return`Geçersiz sayı: ${t.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${t.keys.length>1?"lar":""}: ${g(t.keys,", ")}`;case"invalid_key":return`${t.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${t.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function rm(){return{localeError:ay()}}var uy=()=>{let e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"},map:{unit:"елементів",verb:"матиме"}};function n(t){return e[t]??null}let i={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",mac:"адреса MAC",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",credit_card:"номер кредитної картки",currency_code:"код валюти",iban:"IBAN",jwt:"JWT",template_literal:"вхідні дані"},o={nan:"NaN",number:"число",array:"масив"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Неправильні вхідні дані: очікується instanceof ${t.expected}, отримано ${u}`:`Неправильні вхідні дані: очікується ${r}, отримано ${u}`}case"invalid_value":return t.values.length===1?`Неправильні вхідні дані: очікується ${_(t.values[0])}`:`Неправильна опція: очікується одне з ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Занадто велике: очікується, що ${t.origin??"значення"} ${a.verb} ${r}${t.maximum.toString()} ${a.unit??"елементів"}`:`Занадто велике: очікується, що ${t.origin??"значення"} буде ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Занадто мале: очікується, що ${t.origin} ${a.verb} ${r}${t.minimum.toString()} ${a.unit}`:`Занадто мале: очікується, що ${t.origin} буде ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Неправильний рядок: повинен починатися з "${r.prefix}"`:r.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${r.suffix}"`:r.format==="includes"?`Неправильний рядок: повинен містити "${r.includes}"`:r.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${r.pattern}`:`Неправильний ${i[r.format]??t.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${t.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${t.keys.length>1?"і":""}: ${g(t.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${t.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${t.origin}`;default:return"Неправильні вхідні дані"}}};function ui(){return{localeError:uy()}}function im(){return ui()}var cy=()=>{let e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"},map:{unit:"آئٹمز",verb:"ہونا"}};function n(t){return e[t]??null}let i={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",mac:"ایم اے سی ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",credit_card:"کریڈٹ کارڈ نمبر",currency_code:"کرنسی کوڈ",iban:"IBAN",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},o={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`غلط ان پٹ: instanceof ${t.expected} متوقع تھا، ${u} موصول ہوا`:`غلط ان پٹ: ${r} متوقع تھا، ${u} موصول ہوا`}case"invalid_value":return t.values.length===1?`غلط ان پٹ: ${_(t.values[0])} متوقع تھا`:`غلط آپشن: ${g(t.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`بہت بڑا: ${t.origin??"ویلیو"} کے ${r}${t.maximum.toString()} ${a.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${t.origin??"ویلیو"} کا ${r}${t.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`بہت چھوٹا: ${t.origin} کے ${r}${t.minimum.toString()} ${a.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${t.origin} کا ${r}${t.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let r=t;return r.format==="starts_with"?`غلط سٹرنگ: "${r.prefix}" سے شروع ہونا چاہیے`:r.format==="ends_with"?`غلط سٹرنگ: "${r.suffix}" پر ختم ہونا چاہیے`:r.format==="includes"?`غلط سٹرنگ: "${r.includes}" شامل ہونا چاہیے`:r.format==="regex"?`غلط سٹرنگ: پیٹرن ${r.pattern} سے میچ ہونا چاہیے`:`غلط ${i[r.format]??t.format}`}case"not_multiple_of":return`غلط نمبر: ${t.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${t.keys.length>1?"ز":""}: ${g(t.keys,"، ")}`;case"invalid_key":return`${t.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${t.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function om(){return{localeError:cy()}}var sy=()=>{let e={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"},map:{unit:"yozuv",verb:"bo‘lishi kerak"}};function n(t){return e[t]??null}let i={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",credit_card:"kredit karta raqami",currency_code:"valyuta kodi",iban:"IBAN",jwt:"JWT",template_literal:"kirish"},o={nan:"NaN",number:"raqam",array:"massiv"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Noto‘g‘ri kirish: kutilgan instanceof ${t.expected}, qabul qilingan ${u}`:`Noto‘g‘ri kirish: kutilgan ${r}, qabul qilingan ${u}`}case"invalid_value":return t.values.length===1?`Noto‘g‘ri kirish: kutilgan ${_(t.values[0])}`:`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Juda katta: kutilgan ${t.origin??"qiymat"} ${r}${t.maximum.toString()} ${a.unit} ${a.verb}`:`Juda katta: kutilgan ${t.origin??"qiymat"} ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Juda kichik: kutilgan ${t.origin} ${r}${t.minimum.toString()} ${a.unit} ${a.verb}`:`Juda kichik: kutilgan ${t.origin} ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Noto‘g‘ri satr: "${r.prefix}" bilan boshlanishi kerak`:r.format==="ends_with"?`Noto‘g‘ri satr: "${r.suffix}" bilan tugashi kerak`:r.format==="includes"?`Noto‘g‘ri satr: "${r.includes}" ni o‘z ichiga olishi kerak`:r.format==="regex"?`Noto‘g‘ri satr: ${r.pattern} shabloniga mos kelishi kerak`:`Noto‘g‘ri ${i[r.format]??t.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${t.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${t.keys.length>1?"lar":""}: ${g(t.keys,", ")}`;case"invalid_key":return`${t.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${t.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function am(){return{localeError:sy()}}var ly=()=>{let e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"},map:{unit:"phần tử",verb:"có"}};function n(t){return e[t]??null}let i={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",mac:"địa chỉ MAC",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",credit_card:"số thẻ tín dụng",currency_code:"mã tiền tệ",iban:"IBAN",jwt:"JWT",template_literal:"đầu vào"},o={nan:"NaN",number:"số",array:"mảng"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Đầu vào không hợp lệ: mong đợi instanceof ${t.expected}, nhận được ${u}`:`Đầu vào không hợp lệ: mong đợi ${r}, nhận được ${u}`}case"invalid_value":return t.values.length===1?`Đầu vào không hợp lệ: mong đợi ${_(t.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Quá lớn: mong đợi ${t.origin??"giá trị"} ${a.verb} ${r}${t.maximum.toString()} ${a.unit??"phần tử"}`:`Quá lớn: mong đợi ${t.origin??"giá trị"} ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Quá nhỏ: mong đợi ${t.origin} ${a.verb} ${r}${t.minimum.toString()} ${a.unit}`:`Quá nhỏ: mong đợi ${t.origin} ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${r.prefix}"`:r.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${r.suffix}"`:r.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${r.includes}"`:r.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${r.pattern}`:`${i[r.format]??t.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${t.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${g(t.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${t.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${t.origin}`;default:return"Đầu vào không hợp lệ"}}};function um(){return{localeError:ly()}}var dy=()=>{let e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"},map:{unit:"项",verb:"包含"}};function n(t){return e[t]??null}let i={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",mac:"MAC地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",credit_card:"信用卡号",currency_code:"货币代码",iban:"IBAN",jwt:"JWT",template_literal:"输入"},o={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`无效输入:期望 instanceof ${t.expected},实际接收 ${u}`:`无效输入:期望 ${r},实际接收 ${u}`}case"invalid_value":return t.values.length===1?`无效输入:期望 ${_(t.values[0])}`:`无效选项:期望以下之一 ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`数值过大:期望 ${t.origin??"值"} ${r}${t.maximum.toString()} ${a.unit??"个元素"}`:`数值过大:期望 ${t.origin??"值"} ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`数值过小:期望 ${t.origin} ${r}${t.minimum.toString()} ${a.unit}`:`数值过小:期望 ${t.origin} ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`无效字符串:必须以 "${r.prefix}" 开头`:r.format==="ends_with"?`无效字符串:必须以 "${r.suffix}" 结尾`:r.format==="includes"?`无效字符串:必须包含 "${r.includes}"`:r.format==="regex"?`无效字符串:必须满足正则表达式 ${r.pattern}`:`无效${i[r.format]??t.format}`}case"not_multiple_of":return`无效数字:必须是 ${t.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${g(t.keys,", ")}`;case"invalid_key":return`${t.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${t.origin} 中包含无效值(value)`;default:return"无效输入"}}};function cm(){return{localeError:dy()}}var py=()=>{let e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"},map:{unit:"項目",verb:"擁有"}};function n(t){return e[t]??null}let i={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",mac:"MAC 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",credit_card:"信用卡號",currency_code:"貨幣代碼",iban:"IBAN",jwt:"JWT",template_literal:"輸入"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`無效的輸入值:預期為 instanceof ${t.expected},但收到 ${u}`:`無效的輸入值:預期為 ${r},但收到 ${u}`}case"invalid_value":return t.values.length===1?`無效的輸入值:預期為 ${_(t.values[0])}`:`無效的選項:預期為以下其中之一 ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`數值過大:預期 ${t.origin??"值"} 應為 ${r}${t.maximum.toString()} ${a.unit??"個元素"}`:`數值過大:預期 ${t.origin??"值"} 應為 ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`數值過小:預期 ${t.origin} 應為 ${r}${t.minimum.toString()} ${a.unit}`:`數值過小:預期 ${t.origin} 應為 ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`無效的字串:必須以 "${r.prefix}" 開頭`:r.format==="ends_with"?`無效的字串:必須以 "${r.suffix}" 結尾`:r.format==="includes"?`無效的字串:必須包含 "${r.includes}"`:r.format==="regex"?`無效的字串:必須符合格式 ${r.pattern}`:`無效的 ${i[r.format]??t.format}`}case"not_multiple_of":return`無效的數字:必須為 ${t.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${t.keys.length>1?"們":""}:${g(t.keys,"、")}`;case"invalid_key":return`${t.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${t.origin} 中有無效的值`;default:return"無效的輸入值"}}};function sm(){return{localeError:py()}}var my=()=>{let e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"},map:{unit:"nkan",verb:"ní"}};function n(t){return e[t]??null}let i={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",mac:"àdírẹ́sì MAC",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",credit_card:"nọmba kaadi gbese",currency_code:"koodu owó",iban:"IBAN",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},o={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=x(t.input),u=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${t.expected}, àmọ̀ a rí ${u}`:`Ìbáwọlé aṣìṣe: a ní láti fi ${r}, àmọ̀ a rí ${u}`}case"invalid_value":return t.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${_(t.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Tó pọ̀ jù: a ní láti jẹ́ pé ${t.origin??"iye"} ${a.verb} ${r}${t.maximum} ${a.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${r}${t.maximum}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Kéré ju: a ní láti jẹ́ pé ${t.origin} ${a.verb} ${r}${t.minimum} ${a.unit}`:`Kéré ju: a ní láti jẹ́ ${r}${t.minimum}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${r.prefix}"`:r.format==="ends_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${r.suffix}"`:r.format==="includes"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${r.includes}"`:r.format==="regex"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${r.pattern}`:`Aṣìṣe: ${i[r.format]??t.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${t.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${g(t.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${t.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${t.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function lm(){return{localeError:my()}}var dm,mc=Symbol("ZodOutput"),fc=Symbol("ZodInput"),ci=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...i){let o=i[0];return this._map.set(n,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,n),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){let i=this._map.get(n);return i&&typeof i=="object"&&"id"in i&&this._idmap.delete(i.id),this._map.delete(n),this}get(n){let i=n._zod.parent;if(i){let o={...this.get(i)??{}};delete o.id;let t={...o,...this._map.get(n)};return Object.keys(t).length?t:void 0}return this._map.get(n)}has(n){return this._map.has(n)}};function si(){return new ci}(dm=globalThis).__zod_globalRegistry??(dm.__zod_globalRegistry=si());var Q=globalThis.__zod_globalRegistry;var re=Symbol.for("zod.compile.invalid"),pm=Symbol.for("zod.compile.fallback"),ye=class extends Error{constructor(n="z.compile does not support async refinements, transforms, or checks"){super(n),this.name="ZodCompileAsyncError"}},E=class extends Error{constructor(n,i=!0){super(`z.compile does not support ${n}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=i}};function gy(e,n){try{return di(e,{assertOnly:!0})}catch{return n}}function $c(e,n){try{let i=di(e),o=li(e,i);return o._zod.bag.validator=gy(e,i),o}catch(i){if(n?.strict)throw i;return e}}function li(e,n){if(ri(e))throw new E("a schema whose subtree contains a reference cycle");let i=L(e),o=e._zod.run,t=o.__originalRun??o,r=(a,u)=>{if(u?.async||u?.direction==="backward"||u?.skipChecks||u?.[pm]||u&&ii(u,a.value))return t(a,u);let s=n(a.value);return s!==re?(a.value=s,a):(u&&(u[pm]=!0),t(a,u))};return r.__originalRun=t,i._zod.bag.fallbackRun=t,i._zod.bag.validator=n,i._zod.run=r,o.__originalRun||vy(i,e,n),i}function vy(e,n,i){let o=e,t=n;if(typeof t.safeParse=="function"){let r=t.safeParse;o.safeParse=(a,u)=>{let s=i(a);return s!==re?{success:!0,data:s}:r(a,u)}}if(typeof t.parse=="function"){let r=t.parse;o.parse=(a,u)=>{let s=i(a);return s!==re?s:r(a,u)}}}function di(e,n){let i=!0;try{i=ri(e)}catch{}if(i)throw new E("a schema whose subtree contains a reference cycle");let o={constants:new Map,constantCounter:0,varCounter:0,definite:!0},t=new tt(["input"]),r=F(t,o,e,"input",!n?.assertOnly);t.write(r===null?"return true;":`return ${r};`);let a=["INVALID",...o.constants.keys()],u=[re,...o.constants.values()],s=t.content.join(` + `)}return k.write("payload.value = newResult;"),k.write("return payload;"),k.compile()},a,s=tt,u=!Y.jitless,l=u&&Ro.value,d=n.catchall,p;e._zod.parse=(f,h)=>{p??(p=o.value);let y=f.value;return s(y)?u&&l&&h?.async===!1&&h.jitless!==!0?(a||(a=r(n.shape)),f=a(f,h),d?np([],y,f,h,p,e,h?.abortEarly===!0):f):i(f,h):(f.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),f)}});function Rd(e,n,i,o){for(let r of e)if(r.issues.length===0)return n.value=r.value,n;let t=e.filter(r=>!re(r));return t.length===1?(n.value=t[0].value,t[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:i,errors:e.map(r=>r.issues.map(a=>ce(a,o,B())))}),n)}var Un=g("$ZodUnion",(e,n)=>{E.init(e,n),U(e,"optin",o=>o.def.options.some(t=>t._zod.optin==="defaulted")?"defaulted":o.def.options.some(t=>t._zod.optin!==void 0)?"optional":void 0),U(e,"optout",o=>o.def.options.some(t=>t._zod.optout==="optional")?"optional":void 0),U(e,"values",o=>{if(o.def.options.every(t=>t._zod.values))return new Set(o.def.options.flatMap(t=>Array.from(t._zod.values)))}),U(e,"pattern",o=>{if(o.def.options.every(t=>t._zod.pattern)){let t=o.def.options.map(r=>r._zod.pattern);return new RegExp(`^(${t.map(r=>De(r.source)).join("|")})$`)}});let i=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(o,t)=>{if(i)return i(o,t);let r=!1,a=[];for(let s of n.options){let u=s._zod.run({value:o.value,issues:[]},t);if(u instanceof Promise)a.push(u),r=!0;else{if(u.issues.length===0)return u;a.push(u)}}return r?Promise.all(a).then(s=>Rd(s,o,e,t)):Rd(a,o,e,t)}});function Zd(e,n,i,o){let t=[];for(let r=0;rr.issues.map(a=>ce(a,o,B())))}):n.issues.push({code:"invalid_union",input:n.value,inst:i,errors:[],inclusive:!1,matches:t}),n)}var Bs=g("$ZodXor",(e,n)=>{Un.init(e,n),n.inclusive=!1;let i=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(o,t)=>{if(i)return i(o,t);let r=!1,a=[];for(let s of n.options){let u=s._zod.run({value:o.value,issues:[]},t);u instanceof Promise?(a.push(u),r=!0):a.push(u)}return r?Promise.all(a).then(s=>Zd(s,o,e,t)):Zd(a,o,e,t)}});function Js(e,n){let i=e._zod,o=i.bag.optionsMap;o||(o=ip(i.def),i.bag.optionsMap=o);let t=o.get(n);if(t===null)throw new Error(`Ambiguous discriminator value "${String(n)}"`);return t}function ip(e){let n=new Map;for(let i of e.options){let o=i._zod.propValues?.[e.discriminator];if(!o||o.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let t of o)if(n.has(t)){if(t!==void 0)throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,null)}else n.set(t,i)}return n}var Ks=g("$ZodDiscriminatedUnion",(e,n)=>{n.inclusive=!1,Un.init(e,n);let i=e._zod.parse;U(e,"propValues",t=>{let r={},a=0;for(let s of t.def.options){let u=s._zod.propValues;if(!u||Object.keys(u).length===0)throw new Error(`Invalid discriminated union option at index "${t.def.options.indexOf(s)}"`);u[t.def.discriminator]?.has(void 0)&&a++;for(let[c,l]of Object.entries(u)){Object.prototype.hasOwnProperty.call(r,c)||Q(r,c,new Set);for(let d of l)r[c].add(d)}}return!t.def.unionFallback&&a>1&&r[t.def.discriminator]?.delete(void 0),r}),n.options.forEach((t,r)=>{let a=wt(t._zod.def);if(a&&!Object.prototype.hasOwnProperty.call(a,n.discriminator))throw new Error(`Invalid discriminated union option at index "${r}"`)});let o=St(()=>ip(n));e._zod.parse=(t,r)=>{let a=t.value;if(!tt(a))return t.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),t;let s=a?.[n.discriminator],u=o.value.get(s);return u&&(s!==void 0||r.direction!=="backward")?u._zod.run(t,r):n.unionFallback||r.direction==="backward"?i(t,r):(t.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,options:Array.from(o.value.keys()).filter(c=>o.value.get(c)!==null),input:a,path:[n.discriminator],inst:e}),t)}}),Hs=g("$ZodIntersection",(e,n)=>{E.init(e,n),e._zod.parse=(i,o)=>{let t=i.value,r=n.left._zod.run({value:t,issues:[]},o),a=n.right._zod.run({value:t,issues:[]},o);return r instanceof Promise||a instanceof Promise?Promise.all([r,a]).then(([u,c])=>Md(i,u,c)):Md(i,r,a)}});function Et(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(ve(e)&&ve(n)){let i=Object.keys(n),o=Object.keys(e).filter(r=>i.indexOf(r)!==-1),t={...e,...n};Object.prototype.hasOwnProperty.call(t,"__proto__")&&delete t.__proto__;for(let r of o){if(r==="__proto__")continue;let a=Et(e[r],n[r]);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};t[r]=a.data}return{valid:!0,data:t}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};let i=[];for(let o=0;o{let d;if(c.code==="unrecognized_keys"&&!c.path?.length)t??(t=c),d=c.keys;else if(c.code==="invalid_key"&&c.origin==="record"&&c.path?.length===1){let p=String(c.path[0]);r.has(p)||r.set(p,c),d=[p]}else return!1;for(let p of d)o.has(p)||o.set(p,{}),o.get(p)[l]=!0;return!0};for(let c of n.issues)a(c,"l")||e.issues.push(c);for(let c of i.issues)a(c,"r")||e.issues.push(c);let s=[...o].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(s.length){let c=t?s.filter(l=>t.keys.includes(l)):[];c.length&&e.issues.push({...t,keys:c});for(let l of s)!c.includes(l)&&r.has(l)&&e.issues.push(r.get(l))}let u=Et(n.value,i.value);if(!u.valid){if(re(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var ei=g("$ZodTuple",(e,n)=>{E.init(e,n);let i=n.items,o=Y.memoizer;o?.attach(e),e._zod.parse=(t,r)=>{let a=t.value;if(!Array.isArray(a))return t.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),t;t.value=o?o.alloc(e,t,[],r):[];let s=[],u=Vd(i,"optin"),c=Vd(i,"optout");if(!n.rest){if(a.lengthi.length&&t.issues.push({code:"too_big",maximum:i.length,inclusive:!0,input:a,inst:e,origin:"array"})}let l=new Array(i.length),d=n.rest?r?.abortEarly:void 0,p=!1;for(let f=0;f{l[f]=y})):(l[f]=h,d&&!p&&h.issues.length&&(p=re(h)))}if(n.rest&&!p){let f=i.length-1,h=a.slice(i.length),y=t.issues.length;for(let k of h){if(d&&t.issues.length!==y){if(re(t,y))break;y=t.issues.length}f++;let P=n.rest._zod.run({value:k,issues:[]},r);P instanceof Promise?s.push(P.then(S=>Fd(S,t,f))):Fd(P,t,f)}}return s.length?Promise.all(s).then(()=>Gd(l,t,i,a,c)):Gd(l,t,i,a,c)}});function Vd(e,n){for(let i=e.length-1;i>=0;i--)if(!(n==="optin"?e[i]._zod.optin!==void 0:e[i]._zod.optout==="optional"))return i+1;return 0}function Fd(e,n,i){e.issues.length&&n.issues.push(...ue(i,e.issues)),n.value[i]=e.value}function Gd(e,n,i,o,t){for(let r=0;r=t&&i[r]._zod.optin==="optional"){n.value.length=r;break}if(a.issues.length){if(!s&&r>=t){n.value.length=r;break}n.issues.push(...ue(r,a.issues))}n.value[r]=a.value}for(let r=n.value.length-1;r>=o.length&&(i[r]._zod.optout==="optional"&&n.value[r]===void 0);r--)n.value.length=r;return n}var Ws=g("$ZodRecord",(e,n)=>{E.init(e,n);let i=Y.memoizer;i?.attach(e),e._zod.parse=(o,t)=>{let r=o.value;if(!ve(r))return o.issues.push({expected:"record",code:"invalid_type",input:r,inst:e}),o;let a=[],s=n.keyType._zod.values;if(s&&!n.partial){o.value=i?i.alloc(e,o,{},t):{};let u=new Set;for(let l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(u.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let d=n.keyType._zod.run({value:l,issues:[]},t);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(h=>ce(h,t,B())),input:l,path:[l],inst:e});continue}let p=d.value;if(p==="__proto__")continue;let f=n.valueType._zod.run({value:r[l],issues:[]},t);f instanceof Promise?a.push(f.then(h=>{h.issues.length&&o.issues.push(...ue(l,h.issues)),o.value[p]=h.value})):(f.issues.length&&o.issues.push(...ue(l,f.issues)),o.value[p]=f.value)}let c;for(let l in r)if(!u.has(l))if(n.mode==="loose"){if(l==="__proto__")continue;o.value[l]=r[l]}else c=c??[],c.push(l);c&&c.length>0&&o.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:c,continue:!0})}else{o.value=i?i.alloc(e,o,{},t):{};let u;for(let c of Reflect.ownKeys(r)){if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(r,c))continue;let l=n.keyType._zod.run({value:c,issues:[]},t);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&Oe.test(c)&&l.issues.length){let h=n.keyType._zod.run({value:Number(c),issues:[]},t);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){n.mode==="loose"?o.value[c]=r[c]:s?(u=u??[],u.push(c)):o.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>ce(h,t,B())),input:c,path:[c],inst:e});continue}let p=l.value;if(p==="__proto__")continue;let f=n.valueType._zod.run({value:r[c],issues:[]},t);f instanceof Promise?a.push(f.then(h=>{h.issues.length&&o.issues.push(...ue(c,h.issues)),o.value[p]=h.value})):(f.issues.length&&o.issues.push(...ue(c,f.issues)),o.value[p]=f.value)}u&&u.length>0&&o.issues.push({code:"unrecognized_keys",input:r,inst:e,keys:u,continue:!0})}return a.length?Promise.all(a).then(()=>o):o}}),Xs=g("$ZodMap",(e,n)=>{E.init(e,n);let i=Y.memoizer;i?.attach(e),e._zod.parse=(o,t)=>{let r=o.value;if(!(r instanceof Map))return o.issues.push({expected:"map",code:"invalid_type",input:r,inst:e}),o;let a=[];o.value=i?i.alloc(e,o,new Map,t):new Map;let s=t?.abortEarly,u=o.issues.length;for(let[c,l]of r){if(s&&o.issues.length!==u){if(re(o,u))break;u=o.issues.length}let d=n.keyType._zod.run({value:c,issues:[]},t),p=n.valueType._zod.run({value:l,issues:[]},t);d instanceof Promise||p instanceof Promise?a.push(Promise.all([d,p]).then(([f,h])=>{Bd(f,h,o,c,r,e,t)})):Bd(d,p,o,c,r,e,t)}return a.length?Promise.all(a).then(()=>o):o},Vs(e,h$)});function Bd(e,n,i,o,t,r,a){e.issues.length&&(gn.has(typeof o)?i.issues.push(...ue(o,e.issues)):i.issues.push({code:"invalid_key",origin:"map",input:t,inst:r,issues:e.issues.map(s=>ce(s,a,B()))})),n.issues.length&&(gn.has(typeof o)?i.issues.push(...ue(o,n.issues)):i.issues.push({origin:"map",code:"invalid_element",input:t,inst:r,key:o,issues:n.issues.map(s=>ce(s,a,B()))})),i.value.set(e.value,n.value)}var qs=g("$ZodSet",(e,n)=>{E.init(e,n);let i=Y.memoizer;i?.attach(e),e._zod.parse=(o,t)=>{let r=o.value;if(!(r instanceof Set))return o.issues.push({input:r,inst:e,expected:"set",code:"invalid_type"}),o;let a=[];o.value=i?i.alloc(e,o,new Set,t):new Set;let s=t?.abortEarly,u=o.issues.length;for(let c of r){if(s&&o.issues.length!==u){if(re(o,u))break;u=o.issues.length}let l=n.valueType._zod.run({value:c,issues:[]},t);l instanceof Promise?a.push(l.then(d=>Jd(d,o))):Jd(l,o)}return a.length?Promise.all(a).then(()=>o):o},Vs(e,$$)});function Jd(e,n){e.issues.length&&n.issues.push(...e.issues),n.value.add(e.value)}var Ys=g("$ZodEnum",(e,n)=>{E.init(e,n);let i=kt(n.entries),o=new Set(i);e._zod.values=o,U(e,"pattern",t=>{let r=kt(t.def.entries).filter(a=>gn.has(typeof a));return new RegExp(r.length?`^(${r.map(a=>he(a.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(t,r)=>{let a=t.value;return o.has(a)||t.issues.push({code:"invalid_value",values:i,input:a,inst:e}),t}}),Qs=g("$ZodLiteral",(e,n)=>{E.init(e,n);let i=new Set(n.values);e._zod.values=i,U(e,"pattern",o=>{let t=o.def.values;return new RegExp(t.length?`^(${t.map(r=>typeof r=="string"?he(r):r?he(r.toString()):String(r)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,t)=>{let r=o.value;return i.has(r)||o.issues.push({code:"invalid_value",values:n.values,input:r,inst:e}),o}}),eu=g("$ZodFile",(e,n)=>{E.init(e,n),e._zod.parse=(i,o)=>{let t=i.value;return t instanceof File||i.issues.push({expected:"file",code:"invalid_type",input:t,inst:e}),i}}),tu=g("$ZodTransform",(e,n)=>{E.init(e,n),e._zod.optin="optional",Y.memoizer?.guard(e),e._zod.parse=(i,o)=>{if(o.direction==="backward")throw new Re(e.constructor.name);let t=n.transform(i.value,i);if(o.async)return(t instanceof Promise?t:Promise.resolve(t)).then(a=>(i.value=a,i));if(t instanceof Promise)throw new le;return i.value=t,i}});function Kd(e,n){return e.value=n.issues.length?void 0:n.value,e}var ti=g("$ZodOptional",(e,n)=>{E.init(e,n),U(e,"optin",i=>i.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",U(e,"values",i=>{let o=i.def.innerType._zod.values;return o?new Set([...o,void 0]):void 0}),U(e,"pattern",i=>{let o=i.def.innerType._zod.pattern;return o?new RegExp(`^(${De(o.source)})?$`):void 0}),e._zod.parse=(i,o)=>{if(i.value===void 0){if(n.innerType._zod.optin!=="defaulted")return i;let t=n.innerType._zod.run({value:i.value,issues:[]},o);return t instanceof Promise?t.then(r=>Kd(i,r)):Kd(i,t)}return n.innerType._zod.run(i,o)}}),nu=g("$ZodExactOptional",(e,n)=>{ti.init(e,n),U(e,"values",i=>i.def.innerType._zod.values),U(e,"pattern",i=>i.def.innerType._zod.pattern),e._zod.parse=(i,o)=>n.innerType._zod.run(i,o)}),ru=g("$ZodNullable",(e,n)=>{E.init(e,n),U(e,"optin",i=>i.def.innerType._zod.optin),U(e,"optout",i=>i.def.innerType._zod.optout),U(e,"pattern",i=>{let o=i.def.innerType._zod.pattern;return o?new RegExp(`^(${De(o.source)}|null)$`):void 0}),U(e,"values",i=>i.def.innerType._zod.values?new Set([...i.def.innerType._zod.values,null]):void 0),e._zod.parse=(i,o)=>i.value===null?i:n.innerType._zod.run(i,o)}),iu=g("$ZodDefault",(e,n)=>{E.init(e,n),e._zod.optin="defaulted",U(e,"values",i=>i.def.innerType._zod.values),e._zod.parse=(i,o)=>{if(o.direction==="backward")return n.innerType._zod.run(i,o);if(i.value===void 0)return i.value=n.defaultValue,i;let t=n.innerType._zod.run(i,o);return t instanceof Promise?t.then(r=>Hd(r,n)):Hd(t,n)}});function Hd(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}var ou=g("$ZodPrefault",(e,n)=>{E.init(e,n),e._zod.optin="defaulted",U(e,"values",i=>i.def.innerType._zod.values),e._zod.parse=(i,o)=>(o.direction==="backward"||i.value===void 0&&(i.value=n.defaultValue),n.innerType._zod.run(i,o))}),au=g("$ZodNonOptional",(e,n)=>{E.init(e,n),U(e,"values",i=>{let o=i.def.innerType._zod.values;return o?new Set([...o].filter(t=>t!==void 0)):void 0}),e._zod.parse=(i,o)=>{let t=n.innerType._zod.run(i,o);return t instanceof Promise?t.then(r=>Wd(r,e)):Wd(t,e)}});function Wd(e,n){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}var su=g("$ZodSuccess",(e,n)=>{E.init(e,n),e._zod.parse=(i,o)=>{if(o.direction==="backward")throw new Re("ZodSuccess");let t=n.innerType._zod.run(i,o);return t instanceof Promise?t.then(r=>(i.value=r.issues.length===0,i)):(i.value=t.issues.length===0,i)}});function Xd(e,n,i,o){return n.issues.length?(e.value=i.catchValue({...n,value:e.value,error:{issues:n.issues.map(t=>ce(t,o,B()))},input:e.value}),e):(e.value=n.value,n.memo&&(e.memo=!0),e)}var uu=g("$ZodCatch",(e,n)=>{E.init(e,n),U(e,"optin",i=>i.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),U(e,"optout",i=>i.def.innerType._zod.optout),U(e,"values",i=>i.def.innerType._zod.values),e._zod.parse=(i,o)=>{if(o.direction==="backward")return n.innerType._zod.run(i,o);let t=n.innerType._zod.run({value:i.value,issues:[]},o);return t instanceof Promise?t.then(r=>Xd(i,r,n,o)):Xd(i,t,n,o)}}),cu=g("$ZodNaN",(e,n)=>{E.init(e,n),e._zod.parse=(i,o)=>((typeof i.value!="number"||!Number.isNaN(i.value))&&i.issues.push({input:i.value,inst:e,expected:"nan",code:"invalid_type"}),i)}),ni=g("$ZodPipe",(e,n)=>{E.init(e,n),U(e,"values",i=>i.def.in._zod.values),U(e,"optin",i=>i.def.in._zod.optin),U(e,"optout",i=>i.def.out._zod.optout),U(e,"propValues",i=>i.def.in._zod.propValues),e._zod.parse=(i,o)=>{if(o.direction==="backward"){let r=n.out._zod.run(i,o);return r instanceof Promise?r.then(a=>Cr(a,n.in,o)):Cr(r,n.in,o)}let t=n.in._zod.run(i,o);return t instanceof Promise?t.then(r=>Cr(r,n.out,o)):Cr(t,n.out,o)}});function Cr(e,n,i){return e.issues.some(o=>o.code!=="unrecognized_keys")?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues},i)}var Ln=g("$ZodCodec",(e,n)=>{E.init(e,n),U(e,"values",i=>i.def.in._zod.values),U(e,"optin",i=>i.def.in._zod.optin),U(e,"optout",i=>i.def.out._zod.optout),U(e,"propValues",i=>i.def.in._zod.propValues),e._zod.parse=(i,o)=>{if((o.direction||"forward")==="forward"){let r=n.in._zod.run(i,o);return r instanceof Promise?r.then(a=>Rr(a,n,o)):Rr(r,n,o)}else{let r=n.out._zod.run(i,o);return r instanceof Promise?r.then(a=>Rr(a,n,o)):Rr(r,n,o)}}});function Rr(e,n,i){if(e.issues.length)return e.aborted=!0,e;if((i.direction||"forward")==="forward"){let t=n.transform(e.value,e);return t instanceof Promise?t.then(r=>Zr(e,r,n.out,i)):Zr(e,t,n.out,i)}else{let t=n.reverseTransform(e.value,e);return t instanceof Promise?t.then(r=>Zr(e,r,n.in,i)):Zr(e,t,n.in,i)}}function Zr(e,n,i,o){return e.issues.length?(e.aborted=!0,e):i._zod.run({value:n,issues:e.issues},o)}var lu=g("$ZodPreprocess",(e,n)=>{ni.init(e,n)}),du=g("$ZodReadonly",(e,n)=>{E.init(e,n),U(e,"propValues",i=>i.def.innerType._zod.propValues),U(e,"values",i=>i.def.innerType._zod.values),U(e,"optin",i=>i.def.innerType?._zod?.optin),U(e,"optout",i=>i.def.innerType?._zod?.optout),e._zod.parse=(i,o)=>{if(o.direction==="backward")return n.innerType._zod.run(i,o);let t=n.innerType._zod.run(i,o);return t instanceof Promise?t.then(qd):qd(t)}});function qd(e){return e.memo||(e.value=Object.freeze(e.value)),e}function _$(e){let n=e._zod.def,i=n.pattern,o=!!n.format?.includes("int"),t,r;for(let s of n.checks??[]){let u=s._zod.def;u.pattern&&(i=u.pattern),o||(o=!!u.format?.includes("int"));let c=u.minimum??u.length,l=u.maximum??u.length;c!==void 0&&(t===void 0||c>t)&&(t=c),l!==void 0&&(r===void 0||lr)return"(?!)";if(t!==void 0||r!==void 0)return wa({minimum:t,maximum:r}).source;let a=e._zod.pattern;return(o&&a===Oe?Pn:a)?.source}function ns(e){let n=e._zod.def,i=e._zod.pattern?.source,o=n.innerType??e._zod.innerType;if(o){let t=o._zod.pattern?.source,r=ns(o);return i&&t&&r&&r!==t?i.replace(De(t),()=>De(r)):i}if(n.options){let t=n.options.map(ns);if(t.every(Boolean))return`^(${t.map(r=>De(r)).join("|")})$`}return _$(e)}var pu=g("$ZodTemplateLiteral",(e,n)=>{E.init(e,n);let i=[];for(let o of n.parts)if(typeof o=="object"&&o!==null){let t=ns(o);if(!t)throw new Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);i.push(De(t))}else if(o===null||Zo.has(typeof o))i.push(he(`${o}`));else throw new Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${i.join("")}$`),e._zod.parse=(o,t)=>typeof o.value!="string"?(o.issues.push({input:o.value,inst:e,expected:"string",code:"invalid_type"}),o):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(o.value)||o.issues.push({input:o.value,inst:e,code:"invalid_format",format:n.format??"template_literal",pattern:e._zod.pattern.source}),o)}),mu=g("$ZodFunction",(e,n)=>(E.init(e,n),Object.defineProperty(e,"_def",{value:n}),e._zod.def=n,e.implement=i=>{if(typeof i!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...o){let t=e._def.input?xr(e._def.input,o):o,r=Reflect.apply(i,this,t);return e._def.output?xr(e._def.output,r):r},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=i=>{if(typeof i!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...o){let t=e._def.input?await kr(e._def.input,o):o,r=await Reflect.apply(i,this,t);return e._def.output?await kr(e._def.output,r):r},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(i,o)=>typeof i.value!="function"?(i.issues.push({code:"invalid_type",expected:"function",input:i.value,inst:e}),i):(e._def.output&&e._def.output._zod.def.type==="promise"?i.value=e.implementAsync(i.value):i.value=e.implement(i.value),i),e.input=(...i)=>{let o=e.constructor;return Array.isArray(i[0])?new o({type:"function",input:new ei({type:"tuple",items:i[0],rest:i[1]}),output:e._def.output}):new o({type:"function",input:i[0],output:e._def.output})},e.output=i=>{let o=e.constructor;return new o({type:"function",input:e._def.input,output:i})},e)),fu=g("$ZodPromise",(e,n)=>{E.init(e,n),e._zod.parse=(i,o)=>Promise.resolve(i.value).then(t=>n.innerType._zod.run({value:t,issues:[]},o))}),Cn=g("$ZodLazy",(e,n)=>{E.init(e,n),Lo(e._zod,"innerType",()=>{let i=n;return i._cachedInner||(i._cachedInner=n.getter()),i._cachedInner}),U(e,"pattern",i=>i.innerType?._zod?.pattern),U(e,"propValues",i=>i.innerType?._zod?.propValues),U(e,"optin",i=>i.innerType?._zod?.optin??void 0),U(e,"optout",i=>i.innerType?._zod?.optout??void 0),e._zod.parse=(i,o)=>e._zod.innerType._zod.run(i,o)}),gu=g("$ZodCustom",(e,n)=>{F.init(e,n),E.init(e,n),e._zod.parse=(i,o)=>i,e._zod.check=i=>{let o=i.value,t=n.fn(o);if(t instanceof Promise)return t.then(r=>Yd(r,i,o,e));Yd(t,i,o,e)}});function Yd(e,n,i,o){if(!e){let t={code:"custom",input:i,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(t.params=o._zod.def.params),n.issues.push(zt(t))}}var ai=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},hu="~memo",ap=[];function sp(e){return e!==null&&typeof e=="object"}function vu(e){return e.map(n=>n.path?{...n,path:n.path.slice()}:{...n})}var up=new WeakMap,jt=0,oi=1,Rn=2;function Zn(e,n,i){let o=up.get(e);if(o!==void 0)return o?Rn:jt;if(n.has(e))return Rn;n.add(e);let t=jt,r=l=>{if(t!==Rn&&l?._zod){let d=Zn(l,n,i);d>t&&(t=d)}},a=(l,d)=>{let p=jt;for(let f of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,f);if(d&&!h.enumerable)continue;let y=h.get?oi:h.value?._zod?Zn(h.value,n,i):jt;y>p&&(p=y)}return p},s=l=>{l>t&&(t=l)},u=e._zod.def,c=u.type;switch(c){case"object":{let l=wt(u);s(l?a(l,!0):oi),r(u.catchall);break}case"array":r(u.element);break;case"tuple":for(let l of u.items)r(l);r(u.rest);break;case"record":case"map":r(u.keyType),r(u.valueType);break;case"set":r(u.valueType);break;case"union":for(let l of u.options)r(l);break;case"intersection":r(u.left),r(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":r(u.innerType);break;case"pipe":r(u.in),r(u.out);break;case"function":r(u.input),r(u.output);break;case"lazy":{let l=u._cachedInner??(i?e._zod.innerType:void 0);s(l?Zn(l,n,!1):oi);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in u){let d=Object.getOwnPropertyDescriptor(u,l);if(!d||d.get)continue;let p=d.value;if(!(!p||typeof p!="object")){if(p._zod)r(p);else if(Array.isArray(p))for(let f of p)r(f)}}}return n.delete(e),b$(e,t)}function b$(e,n){return n!==oi&&up.set(e,n===Rn),n}function si(e){return Zn(e,new Set,!0)!==jt}function x$(e,n){let i=e.buckets.get(n);return i||(i=new WeakMap,e.buckets.set(n,i)),i}var ri,ii=[],k$={alloc(e,n,i){let o=ri;if(!o)return i;ri=void 0;let t={value:i,issues:null};return o.set(n.value,t),ii.push(t),i},guard(e){var n;(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred.push(()=>{let i=e._zod.parse,o=(t,r)=>{if(r.direction!=="backward"&&ui(r,t.value))throw new ai;return i(t,r)};e._zod.parse=o,e._zod.run===i&&(e._zod.run=o)})},attach(e){var n;let i,o=!1,t,r;(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred.push(()=>{let a=e._zod.parse,s=(u,c)=>{if(i===void 0){let P=Zn(e,new Set,!1);if(P===jt)return e._zod.parse=a,e._zod.run===s&&(e._zod.run=a),a(u,c);P===Rn||o?i=!0:o=!0}let l=u.value;if(!sp(l))return a(u,c);let d=c[hu];d||(d={buckets:new WeakMap,backEdges:void 0},c[hu]=d);let p;t===c?p=r:(p=x$(d,e),t=c,r=p);let f=p.get(l);if(f)return u.value=f.value,f.issues?f.issues.length&&u.issues.push(...vu(f.issues)):(u.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(f.value)),u;ri=p;let h=ii.length,y=a(u,c);ri=void 0;let k=ii.length>h?ii.pop():void 0;return y instanceof Promise?y.then(P=>(k&&(k.issues=P.issues.length?vu(P.issues):ap),P)):(k&&(k.issues=y.issues.length?vu(y.issues):ap),y)};e._zod.parse=s,e._zod.run===a&&(e._zod.run=s)})}};function Mn(){return k$}function ui(e,n){let i=e[hu]?.backEdges;return i!==void 0&&sp(n)&&i.has(n)}var Fn={};Ne(Fn,{ar:()=>cp,az:()=>lp,be:()=>pp,bg:()=>mp,bn:()=>fp,ca:()=>gp,ckb:()=>vp,cs:()=>hp,da:()=>$p,de:()=>yp,el:()=>_p,en:()=>ci,eo:()=>bp,es:()=>xp,fa:()=>kp,fi:()=>Ip,fr:()=>Sp,frCA:()=>wp,gu:()=>Pp,he:()=>zp,hi:()=>Ap,hr:()=>Np,hu:()=>Tp,hy:()=>Op,id:()=>Ep,is:()=>jp,it:()=>Up,ja:()=>Lp,ka:()=>Cp,kh:()=>Rp,km:()=>li,kn:()=>Zp,ko:()=>Mp,lt:()=>Fp,mk:()=>Gp,ms:()=>Bp,ne:()=>Jp,nl:()=>Kp,nn:()=>Hp,no:()=>Wp,ota:()=>Xp,pl:()=>Yp,ps:()=>qp,pt:()=>Qp,ptBR:()=>em,ro:()=>tm,ru:()=>rm,sk:()=>im,sl:()=>om,sv:()=>am,ta:()=>sm,tg:()=>um,th:()=>cm,tk:()=>lm,tr:()=>dm,ua:()=>pm,uk:()=>di,ur:()=>mm,uz:()=>fm,vi:()=>gm,yo:()=>$m,zhCN:()=>vm,zhTW:()=>hm});var I$=()=>{let e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"},map:{unit:"عنصر",verb:"أن يحوي"}};function n(t){return e[t]??null}let i={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",mac:"عنوان MAC",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",credit_card:"رقم بطاقة الائتمان",currency_code:"رمز العملة",iban:"IBAN",jwt:"JWT",template_literal:"مدخل"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`مدخلات غير مقبولة: يفترض إدخال instanceof ${t.expected}، ولكن تم إدخال ${s}`:`مدخلات غير مقبولة: يفترض إدخال ${r}، ولكن تم إدخال ${s}`}case"invalid_value":return t.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${_(t.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?` أكبر من اللازم: يفترض أن تكون ${t.origin??"القيمة"} ${r} ${t.maximum.toString()} ${a.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${t.origin??"القيمة"} ${r} ${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`أصغر من اللازم: يفترض لـ ${t.origin} أن يكون ${r} ${t.minimum.toString()} ${a.unit}`:`أصغر من اللازم: يفترض لـ ${t.origin} أن يكون ${r} ${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${t.prefix}"`:r.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${r.suffix}"`:r.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${r.includes}"`:r.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${r.pattern}`:`${i[r.format]??t.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${t.divisor}`;case"unrecognized_keys":return`معرف${t.keys.length>1?"ات":""} غريب${t.keys.length>1?"ة":""}: ${v(t.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${t.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${t.origin}`;default:return"مدخل غير مقبول"}}};function cp(){return{localeError:I$()}}var S$=()=>{let e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"},map:{unit:"element",verb:"olmalıdır"}};function n(t){return e[t]??null}let i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",credit_card:"kredit kartı nömrəsi",currency_code:"valyuta kodu",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Yanlış dəyər: gözlənilən instanceof ${t.expected}, daxil olan ${s}`:`Yanlış dəyər: gözlənilən ${r}, daxil olan ${s}`}case"invalid_value":return t.values.length===1?`Yanlış dəyər: gözlənilən ${_(t.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Çox böyük: gözlənilən ${t.origin??"dəyər"} ${r}${t.maximum.toString()} ${a.unit??"element"}`:`Çox böyük: gözlənilən ${t.origin??"dəyər"} ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Çox kiçik: gözlənilən ${t.origin} ${r}${t.minimum.toString()} ${a.unit}`:`Çox kiçik: gözlənilən ${t.origin} ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Yanlış mətn: "${r.prefix}" ilə başlamalıdır`:r.format==="ends_with"?`Yanlış mətn: "${r.suffix}" ilə bitməlidir`:r.format==="includes"?`Yanlış mətn: "${r.includes}" daxil olmalıdır`:r.format==="regex"?`Yanlış mətn: ${r.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${i[r.format]??t.format}`}case"not_multiple_of":return`Yanlış ədəd: ${t.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${t.keys.length>1?"lar":""}: ${v(t.keys,", ")}`;case"invalid_key":return`${t.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${t.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function lp(){return{localeError:S$()}}function dp(e,n,i,o){let t=Math.abs(e),r=t%10,a=t%100;return a>=11&&a<=19?o:r===1?n:r>=2&&r<=4?i:o}var w$=()=>{let e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},map:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function n(t){return e[t]??null}let i={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",mac:"MAC адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",credit_card:"нумар крэдытнай карты",currency_code:"код валюты",iban:"IBAN",jwt:"JWT",template_literal:"увод"},o={nan:"NaN",number:"лік",array:"масіў"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Няправільны ўвод: чакаўся instanceof ${t.expected}, атрымана ${s}`:`Няправільны ўвод: чакаўся ${r}, атрымана ${s}`}case"invalid_value":return t.values.length===1?`Няправільны ўвод: чакалася ${_(t.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);if(a){let s=Number(t.maximum),u=dp(s,a.unit.one,a.unit.few,a.unit.many);return`Занадта вялікі: чакалася, што ${t.origin??"значэнне"} павінна ${a.verb} ${r}${t.maximum.toString()} ${u}`}return`Занадта вялікі: чакалася, што ${t.origin??"значэнне"} павінна быць ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);if(a){let s=Number(t.minimum),u=dp(s,a.unit.one,a.unit.few,a.unit.many);return`Занадта малы: чакалася, што ${t.origin} павінна ${a.verb} ${r}${t.minimum.toString()} ${u}`}return`Занадта малы: чакалася, што ${t.origin} павінна быць ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${r.prefix}"`:r.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${r.suffix}"`:r.format==="includes"?`Няправільны радок: павінен змяшчаць "${r.includes}"`:r.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${r.pattern}`:`Няправільны ${i[r.format]??t.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${t.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${t.keys.length>1?"ключы":"ключ"}: ${v(t.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${t.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${t.origin}`;default:return"Няправільны ўвод"}}};function pp(){return{localeError:w$()}}var P$=()=>{let e={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"},map:{unit:"елемента",verb:"да съдържа"}};function n(t){return e[t]??null}let i={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",mac:"MAC адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",credit_card:"номер на кредитна карта",currency_code:"код на валута",iban:"IBAN",jwt:"JWT",template_literal:"вход"},o={nan:"NaN",number:"число",array:"масив"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Невалиден вход: очакван instanceof ${t.expected}, получен ${s}`:`Невалиден вход: очакван ${r}, получен ${s}`}case"invalid_value":return t.values.length===1?`Невалиден вход: очакван ${_(t.values[0])}`:`Невалидна опция: очаквано едно от ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Твърде голямо: очаква се ${t.origin??"стойност"} да съдържа ${r}${t.maximum.toString()} ${a.unit??"елемента"}`:`Твърде голямо: очаква се ${t.origin??"стойност"} да бъде ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Твърде малко: очаква се ${t.origin} да съдържа ${r}${t.minimum.toString()} ${a.unit}`:`Твърде малко: очаква се ${t.origin} да бъде ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;if(r.format==="starts_with")return`Невалиден низ: трябва да започва с "${r.prefix}"`;if(r.format==="ends_with")return`Невалиден низ: трябва да завършва с "${r.suffix}"`;if(r.format==="includes")return`Невалиден низ: трябва да включва "${r.includes}"`;if(r.format==="regex")return`Невалиден низ: трябва да съвпада с ${r.pattern}`;let a="Невалиден";return r.format==="emoji"&&(a="Невалидно"),r.format==="datetime"&&(a="Невалидно"),r.format==="date"&&(a="Невалидна"),r.format==="time"&&(a="Невалидно"),r.format==="duration"&&(a="Невалидна"),`${a} ${i[r.format]??t.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${t.divisor}`;case"unrecognized_keys":return`Неразпознат${t.keys.length>1?"и":""} ключ${t.keys.length>1?"ове":""}: ${v(t.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${t.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${t.origin}`;default:return"Невалиден вход"}}};function mp(){return{localeError:P$()}}var z$=()=>{let e={string:{unit:"অক্ষর",verb:"থাকতে হবে"},file:{unit:"বাইট",verb:"থাকতে হবে"},array:{unit:"আইটেম",verb:"থাকতে হবে"},set:{unit:"আইটেম",verb:"থাকতে হবে"},map:{unit:"এন্ট্রি",verb:"থাকতে হবে"}};function n(t){return e[t]??null}let i={regex:"ইনপুট",email:"ইমেইল ঠিকানা",url:"URL",emoji:"ইমোজি",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO তারিখ ও সময়",date:"ISO তারিখ",time:"ISO সময়",duration:"ISO সময়কাল",ipv4:"IPv4 ঠিকানা",ipv6:"IPv6 ঠিকানা",mac:"MAC ঠিকানা",cidrv4:"IPv4 রেঞ্জ",cidrv6:"IPv6 রেঞ্জ",base64:"base64-এনকোডেড স্ট্রিং",base64url:"base64url-এনকোডেড স্ট্রিং",json_string:"JSON স্ট্রিং",e164:"E.164 নম্বর",credit_card:"ক্রেডিট কার্ড নম্বর",currency_code:"মুদ্রা কোড",iban:"IBAN",jwt:"JWT",template_literal:"ইনপুট"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return`অবৈধ ইনপুট: প্রত্যাশিত ${r}, প্রাপ্ত ${s}`}case"invalid_value":return t.values.length===1?`অবৈধ ইনপুট: প্রত্যাশিত ${_(t.values[0])}`:`অবৈধ অপশন: ${v(t.values," | ")} এর মধ্যে একটি প্রত্যাশিত`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`অনেক বড়: ${t.origin??"মান"} ${r}${t.maximum.toString()} ${a.unit??"এলিমেন্ট"} হতে হবে`:`অনেক বড়: ${t.origin??"মান"} ${r}${t.maximum.toString()} হতে হবে`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`অনেক ছোট: ${t.origin} ${r}${t.minimum.toString()} ${a.unit} হতে হবে`:`অনেক ছোট: ${t.origin} ${r}${t.minimum.toString()} হতে হবে`}case"invalid_format":{let r=t;return r.format==="starts_with"?`অবৈধ স্ট্রিং: "${r.prefix}" দিয়ে শুরু হতে হবে`:r.format==="ends_with"?`অবৈধ স্ট্রিং: "${r.suffix}" দিয়ে শেষ হতে হবে`:r.format==="includes"?`অবৈধ স্ট্রিং: "${r.includes}" অন্তর্ভুক্ত থাকতে হবে`:r.format==="regex"?`অবৈধ স্ট্রিং: ${r.pattern} প্যাটার্ন মিলতে হবে`:`অবৈধ ${i[r.format]??t.format}`}case"not_multiple_of":return`অবৈধ নম্বর: ${t.divisor} এর গুণিতক হতে হবে`;case"unrecognized_keys":return`অচেনা কী${t.keys.length>1?"গুলো":""}: ${v(t.keys,", ")}`;case"invalid_key":return`${t.origin} এ অবৈধ কী`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`অবৈধ ডিসক্রিমিনেটর মান। প্রত্যাশিত ${t.options.map(a=>`'${a}'`).join(" | ")}`:"অবৈধ ইনপুট";case"invalid_element":return`${t.origin} এ অবৈধ মান`;default:return"অবৈধ ইনপুট"}}};function fp(){return{localeError:z$()}}var A$=()=>{let e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"},map:{unit:"elements",verb:"contenir"}};function n(t){return e[t]??null}let i={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",mac:"adreça MAC",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",credit_card:"número de targeta de crèdit",currency_code:"codi de moneda",iban:"IBAN",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Tipus invàlid: s'esperava instanceof ${t.expected}, s'ha rebut ${s}`:`Tipus invàlid: s'esperava ${r}, s'ha rebut ${s}`}case"invalid_value":return t.values.length===1?`Valor invàlid: s'esperava ${_(t.values[0])}`:`Opció invàlida: s'esperava una de ${v(t.values," o ")}`;case"too_big":{let r=t.inclusive?"com a màxim":"menys de",a=n(t.origin);return a?`Massa gran: s'esperava que ${t.origin??"el valor"} contingués ${r} ${t.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${t.origin??"el valor"} fos ${r} ${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?"com a mínim":"més de",a=n(t.origin);return a?`Massa petit: s'esperava que ${t.origin} contingués ${r} ${t.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${t.origin} fos ${r} ${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Format invàlid: ha de començar amb "${r.prefix}"`:r.format==="ends_with"?`Format invàlid: ha d'acabar amb "${r.suffix}"`:r.format==="includes"?`Format invàlid: ha d'incloure "${r.includes}"`:r.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${r.pattern}`:`Format invàlid per a ${i[r.format]??t.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${t.divisor}`;case"unrecognized_keys":return`Clau${t.keys.length>1?"s":""} no reconeguda${t.keys.length>1?"s":""}: ${v(t.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${t.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${t.origin}`;default:return"Entrada invàlida"}}};function gp(){return{localeError:A$()}}var N$=()=>{let e={string:{unit:"پیت",verb:"بێت"},file:{unit:"بایت",verb:"بێت"},array:{unit:"دانە",verb:"بێت"},set:{unit:"دانە",verb:"بێت"},map:{unit:"دانە",verb:"بێت"}};function n(t){return e[t]??null}let i={regex:"regex",email:"ئیمەیڵ",url:"بەستەر (URL)",emoji:"ئیمۆجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ڕێکەوت و کات",date:"ڕێکەوت",time:"کات",duration:"ماوە",ipv4:"ناونیشانی IPv4",ipv6:"ناونیشانی IPv6",mac:"ناونیشانی MAC",cidrv4:"مەودای IPv4",cidrv6:"مەودای IPv6",base64:"دەقی base64",base64url:"دەقی base64url",json_string:"دەقی JSON",e164:"ژمارەی E.164",credit_card:"ژمارەی کارتی کرێدیت",currency_code:"کۆدی دراو",iban:"IBAN",jwt:"JWT",template_literal:"تێکردە"},o={nan:"NaN",string:"نووسین",number:"ژمارە",boolean:"boolean",array:"array",object:"object",date:"ڕێکەوت",integer:"ژمارە",float:"ژمارە",null:"null",undefined:"undefined",function:"function",symbol:"symbol",unknown:"unknown",promise:"promise",void:"void",never:"never",map:"map",set:"set"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a,u=["ا","و","ۆ","وو","ە","ی","ێ"].some(l=>s.endsWith(l))?"یە":"ە",c=/^[a-zA-Z]+$/.test(s);return a==="null"||a==="undefined"?"داواکراوە":`چاوەڕوانکراوە ${r} بێت، بەڵام ${s}${c?"":u}`}case"invalid_value":return t.values.length===1?`بەهاکە نادرووستە: چاوەڕوانکراوە ${_(t.values[0])} بێت`:`هەڵبژاردەی نادروست: چاوەڕوانکراوە یەکێک بێت لە ${v(t.values,"|")}`;case"too_big":{let r=n(t.origin);return r?`پێویستە بە لایەنی زۆرەوە ${t.maximum.toString()} ${r.unit} ${r.verb}`:`پێویستە بە لایەنی زۆرەوە ${t.maximum.toString()} بێت`}case"too_small":{let r=n(t.origin);return r?`پێویستە بە لایەنی کەمەوە ${t.minimum.toString()} ${r.unit} ${r.verb}`:`پێویستە بە لایەنی کەمەوە ${t.minimum.toString()} بێت`}case"invalid_format":{let r=t;return r.format==="starts_with"?`دەقی نادروست: پێویستە دەستپێبکات بە "${r.prefix}"`:r.format==="ends_with"?`دەقی نادروست: پێویستە کۆتاییبێت بە "${r.suffix}"`:r.format==="includes"?`دەقی نادروست: پێویستە "${r.includes}" لەخۆبگرێت`:r.format==="regex"?`دەقی نادروست: پێویستە لەگەڵ پاتێرنی ${r.pattern} بگونجێت`:`بەهای ${i[r.format]??t.format} نادروستە`}case"not_multiple_of":return`ژمارەی نادروست: دەبێت چەند هێندە بێت بۆ ${t.divisor}`;case"unrecognized_keys":return`کلیلی نەناسراو: ${v(t.keys,", ")}`;case"invalid_key":return`کلیلی نادروست لە ${t.origin}`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`بەهای نەناسراو هەیە. بەهای چاوەڕوانکراو: ${t.options.map(a=>`'${a}'`).join(" | ")}`:"یەکگرتنی نادروست";case"invalid_element":return`${t.origin} بەهاکە نادروستە`;default:return"تێکردەی نادروست"}}};function vp(){return{localeError:N$()}}var T$=()=>{let e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"},map:{unit:"prvků",verb:"mít"}};function n(t){return e[t]??null}let i={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",credit_card:"číslo kreditní karty",currency_code:"kód měny",iban:"IBAN",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Neplatný vstup: očekáváno instanceof ${t.expected}, obdrženo ${s}`:`Neplatný vstup: očekáváno ${r}, obdrženo ${s}`}case"invalid_value":return t.values.length===1?`Neplatný vstup: očekáváno ${_(t.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Hodnota je příliš velká: ${t.origin??"hodnota"} musí mít ${r}${t.maximum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš velká: ${t.origin??"hodnota"} musí být ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Hodnota je příliš malá: ${t.origin??"hodnota"} musí mít ${r}${t.minimum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš malá: ${t.origin??"hodnota"} musí být ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Neplatný řetězec: musí začínat na "${r.prefix}"`:r.format==="ends_with"?`Neplatný řetězec: musí končit na "${r.suffix}"`:r.format==="includes"?`Neplatný řetězec: musí obsahovat "${r.includes}"`:r.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${r.pattern}`:`Neplatný formát ${i[r.format]??t.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${t.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${v(t.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${t.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${t.origin}`;default:return"Neplatný vstup"}}};function hp(){return{localeError:T$()}}var D$=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"},map:{unit:"elementer",verb:"indeholdt"}};function n(t){return e[t]??null}let i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kreditkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ugyldigt input: forventede instanceof ${t.expected}, fik ${s}`:`Ugyldigt input: forventede ${r}, fik ${s}`}case"invalid_value":return t.values.length===1?`Ugyldig værdi: forventede ${_(t.values[0])}`:`Ugyldigt valg: forventede en af følgende ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin),s=o[t.origin]??t.origin;return a?`For stor: forventede ${s??"value"} ${a.verb} ${r} ${t.maximum.toString()} ${a.unit??"elementer"}`:`For stor: forventede ${s??"value"} havde ${r} ${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin),s=o[t.origin]??t.origin;return a?`For lille: forventede ${s} ${a.verb} ${r} ${t.minimum.toString()} ${a.unit}`:`For lille: forventede ${s} havde ${r} ${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ugyldig streng: skal starte med "${r.prefix}"`:r.format==="ends_with"?`Ugyldig streng: skal ende med "${r.suffix}"`:r.format==="includes"?`Ugyldig streng: skal indeholde "${r.includes}"`:r.format==="regex"?`Ugyldig streng: skal matche mønsteret ${r.pattern}`:`Ugyldig ${i[r.format]??t.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${v(t.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${t.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${t.origin}`;default:return"Ugyldigt input"}}};function $p(){return{localeError:D$()}}var O$=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"},map:{unit:"Elemente",verb:"zu haben"}};function n(t){return e[t]??null}let i={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",mac:"MAC-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",credit_card:"Kreditkartennummer",currency_code:"Währungscode",iban:"IBAN",jwt:"JWT",template_literal:"Eingabe"},o={nan:"NaN",number:"Zahl",array:"Array"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ungültige Eingabe: erwartet instanceof ${t.expected}, erhalten ${s}`:`Ungültige Eingabe: erwartet ${r}, erhalten ${s}`}case"invalid_value":return t.values.length===1?`Ungültige Eingabe: erwartet ${_(t.values[0])}`:`Ungültige Option: erwartet eine von ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Zu groß: erwartet, dass ${t.origin??"Wert"} ${r}${t.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${t.origin??"Wert"} ${r}${t.maximum.toString()} ist`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Zu klein: erwartet, dass ${t.origin} ${r}${t.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${t.origin} ${r}${t.minimum.toString()} ist`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ungültiger String: muss mit "${r.prefix}" beginnen`:r.format==="ends_with"?`Ungültiger String: muss mit "${r.suffix}" enden`:r.format==="includes"?`Ungültiger String: muss "${r.includes}" enthalten`:r.format==="regex"?`Ungültiger String: muss dem Muster ${r.pattern} entsprechen`:`Ungültig: ${i[r.format]??t.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${t.divisor} sein`;case"unrecognized_keys":return`${t.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${v(t.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${t.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${t.origin}`;default:return"Ungültige Eingabe"}}};function yp(){return{localeError:O$()}}var E$=()=>{let e={string:{unit:"χαρακτήρες",verb:"να έχει"},file:{unit:"bytes",verb:"να έχει"},array:{unit:"στοιχεία",verb:"να έχει"},set:{unit:"στοιχεία",verb:"να έχει"},map:{unit:"καταχωρήσεις",verb:"να έχει"}};function n(t){return e[t]??null}let i={regex:"είσοδος",email:"διεύθυνση email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ημερομηνία και ώρα",date:"ISO ημερομηνία",time:"ISO ώρα",duration:"ISO διάρκεια",ipv4:"διεύθυνση IPv4",ipv6:"διεύθυνση IPv6",mac:"διεύθυνση MAC",cidrv4:"εύρος IPv4",cidrv6:"εύρος IPv6",base64:"συμβολοσειρά κωδικοποιημένη σε base64",base64url:"συμβολοσειρά κωδικοποιημένη σε base64url",json_string:"συμβολοσειρά JSON",e164:"αριθμός E.164",credit_card:"αριθμός πιστωτικής κάρτας",currency_code:"κωδικός νομίσματος",iban:"IBAN",jwt:"JWT",template_literal:"είσοδος"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return typeof t.expected=="string"&&/^[A-Z]/.test(t.expected)?`Μη έγκυρη είσοδος: αναμενόταν instanceof ${t.expected}, λήφθηκε ${s}`:`Μη έγκυρη είσοδος: αναμενόταν ${r}, λήφθηκε ${s}`}case"invalid_value":return t.values.length===1?`Μη έγκυρη είσοδος: αναμενόταν ${_(t.values[0])}`:`Μη έγκυρη επιλογή: αναμενόταν ένα από ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Πολύ μεγάλο: αναμενόταν ${t.origin??"τιμή"} να έχει ${r}${t.maximum.toString()} ${a.unit??"στοιχεία"}`:`Πολύ μεγάλο: αναμενόταν ${t.origin??"τιμή"} να είναι ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Πολύ μικρό: αναμενόταν ${t.origin} να έχει ${r}${t.minimum.toString()} ${a.unit}`:`Πολύ μικρό: αναμενόταν ${t.origin} να είναι ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${r.prefix}"`:r.format==="ends_with"?`Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${r.suffix}"`:r.format==="includes"?`Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${r.includes}"`:r.format==="regex"?`Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${r.pattern}`:`Μη έγκυρο: ${i[r.format]??t.format}`}case"not_multiple_of":return`Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${t.divisor}`;case"unrecognized_keys":return`Άγνωστ${t.keys.length>1?"α":"ο"} κλειδ${t.keys.length>1?"ιά":"ί"}: ${v(t.keys,", ")}`;case"invalid_key":return`Μη έγκυρο κλειδί στο ${t.origin}`;case"invalid_union":return"Μη έγκυρη είσοδος";case"invalid_element":return`Μη έγκυρη τιμή στο ${t.origin}`;default:return"Μη έγκυρη είσοδος"}}};function _p(){return{localeError:E$()}}var j$=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function n(r){return e[r]??null}let i={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};function t(r,a){return r==="number"&&typeof a=="number"&&!Number.isFinite(a)?String(a):o[r]??r}return r=>{switch(r.code){case"invalid_type":{let a=t(r.expected),s=b(r.input),u=t(s,r.input);return`Invalid input: expected ${a}, received ${u}`}case"invalid_value":return r.values.length===1?`Invalid input: expected ${_(r.values[0])}`:`Invalid option: expected one of ${v(r.values,"|")}`;case"too_big":{let a=r.exact?"exactly ":r.inclusive?"<=":"<",s=n(r.origin);return s?`Too big: expected ${r.origin??"value"} to have ${a}${r.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${r.origin??"value"} to be ${a}${r.maximum.toString()}`}case"too_small":{let a=r.exact?"exactly ":r.inclusive?">=":">",s=n(r.origin);return s?`Too small: expected ${r.origin} to have ${a}${r.minimum.toString()} ${s.unit}`:`Too small: expected ${r.origin} to be ${a}${r.minimum.toString()}`}case"invalid_format":{let a=r;return a.format==="starts_with"?`Invalid string: must start with "${a.prefix}"`:a.format==="ends_with"?`Invalid string: must end with "${a.suffix}"`:a.format==="includes"?`Invalid string: must include "${a.includes}"`:a.format==="regex"?`Invalid string: must match pattern ${a.pattern}`:`Invalid ${i[a.format]??r.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${r.divisor}`;case"unrecognized_keys":return`Unrecognized key${r.keys.length>1?"s":""}: ${v(r.keys,", ")}`;case"invalid_key":return`Invalid key in ${r.origin}`;case"invalid_union":return r.options&&Array.isArray(r.options)&&r.options.length>0?`Invalid discriminator value. Expected ${r.options.map(s=>`'${s}'`).join(" | ")}`:r.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${r.origin}`;default:return"Invalid input"}}};function ci(){return{localeError:j$()}}var U$=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"},map:{unit:"elementojn",verb:"havi"}};function n(t){return e[t]??null}let i={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",mac:"MAC-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",credit_card:"kreditkarta numero",currency_code:"valuta kodo",iban:"IBAN",jwt:"JWT",template_literal:"enigo"},o={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Nevalida enigo: atendiĝis instanceof ${t.expected}, riceviĝis ${s}`:`Nevalida enigo: atendiĝis ${r}, riceviĝis ${s}`}case"invalid_value":return t.values.length===1?`Nevalida enigo: atendiĝis ${_(t.values[0])}`:`Nevalida opcio: atendiĝis unu el ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Tro granda: atendiĝis ke ${t.origin??"valoro"} havu ${r}${t.maximum.toString()} ${a.unit??"elementojn"}`:`Tro granda: atendiĝis ke ${t.origin??"valoro"} havu ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Tro malgranda: atendiĝis ke ${t.origin} havu ${r}${t.minimum.toString()} ${a.unit}`:`Tro malgranda: atendiĝis ke ${t.origin} estu ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Nevalida karaktraro: devas komenciĝi per "${r.prefix}"`:r.format==="ends_with"?`Nevalida karaktraro: devas finiĝi per "${r.suffix}"`:r.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${r.includes}"`:r.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${r.pattern}`:`Nevalida ${i[r.format]??t.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${t.divisor}`;case"unrecognized_keys":return`Nekonata${t.keys.length>1?"j":""} ŝlosilo${t.keys.length>1?"j":""}: ${v(t.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${t.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${t.origin}`;default:return"Nevalida enigo"}}};function bp(){return{localeError:U$()}}var L$=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function n(t){return e[t]??null}let i={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",mac:"dirección MAC",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",credit_card:"número de tarjeta de crédito",currency_code:"código de moneda",iban:"IBAN",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Entrada inválida: se esperaba instanceof ${t.expected}, recibido ${s}`:`Entrada inválida: se esperaba ${r}, recibido ${s}`}case"invalid_value":return t.values.length===1?`Entrada inválida: se esperaba ${_(t.values[0])}`:`Opción inválida: se esperaba una de ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin),s=o[t.origin]??t.origin;return a?`Demasiado grande: se esperaba que ${s??"valor"} tuviera ${r}${t.maximum.toString()} ${a.unit??"elementos"}`:`Demasiado grande: se esperaba que ${s??"valor"} fuera ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin),s=o[t.origin]??t.origin;return a?`Demasiado pequeño: se esperaba que ${s} tuviera ${r}${t.minimum.toString()} ${a.unit}`:`Demasiado pequeño: se esperaba que ${s} fuera ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Cadena inválida: debe comenzar con "${r.prefix}"`:r.format==="ends_with"?`Cadena inválida: debe terminar en "${r.suffix}"`:r.format==="includes"?`Cadena inválida: debe incluir "${r.includes}"`:r.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${r.pattern}`:`Inválido ${i[r.format]??t.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${t.divisor}`;case"unrecognized_keys":return`Llave${t.keys.length>1?"s":""} desconocida${t.keys.length>1?"s":""}: ${v(t.keys,", ")}`;case"invalid_key":return`Llave inválida en ${o[t.origin]??t.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${o[t.origin]??t.origin}`;default:return"Entrada inválida"}}};function xp(){return{localeError:L$()}}var C$=()=>{let e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"},map:{unit:"آیتم",verb:"داشته باشد"}};function n(t){return e[t]??null}let i={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",mac:"MAC آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",credit_card:"شماره کارت اعتباری",currency_code:"کد ارز",iban:"IBAN",jwt:"JWT",template_literal:"ورودی"},o={nan:"NaN",number:"عدد",array:"آرایه"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`ورودی نامعتبر: می‌بایست instanceof ${t.expected} می‌بود، ${s} دریافت شد`:`ورودی نامعتبر: می‌بایست ${r} می‌بود، ${s} دریافت شد`}case"invalid_value":return t.values.length===1?`ورودی نامعتبر: می‌بایست ${_(t.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${v(t.values,"|")} می‌بود`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`خیلی بزرگ: ${t.origin??"مقدار"} باید ${r}${t.maximum.toString()} ${a.unit??"عنصر"} باشد`:`خیلی بزرگ: ${t.origin??"مقدار"} باید ${r}${t.maximum.toString()} باشد`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`خیلی کوچک: ${t.origin} باید ${r}${t.minimum.toString()} ${a.unit} باشد`:`خیلی کوچک: ${t.origin} باید ${r}${t.minimum.toString()} باشد`}case"invalid_format":{let r=t;return r.format==="starts_with"?`رشته نامعتبر: باید با "${r.prefix}" شروع شود`:r.format==="ends_with"?`رشته نامعتبر: باید با "${r.suffix}" تمام شود`:r.format==="includes"?`رشته نامعتبر: باید شامل "${r.includes}" باشد`:r.format==="regex"?`رشته نامعتبر: باید با الگوی ${r.pattern} مطابقت داشته باشد`:`${i[r.format]??t.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${t.divisor} باشد`;case"unrecognized_keys":return`کلید${t.keys.length>1?"های":""} ناشناس: ${v(t.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${t.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${t.origin}`;default:return"ورودی نامعتبر"}}};function kp(){return{localeError:C$()}}var R$=()=>{let e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},map:{unit:"alkiota",subject:"kuvauksen"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function n(t){return e[t]??null}let i={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",mac:"MAC-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",credit_card:"luottokortin numero",currency_code:"valuuttakoodi",iban:"IBAN",jwt:"JWT",template_literal:"templaattimerkkijono"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Virheellinen tyyppi: odotettiin instanceof ${t.expected}, oli ${s}`:`Virheellinen tyyppi: odotettiin ${r}, oli ${s}`}case"invalid_value":return t.values.length===1?`Virheellinen syöte: täytyy olla ${_(t.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Liian suuri: ${a.subject} täytyy olla ${r}${t.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon täytyy olla ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Liian pieni: ${a.subject} täytyy olla ${r}${t.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon täytyy olla ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${r.prefix}"`:r.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${r.suffix}"`:r.format==="includes"?`Virheellinen syöte: täytyy sisältää "${r.includes}"`:r.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${r.pattern}`:`Virheellinen ${i[r.format]??t.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${t.divisor} monikerta`;case"unrecognized_keys":return`${t.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${v(t.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function Ip(){return{localeError:R$()}}var Z$=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function n(t){return e[t]??null}let i={regex:"expression régulière",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",mac:"adresse MAC",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne de caractères encodée en base64",base64url:"chaîne de caractères encodée en base64url",json_string:"chaîne de caractères JSON",e164:"numéro au format E.164",credit_card:"numéro de carte de crédit",currency_code:"code de devise",iban:"IBAN",jwt:"JWT",template_literal:"entrée"},o={string:"chaîne de caractères",number:"nombre",int:"entier",boolean:"booléen",bigint:"grand entier",symbol:"symbole",undefined:"indéfini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"record",map:"map",set:"ensemble",file:"fichier",nonoptional:"non optionnel",nan:"NaN",function:"fonction"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Entrée invalide : instance de ${t.expected} attendu, ${s} reçu`:`Entrée invalide : ${r} attendu, ${s} reçu`}case"invalid_value":return t.values.length===1?`Entrée invalide : ${_(t.values[0])} attendu`:`Option invalide : une valeur parmi ${v(t.values,"|")} attendue`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Trop grand : ${o[t.origin]??"valeur"} doit ${a.verb} ${r}${t.maximum.toString()} ${a.unit??"élément(s)"}`:`Trop grand : ${o[t.origin]??"valeur"} doit être ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Trop petit : ${o[t.origin]??"valeur"} doit ${a.verb} ${r}${t.minimum.toString()} ${a.unit}`:`Trop petit : ${o[t.origin]??"valeur"} doit être ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Chaîne de caractères invalide : doit commencer par "${r.prefix}"`:r.format==="ends_with"?`Chaîne de caractères invalide : doit se terminer par "${r.suffix}"`:r.format==="includes"?`Chaîne de caractères invalide : doit inclure "${r.includes}"`:r.format==="regex"?`Chaîne de caractères invalide : doit correspondre au motif ${r.pattern}`:`${i[r.format]??t.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${t.divisor}`;case"unrecognized_keys":return`Clé${t.keys.length>1?"s":""} non reconnue${t.keys.length>1?"s":""} : ${v(t.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${t.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${t.origin}`;default:return"Entrée invalide"}}};function Sp(){return{localeError:Z$()}}var M$=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"},map:{unit:"éléments",verb:"avoir"}};function n(t){return e[t]??null}let i={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",mac:"adresse MAC",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",credit_card:"numéro de carte de crédit",currency_code:"code de devise",iban:"IBAN",jwt:"JWT",template_literal:"entrée"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Entrée invalide : attendu instanceof ${t.expected}, reçu ${s}`:`Entrée invalide : attendu ${r}, reçu ${s}`}case"invalid_value":return t.values.length===1?`Entrée invalide : attendu ${_(t.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"≤":"<",a=n(t.origin);return a?`Trop grand : attendu que ${t.origin??"la valeur"} ait ${r}${t.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${t.origin??"la valeur"} soit ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?"≥":">",a=n(t.origin);return a?`Trop petit : attendu que ${t.origin} ait ${r}${t.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${t.origin} soit ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Chaîne invalide : doit commencer par "${r.prefix}"`:r.format==="ends_with"?`Chaîne invalide : doit se terminer par "${r.suffix}"`:r.format==="includes"?`Chaîne invalide : doit inclure "${r.includes}"`:r.format==="regex"?`Chaîne invalide : doit correspondre au motif ${r.pattern}`:`${i[r.format]??t.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${t.divisor}`;case"unrecognized_keys":return`Clé${t.keys.length>1?"s":""} non reconnue${t.keys.length>1?"s":""} : ${v(t.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${t.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${t.origin}`;default:return"Entrée invalide"}}};function wp(){return{localeError:M$()}}var V$=()=>{let e={string:{unit:"અક્ષર",verb:"હોવા જોઈએ"},file:{unit:"બાયટ",verb:"હોવા જોઈએ"},array:{unit:"આઇટમ",verb:"હોવા જોઈએ"},set:{unit:"આઇટમ",verb:"હોવા જોઈએ"},map:{unit:"એન્ટ્રી",verb:"હોવા જોઈએ"}};function n(t){return e[t]??null}let i={regex:"ઇનપુટ",email:"ઈમેઇલ એડ્રેસ",url:"URL",emoji:"ઇમોજી",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO તારીખ અને સમય",date:"ISO તારીખ",time:"ISO સમય",duration:"ISO અવધિ",ipv4:"IPv4 એડ્રેસ",ipv6:"IPv6 એડ્રેસ",mac:"MAC એડ્રેસ",cidrv4:"IPv4 શ્રેણી",cidrv6:"IPv6 શ્રેણી",base64:"base64-એન્કોડેડ સ્ટ્રિંગ",base64url:"base64url-એન્કોડેડ સ્ટ્રિંગ",json_string:"JSON સ્ટ્રિંગ",e164:"E.164 નંબર",credit_card:"ક્રેડિટ કાર્ડ નંબર",currency_code:"ચલણ કોડ",iban:"IBAN",jwt:"JWT",template_literal:"ઇનપુટ"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return`અમાન્ય ઇનપુટ: અપેક્ષિત ${r}, પ્રાપ્ત ${s}`}case"invalid_value":return t.values.length===1?`અમાન્ય ઇનપુટ: અપેક્ષિત ${_(t.values[0])}`:`અમાન્ય વિકલ્પ: ${v(t.values," | ")} માધ્યમથી એક અપેક્ષિત`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`ખૂબ મોટું: ${t.origin??"મૂલ્ય"} ${r}${t.maximum.toString()} ${a.unit??"એલિમેન્ટ"} હોવા જોઈએ`:`ખૂબ મોટું: ${t.origin??"મૂલ્ય"} ${r}${t.maximum.toString()} હોવું જોઈએ`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`ખૂબ નાનું: ${t.origin} ${r}${t.minimum.toString()} ${a.unit} હોવા જોઈએ`:`ખૂબ નાનું: ${t.origin} ${r}${t.minimum.toString()} હોવું જોઈએ`}case"invalid_format":{let r=t;return r.format==="starts_with"?`અમાન્ય સ્ટ્રિંગ: "${r.prefix}" થી શરૂ થવું જોઈએ`:r.format==="ends_with"?`અમાન્ય સ્ટ્રિંગ: "${r.suffix}" પર સમાપ્ત થવું જોઈએ`:r.format==="includes"?`અમાન્ય સ્ટ્રિંગ: "${r.includes}" શામેલ હોવું જોઈએ`:r.format==="regex"?`અમાન્ય સ્ટ્રિંગ: પેટર્ન ${r.pattern} સાથે મેળ ખાવું જોઈએ`:`અમાન્ય ${i[r.format]??t.format}`}case"not_multiple_of":return`અમાન્ય નંબર: ${t.divisor} નો ગુણાંક હોવો જોઈએ`;case"unrecognized_keys":return`ઓળખી શકાતા નહીં તે કી${t.keys.length>1?"ઓ":""}: ${v(t.keys,", ")}`;case"invalid_key":return`${t.origin} માં અમાન્ય કી`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`અમાન્ય ડિસ્ક્રિમિનેટર મૂલ્ય. અપેક્ષિત ${t.options.map(a=>`'${a}'`).join(" | ")}`:"અમાન્ય ઇનપુટ";case"invalid_element":return`${t.origin} માં અમાન્ય મૂલ્ય`;default:return"અમાન્ય ઇનપુટ"}}};function Pp(){return{localeError:V$()}}var F$=()=>{let e={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},n={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},i=c=>c?e[c]:void 0,o=c=>{let l=i(c);return l?l.label:c??e.unknown.label},t=c=>`ה${o(c)}`,r=c=>(i(c)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות",a=c=>c?n[c]??null:null,s={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},uuidv4:{label:"UUIDv4",gender:"m"},uuidv6:{label:"UUIDv6",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},mac:{label:"כתובת MAC",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},credit_card:{label:"מספר כרטיס אשראי",gender:"m"},currency_code:{label:"קוד מטבע",gender:"m"},iban:{label:"IBAN",gender:"m"},jwt:{label:"JWT",gender:"m"},template_literal:{label:"קלט",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},u={nan:"NaN"};return c=>{switch(c.code){case"invalid_type":{let l=c.expected,d=u[l??""]??o(l),p=b(c.input),f=u[p]??e[p]?.label??p;return/^[A-Z]/.test(c.expected)?`קלט לא תקין: צריך להיות instanceof ${c.expected}, התקבל ${f}`:`קלט לא תקין: צריך להיות ${d}, התקבל ${f}`}case"invalid_value":{if(c.values.length===1)return`ערך לא תקין: הערך חייב להיות ${_(c.values[0])}`;let l=c.values.map(f=>_(f));if(c.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${l[0]} או ${l[1]}`;let d=l[l.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${l.slice(0,-1).join(", ")} או ${d}`}case"too_big":{let l=a(c.origin),d=t(c.origin??"value");if(c.origin==="string")return`${l?.longLabel??"ארוך"} מדי: ${d} צריכה להכיל ${c.maximum.toString()} ${l?.unit??""} ${c.inclusive?"או פחות":"לכל היותר"}`.trim();if(c.origin==="number"){let h=c.inclusive?`קטן או שווה ל-${c.maximum}`:`קטן מ-${c.maximum}`;return`גדול מדי: ${d} צריך להיות ${h}`}if(c.origin==="array"||c.origin==="set"){let h=c.origin==="set"?"צריכה":"צריך",y=c.inclusive?`${c.maximum} ${l?.unit??""} או פחות`:`פחות מ-${c.maximum} ${l?.unit??""}`;return`גדול מדי: ${d} ${h} להכיל ${y}`.trim()}let p=c.inclusive?"<=":"<",f=r(c.origin??"value");return l?.unit?`${l.longLabel} מדי: ${d} ${f} ${p}${c.maximum.toString()} ${l.unit}`:`${l?.longLabel??"גדול"} מדי: ${d} ${f} ${p}${c.maximum.toString()}`}case"too_small":{let l=a(c.origin),d=t(c.origin??"value");if(c.origin==="string")return`${l?.shortLabel??"קצר"} מדי: ${d} צריכה להכיל ${c.minimum.toString()} ${l?.unit??""} ${c.inclusive?"או יותר":"לפחות"}`.trim();if(c.origin==="number"){let h=c.inclusive?`גדול או שווה ל-${c.minimum}`:`גדול מ-${c.minimum}`;return`קטן מדי: ${d} צריך להיות ${h}`}if(c.origin==="array"||c.origin==="set"){let h=c.origin==="set"?"צריכה":"צריך";if(c.minimum===1&&c.inclusive){let k=(c.origin==="set","לפחות פריט אחד");return`קטן מדי: ${d} ${h} להכיל ${k}`}let y=c.inclusive?`${c.minimum} ${l?.unit??""} או יותר`:`יותר מ-${c.minimum} ${l?.unit??""}`;return`קטן מדי: ${d} ${h} להכיל ${y}`.trim()}let p=c.inclusive?">=":">",f=r(c.origin??"value");return l?.unit?`${l.shortLabel} מדי: ${d} ${f} ${p}${c.minimum.toString()} ${l.unit}`:`${l?.shortLabel??"קטן"} מדי: ${d} ${f} ${p}${c.minimum.toString()}`}case"invalid_format":{let l=c;if(l.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${l.prefix}"`;if(l.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${l.suffix}"`;if(l.format==="includes")return`המחרוזת חייבת לכלול "${l.includes}"`;if(l.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${l.pattern}`;let d=s[l.format],p=d?.label??l.format,h=(d?.gender??"m")==="f"?"תקינה":"תקין";return`${p} לא ${h}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${c.divisor}`;case"unrecognized_keys":return`מפתח${c.keys.length>1?"ות":""} לא מזוה${c.keys.length>1?"ים":"ה"}: ${v(c.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${t(c.origin??"array")}`;default:return"קלט לא תקין"}}};function zp(){return{localeError:F$()}}var G$=()=>{let e={string:{unit:"अक्षर",verb:"रखने के लिए"},file:{unit:"बाइट्स",verb:"रखने के लिए"},array:{unit:"तत्व",verb:"रखने के लिए"},set:{unit:"तत्व",verb:"रखने के लिए"},map:{unit:"प्रविष्टियाँ",verb:"रखने के लिए"}};function n(t){return e[t]??null}let i={regex:"इनपुट",email:"ईमेल पता",url:"URL",emoji:"इमोजी",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO तिथि और समय",date:"ISO तिथि",time:"ISO समय",duration:"ISO अवधि",ipv4:"IPv4 पता",ipv6:"IPv6 पता",mac:"MAC पता",cidrv4:"IPv4 श्रेणी",cidrv6:"IPv6 श्रेणी",base64:"Base64-एन्कोडेड स्ट्रिंग",base64url:"Base64URL-एन्कोडेड स्ट्रिंग",json_string:"JSON स्ट्रिंग",e164:"E.164 संख्या",credit_card:"क्रेडिट कार्ड संख्या",currency_code:"मुद्रा कोड",iban:"IBAN",jwt:"JWT",template_literal:"इनपुट"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return`अमान्य इनपुट: अपेक्षित ${r}, प्राप्त ${s}`}case"invalid_value":return t.values.length===1?`अमान्य इनपुट: अपेक्षित ${_(t.values[0])}`:`अमान्य विकल्प: अपेक्षित मानों में से एक ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`बहुत बड़ा: अपेक्षित था कि ${t.origin??"मान"} में ${r}${t.maximum} ${a.unit} हों`:`बहुत बड़ा: अपेक्षित था कि ${t.origin??"मान"} ${r}${t.maximum} हो`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`बहुत छोटा: अपेक्षित था कि ${t.origin} में ${r}${t.minimum} ${a.unit} हों`:`बहुत छोटा: अपेक्षित था कि ${t.origin} ${r}${t.minimum} हो`}case"invalid_format":{let r=t;return r.format==="starts_with"?`अमान्य स्ट्रिंग: "${r.prefix}" से शुरू होना चाहिए`:r.format==="ends_with"?`अमान्य स्ट्रिंग: "${r.suffix}" पर समाप्त होना चाहिए`:r.format==="includes"?`अमान्य स्ट्रिंग: इसमें "${r.includes}" शामिल होना चाहिए`:r.format==="regex"?`अमान्य स्ट्रिंग: पैटर्न ${r.pattern} से मेल खाना चाहिए`:`अमान्य ${i[r.format]??t.format}`}case"not_multiple_of":return`अमान्य संख्या: यह ${t.divisor} का गुणज होना चाहिए`;case"unrecognized_keys":return`अपरिचित कुंजी${t.keys.length>1?"याँ":""}: ${v(t.keys,", ")}`;case"invalid_key":return`अमान्य कुंजी: ${t.origin} में`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`अमान्य डिस्क्रिमिनेटर मान: अपेक्षित ${t.options.map(a=>`'${a}'`).join(" | ")}`:"अमान्य इनपुट";case"invalid_element":return`अमान्य मान: ${t.origin} में`;default:return"अमान्य इनपुट"}}};function Ap(){return{localeError:G$()}}var B$=()=>{let e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function n(t){return e[t]??null}let i={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",credit_card:"broj kreditne kartice",currency_code:"kod valute",iban:"IBAN",jwt:"JWT",template_literal:"unos"},o={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Neispravan unos: očekuje se instanceof ${t.expected}, a primljeno je ${s}`:`Neispravan unos: očekuje se ${r}, a primljeno je ${s}`}case"invalid_value":return t.values.length===1?`Neispravna vrijednost: očekivano ${_(t.values[0])}`:`Neispravna opcija: očekivano jedno od ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin),s=o[t.origin]??t.origin;return a?`Preveliko: očekivano da ${s??"vrijednost"} ima ${r}${t.maximum.toString()} ${a.unit??"elemenata"}`:`Preveliko: očekivano da ${s??"vrijednost"} bude ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin),s=o[t.origin]??t.origin;return a?`Premalo: očekivano da ${s} ima ${r}${t.minimum.toString()} ${a.unit}`:`Premalo: očekivano da ${s} bude ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Neispravan tekst: mora započinjati s "${r.prefix}"`:r.format==="ends_with"?`Neispravan tekst: mora završavati s "${r.suffix}"`:r.format==="includes"?`Neispravan tekst: mora sadržavati "${r.includes}"`:r.format==="regex"?`Neispravan tekst: mora odgovarati uzorku ${r.pattern}`:`Neispravna ${i[r.format]??t.format}`}case"not_multiple_of":return`Neispravan broj: mora biti višekratnik od ${t.divisor}`;case"unrecognized_keys":return`Neprepoznat${t.keys.length>1?"i ključevi":" ključ"}: ${v(t.keys,", ")}`;case"invalid_key":return`Neispravan ključ u ${o[t.origin]??t.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${o[t.origin]??t.origin}`;default:return"Neispravan unos"}}};function Np(){return{localeError:B$()}}var J$=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"},map:{unit:"elem",verb:"legyen"}};function n(t){return e[t]??null}let i={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",mac:"MAC cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",credit_card:"hitelkártyaszám",currency_code:"pénznemkód",iban:"IBAN",jwt:"JWT",template_literal:"bemenet"},o={nan:"NaN",number:"szám",array:"tömb"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Érvénytelen bemenet: a várt érték instanceof ${t.expected}, a kapott érték ${s}`:`Érvénytelen bemenet: a várt érték ${r}, a kapott érték ${s}`}case"invalid_value":return t.values.length===1?`Érvénytelen bemenet: a várt érték ${_(t.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Túl nagy: ${t.origin??"érték"} mérete túl nagy ${r}${t.maximum.toString()} ${a.unit??"elem"}`:`Túl nagy: a bemeneti érték ${t.origin??"érték"} túl nagy: ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Túl kicsi: a bemeneti érték ${t.origin} mérete túl kicsi ${r}${t.minimum.toString()} ${a.unit}`:`Túl kicsi: a bemeneti érték ${t.origin} túl kicsi ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Érvénytelen string: "${r.prefix}" értékkel kell kezdődnie`:r.format==="ends_with"?`Érvénytelen string: "${r.suffix}" értékkel kell végződnie`:r.format==="includes"?`Érvénytelen string: "${r.includes}" értéket kell tartalmaznia`:r.format==="regex"?`Érvénytelen string: ${r.pattern} mintának kell megfelelnie`:`Érvénytelen ${i[r.format]??t.format}`}case"not_multiple_of":return`Érvénytelen szám: ${t.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${t.keys.length>1?"s":""}: ${v(t.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${t.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${t.origin}`;default:return"Érvénytelen bemenet"}}};function Tp(){return{localeError:J$()}}function Dp(e,n,i){return Math.abs(e)===1?n:i}function Ut(e){if(!e)return"";let n=["ա","ե","ը","ի","ո","ու","օ"],i=e[e.length-1];return e+(n.includes(i)?"ն":"ը")}var K$=()=>{let e={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},map:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function n(t){return e[t]??null}let i={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",mac:"MAC հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",credit_card:"կրեդիտ քարտի համար",currency_code:"արժույթի կոդ",iban:"IBAN",jwt:"JWT",template_literal:"մուտք"},o={nan:"NaN",number:"թիվ",array:"զանգված"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Սխալ մուտքագրում․ սպասվում էր instanceof ${t.expected}, ստացվել է ${s}`:`Սխալ մուտքագրում․ սպասվում էր ${r}, ստացվել է ${s}`}case"invalid_value":return t.values.length===1?`Սխալ մուտքագրում․ սպասվում էր ${_(t.values[1])}`:`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);if(a){let s=Number(t.maximum),u=Dp(s,a.unit.one,a.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${Ut(t.origin??"արժեք")} կունենա ${r}${t.maximum.toString()} ${u}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${Ut(t.origin??"արժեք")} լինի ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);if(a){let s=Number(t.minimum),u=Dp(s,a.unit.one,a.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${Ut(t.origin)} կունենա ${r}${t.minimum.toString()} ${u}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${Ut(t.origin)} լինի ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Սխալ տող․ պետք է սկսվի "${r.prefix}"-ով`:r.format==="ends_with"?`Սխալ տող․ պետք է ավարտվի "${r.suffix}"-ով`:r.format==="includes"?`Սխալ տող․ պետք է պարունակի "${r.includes}"`:r.format==="regex"?`Սխալ տող․ պետք է համապատասխանի ${r.pattern} ձևաչափին`:`Սխալ ${i[r.format]??t.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${t.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${t.keys.length>1?"ներ":""}. ${v(t.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${Ut(t.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${Ut(t.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function Op(){return{localeError:K$()}}var H$=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"},map:{unit:"item",verb:"memiliki"}};function n(t){return e[t]??null}let i={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",mac:"alamat MAC",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",credit_card:"nomor kartu kredit",currency_code:"kode mata uang",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Input tidak valid: diharapkan instanceof ${t.expected}, diterima ${s}`:`Input tidak valid: diharapkan ${r}, diterima ${s}`}case"invalid_value":return t.values.length===1?`Input tidak valid: diharapkan ${_(t.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Terlalu besar: diharapkan ${t.origin??"value"} memiliki ${r}${t.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${t.origin??"value"} menjadi ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Terlalu kecil: diharapkan ${t.origin} memiliki ${r}${t.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${t.origin} menjadi ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`String tidak valid: harus dimulai dengan "${r.prefix}"`:r.format==="ends_with"?`String tidak valid: harus berakhir dengan "${r.suffix}"`:r.format==="includes"?`String tidak valid: harus menyertakan "${r.includes}"`:r.format==="regex"?`String tidak valid: harus sesuai pola ${r.pattern}`:`${i[r.format]??t.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${t.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${t.keys.length>1?"s":""}: ${v(t.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${t.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${t.origin}`;default:return"Input tidak valid"}}};function Ep(){return{localeError:H$()}}var W$=()=>{let e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"},map:{unit:"hluti",verb:"að hafa"}};function n(t){return e[t]??null}let i={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",credit_card:"kreditkortanúmer",currency_code:"gjaldmiðilskóði",iban:"IBAN",jwt:"JWT",template_literal:"gildi"},o={nan:"NaN",number:"númer",array:"fylki"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Rangt gildi: Þú slóst inn ${s} þar sem á að vera instanceof ${t.expected}`:`Rangt gildi: Þú slóst inn ${s} þar sem á að vera ${r}`}case"invalid_value":return t.values.length===1?`Rangt gildi: gert ráð fyrir ${_(t.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Of stórt: gert er ráð fyrir að ${t.origin??"gildi"} hafi ${r}${t.maximum.toString()} ${a.unit??"hluti"}`:`Of stórt: gert er ráð fyrir að ${t.origin??"gildi"} sé ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Of lítið: gert er ráð fyrir að ${t.origin} hafi ${r}${t.minimum.toString()} ${a.unit}`:`Of lítið: gert er ráð fyrir að ${t.origin} sé ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ógildur strengur: verður að byrja á "${r.prefix}"`:r.format==="ends_with"?`Ógildur strengur: verður að enda á "${r.suffix}"`:r.format==="includes"?`Ógildur strengur: verður að innihalda "${r.includes}"`:r.format==="regex"?`Ógildur strengur: verður að fylgja mynstri ${r.pattern}`:`Rangt ${i[r.format]??t.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${t.divisor}`;case"unrecognized_keys":return`Óþekkt ${t.keys.length>1?"ir lyklar":"ur lykill"}: ${v(t.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${t.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${t.origin}`;default:return"Rangt gildi"}}};function jp(){return{localeError:W$()}}var X$=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"},map:{unit:"elementi",verb:"avere"}};function n(t){return e[t]??null}let i={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",mac:"indirizzo MAC",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",credit_card:"numero di carta di credito",currency_code:"codice valuta",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"numero",array:"vettore"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Input non valido: atteso instanceof ${t.expected}, ricevuto ${s}`:`Input non valido: atteso ${r}, ricevuto ${s}`}case"invalid_value":return t.values.length===1?`Input non valido: atteso ${_(t.values[0])}`:`Opzione non valida: atteso uno tra ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Troppo grande: ${t.origin??"valore"} deve avere ${r}${t.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${t.origin??"valore"} deve essere ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Troppo piccolo: ${t.origin} deve avere ${r}${t.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${t.origin} deve essere ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Stringa non valida: deve iniziare con "${r.prefix}"`:r.format==="ends_with"?`Stringa non valida: deve terminare con "${r.suffix}"`:r.format==="includes"?`Stringa non valida: deve includere "${r.includes}"`:r.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${r.pattern}`:`Input non valido: ${i[r.format]??t.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${t.divisor}`;case"unrecognized_keys":return`Chiav${t.keys.length>1?"i":"e"} non riconosciut${t.keys.length>1?"e":"a"}: ${v(t.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${t.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${t.origin}`;default:return"Input non valido"}}};function Up(){return{localeError:X$()}}var q$=()=>{let e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"},map:{unit:"要素",verb:"である"}};function n(t){return e[t]??null}let i={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",mac:"MACアドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",credit_card:"クレジットカード番号",currency_code:"通貨コード",iban:"IBAN",jwt:"JWT",template_literal:"入力値"},o={nan:"NaN",number:"数値",array:"配列"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`無効な入力: instanceof ${t.expected}が期待されましたが、${s}が入力されました`:`無効な入力: ${r}が期待されましたが、${s}が入力されました`}case"invalid_value":return t.values.length===1?`無効な入力: ${_(t.values[0])}が期待されました`:`無効な選択: ${v(t.values,"、")}のいずれかである必要があります`;case"too_big":{let r=t.inclusive?"以下である":"より小さい",a=n(t.origin);return a?`大きすぎる値: ${t.origin??"値"}は${t.maximum.toString()}${a.unit??"要素"}${r}必要があります`:`大きすぎる値: ${t.origin??"値"}は${t.maximum.toString()}${r}必要があります`}case"too_small":{let r=t.inclusive?"以上である":"より大きい",a=n(t.origin);return a?`小さすぎる値: ${t.origin}は${t.minimum.toString()}${a.unit}${r}必要があります`:`小さすぎる値: ${t.origin}は${t.minimum.toString()}${r}必要があります`}case"invalid_format":{let r=t;return r.format==="starts_with"?`無効な文字列: "${r.prefix}"で始まる必要があります`:r.format==="ends_with"?`無効な文字列: "${r.suffix}"で終わる必要があります`:r.format==="includes"?`無効な文字列: "${r.includes}"を含む必要があります`:r.format==="regex"?`無効な文字列: パターン${r.pattern}に一致する必要があります`:`無効な${i[r.format]??t.format}`}case"not_multiple_of":return`無効な数値: ${t.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${t.keys.length>1?"群":""}: ${v(t.keys,"、")}`;case"invalid_key":return`${t.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${t.origin}内の無効な値`;default:return"無効な入力"}}};function Lp(){return{localeError:q$()}}var Y$=()=>{let e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},map:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function n(t){return e[t]??null}let i={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",mac:"MAC მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული ველი",base64url:"base64url-კოდირებული ველი",json_string:"JSON ველი",e164:"E.164 ნომერი",credit_card:"საკრედიტო ბარათის ნომერი",currency_code:"ვალუტის კოდი",iban:"IBAN",jwt:"JWT",template_literal:"შეყვანა"},o={nan:"NaN",number:"რიცხვი",string:"ველი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`არასწორი შეყვანა: მოსალოდნელი instanceof ${t.expected}, მიღებული ${s}`:`არასწორი შეყვანა: მოსალოდნელი ${r}, მიღებული ${s}`}case"invalid_value":return t.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${_(t.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${v(t.values,"|")}-დან`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`ზედმეტად დიდი: მოსალოდნელი ${t.origin??"მნიშვნელობა"} ${a.verb} ${r}${t.maximum.toString()} ${a.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${t.origin??"მნიშვნელობა"} იყოს ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`ზედმეტად პატარა: მოსალოდნელი ${t.origin} ${a.verb} ${r}${t.minimum.toString()} ${a.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${t.origin} იყოს ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`არასწორი ველი: უნდა იწყებოდეს "${r.prefix}"-ით`:r.format==="ends_with"?`არასწორი ველი: უნდა მთავრდებოდეს "${r.suffix}"-ით`:r.format==="includes"?`არასწორი ველი: უნდა შეიცავდეს "${r.includes}"-ს`:r.format==="regex"?`არასწორი ველი: უნდა შეესაბამებოდეს შაბლონს ${r.pattern}`:`არასწორი ${i[r.format]??t.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${t.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${t.keys.length>1?"ები":"ი"}: ${v(t.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${t.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${t.origin}-ში`;default:return"არასწორი შეყვანა"}}};function Cp(){return{localeError:Y$()}}var Q$=()=>{let e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"},map:{unit:"ធាតុ",verb:"គួរមាន"}};function n(t){return e[t]??null}let i={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",mac:"អាសយដ្ឋាន MAC",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",credit_card:"លេខប័ណ្ណឥណទាន",currency_code:"កូដរូបិយប័ណ្ណ",iban:"IBAN",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},o={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${t.expected} ប៉ុន្តែទទួលបាន ${s}`:`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${r} ប៉ុន្តែទទួលបាន ${s}`}case"invalid_value":return t.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${_(t.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`ធំពេក៖ ត្រូវការ ${t.origin??"តម្លៃ"} ${r} ${t.maximum.toString()} ${a.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${t.origin??"តម្លៃ"} ${r} ${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`តូចពេក៖ ត្រូវការ ${t.origin} ${r} ${t.minimum.toString()} ${a.unit}`:`តូចពេក៖ ត្រូវការ ${t.origin} ${r} ${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${r.prefix}"`:r.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${r.suffix}"`:r.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${r.includes}"`:r.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${r.pattern}`:`មិនត្រឹមត្រូវ៖ ${i[r.format]??t.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${t.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${v(t.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${t.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${t.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function li(){return{localeError:Q$()}}function Rp(){return li()}var ey=()=>{let e={string:{unit:"ಅಕ್ಷರಗಳು",verb:"ಹೊಂದಲು"},file:{unit:"ಬೈಟ್‌ಗಳು",verb:"ಹೊಂದಲು"},array:{unit:"ವಸ್ತುಗಳು",verb:"ಹೊಂದಲು"},set:{unit:"ವಸ್ತುಗಳು",verb:"ಹೊಂದಲು"},map:{unit:"entries",verb:"ಹೊಂದಲು"}};function n(t){return e[t]??null}let i={regex:"ಇನ್ಪುಟ್",email:"email ವಿಳಾಸ",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ದಿನಾಂಕದ ಸಮಯ",date:"ISO ದಿನಾಂಕ",time:"ISO ಸಮಯ",duration:"ISO ಅವಧಿ",ipv4:"IPv4 ವಿಳಾಸ",ipv6:"IPv6 ವಿಳಾಸ",mac:"MAC ವಿಳಾಸ",cidrv4:"IPv4 ವ್ಯಾಪ್ತಿಯ",cidrv6:"IPv6 ವ್ಯಾಪ್ತಿಯ",base64:"base64-encodedಸ್ಟ್ರಿಂಗ್",base64url:"base64url-encodedಸ್ಟ್ರಿಂಗ್",json_string:"JSONಸ್ಟ್ರಿಂಗ್",e164:"E.164 ಸಂಖ್ಯೆ",credit_card:"ಕ್ರೆಡಿಟ್ ಕಾರ್ಡ್ ಸಂಖ್ಯೆ",currency_code:"ಕರೆನ್ಸಿ ಕೋಡ್",iban:"IBAN",jwt:"JWT",template_literal:"ಇನ್ಪುಟ್"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return`ಅಮಾನ್ಯ ಇನ್‌ಪುಟ್: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${r}, ಸ್ವೀಕರಿಸಿದನು ${s}`}case"invalid_value":return t.values.length===1?`ಅಮಾನ್ಯ ಇನ್‌ಪುಟ್: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${_(t.values[0])}`:`ಅಮಾನ್ಯ ಆಯ್ಕೆ: ಇವುಗಳಲ್ಲಿ ಒಂದನ್ನು ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`ತುಂಬಾ ದೊಡ್ಡದು: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${t.origin??"value"} ಹೊಂದಲು ${r}${t.maximum.toString()} ${a.unit??"ಅಂಶಗಳು"}`:`ತುಂಬಾ ದೊಡ್ಡದು: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${t.origin??"value"} ಎಂದು ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`ತುಂಬಾ ಚಿಕ್ಕದು: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${t.origin} ಹೊಂದಲು ${r}${t.minimum.toString()} ${a.unit}`:`ತುಂಬಾ ಚಿಕ್ಕದು: ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${t.origin} ಎಂದು ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`ಅಮಾನ್ಯವಾದ ಸ್ಟ್ರಿಂಗ್: ಇದರೊಂದಿಗೆ ಪ್ರಾರಂಭಿಸಬೇಕು "${r.prefix}"`:r.format==="ends_with"?`ಅಮಾನ್ಯವಾದ ಸ್ಟ್ರಿಂಗ್: ಇದರೊಂದಿಗೆ ಕೊನೆಗೊಳ್ಳಬೇಕು "${r.suffix}"`:r.format==="includes"?`ಅಮಾನ್ಯ ಸ್ಟ್ರಿಂಗ್: ಒಳಗೊಂಡಿರಬೇಕು "${r.includes}"`:r.format==="regex"?`ಅಮಾನ್ಯವಾದ ಸ್ಟ್ರಿಂಗ್: ಮಾದರಿಗೆ ಹೊಂದಿಕೆಯಾಗಬೇಕು ${r.pattern}`:`ಅಮಾನ್ಯ ${i[r.format]??t.format}`}case"not_multiple_of":return`ಅಮಾನ್ಯ ಸಂಖ್ಯೆ: ಬಹುಸಂಖ್ಯೆಯಾಗಿರಬೇಕು ${t.divisor}`;case"unrecognized_keys":return`ಗುರುತಿಸಲಾಗದ ಕೀ ${t.keys.length>1?"s":""}: ${v(t.keys,", ")}`;case"invalid_key":return`ಅಮಾನ್ಯವಾದ ಕೀ ಇನ್ ${t.origin}`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`ಅಮಾನ್ಯ ತಾರತಮ್ಯ ಮೌಲ್ಯ. ನಿರೀಕ್ಷಿಸಲಾಗಿದೆ ${t.options.map(a=>`'${a}'`).join(" | ")}`:"ಅಮಾನ್ಯ ಇನ್‌ಪುಟ್";case"invalid_element":return`ರಲ್ಲಿ ಅಮಾನ್ಯ ಮೌಲ್ಯ ${t.origin}`;default:return"ಅಮಾನ್ಯ ಇನ್‌ಪುಟ್"}}};function Zp(){return{localeError:ey()}}var ty=()=>{let e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"},map:{unit:"개",verb:"to have"}};function n(t){return e[t]??null}let i={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",mac:"MAC 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",credit_card:"신용카드 번호",currency_code:"통화 코드",iban:"IBAN",jwt:"JWT",template_literal:"입력"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`잘못된 입력: 예상 타입은 instanceof ${t.expected}, 받은 타입은 ${s}입니다`:`잘못된 입력: 예상 타입은 ${r}, 받은 타입은 ${s}입니다`}case"invalid_value":return t.values.length===1?`잘못된 입력: 값은 ${_(t.values[0])} 이어야 합니다`:`잘못된 옵션: ${v(t.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let r=t.inclusive?"이하":"미만",a=r==="미만"?"이어야 합니다":"여야 합니다",s=n(t.origin),u=s?.unit??"요소";return s?`${t.origin??"값"}이 너무 큽니다: ${t.maximum.toString()}${u} ${r}${a}`:`${t.origin??"값"}이 너무 큽니다: ${t.maximum.toString()} ${r}${a}`}case"too_small":{let r=t.inclusive?"이상":"초과",a=r==="이상"?"이어야 합니다":"여야 합니다",s=n(t.origin),u=s?.unit??"요소";return s?`${t.origin??"값"}이 너무 작습니다: ${t.minimum.toString()}${u} ${r}${a}`:`${t.origin??"값"}이 너무 작습니다: ${t.minimum.toString()} ${r}${a}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`잘못된 문자열: "${r.prefix}"(으)로 시작해야 합니다`:r.format==="ends_with"?`잘못된 문자열: "${r.suffix}"(으)로 끝나야 합니다`:r.format==="includes"?`잘못된 문자열: "${r.includes}"을(를) 포함해야 합니다`:r.format==="regex"?`잘못된 문자열: 정규식 ${r.pattern} 패턴과 일치해야 합니다`:`잘못된 ${i[r.format]??t.format}`}case"not_multiple_of":return`잘못된 숫자: ${t.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${v(t.keys,", ")}`;case"invalid_key":return`잘못된 키: ${t.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${t.origin}`;default:return"잘못된 입력"}}};function Mp(){return{localeError:ty()}}var Vn=e=>e.charAt(0).toUpperCase()+e.slice(1);function Vp(e){let n=Math.abs(e),i=n%10,o=n%100;return o>=11&&o<=19||i===0?"many":i===1?"one":"few"}var ny=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function n(t,r,a,s){let u=e[t]??null;return u===null?u:{unit:u.unit[r],verb:u.verb[s][a?"inclusive":"notInclusive"]}}let i={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",mac:"MAC adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",credit_card:"kredito kortelės numeris",currency_code:"valiutos kodas",iban:"IBAN",jwt:"JWT",template_literal:"įvestis"},o={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Gautas tipas ${s}, o tikėtasi - instanceof ${t.expected}`:`Gautas tipas ${s}, o tikėtasi - ${r}`}case"invalid_value":return t.values.length===1?`Privalo būti ${_(t.values[0])}`:`Privalo būti vienas iš ${v(t.values,"|")} pasirinkimų`;case"too_big":{let r=o[t.origin]??t.origin,a=n(t.origin,Vp(Number(t.maximum)),t.inclusive??!1,"smaller");if(a?.verb)return`${Vn(r??t.origin??"reikšmė")} ${a.verb} ${t.maximum.toString()} ${a.unit??"elementų"}`;let s=t.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${Vn(r??t.origin??"reikšmė")} turi būti ${s} ${t.maximum.toString()} ${a?.unit}`}case"too_small":{let r=o[t.origin]??t.origin,a=n(t.origin,Vp(Number(t.minimum)),t.inclusive??!1,"bigger");if(a?.verb)return`${Vn(r??t.origin??"reikšmė")} ${a.verb} ${t.minimum.toString()} ${a.unit??"elementų"}`;let s=t.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${Vn(r??t.origin??"reikšmė")} turi būti ${s} ${t.minimum.toString()} ${a?.unit}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Eilutė privalo prasidėti "${r.prefix}"`:r.format==="ends_with"?`Eilutė privalo pasibaigti "${r.suffix}"`:r.format==="includes"?`Eilutė privalo įtraukti "${r.includes}"`:r.format==="regex"?`Eilutė privalo atitikti ${r.pattern}`:`Neteisingas ${i[r.format]??t.format}`}case"not_multiple_of":return`Skaičius privalo būti ${t.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${t.keys.length>1?"i":"as"} rakt${t.keys.length>1?"ai":"as"}: ${v(t.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let r=o[t.origin]??t.origin;return`${Vn(r??t.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function Fp(){return{localeError:ny()}}var ry=()=>{let e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"},map:{unit:"ставки",verb:"да имаат"}};function n(t){return e[t]??null}let i={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",mac:"MAC адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",credit_card:"број на кредитна картичка",currency_code:"код на валута",iban:"IBAN",jwt:"JWT",template_literal:"внес"},o={nan:"NaN",number:"број",array:"низа"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Грешен внес: се очекува instanceof ${t.expected}, примено ${s}`:`Грешен внес: се очекува ${r}, примено ${s}`}case"invalid_value":return t.values.length===1?`Invalid input: expected ${_(t.values[0])}`:`Грешана опција: се очекува една ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Премногу голем: се очекува ${t.origin??"вредноста"} да има ${r}${t.maximum.toString()} ${a.unit??"елементи"}`:`Премногу голем: се очекува ${t.origin??"вредноста"} да биде ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Премногу мал: се очекува ${t.origin} да има ${r}${t.minimum.toString()} ${a.unit}`:`Премногу мал: се очекува ${t.origin} да биде ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Неважечка низа: мора да започнува со "${r.prefix}"`:r.format==="ends_with"?`Неважечка низа: мора да завршува со "${r.suffix}"`:r.format==="includes"?`Неважечка низа: мора да вклучува "${r.includes}"`:r.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${r.pattern}`:`Invalid ${i[r.format]??t.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${v(t.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${t.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${t.origin}`;default:return"Грешен внес"}}};function Gp(){return{localeError:ry()}}var iy=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"},map:{unit:"elemen",verb:"mempunyai"}};function n(t){return e[t]??null}let i={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",mac:"alamat MAC",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",credit_card:"nombor kad kredit",currency_code:"kod mata wang",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"nombor"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Input tidak sah: dijangka instanceof ${t.expected}, diterima ${s}`:`Input tidak sah: dijangka ${r}, diterima ${s}`}case"invalid_value":return t.values.length===1?`Input tidak sah: dijangka ${_(t.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Terlalu besar: dijangka ${t.origin??"nilai"} ${a.verb} ${r}${t.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${t.origin??"nilai"} adalah ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Terlalu kecil: dijangka ${t.origin} ${a.verb} ${r}${t.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${t.origin} adalah ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`String tidak sah: mesti bermula dengan "${r.prefix}"`:r.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${r.suffix}"`:r.format==="includes"?`String tidak sah: mesti mengandungi "${r.includes}"`:r.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${r.pattern}`:`${i[r.format]??t.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${t.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${v(t.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${t.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${t.origin}`;default:return"Input tidak sah"}}};function Bp(){return{localeError:iy()}}var oy=()=>{let e={string:{unit:"अक्षर",verb:"हुनुपर्छ"},file:{unit:"बाइट",verb:"हुनुपर्छ"},array:{unit:"तत्व",verb:"हुनुपर्छ"},set:{unit:"तत्व",verb:"हुनुपर्छ"},map:{unit:"प्रविष्टि",verb:"हुनुपर्छ"}};function n(t){return e[t]??null}let i={regex:"इनपुट",email:"इमेल ठेगाना",url:"URL",emoji:"इमोजी",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO मिति र समय",date:"ISO मिति",time:"ISO समय",duration:"ISO अवधि",ipv4:"IPv4 ठेगाना",ipv6:"IPv6 ठेगाना",mac:"MAC ठेगाना",cidrv4:"IPv4 दायरा",cidrv6:"IPv6 दायरा",base64:"base64-इन्कोड गरिएको स्ट्रिङ",base64url:"base64url-इन्कोड गरिएको स्ट्रिङ",json_string:"JSON स्ट्रिङ",e164:"E.164 नम्बर",credit_card:"क्रेडिट कार्ड नम्बर",currency_code:"मुद्रा कोड",iban:"IBAN",jwt:"JWT",template_literal:"इनपुट"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return`अमान्य इनपुट: अपेक्षित ${r}, प्राप्त ${s}`}case"invalid_value":return t.values.length===1?`अमान्य इनपुट: अपेक्षित ${_(t.values[0])}`:`अमान्य विकल्प: अपेक्षित मानहरू मध्ये एक ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`धेरै ठूलो: ${t.origin??"मान"} मा ${r}${t.maximum.toString()} ${a.unit} ${a.verb}`:`धेरै ठूलो: ${t.origin??"मान"} ${r}${t.maximum.toString()} हुनुपर्छ`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`धेरै सानो: ${t.origin} मा ${r}${t.minimum.toString()} ${a.unit} ${a.verb}`:`धेरै सानो: ${t.origin} ${r}${t.minimum.toString()} हुनुपर्छ`}case"invalid_format":{let r=t;return r.format==="starts_with"?`अमान्य स्ट्रिङ: "${r.prefix}" बाट सुरु हुनुपर्छ`:r.format==="ends_with"?`अमान्य स्ट्रिङ: "${r.suffix}" मा समाप्त हुनुपर्छ`:r.format==="includes"?`अमान्य स्ट्रिङ: "${r.includes}" समावेश हुनुपर्छ`:r.format==="regex"?`अमान्य स्ट्रिङ: ढाँचा ${r.pattern} सँग मेल खानुपर्छ`:`अमान्य ${i[r.format]??t.format}`}case"not_multiple_of":return`अमान्य संख्या: ${t.divisor} को गुणज हुनुपर्छ`;case"unrecognized_keys":return`अपरिचित कुञ्जी${t.keys.length>1?"हरू":""}: ${v(t.keys,", ")}`;case"invalid_key":return`अमान्य कुञ्जी: ${t.origin} मा`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`अमान्य डिस्क्रिमिनेटर मान: अपेक्षित ${t.options.map(a=>`'${a}'`).join(" | ")}`:"अमान्य इनपुट";case"invalid_element":return`अमान्य मान: ${t.origin} मा`;default:return"अमान्य इनपुट"}}};function Jp(){return{localeError:oy()}}var ay=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"},map:{unit:"elementen",verb:"heeft"}};function n(t){return e[t]??null}let i={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",mac:"MAC-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",credit_card:"creditcardnummer",currency_code:"valutacode",iban:"IBAN",jwt:"JWT",template_literal:"invoer"},o={nan:"NaN",number:"getal"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ongeldige invoer: verwacht instanceof ${t.expected}, ontving ${s}`:`Ongeldige invoer: verwacht ${r}, ontving ${s}`}case"invalid_value":return t.values.length===1?`Ongeldige invoer: verwacht ${_(t.values[0])}`:`Ongeldige optie: verwacht één van ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin),s=t.origin==="date"?"laat":t.origin==="string"?"lang":"groot";return a?`Te ${s}: verwacht dat ${t.origin??"waarde"} ${r}${t.maximum.toString()} ${a.unit??"elementen"} ${a.verb}`:`Te ${s}: verwacht dat ${t.origin??"waarde"} ${r}${t.maximum.toString()} is`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin),s=t.origin==="date"?"vroeg":t.origin==="string"?"kort":"klein";return a?`Te ${s}: verwacht dat ${t.origin} ${r}${t.minimum.toString()} ${a.unit} ${a.verb}`:`Te ${s}: verwacht dat ${t.origin} ${r}${t.minimum.toString()} is`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ongeldige tekst: moet met "${r.prefix}" beginnen`:r.format==="ends_with"?`Ongeldige tekst: moet op "${r.suffix}" eindigen`:r.format==="includes"?`Ongeldige tekst: moet "${r.includes}" bevatten`:r.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${r.pattern}`:`Ongeldig: ${i[r.format]??t.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${t.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${t.keys.length>1?"s":""}: ${v(t.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${t.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${t.origin}`;default:return"Ongeldige invoer"}}};function Kp(){return{localeError:ay()}}var sy=()=>{let e={string:{unit:"teikn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"element",verb:"å innehalde"},set:{unit:"element",verb:"å innehalde"},map:{unit:"element",verb:"å innehalde"}};function n(t){return e[t]??null}let i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varigheit",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkoda streng",base64url:"base64url-enkoda streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kredittkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tal",array:"liste"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ugyldig input: forventa instanceof ${t.expected}, fekk ${s}`:`Ugyldig input: forventa ${r}, fekk ${s}`}case"invalid_value":return t.values.length===1?`Ugyldig verdi: forventa ${_(t.values[0])}`:`Ugyldig val: forventa eitt av ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`For stor(t): forventa ${t.origin??"value"} til å ha ${r}${t.maximum.toString()} ${a.unit??"element"}`:`For stor(t): forventa ${t.origin??"value"} til å ha ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`For lite(n): forventa ${t.origin} til å ha ${r}${t.minimum.toString()} ${a.unit}`:`For lite(n): forventa ${t.origin} til å ha ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ugyldig streng: må starte med "${r.prefix}"`:r.format==="ends_with"?`Ugyldig streng: må slutte med "${r.suffix}"`:r.format==="includes"?`Ugyldig streng: må innehalde "${r.includes}"`:r.format==="regex"?`Ugyldig streng: må matche mønsteret ${r.pattern}`:`Ugyldig ${i[r.format]??t.format}`}case"not_multiple_of":return`Ugyldig tal: må vere eit multiplum av ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Ukjende nøklar":"Ukjend nøkkel"}: ${v(t.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${t.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${t.origin}`;default:return"Ugyldig input"}}};function Hp(){return{localeError:sy()}}var uy=()=>{let e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"},map:{unit:"elementer",verb:"å inneholde"}};function n(t){return e[t]??null}let i={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-adresse",ipv6:"IPv6-adresse",mac:"MAC-adresse",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",credit_card:"kredittkortnummer",currency_code:"valutakode",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tall",array:"liste"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ugyldig input: forventet instanceof ${t.expected}, fikk ${s}`:`Ugyldig input: forventet ${r}, fikk ${s}`}case"invalid_value":return t.values.length===1?`Ugyldig verdi: forventet ${_(t.values[0])}`:`Ugyldig valg: forventet en av ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`For stor(t): forventet ${t.origin??"value"} til å ha ${r}${t.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${t.origin??"value"} til å ha ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`For lite(n): forventet ${t.origin} til å ha ${r}${t.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${t.origin} til å ha ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ugyldig streng: må starte med "${r.prefix}"`:r.format==="ends_with"?`Ugyldig streng: må ende med "${r.suffix}"`:r.format==="includes"?`Ugyldig streng: må inneholde "${r.includes}"`:r.format==="regex"?`Ugyldig streng: må matche mønsteret ${r.pattern}`:`Ugyldig ${i[r.format]??t.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${v(t.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${t.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${t.origin}`;default:return"Ugyldig input"}}};function Wp(){return{localeError:uy()}}var cy=()=>{let e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"},map:{unit:"unsur",verb:"olmalıdır"}};function n(t){return e[t]??null}let i={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",mac:"MAC nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",credit_card:"i'tibâr kartı numarası",currency_code:"para birimi kodu",iban:"IBAN",jwt:"JWT",template_literal:"giren"},o={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Fâsit giren: umulan instanceof ${t.expected}, alınan ${s}`:`Fâsit giren: umulan ${r}, alınan ${s}`}case"invalid_value":return t.values.length===1?`Fâsit giren: umulan ${_(t.values[0])}`:`Fâsit tercih: mûteberler ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Fazla büyük: ${t.origin??"value"}, ${r}${t.maximum.toString()} ${a.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${t.origin??"value"}, ${r}${t.maximum.toString()} olmalıydı.`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Fazla küçük: ${t.origin}, ${r}${t.minimum.toString()} ${a.unit} sahip olmalıydı.`:`Fazla küçük: ${t.origin}, ${r}${t.minimum.toString()} olmalıydı.`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Fâsit metin: "${r.prefix}" ile başlamalı.`:r.format==="ends_with"?`Fâsit metin: "${r.suffix}" ile bitmeli.`:r.format==="includes"?`Fâsit metin: "${r.includes}" ihtivâ etmeli.`:r.format==="regex"?`Fâsit metin: ${r.pattern} nakşına uymalı.`:`Fâsit ${i[r.format]??t.format}`}case"not_multiple_of":return`Fâsit sayı: ${t.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${t.keys.length>1?"s":""}: ${v(t.keys,", ")}`;case"invalid_key":return`${t.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${t.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function Xp(){return{localeError:cy()}}var ly=()=>{let e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"},map:{unit:"توکي",verb:"ولري"}};function n(t){return e[t]??null}let i={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",mac:"د MAC پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",credit_card:"د کریډیټ کارت شمیره",currency_code:"د اسعارو کوډ",iban:"IBAN",jwt:"JWT",template_literal:"ورودي"},o={nan:"NaN",number:"عدد",array:"ارې"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`ناسم ورودي: باید instanceof ${t.expected} وای, مګر ${s} ترلاسه شو`:`ناسم ورودي: باید ${r} وای, مګر ${s} ترلاسه شو`}case"invalid_value":return t.values.length===1?`ناسم ورودي: باید ${_(t.values[0])} وای`:`ناسم انتخاب: باید یو له ${v(t.values,"|")} څخه وای`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`ډیر لوی: ${t.origin??"ارزښت"} باید ${r}${t.maximum.toString()} ${a.unit??"عنصرونه"} ولري`:`ډیر لوی: ${t.origin??"ارزښت"} باید ${r}${t.maximum.toString()} وي`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`ډیر کوچنی: ${t.origin} باید ${r}${t.minimum.toString()} ${a.unit} ولري`:`ډیر کوچنی: ${t.origin} باید ${r}${t.minimum.toString()} وي`}case"invalid_format":{let r=t;return r.format==="starts_with"?`ناسم متن: باید د "${r.prefix}" سره پیل شي`:r.format==="ends_with"?`ناسم متن: باید د "${r.suffix}" سره پای ته ورسيږي`:r.format==="includes"?`ناسم متن: باید "${r.includes}" ولري`:r.format==="regex"?`ناسم متن: باید د ${r.pattern} سره مطابقت ولري`:`${i[r.format]??t.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${t.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${t.keys.length>1?"کلیډونه":"کلیډ"}: ${v(t.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${t.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${t.origin} کې`;default:return"ناسمه ورودي"}}};function qp(){return{localeError:ly()}}var dy=()=>{let e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"},map:{unit:"elementów",verb:"mieć"}};function n(t){return e[t]??null}let i={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",mac:"adres MAC",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",credit_card:"numer karty kredytowej",currency_code:"kod waluty",iban:"IBAN",jwt:"JWT",template_literal:"wejście"},o={nan:"NaN",number:"liczba",array:"tablica"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${t.expected}, otrzymano ${s}`:`Nieprawidłowe dane wejściowe: oczekiwano ${r}, otrzymano ${s}`}case"invalid_value":return t.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${_(t.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Za duża wartość: oczekiwano, że ${t.origin??"wartość"} będzie mieć ${r}${t.maximum.toString()} ${a.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${t.origin??"wartość"} będzie wynosić ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Za mała wartość: oczekiwano, że ${t.origin??"wartość"} będzie mieć ${r}${t.minimum.toString()} ${a.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${t.origin??"wartość"} będzie wynosić ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${r.prefix}"`:r.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${r.suffix}"`:r.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${r.includes}"`:r.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${r.pattern}`:`Nieprawidłow(y/a/e) ${i[r.format]??t.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${t.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${t.keys.length>1?"s":""}: ${v(t.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${t.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${t.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function Yp(){return{localeError:dy()}}var py=()=>{let e={string:{unit:"caracteres"},file:{unit:"bytes"},array:{unit:"elementos"},set:{unit:"elementos"},map:{unit:"entradas"}};function n(a){return e[a]??null}let i={regex:"a entrada",email:"o endereço de e-mail",url:"o URL",emoji:"o emoji",uuid:"o UUID",uuidv4:"o UUIDv4",uuidv6:"o UUIDv6",nanoid:"o nanoid",guid:"o GUID",cuid:"o cuid",cuid2:"o cuid2",ulid:"o ULID",xid:"o XID",ksuid:"o KSUID",datetime:"a data e hora ISO",date:"a data ISO",time:"a hora ISO",duration:"a duração ISO",ipv4:"o endereço IPv4",ipv6:"o endereço IPv6",mac:"o endereço MAC",cidrv4:"o intervalo de endereços IPv4",cidrv6:"o intervalo de endereços IPv6",base64:"o texto codificado em base64",base64url:"o texto codificado em base64url",json_string:"o texto JSON",e164:"o número E.164",credit_card:"o número de cartão de crédito",currency_code:"o código de moeda",iban:"o IBAN",jwt:"o JWT",template_literal:"a entrada"},o={masculine:{definite:"o",indefinite:"um"},feminine:{definite:"a",indefinite:"uma"}},t={string:{name:"texto",articles:o.masculine},number:{name:"número",articles:o.masculine},int:{name:"número inteiro",articles:o.masculine},boolean:{name:"valor booleano",articles:o.masculine},bigint:{name:"número bigint",articles:o.masculine},symbol:{name:"símbolo",articles:o.masculine},undefined:{name:'valor "undefined"',articles:o.masculine},null:{name:'valor "nulo"',articles:o.masculine},never:{name:'valor "never"',articles:o.masculine},void:{name:'valor "void"',articles:o.masculine},date:{name:"data",articles:o.feminine},array:{name:"vetor",articles:o.masculine},object:{name:"objeto",articles:o.masculine},tuple:{name:"tuplo",articles:o.masculine},record:{name:"registo",articles:o.masculine},map:{name:"mapa",articles:o.masculine},set:{name:"conjunto",articles:o.masculine},file:{name:"ficheiro",articles:o.masculine},nonoptional:{name:"valor não opcional",articles:o.masculine},nan:{name:'valor "NaN"',articles:o.masculine},function:{name:"função",articles:o.feminine}};function r(a,s){let u=t[a]??{name:`valor "${a}"`,articles:o.masculine};return`${u.articles[s]} ${u.name}`}return a=>{switch(a.code){case"invalid_type":{let s=r(a.expected,"indefinite"),u=b(a.input),c=r(u,"indefinite");return`Entrada inválida: esperava ${s}, recebeu ${c}`}case"invalid_value":return a.values.length===1?`Entrada inválida: esperava ${_(a.values[0])}`:`Opção inválida: esperava uma das seguintes opções: ${v(a.values,"|")}`;case"too_big":{let s=a.inclusive?"<=":"<",u=n(a.origin);return u?`Demasiado grande: esperava que ${r(a.origin,"definite")} tivesse ${s} ${a.maximum.toString()} ${u.unit??"elementos"}`:`Demasiado grande: esperava que ${r(a.origin,"definite")} fosse ${s} ${a.maximum.toString()}`}case"too_small":{let s=a.inclusive?">=":">",u=n(a.origin);return u?`Demasiado pequeno: esperava que ${r(a.origin,"definite")} tivesse ${s} ${a.minimum.toString()} ${u.unit??"elementos"}`:`Demasiado pequeno: esperava que ${r(a.origin,"definite")} fosse ${s} ${a.minimum.toString()}`}case"invalid_format":{let s=a;return s.format==="starts_with"?`Texto inválido: deve começar por "${s.prefix}"`:s.format==="ends_with"?`Texto inválido: deve terminar em "${s.suffix}"`:s.format==="includes"?`Texto inválido: deve incluir "${s.includes}"`:s.format==="regex"?`Texto inválido: deve corresponder ao padrão ${s.pattern}`:`Formato d${i[s.format]??a.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${a.divisor}`;case"unrecognized_keys":{let s=a.keys.length>1?"s":"";return`Chave${s} inválida${s}: ${v(a.keys,", ")}`}case"invalid_key":return`Entrada inválida n${r(a.origin,"definite")}`;case"invalid_union":return a.options&&Array.isArray(a.options)&&a.options.length>0?`Valor de discriminação inválido. Esperava ${a.options.map(u=>`'${u}'`).join(" | ")}`:"Entrada inválida";case"invalid_element":return`Entrada inválida n${r(a.origin,"definite")}`;default:return"Entrada inválida"}}};function Qp(){return{localeError:py()}}var my=()=>{let e={string:{unit:"caracteres"},file:{unit:"bytes"},array:{unit:"elementos"},set:{unit:"elementos"},map:{unit:"entradas"}};function n(a){return e[a]??null}let i={regex:"a entrada",email:"o endereço de e-mail",url:"o URL",emoji:"o emoji",uuid:"o UUID",uuidv4:"o UUIDv4",uuidv6:"o UUIDv6",nanoid:"o nanoid",guid:"o GUID",cuid:"o cuid",cuid2:"o cuid2",ulid:"o ULID",xid:"o XID",ksuid:"o KSUID",datetime:"a data e hora ISO",date:"a data ISO",time:"a hora ISO",duration:"a duração ISO",ipv4:"o endereço IPv4",ipv6:"o endereço IPv6",mac:"o endereço MAC",cidrv4:"a faixa de endereços IPv4",cidrv6:"a faixa de endereços IPv6",base64:"o texto codificado em base64",base64url:"o texto codificado em base64url",json_string:"o texto JSON",e164:"o número E.164",credit_card:"o número de cartão de crédito",currency_code:"o código de moeda",iban:"o IBAN",jwt:"o JWT",template_literal:"a entrada"},o={masculine:{definite:"o",indefinite:"um"},feminine:{definite:"a",indefinite:"uma"}},t={string:{name:"texto",articles:o.masculine},number:{name:"número",articles:o.masculine},int:{name:"número inteiro",articles:o.masculine},boolean:{name:"valor booleano",articles:o.masculine},bigint:{name:"número bigint",articles:o.masculine},symbol:{name:"símbolo",articles:o.masculine},undefined:{name:'valor "undefined"',articles:o.masculine},null:{name:'valor "nulo"',articles:o.masculine},never:{name:'valor "never"',articles:o.masculine},void:{name:'valor "void"',articles:o.masculine},date:{name:"data",articles:o.feminine},array:{name:"vetor",articles:o.masculine},object:{name:"objeto",articles:o.masculine},tuple:{name:"tupla",articles:o.feminine},record:{name:"registro",articles:o.masculine},map:{name:"mapa",articles:o.masculine},set:{name:"conjunto",articles:o.masculine},file:{name:"arquivo",articles:o.masculine},nonoptional:{name:"valor não opcional",articles:o.masculine},nan:{name:'valor "NaN"',articles:o.masculine},function:{name:"função",articles:o.feminine}};function r(a,s){let u=t[a]??{name:`valor "${a}"`,articles:o.masculine};return`${u.articles[s]} ${u.name}`}return a=>{switch(a.code){case"invalid_type":{let s=r(a.expected,"indefinite"),u=b(a.input),c=r(u,"indefinite");return`Entrada inválida: esperava ${s}, recebeu ${c}`}case"invalid_value":return a.values.length===1?`Entrada inválida: esperava ${_(a.values[0])}`:`Opção inválida: esperava uma das seguintes opções: ${v(a.values,"|")}`;case"too_big":{let s=a.inclusive?"<=":"<",u=n(a.origin);return u?`Grande demais: esperava que ${r(a.origin,"definite")} tivesse ${s} ${a.maximum.toString()} ${u.unit??"elementos"}`:`Grande demais: esperava que ${r(a.origin,"definite")} fosse ${s} ${a.maximum.toString()}`}case"too_small":{let s=a.inclusive?">=":">",u=n(a.origin);return u?`Pequeno demais: esperava que ${r(a.origin,"definite")} tivesse ${s} ${a.minimum.toString()} ${u.unit??"elementos"}`:`Pequeno demais: esperava que ${r(a.origin,"definite")} fosse ${s} ${a.minimum.toString()}`}case"invalid_format":{let s=a;return s.format==="starts_with"?`Texto inválido: deve começar com "${s.prefix}"`:s.format==="ends_with"?`Texto inválido: deve terminar com "${s.suffix}"`:s.format==="includes"?`Texto inválido: deve incluir "${s.includes}"`:s.format==="regex"?`Texto inválido: deve corresponder ao padrão ${s.pattern}`:`Formato d${i[s.format]??a.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${a.divisor}`;case"unrecognized_keys":{let s=a.keys.length>1?"s":"";return`Chave${s} inválida${s}: ${v(a.keys,", ")}`}case"invalid_key":return`Entrada inválida n${r(a.origin,"definite")}`;case"invalid_union":return a.options&&Array.isArray(a.options)&&a.options.length>0?`Valor de discriminação inválido. Esperava ${a.options.map(u=>`'${u}'`).join(" | ")}`:"Entrada inválida";case"invalid_element":return`Entrada inválida n${r(a.origin,"definite")}`;default:return"Entrada inválida"}}};function em(){return{localeError:my()}}var fy=()=>{let e={string:{unit:"caractere",verb:"să aibă"},file:{unit:"octeți",verb:"să aibă"},array:{unit:"elemente",verb:"să aibă"},set:{unit:"elemente",verb:"să aibă"},map:{unit:"intrări",verb:"să aibă"}};function n(t){return e[t]??null}let i={regex:"intrare",email:"adresă de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dată și oră ISO",date:"dată ISO",time:"oră ISO",duration:"durată ISO",ipv4:"adresă IPv4",ipv6:"adresă IPv6",mac:"adresă MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"șir codat base64",base64url:"șir codat base64url",json_string:"șir JSON",e164:"număr E.164",credit_card:"număr de card de credit",currency_code:"cod valutar",iban:"IBAN",jwt:"JWT",template_literal:"intrare"},o={nan:"NaN",string:"șir",number:"număr",boolean:"boolean",function:"funcție",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"număr mare",void:"void",never:"never",map:"hartă",set:"set"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return`Intrare invalidă: așteptat ${r}, primit ${s}`}case"invalid_value":return t.values.length===1?`Intrare invalidă: așteptat ${_(t.values[0])}`:`Opțiune invalidă: așteptat una dintre ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Prea mare: așteptat ca ${t.origin??"valoarea"} ${a.verb} ${r}${t.maximum.toString()} ${a.unit??"elemente"}`:`Prea mare: așteptat ca ${t.origin??"valoarea"} să fie ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Prea mic: așteptat ca ${t.origin} ${a.verb} ${r}${t.minimum.toString()} ${a.unit}`:`Prea mic: așteptat ca ${t.origin} să fie ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Șir invalid: trebuie să înceapă cu "${r.prefix}"`:r.format==="ends_with"?`Șir invalid: trebuie să se termine cu "${r.suffix}"`:r.format==="includes"?`Șir invalid: trebuie să includă "${r.includes}"`:r.format==="regex"?`Șir invalid: trebuie să se potrivească cu modelul ${r.pattern}`:`Format invalid: ${i[r.format]??t.format}`}case"not_multiple_of":return`Număr invalid: trebuie să fie multiplu de ${t.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${v(t.keys,", ")}`;case"invalid_key":return`Cheie invalidă în ${t.origin}`;case"invalid_union":return"Intrare invalidă";case"invalid_element":return`Valoare invalidă în ${t.origin}`;default:return"Intrare invalidă"}}};function tm(){return{localeError:fy()}}function nm(e,n,i,o){let t=Math.abs(e),r=t%10,a=t%100;return a>=11&&a<=19?o:r===1?n:r>=2&&r<=4?i:o}var gy=()=>{let e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},map:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function n(t){return e[t]??null}let i={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",mac:"MAC адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",credit_card:"номер кредитной карты",currency_code:"код валюты",iban:"IBAN",jwt:"JWT",template_literal:"ввод"},o={nan:"NaN",number:"число",array:"массив"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Неверный ввод: ожидалось instanceof ${t.expected}, получено ${s}`:`Неверный ввод: ожидалось ${r}, получено ${s}`}case"invalid_value":return t.values.length===1?`Неверный ввод: ожидалось ${_(t.values[0])}`:`Неверный вариант: ожидалось одно из ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);if(a){let s=Number(t.maximum),u=nm(s,a.unit.one,a.unit.few,a.unit.many);return`Слишком большое значение: ожидалось, что ${t.origin??"значение"} будет иметь ${r}${t.maximum.toString()} ${u}`}return`Слишком большое значение: ожидалось, что ${t.origin??"значение"} будет ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);if(a){let s=Number(t.minimum),u=nm(s,a.unit.one,a.unit.few,a.unit.many);return`Слишком маленькое значение: ожидалось, что ${t.origin} будет иметь ${r}${t.minimum.toString()} ${u}`}return`Слишком маленькое значение: ожидалось, что ${t.origin} будет ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Неверная строка: должна начинаться с "${r.prefix}"`:r.format==="ends_with"?`Неверная строка: должна заканчиваться на "${r.suffix}"`:r.format==="includes"?`Неверная строка: должна содержать "${r.includes}"`:r.format==="regex"?`Неверная строка: должна соответствовать шаблону ${r.pattern}`:`Неверный ${i[r.format]??t.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${t.divisor}`;case"unrecognized_keys":return`Нераспознанн${t.keys.length>1?"ые":"ый"} ключ${t.keys.length>1?"и":""}: ${v(t.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${t.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${t.origin}`;default:return"Неверные входные данные"}}};function rm(){return{localeError:gy()}}var vy=()=>{let e={string:{unit:"znakov",verb:"mať"},file:{unit:"bajtov",verb:"mať"},array:{unit:"prvkov",verb:"mať"},set:{unit:"prvkov",verb:"mať"},map:{unit:"položiek",verb:"mať"}};function n(t){return e[t]??null}let i={regex:"regulárny výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dátum a čas vo formáte ISO",date:"dátum vo formáte ISO",time:"čas vo formáte ISO",duration:"doba trvania ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",mac:"MAC adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"reťazec zakódovaný vo formáte base64",base64url:"reťazec zakódovaný vo formáte base64url",json_string:"reťazec vo formáte JSON",e164:"číslo E.164",credit_card:"číslo kreditnej karty",currency_code:"kód meny",iban:"IBAN",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"číslo",string:"reťazec",function:"funkcia",array:"pole"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Neplatný vstup: očakávané instanceof ${t.expected}, obdržané ${s}`:`Neplatný vstup: očakávané ${r}, obdržané ${s}`}case"invalid_value":return t.values.length===1?`Neplatný vstup: očakávané ${_(t.values[0])}`:`Neplatný vstup: očakávaná jedna z hodnôt ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Hodnota je príliš veľká: ${t.origin??"hodnota"} musí mať ${r}${t.maximum.toString()} ${a.unit??"prvkov"}`:`Hodnota je príliš veľká: ${t.origin??"hodnota"} musí byť ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Hodnota je príliš malá: ${t.origin??"hodnota"} musí mať ${r}${t.minimum.toString()} ${a.unit??"prvkov"}`:`Hodnota je príliš malá: ${t.origin??"hodnota"} musí byť ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Neplatný reťazec: musí začínať na "${r.prefix}"`:r.format==="ends_with"?`Neplatný reťazec: musí končiť na "${r.suffix}"`:r.format==="includes"?`Neplatný reťazec: musí obsahovať "${r.includes}"`:r.format==="regex"?`Neplatný reťazec: musí zodpovedať vzoru ${r.pattern}`:`Neplatný formát ${i[r.format]??t.format}`}case"not_multiple_of":return`Neplatné číslo: musí byť násobkom ${t.divisor}`;case"unrecognized_keys":return`Neznáme klúče: ${v(t.keys,", ")}`;case"invalid_key":return`Neplatný klúč v ${t.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${t.origin}`;default:return"Neplatný vstup"}}};function im(){return{localeError:vy()}}var hy=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"},map:{unit:"elementov",verb:"imeti"}};function n(t){return e[t]??null}let i={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",mac:"MAC naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",credit_card:"številka kreditne kartice",currency_code:"koda valute",iban:"IBAN",jwt:"JWT",template_literal:"vnos"},o={nan:"NaN",number:"število",array:"tabela"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Neveljaven vnos: pričakovano instanceof ${t.expected}, prejeto ${s}`:`Neveljaven vnos: pričakovano ${r}, prejeto ${s}`}case"invalid_value":return t.values.length===1?`Neveljaven vnos: pričakovano ${_(t.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Preveliko: pričakovano, da bo ${t.origin??"vrednost"} imelo ${r}${t.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${t.origin??"vrednost"} ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Premajhno: pričakovano, da bo ${t.origin} imelo ${r}${t.minimum.toString()} ${a.unit}`:`Premajhno: pričakovano, da bo ${t.origin} ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Neveljaven niz: mora se začeti z "${r.prefix}"`:r.format==="ends_with"?`Neveljaven niz: mora se končati z "${r.suffix}"`:r.format==="includes"?`Neveljaven niz: mora vsebovati "${r.includes}"`:r.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${r.pattern}`:`Neveljaven ${i[r.format]??t.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${t.divisor}`;case"unrecognized_keys":return`Neprepoznan${t.keys.length>1?"i ključi":" ključ"}: ${v(t.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${t.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${t.origin}`;default:return"Neveljaven vnos"}}};function om(){return{localeError:hy()}}var $y=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"},map:{unit:"objekt",verb:"att innehålla"}};function n(t){return e[t]??null}let i={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-adress",ipv6:"IPv6-adress",mac:"MAC-adress",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",credit_card:"kreditkortsnummer",currency_code:"valutakod",iban:"IBAN",jwt:"JWT",template_literal:"mall-literal"},o={nan:"NaN",number:"antal",array:"lista"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ogiltig inmatning: förväntat instanceof ${t.expected}, fick ${s}`:`Ogiltig inmatning: förväntat ${r}, fick ${s}`}case"invalid_value":return t.values.length===1?`Ogiltig inmatning: förväntat ${_(t.values[0])}`:`Ogiltigt val: förväntade en av ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`För stor(t): förväntade ${t.origin??"värdet"} att ha ${r}${t.maximum.toString()} ${a.unit??"element"}`:`För stor(t): förväntat ${t.origin??"värdet"} att ha ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`För lite(t): förväntade ${t.origin??"värdet"} att ha ${r}${t.minimum.toString()} ${a.unit}`:`För lite(t): förväntade ${t.origin??"värdet"} att ha ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ogiltig sträng: måste börja med "${r.prefix}"`:r.format==="ends_with"?`Ogiltig sträng: måste sluta med "${r.suffix}"`:r.format==="includes"?`Ogiltig sträng: måste innehålla "${r.includes}"`:r.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${r.pattern}"`:`Ogiltig(t) ${i[r.format]??t.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${t.divisor}`;case"unrecognized_keys":return`${t.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${v(t.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${t.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${t.origin??"värdet"}`;default:return"Ogiltig input"}}};function am(){return{localeError:$y()}}var yy=()=>{let e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},map:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function n(t){return e[t]??null}let i={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",mac:"MAC முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",credit_card:"கடன் அட்டை எண்",currency_code:"நாணயக் குறியீடு",iban:"IBAN",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${t.expected}, பெறப்பட்டது ${s}`:`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${r}, பெறப்பட்டது ${s}`}case"invalid_value":return t.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${_(t.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${v(t.values,"|")} இல் ஒன்று`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${t.origin??"மதிப்பு"} ${r}${t.maximum.toString()} ${a.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${t.origin??"மதிப்பு"} ${r}${t.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${t.origin} ${r}${t.minimum.toString()} ${a.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${t.origin} ${r}${t.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let r=t;return r.format==="starts_with"?`தவறான சரம்: "${r.prefix}" இல் தொடங்க வேண்டும்`:r.format==="ends_with"?`தவறான சரம்: "${r.suffix}" இல் முடிவடைய வேண்டும்`:r.format==="includes"?`தவறான சரம்: "${r.includes}" ஐ உள்ளடக்க வேண்டும்`:r.format==="regex"?`தவறான சரம்: ${r.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${i[r.format]??t.format}`}case"not_multiple_of":return`தவறான எண்: ${t.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${t.keys.length>1?"கள்":""}: ${v(t.keys,", ")}`;case"invalid_key":return`${t.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${t.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function sm(){return{localeError:yy()}}var _y=()=>{let e={string:{unit:"аломат",verb:"дошта бошад"},file:{unit:"байт",verb:"дошта бошад"},array:{unit:"унсур",verb:"дошта бошад"},set:{unit:"унсур",verb:"дошта бошад"},map:{unit:"сабт",verb:"дошта бошад"}};function n(t){return e[t]??null}let i={regex:"вуруд",email:"суроғаи email",url:"URL",emoji:"эмоҷи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"санаву вақти ISO",date:"санаи ISO",time:"вақти ISO",duration:"давомнокии ISO",ipv4:"суроғаи IPv4",ipv6:"суроғаи IPv6",mac:"суроғаи MAC",cidrv4:"маҳдудаи IPv4",cidrv6:"маҳдудаи IPv6",base64:"сатри дар формати base64",base64url:"сатри дар формати base64url",json_string:"сатри JSON",e164:"рақами E.164",credit_card:"рақами корти кредитӣ",currency_code:"рамзи асъор",iban:"IBAN",jwt:"JWT",template_literal:"вуруд"},o={nan:"NaN",number:"рақам",string:"сатр",array:"массив",object:"объект",date:"сана"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return`Вуруди нодуруст: ${r} интизор мерафт, ${s} гирифта шуд`}case"invalid_value":return t.values.length===1?`Вуруди нодуруст: ${_(t.values[0])} интизор мерафт`:`Интихоби нодуруст: яке аз ${v(t.values,"|")} интизор мерафт`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Хеле калон: ${t.origin??"қимат"} бояд ${r}${t.maximum.toString()} ${a.unit} ${a.verb}`:`Хеле калон: ${t.origin??"қимат"} бояд ${r}${t.maximum.toString()} бошад`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Хеле хурд: ${t.origin} бояд ${r}${t.minimum.toString()} ${a.unit} ${a.verb}`:`Хеле хурд: ${t.origin} бояд ${r}${t.minimum.toString()} бошад`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Сатри нодуруст: бояд бо "${r.prefix}" оғоз шавад`:r.format==="ends_with"?`Сатри нодуруст: бояд бо "${r.suffix}" анҷом ёбад`:r.format==="includes"?`Сатри нодуруст: бояд "${r.includes}"-ро дар бар гирад`:r.format==="regex"?`Сатри нодуруст: бояд ба намунаи ${r.pattern} мувофиқат кунад`:`${i[r.format]??t.format}-и нодуруст`}case"not_multiple_of":return`Рақами нодуруст: бояд ба ${t.divisor} бе бақия тақсим шавад`;case"unrecognized_keys":return`Калид${t.keys.length>1?"ҳои":"и"} номаълум: ${v(t.keys,", ")}`;case"invalid_key":return`Калиди нодуруст дар ${t.origin}`;case"invalid_union":return t.options&&Array.isArray(t.options)&&t.options.length>0?`Қимати нодурусти дискриминатор: ${t.options.map(a=>`'${a}'`).join(" | ")} интизор мерафт`:"Вуруди нодуруст";case"invalid_element":return`Қимати нодуруст дар ${t.origin}`;default:return"Вуруди нодуруст"}}};function um(){return{localeError:_y()}}var by=()=>{let e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"},map:{unit:"รายการ",verb:"ควรมี"}};function n(t){return e[t]??null}let i={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",mac:"ที่อยู่ MAC",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",credit_card:"หมายเลขบัตรเครดิต",currency_code:"รหัสสกุลเงิน",iban:"IBAN",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},o={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${t.expected} แต่ได้รับ ${s}`:`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${r} แต่ได้รับ ${s}`}case"invalid_value":return t.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${_(t.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"ไม่เกิน":"น้อยกว่า",a=n(t.origin);return a?`เกินกำหนด: ${t.origin??"ค่า"} ควรมี${r} ${t.maximum.toString()} ${a.unit??"รายการ"}`:`เกินกำหนด: ${t.origin??"ค่า"} ควรมี${r} ${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?"อย่างน้อย":"มากกว่า",a=n(t.origin);return a?`น้อยกว่ากำหนด: ${t.origin} ควรมี${r} ${t.minimum.toString()} ${a.unit}`:`น้อยกว่ากำหนด: ${t.origin} ควรมี${r} ${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${r.prefix}"`:r.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${r.suffix}"`:r.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${r.includes}" อยู่ในข้อความ`:r.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${r.pattern}`:`รูปแบบไม่ถูกต้อง: ${i[r.format]??t.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${t.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${v(t.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${t.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${t.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function cm(){return{localeError:by()}}var xy=()=>{let e={string:{unit:"simwol",verb:"bolmaly"},file:{unit:"baýt",verb:"bolmaly"},array:{unit:"elementler",verb:"bolmaly"},set:{unit:"elementler",verb:"bolmaly"},map:{unit:"elementler",verb:"bolmaly"}};function n(t){return e[t]??null}let i={regex:"giriş",email:"e-poçta salgysy",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sene we wagt",date:"ISO sene",time:"ISO wagt",duration:"ISO wagt aralygy",ipv4:"IPv4 salgysy",ipv6:"IPv6 salgysy",mac:"MAC salgysy",cidrv4:"IPv4 aralygy",cidrv6:"IPv6 aralygy",base64:"base64 bilen şifrlenen setir",base64url:"base64url bilen şifrlenen setir",json_string:"JSON setiri",e164:"E.164 nomeri",credit_card:"kredit kartynyň nomeri",currency_code:"walýuta kody",iban:"IBAN",jwt:"JWT",template_literal:"şablon"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return`Nädogry baha: garaşylan ${r} ýerine ${s} alyndy`}case"invalid_value":return t.values.length===1?`Nädogry baha: ${_(t.values[0])} bolmaly`:`Nädogry saýlaw: aşakdakylardan biri bolmaly: ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Has uly: garaşylýan ${t.origin??"baha"} ${r} ${t.maximum.toString()} ${a.unit??"element"}`:`Has uly: garaşylýan ${t.origin??"baha"} ${r} ${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Has kiçi: garaşylýan ${t.origin} ${r} ${t.minimum.toString()} ${a.unit}`:`Has kiçi: garaşylýan ${t.origin} ${r} ${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Nädogry setir: "${r.prefix}" bilen başlamaly`:r.format==="ends_with"?`Nädogry setir: "${r.suffix}" bilen gutarmaly`:r.format==="includes"?`Nädogry setir: "${r.includes}" saklamaly`:r.format==="regex"?`Nädogry setir: ${r.pattern} nusga laýyk bolmaly`:`Nädogry ${i[r.format]??t.format}`}case"not_multiple_of":return`Nädogry san: ${t.divisor} bilen galyndysyz bölünmeli`;case"unrecognized_keys":return`Tanalmaýan açar${t.keys.length>1?"lar":""}: ${v(t.keys,", ")}`;case"invalid_key":return`${t.origin} içinde nädogry açar`;case"invalid_union":return"Nädogry baha";case"invalid_element":return`${t.origin} içinde nädogry baha`;default:return"Nädogry baha"}}};function lm(){return{localeError:xy()}}var ky=()=>{let e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"},map:{unit:"öğe",verb:"olmalı"}};function n(t){return e[t]??null}let i={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",mac:"MAC adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",credit_card:"kredi kartı numarası",currency_code:"para birimi kodu",iban:"IBAN",jwt:"JWT",template_literal:"Şablon dizesi"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Geçersiz değer: beklenen instanceof ${t.expected}, alınan ${s}`:`Geçersiz değer: beklenen ${r}, alınan ${s}`}case"invalid_value":return t.values.length===1?`Geçersiz değer: beklenen ${_(t.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Çok büyük: beklenen ${t.origin??"değer"} ${r}${t.maximum.toString()} ${a.unit??"öğe"}`:`Çok büyük: beklenen ${t.origin??"değer"} ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Çok küçük: beklenen ${t.origin} ${r}${t.minimum.toString()} ${a.unit}`:`Çok küçük: beklenen ${t.origin} ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Geçersiz metin: "${r.prefix}" ile başlamalı`:r.format==="ends_with"?`Geçersiz metin: "${r.suffix}" ile bitmeli`:r.format==="includes"?`Geçersiz metin: "${r.includes}" içermeli`:r.format==="regex"?`Geçersiz metin: ${r.pattern} desenine uymalı`:`Geçersiz ${i[r.format]??t.format}`}case"not_multiple_of":return`Geçersiz sayı: ${t.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${t.keys.length>1?"lar":""}: ${v(t.keys,", ")}`;case"invalid_key":return`${t.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${t.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function dm(){return{localeError:ky()}}var Iy=()=>{let e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"},map:{unit:"елементів",verb:"матиме"}};function n(t){return e[t]??null}let i={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",mac:"адреса MAC",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",credit_card:"номер кредитної картки",currency_code:"код валюти",iban:"IBAN",jwt:"JWT",template_literal:"вхідні дані"},o={nan:"NaN",number:"число",array:"масив"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Неправильні вхідні дані: очікується instanceof ${t.expected}, отримано ${s}`:`Неправильні вхідні дані: очікується ${r}, отримано ${s}`}case"invalid_value":return t.values.length===1?`Неправильні вхідні дані: очікується ${_(t.values[0])}`:`Неправильна опція: очікується одне з ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Занадто велике: очікується, що ${t.origin??"значення"} ${a.verb} ${r}${t.maximum.toString()} ${a.unit??"елементів"}`:`Занадто велике: очікується, що ${t.origin??"значення"} буде ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Занадто мале: очікується, що ${t.origin} ${a.verb} ${r}${t.minimum.toString()} ${a.unit}`:`Занадто мале: очікується, що ${t.origin} буде ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Неправильний рядок: повинен починатися з "${r.prefix}"`:r.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${r.suffix}"`:r.format==="includes"?`Неправильний рядок: повинен містити "${r.includes}"`:r.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${r.pattern}`:`Неправильний ${i[r.format]??t.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${t.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${t.keys.length>1?"і":""}: ${v(t.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${t.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${t.origin}`;default:return"Неправильні вхідні дані"}}};function di(){return{localeError:Iy()}}function pm(){return di()}var Sy=()=>{let e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"},map:{unit:"آئٹمز",verb:"ہونا"}};function n(t){return e[t]??null}let i={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",mac:"ایم اے سی ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",credit_card:"کریڈٹ کارڈ نمبر",currency_code:"کرنسی کوڈ",iban:"IBAN",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},o={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`غلط ان پٹ: instanceof ${t.expected} متوقع تھا، ${s} موصول ہوا`:`غلط ان پٹ: ${r} متوقع تھا، ${s} موصول ہوا`}case"invalid_value":return t.values.length===1?`غلط ان پٹ: ${_(t.values[0])} متوقع تھا`:`غلط آپشن: ${v(t.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`بہت بڑا: ${t.origin??"ویلیو"} کے ${r}${t.maximum.toString()} ${a.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${t.origin??"ویلیو"} کا ${r}${t.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`بہت چھوٹا: ${t.origin} کے ${r}${t.minimum.toString()} ${a.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${t.origin} کا ${r}${t.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let r=t;return r.format==="starts_with"?`غلط سٹرنگ: "${r.prefix}" سے شروع ہونا چاہیے`:r.format==="ends_with"?`غلط سٹرنگ: "${r.suffix}" پر ختم ہونا چاہیے`:r.format==="includes"?`غلط سٹرنگ: "${r.includes}" شامل ہونا چاہیے`:r.format==="regex"?`غلط سٹرنگ: پیٹرن ${r.pattern} سے میچ ہونا چاہیے`:`غلط ${i[r.format]??t.format}`}case"not_multiple_of":return`غلط نمبر: ${t.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${t.keys.length>1?"ز":""}: ${v(t.keys,"، ")}`;case"invalid_key":return`${t.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${t.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function mm(){return{localeError:Sy()}}var wy=()=>{let e={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"},map:{unit:"yozuv",verb:"bo‘lishi kerak"}};function n(t){return e[t]??null}let i={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",credit_card:"kredit karta raqami",currency_code:"valyuta kodi",iban:"IBAN",jwt:"JWT",template_literal:"kirish"},o={nan:"NaN",number:"raqam",array:"massiv"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Noto‘g‘ri kirish: kutilgan instanceof ${t.expected}, qabul qilingan ${s}`:`Noto‘g‘ri kirish: kutilgan ${r}, qabul qilingan ${s}`}case"invalid_value":return t.values.length===1?`Noto‘g‘ri kirish: kutilgan ${_(t.values[0])}`:`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Juda katta: kutilgan ${t.origin??"qiymat"} ${r}${t.maximum.toString()} ${a.unit} ${a.verb}`:`Juda katta: kutilgan ${t.origin??"qiymat"} ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Juda kichik: kutilgan ${t.origin} ${r}${t.minimum.toString()} ${a.unit} ${a.verb}`:`Juda kichik: kutilgan ${t.origin} ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Noto‘g‘ri satr: "${r.prefix}" bilan boshlanishi kerak`:r.format==="ends_with"?`Noto‘g‘ri satr: "${r.suffix}" bilan tugashi kerak`:r.format==="includes"?`Noto‘g‘ri satr: "${r.includes}" ni o‘z ichiga olishi kerak`:r.format==="regex"?`Noto‘g‘ri satr: ${r.pattern} shabloniga mos kelishi kerak`:`Noto‘g‘ri ${i[r.format]??t.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${t.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${t.keys.length>1?"lar":""}: ${v(t.keys,", ")}`;case"invalid_key":return`${t.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${t.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function fm(){return{localeError:wy()}}var Py=()=>{let e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"},map:{unit:"phần tử",verb:"có"}};function n(t){return e[t]??null}let i={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",mac:"địa chỉ MAC",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",credit_card:"số thẻ tín dụng",currency_code:"mã tiền tệ",iban:"IBAN",jwt:"JWT",template_literal:"đầu vào"},o={nan:"NaN",number:"số",array:"mảng"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Đầu vào không hợp lệ: mong đợi instanceof ${t.expected}, nhận được ${s}`:`Đầu vào không hợp lệ: mong đợi ${r}, nhận được ${s}`}case"invalid_value":return t.values.length===1?`Đầu vào không hợp lệ: mong đợi ${_(t.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Quá lớn: mong đợi ${t.origin??"giá trị"} ${a.verb} ${r}${t.maximum.toString()} ${a.unit??"phần tử"}`:`Quá lớn: mong đợi ${t.origin??"giá trị"} ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Quá nhỏ: mong đợi ${t.origin} ${a.verb} ${r}${t.minimum.toString()} ${a.unit}`:`Quá nhỏ: mong đợi ${t.origin} ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${r.prefix}"`:r.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${r.suffix}"`:r.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${r.includes}"`:r.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${r.pattern}`:`${i[r.format]??t.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${t.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${v(t.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${t.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${t.origin}`;default:return"Đầu vào không hợp lệ"}}};function gm(){return{localeError:Py()}}var zy=()=>{let e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"},map:{unit:"项",verb:"包含"}};function n(t){return e[t]??null}let i={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",mac:"MAC地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",credit_card:"信用卡号",currency_code:"货币代码",iban:"IBAN",jwt:"JWT",template_literal:"输入"},o={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`无效输入:期望 instanceof ${t.expected},实际接收 ${s}`:`无效输入:期望 ${r},实际接收 ${s}`}case"invalid_value":return t.values.length===1?`无效输入:期望 ${_(t.values[0])}`:`无效选项:期望以下之一 ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`数值过大:期望 ${t.origin??"值"} ${r}${t.maximum.toString()} ${a.unit??"个元素"}`:`数值过大:期望 ${t.origin??"值"} ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`数值过小:期望 ${t.origin} ${r}${t.minimum.toString()} ${a.unit}`:`数值过小:期望 ${t.origin} ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`无效字符串:必须以 "${r.prefix}" 开头`:r.format==="ends_with"?`无效字符串:必须以 "${r.suffix}" 结尾`:r.format==="includes"?`无效字符串:必须包含 "${r.includes}"`:r.format==="regex"?`无效字符串:必须满足正则表达式 ${r.pattern}`:`无效${i[r.format]??t.format}`}case"not_multiple_of":return`无效数字:必须是 ${t.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${v(t.keys,", ")}`;case"invalid_key":return`${t.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${t.origin} 中包含无效值(value)`;default:return"无效输入"}}};function vm(){return{localeError:zy()}}var Ay=()=>{let e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"},map:{unit:"項目",verb:"擁有"}};function n(t){return e[t]??null}let i={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",mac:"MAC 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",credit_card:"信用卡號",currency_code:"貨幣代碼",iban:"IBAN",jwt:"JWT",template_literal:"輸入"},o={nan:"NaN"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`無效的輸入值:預期為 instanceof ${t.expected},但收到 ${s}`:`無效的輸入值:預期為 ${r},但收到 ${s}`}case"invalid_value":return t.values.length===1?`無效的輸入值:預期為 ${_(t.values[0])}`:`無效的選項:預期為以下其中之一 ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`數值過大:預期 ${t.origin??"值"} 應為 ${r}${t.maximum.toString()} ${a.unit??"個元素"}`:`數值過大:預期 ${t.origin??"值"} 應為 ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`數值過小:預期 ${t.origin} 應為 ${r}${t.minimum.toString()} ${a.unit}`:`數值過小:預期 ${t.origin} 應為 ${r}${t.minimum.toString()}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`無效的字串:必須以 "${r.prefix}" 開頭`:r.format==="ends_with"?`無效的字串:必須以 "${r.suffix}" 結尾`:r.format==="includes"?`無效的字串:必須包含 "${r.includes}"`:r.format==="regex"?`無效的字串:必須符合格式 ${r.pattern}`:`無效的 ${i[r.format]??t.format}`}case"not_multiple_of":return`無效的數字:必須為 ${t.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${t.keys.length>1?"們":""}:${v(t.keys,"、")}`;case"invalid_key":return`${t.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${t.origin} 中有無效的值`;default:return"無效的輸入值"}}};function hm(){return{localeError:Ay()}}var Ny=()=>{let e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"},map:{unit:"nkan",verb:"ní"}};function n(t){return e[t]??null}let i={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",mac:"àdírẹ́sì MAC",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",credit_card:"nọmba kaadi gbese",currency_code:"koodu owó",iban:"IBAN",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},o={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return t=>{switch(t.code){case"invalid_type":{let r=o[t.expected]??t.expected,a=b(t.input),s=o[a]??a;return/^[A-Z]/.test(t.expected)?`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${t.expected}, àmọ̀ a rí ${s}`:`Ìbáwọlé aṣìṣe: a ní láti fi ${r}, àmọ̀ a rí ${s}`}case"invalid_value":return t.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${_(t.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${v(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=n(t.origin);return a?`Tó pọ̀ jù: a ní láti jẹ́ pé ${t.origin??"iye"} ${a.verb} ${r}${t.maximum} ${a.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${r}${t.maximum}`}case"too_small":{let r=t.inclusive?">=":">",a=n(t.origin);return a?`Kéré ju: a ní láti jẹ́ pé ${t.origin} ${a.verb} ${r}${t.minimum} ${a.unit}`:`Kéré ju: a ní láti jẹ́ ${r}${t.minimum}`}case"invalid_format":{let r=t;return r.format==="starts_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${r.prefix}"`:r.format==="ends_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${r.suffix}"`:r.format==="includes"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${r.includes}"`:r.format==="regex"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${r.pattern}`:`Aṣìṣe: ${i[r.format]??t.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${t.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${v(t.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${t.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${t.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function $m(){return{localeError:Ny()}}var ym,$u=Symbol("ZodOutput"),yu=Symbol("ZodInput"),pi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...i){let o=i[0];return this._map.set(n,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,n),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){let i=this._map.get(n);return i&&typeof i=="object"&&"id"in i&&this._idmap.delete(i.id),this._map.delete(n),this}get(n){let i=n._zod.parent;if(i){let o={...this.get(i)??{}};delete o.id;let t={...o,...this._map.get(n)};return Object.keys(t).length?t:void 0}return this._map.get(n)}has(n){return this._map.has(n)}};function mi(){return new pi}(ym=globalThis).__zod_globalRegistry??(ym.__zod_globalRegistry=mi());var ee=globalThis.__zod_globalRegistry;var ie=Symbol.for("zod.compile.invalid"),_m=Symbol.for("zod.compile.fallback"),be=class extends Error{constructor(n="z.compile does not support async refinements, transforms, or checks"){super(n),this.name="ZodCompileAsyncError"}},L=class extends Error{constructor(n,i=!0){super(`z.compile does not support ${n}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=i}};function Dy(e,n){try{return gi(e,{assertOnly:!0})}catch{return n}}function ku(e,n){try{let i=gi(e),o=fi(e,i);return o._zod.bag.validator=Dy(e,i),o}catch(i){if(n?.strict)throw i;return e}}function fi(e,n){if(si(e))throw new L("a schema whose subtree contains a reference cycle");let i=C(e),o=e._zod.run,t=o.__originalRun??o,r=(a,s)=>{if(s?.async||s?.direction==="backward"||s?.skipChecks||s?.[_m]||s&&ui(s,a.value))return t(a,s);let u=n(a.value);return u!==ie?(a.value=u,a):(s&&(s[_m]=!0),t(a,s))};return r.__originalRun=t,i._zod.bag.fallbackRun=t,i._zod.bag.validator=n,i._zod.run=r,o.__originalRun||Oy(i,e,n),i}function Oy(e,n,i){let o=e,t=n;if(typeof t.safeParse=="function"){let r=t.safeParse;o.safeParse=(a,s)=>{let u=i(a);return u!==ie?{success:!0,data:u}:r(a,s)}}if(typeof t.parse=="function"){let r=t.parse;o.parse=(a,s)=>{let u=i(a);return u!==ie?u:r(a,s)}}}function gi(e,n){let i=!0;try{i=si(e)}catch{}if(i)throw new L("a schema whose subtree contains a reference cycle");let o={constants:new Map,constantCounter:0,varCounter:0,definite:!0},t=new it(["input"]),r=G(t,o,e,"input",!n?.assertOnly);t.write(r===null?"return true;":`return ${r};`);let a=["INVALID",...o.constants.keys()],s=[ie,...o.constants.values()],u=t.content.join(` `),c=n?.debug?a.length>0?`// Constants: ${a.join(", ")} -${s}`:s:"",l=Function,d=`return (input) => { -${s} -}`,m;try{m=new l(...a,d)(...u)}catch(p){throw new E(`this schema (generated code failed to evaluate: ${p.message})`)}return n?.debug&&(m.code=c),m.definite=o.definite,m}function O(e,n){for(let[o,t]of e.constants)if(t===n)return o;let i=`c${e.constantCounter++}`;return e.constants.set(i,n),i}function it(e,n){return e.definite=!1,O(e,n)}function N(e){return`v${e.varCounter++}`}function hy(e,n){let i=e._zod.run({value:n,issues:[]},{});if(i&&typeof i.then=="function")return re;let o=i;return o.issues.length===0?o.value:re}function ee(e,n,i,o,t=!0){let r=e.content.length,a=n.constants.size,u=n.constantCounter,s=n.varCounter;try{return F(e,n,i,o,t)}catch(c){if(!(c instanceof E)||!c.islandable)throw c;if(e.content.length=r,n.constants.size>a){let l=Array.from(n.constants.keys()).slice(a);for(let d of l)n.constants.delete(d)}return n.constantCounter=u,n.varCounter=s,$y(e,n,i,o)}}function $y(e,n,i,o){n.definite=!1;let t=O(n,i),r=O(n,hy),a=N(n);return e.write(`const ${a} = ${r}(${t}, ${o});`),e.write(`if (${a} === INVALID) return INVALID;`),a}var yy=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function _y(e,n,i,o){let t=i._zod.def.checks;if(!t||t.length===0)return o;let r=o;for(let a of t){let u=a._zod.def;if(u.when&&!yy.has(u.check))throw new E('check with a custom "when" condition');switch(u.check){case"greater_than":by(e,n,u,r);break;case"less_than":xy(e,n,u,r);break;case"multiple_of":ky(e,n,u,r);break;case"number_format":$m(e,u,r);break;case"min_length":{let s=Ze(u.minimum,"min_length"),c=gc(e,n,r,`${r}.length >= ${s} && ${r}.length < ${u.minimum*2}`);e.write(`if (${c} < ${s}) return INVALID;`);break}case"max_length":{let s=Ze(u.maximum,"max_length"),c=gc(e,n,r,`${r}.length > ${s}`);e.write(`if (${c} > ${s}) return INVALID;`);break}case"length_equals":{let s=Ze(u.length,"length_equals"),c=gc(e,n,r,`${r}.length >= ${s} && ${r}.length <= ${u.length*2}`);e.write(`if (${c} !== ${s}) return INVALID;`);break}case"min_size":e.write(`if (${r}.size < ${Ze(u.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${r}.size > ${Ze(u.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${r}.size !== ${Ze(u.size,"size_equals")}) return INVALID;`);break;case"string_format":r=ym(e,n,u,r);break;case"custom":r=Dy(e,n,a,r);break;case"bigint_format":Iy(e,u,r);break;case"mime_type":wy(e,n,u,r);break;case"property":zy(e,n,u,r);break;case"properties":Sy(e,n,u,r);break;case"overwrite":{let s=N(n);Py(e,n,a,r,s),r=s;break}default:throw new E(`check type ${u.check}`)}}return r}function gc(e,n,i,o){let t=O(n,Qe),r=N(n);return e.write(`const ${r} = typeof ${i} === "string" && ${o} ? ${t}(${i}) : ${i}.length;`),r}function Ze(e,n){if(typeof e!="number"||!Number.isFinite(e))throw new E(`${n} bound of type ${typeof e}`);return`${e}`}function hm(e,n){if(typeof n=="bigint")return`${n}n`;if(typeof n=="number"){if(Number.isNaN(n))throw new E("comparison check with NaN bound");return`${n}`}if(n instanceof Date){if(Number.isNaN(n.getTime()))throw new E("comparison check with Invalid Date bound");return O(e,n)}throw new E(`comparison check bound of type ${typeof n}`)}function by(e,n,i,o){let t=i.inclusive?"<":"<=";e.write(`if (${o} ${t} ${hm(n,i.value)}) return INVALID;`)}function xy(e,n,i,o){let t=i.inclusive?">":">=";e.write(`if (${o} ${t} ${hm(n,i.value)}) return INVALID;`)}function ky(e,n,i,o){if(typeof i.value=="bigint"){if(i.value===BigInt(0))throw new E("multiple_of check with a zero divisor");e.write(`if (${o} % ${i.value}n !== 0n) return INVALID;`)}else{let t=O(n,ln);e.write(`if (${t}(${o}, ${Ze(i.value,"multiple_of")}) !== 0) return INVALID;`)}}function $m(e,n,i){let o=n.format;switch(o){case"safeint":e.write(`if (!Number.isSafeInteger(${i})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${i}) || ${i} < -2147483648 || ${i} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${i}) || ${i} < 0 || ${i} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${i}) || ${i} < -3.4028234663852886e38 || ${i} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${i})) return INVALID;`);break;default:throw new E(`number format ${o}`)}}function Iy(e,n,i){let o=n.format;if(o)switch(o){case"int64":e.write(`if (${i} < -9223372036854775808n || ${i} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${i} < 0n || ${i} > 18446744073709551615n) return INVALID;`);break;default:throw new E(`bigint format ${o}`)}}function wy(e,n,i,o){let t=i.mime;if(t&&t.length>0){let r=O(n,new Set(t));e.write(`if (!${r}.has(${o}.type)) return INVALID;`)}}function Sy(e,n,i,o){if(i.when)throw new E('check with a custom "when" condition');e.write(`if (${o} == null) return INVALID;`);let t=i.shape;for(let r of Reflect.ownKeys(t)){let a=typeof r=="symbol"?O(n,r):te(r),u=N(n);e.write(`const ${u} = ${o}[${a}];`),ee(e,n,t[r],u,!1)}}function zy(e,n,i,o){let t=`${o}[${JSON.stringify(i.property)}]`;F(e,n,i.schema,t)}function Py(e,n,i,o,t){let r=i._zod.def.tx;if(!r)throw new E("overwrite check without a transform function");if(ot(r))throw new ye("z.compile: async overwrite transforms are not supported");let a=O(n,r);e.write(`const ${t} = ${a}(${o});`)}function vc(){throw new se}function yc(e){this.issues.push(e)}function Dy(e,n,i,o){let t=i._zod.def;if(t.fn){if(ot(t.fn))throw new ye("z.compile: async .refine() predicates are not supported");let r=it(n,t.fn),a=O(n,vc),u=N(n);return e.write(`const ${u} = ${r}(${o});`),e.write(`if (${u} instanceof Promise) ${a}();`),e.write(`if (!${u}) return INVALID;`),o}if(i._zod.check){if(ot(i._zod.check))throw new ye("z.compile: async .superRefine() / check functions are not supported");let r=i._zod.check,u=it(n,c=>{let l={value:c,issues:[],addIssue:yc};return r(l)instanceof Promise&&vc(),l.issues.length===0?l.value:re}),s=N(n);return e.write(`const ${s} = ${u}(${o});`),e.write(`if (${s} === INVALID) return INVALID;`),s}throw new E("custom check without a predicate or check function")}var Ny=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function ym(e,n,i,o,t=!0){let r=i.format;if(r==="base64"){let c=O(n,Nn);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(r==="base64url"){let c=O(n,Gr);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(r==="jwt"){let c=O(n,Kr),l=O(n,i.alg??null);return e.write(`if (!${c}(${o}, ${l})) return INVALID;`),o}if(r==="ipv6"){let c=O(n,Dn);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(r==="cidrv6"){let c=O(n,Mr);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(r==="credit_card"){let c=O(n,Jr);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(r==="iban"){let c=O(n,Br);return e.write(`if (!${c}(${o})) return INVALID;`),o}let a=i;if(r==="url"||r==="httpurl"||a.normalize||a.hostname!==void 0||a.protocol!==void 0){let c=O(n,Zr),l=O(n,i),d=N(n),m=N(n);if(e.write(`const ${d} = ${o}.trim();`),e.write(`const ${m} = ${c}(${d}, ${l});`),e.write(`if (typeof ${m} === "number") return INVALID;`),a.hostname!==void 0){let b=O(n,Rr);e.write(`if (!${b}(${m}, ${l}.hostname)) return INVALID;`)}if(a.protocol!==void 0){let b=O(n,Vr);e.write(`if (!${b}(${m}, ${l}.protocol)) return INVALID;`)}if(!t)return null;let p=N(n),v=a.normalize?`${m}.href`:`${O(n,Pn)}(${d})`;return e.write(`const ${p} = ${v};`),p}let u=i.fn;if(u){if(ot(u))throw new E(`async string format ${r}`);let c=O(n,u);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(Ny.has(r)&&i.pattern){let c=O(n,i.pattern);return e.write(`${c}.lastIndex = 0;`),e.write(`if (!${c}.test(${o})) return INVALID;`),o}let s=i.format;switch(s){case"regex":throw new E("regex format without a pattern");case"lowercase":e.write(`if (${o} !== ${o}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${o} !== ${o}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${o}.includes(${te(i.includes)})) return INVALID;`);break;case"starts_with":{let c=i.prefix;e.write(`if (${o}.slice(0, ${c.length}) !== ${te(c)}) return INVALID;`);break}case"ends_with":{let c=i.suffix;e.write(`if (${o}.slice(-${c.length}) !== ${te(c)}) return INVALID;`);break}default:throw new E(`string format ${s}`)}return o}function F(e,n,i,o,t=!0){let r=i._zod.def,a=r.type;if(r.coerce)throw new E(`coercion (z.coerce.${a}())`);let u=t||!!r.checks?.length,s;switch(a){case"string":s=Oy(e,n,i,o,u);break;case"number":s=jy(e,i,o);break;case"boolean":s=Ay(e,o);break;case"bigint":s=Uy(e,i,o);break;case"symbol":s=Ty(e,o);break;case"undefined":s=Ey(e,o);break;case"null":s=Ly(e,o);break;case"any":case"unknown":s=o;break;case"never":e.write("return INVALID;"),s=o;break;case"void":s=Cy(e,o);break;case"nan":s=Zy(e,o);break;case"date":s=Ry(e,o);break;case"object":s=Vy(e,n,i,o,u);break;case"optional":s=My(e,n,i,o,u);break;case"nullable":s=Jy(e,n,i,o,u);break;case"array":s=By(e,n,i,o,u);break;case"literal":s=Ky(e,n,i,o);break;case"enum":s=Wy(e,n,i,o);break;case"readonly":{let c=fm(e,n,i,o),l=N(n);e.write(`const ${l} = Object.freeze(${c});`),s=l;break}case"success":fm(e,n,i,o),s="true";break;case"default":case"prefault":s=Hy(e,n,i,o);break;case"nonoptional":s=Xy(e,n,i,o);break;case"tuple":s=qy(e,n,i,o);break;case"union":s=Yy(e,n,i,o);break;case"intersection":s=t_(e,n,i,o);break;case"record":s=n_(e,n,i,o);break;case"map":s=i_(e,n,i,o);break;case"set":s=o_(e,n,i,o);break;case"file":s=a_(e,o);break;case"template_literal":s=u_(e,n,i,o);break;case"lazy":s=c_(e,n,i,o);break;case"pipe":s=s_(e,n,i,o);break;case"custom":s=l_(e,n,i,o);break;case"transform":s=m_(e,n,i,o);break;case"catch":s=p_(e,n,i,o);break;default:throw new E(`schema type ${a}`)}return s===null?null:_y(e,n,i,s)}function Oy(e,n,i,o,t=!0){e.write(`if (typeof ${o} !== "string") return INVALID;`);let r=i._zod.def;return r.format===void 0?o:ym(e,n,r,o,t)}function jy(e,n,i){e.write(`if (typeof ${i} !== "number" || !Number.isFinite(${i})) return INVALID;`);let o=n._zod.def;return o.check==="number_format"&&o.format&&$m(e,{format:o.format},i),i}function Ay(e,n){return e.write(`if (typeof ${n} !== "boolean") return INVALID;`),n}function Uy(e,n,i){e.write(`if (typeof ${i} !== "bigint") return INVALID;`);let o=n._zod.def;if(o.format)switch(o.format){case"int64":e.write(`if (${i} < -9223372036854775808n || ${i} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${i} < 0n || ${i} > 18446744073709551615n) return INVALID;`);break}return i}function Ty(e,n){return e.write(`if (typeof ${n} !== "symbol") return INVALID;`),n}function Ey(e,n){return e.write(`if (${n} !== undefined) return INVALID;`),n}function Ly(e,n){return e.write(`if (${n} !== null) return INVALID;`),n}function Cy(e,n){return e.write(`if (${n} !== undefined) return INVALID;`),n}function Zy(e,n){return e.write(`if (typeof ${n} !== "number" || !Number.isNaN(${n})) return INVALID;`),n}function Ry(e,n){return e.write(`if (!(${n} instanceof Date) || Number.isNaN(${n}.getTime())) return INVALID;`),n}function Vy(e,n,i,o,t=!0){let r=i._zod.def;e.write(`if (typeof ${o} !== "object" || ${o} === null || Array.isArray(${o})) return INVALID;`);let a=r.shape,u=Object.keys(a),s=Object.getOwnPropertySymbols(a),c=s.length?[...u,...s]:u,l=$=>typeof $=="symbol"?O(n,$):te($),d=$=>typeof $=="symbol"?`[${l($)}]`:te($),m=a;if(u.includes("__proto__"))throw new E('object shape key "__proto__"');let p=new Map;for(let $ of c){let S=m[$],k=l($),D=N(n);if(e.write(`const ${D} = ${o}[${k}];`),S._zod.optin!==void 0){let U=N(n);e.write(`let ${U} = (() => {`),e.indented(J=>{let Te=ee(J,n,S,D);J.write(`return ${Te};`)}),e.write("})();"),S._zod.optout==="optional"?(e.write(`if (${U} === INVALID) {`),e.indented(J=>{J.write(`if (${k} in ${o}) return INVALID;`),J.write(`${U} = undefined;`)}),e.write("}")):e.write(`if (${U} === INVALID) return INVALID;`),p.set($,U)}else{Gy(S)&&e.write(`if (!(${k} in ${o})) return INVALID;`);let U=ee(e,n,S,D,t);U!==null&&p.set($,U)}}let v=r.catchall,b="none";if(v){let $=v._zod.def.type;if($==="never"){let S=u.map(k=>`k !== ${te(k)}`).join(" && ")||"true";e.write(`for (const k in ${o}) {`),e.indented(k=>{k.write(`if (${S}) return INVALID;`)}),e.write("}")}else($==="unknown"||$==="any")&&!v._zod.def.checks?.length?b="passthrough":b="schema"}let w=N(n),z=c.some($=>mm(m[$])||hc(m[$]));if(!t){if(b==="schema"){let $=u.length>0?O(n,new Set(u)):null;e.write(`for (const k in ${o}) {`),e.indented(S=>{S.write('if (k === "__proto__") continue;'),$&&S.write(`if (${$}.has(k)) continue;`);let k=N(n);S.write(`const ${k} = ${o}[k];`),ee(S,n,v,k,!1)}),e.write("}")}return null}if(z){e.write(`const ${w} = {};`);for(let $ of c){let S=l($),k=p.get($);hc(m[$])?e.write(`if (${S} in ${o}) ${w}[${S}] = ${k};`):mm(m[$])?e.write(`if (${k} !== undefined || ${S} in ${o}) ${w}[${S}] = ${k};`):e.write(`${w}[${S}] = ${k};`)}}else{let $=c.map(S=>`${d(S)}: ${p.get(S)}`).join(", ");e.write(`const ${w} = { ${$} };`)}if(b!=="none"){let $=u.length>0?O(n,new Set(u)):null;e.write(`for (const k in ${o}) {`),e.indented(S=>{if(S.write('if (k === "__proto__") continue;'),$&&S.write(`if (${$}.has(k)) continue;`),b==="passthrough")S.write(`${w}[k] = ${o}[k];`);else{let k=N(n);S.write(`const ${k} = ${o}[k];`);let D=ee(S,n,v,k);S.write(`${w}[k] = ${D};`)}}),e.write("}")}return w}function My(e,n,i,o,t=!0){let r=i._zod.def;if(Fy(i))return F(e,n,r.innerType,o,t);if(r.innerType._zod.optin==="defaulted"){let u=N(n),s=N(n);return e.write(`let ${u};`),e.write(`if (${o} === undefined) {`),e.indented(c=>{c.write(`const ${s} = (() => {`),c.indented(l=>{let d=F(l,n,r.innerType,o);l.write(`return ${d};`)}),c.write("})();"),c.write(`if (${s} !== INVALID) ${u} = ${s};`)}),e.write("} else {"),e.indented(c=>{let l=F(c,n,r.innerType,o);c.write(`${u} = ${l};`)}),e.write("}"),u}let a=t?N(n):null;return a&&e.write(`let ${a};`),e.write(`if (${o} !== undefined) {`),e.indented(u=>{let s=F(u,n,r.innerType,o,t);a&&s!==null&&u.write(`${a} = ${s};`)}),e.write("}"),a}function Fy(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function Gy(e){return e._zod.optin===void 0&&rt(e)}function rt(e){if(e._zod.def.coerce)return!0;let n=e._zod.def;switch(n.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return n.innerType?rt(n.innerType):!1;case"literal":return!!n.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return n.innerType?rt(n.innerType):!0;case"catch":return!0;case"union":return n.options?n.options.some(rt):!0;case"intersection":return!n.left||!n.right?!0:rt(n.left)&&rt(n.right);case"pipe":return n.in?rt(n.in):!0;default:return!0}}function hc(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function mm(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Tt(e)}function Tt(e){let n=e._zod.def;switch(n.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!n.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return n.innerType?Tt(n.innerType):!0;case"union":return n.options?n.options.some(Tt):!0;case"intersection":return!n.left||!n.right||Tt(n.left)||Tt(n.right);case"pipe":return n.out?Tt(n.out):!0;default:return!0}}function Jy(e,n,i,o,t=!0){let r=i._zod.def,a=t?N(n):null;return a&&e.write(`let ${a} = null;`),e.write(`if (${o} !== null) {`),e.indented(u=>{let s=F(u,n,r.innerType,o,t);a&&s!==null&&u.write(`${a} = ${s};`)}),e.write("}"),a}function _c(e,n,i){for(let[o,t]of wt(n._zod.def.checks))e.write(`if (${i} > ${Ze(o,t._zod.def.check)}) return INVALID;`)}function By(e,n,i,o,t=!0){let r=i._zod.def;e.write(`if (!Array.isArray(${o})) return INVALID;`),_c(e,i,`${o}.length`);let a=t?N(n):null,u=N(n),s=N(n);return a&&e.write(`const ${a} = new Array(${o}.length);`),e.write(`for (let ${u} = 0; ${u} < ${o}.length; ${u}++) {`),e.indented(c=>{c.write(`const ${s} = ${o}[${u}];`);let l=ee(c,n,r.element,s,t);a&&l!==null&&c.write(`${a}[${u}] = ${l};`)}),e.write("}"),a}function Ky(e,n,i,o){let r=i._zod.def.values;if(r.length!==1){let u=O(n,new Set(r));return e.write(`if (!${u}.has(${o})) return INVALID;`),o}let a=r[0];if(typeof a=="number"&&Number.isNaN(a)){let u=O(n,new Set(r));return e.write(`if (!${u}.has(${o})) return INVALID;`),o}if(typeof a=="string")e.write(`if (${o} !== ${te(a)}) return INVALID;`);else if(typeof a=="number"||typeof a=="boolean")e.write(`if (${o} !== ${a}) return INVALID;`);else if(a===null)e.write(`if (${o} !== null) return INVALID;`);else if(a===void 0)e.write(`if (${o} !== undefined) return INVALID;`);else if(typeof a=="bigint")e.write(`if (${o} !== ${a}n) return INVALID;`);else throw new E(`literal type ${typeof a}`);return o}function Wy(e,n,i,o){let t=i._zod.values;if(!t)throw new E("enum schema without enumerated values");let r=O(n,t);return e.write(`if (!${r}.has(${o})) return INVALID;`),o}function fm(e,n,i,o){let t=i._zod.def;return F(e,n,t.innerType,o)}function Hy(e,n,i,o){let t=i._zod.def,a=Object.getOwnPropertyDescriptor(i._zod.def,"defaultValue")?()=>i._zod.def.defaultValue:void 0;if(i._zod.def.type==="prefault"){if(!a)return F(e,n,t.innerType,o);let s=O(n,a),c=N(n);return e.write(`let ${c} = ${o};`),e.write(`if (${o} === undefined) ${c} = ${s}();`),F(e,n,t.innerType,c)}let u=N(n);if(a){let s=O(n,a),c=O(n,dn);e.write(`let ${u};`),e.write(`if (${o} === undefined) {`),e.indented(l=>{l.write(`${u} = ${c}(${s}());`)}),e.write("} else {"),e.indented(l=>{let d=F(l,n,t.innerType,o);l.write(`${u} = ${d} === undefined ? ${c}(${s}()) : ${d};`)}),e.write("}")}else e.write(`let ${u};`),e.write(`if (${o} !== undefined) {`),e.indented(s=>{let c=F(s,n,t.innerType,o);s.write(`${u} = ${c};`)}),e.write("}");return u}function Xy(e,n,i,o){let t=i._zod.def,r=F(e,n,t.innerType,o),a=N(n);return e.write(`const ${a} = ${r};`),e.write(`if (${a} === undefined) return INVALID;`),a}function qy(e,n,i,o){let t=i._zod.def,r=t.items,a=t.rest;e.write(`if (!Array.isArray(${o})) return INVALID;`);let u=gm(r,"optin"),s=gm(r,"optout");a?e.write(`if (${o}.length < ${u}) return INVALID;`):e.write(`if (${o}.length < ${u} || ${o}.length > ${r.length}) return INVALID;`);let c=N(n);e.write(`const ${c} = [];`);for(let l=0;l=s)e.write(`if (${c}.length === ${l}) {`),e.indented(m=>{m.write(`if (${l} < ${o}.length) {`),m.indented(p=>{let v=N(n);p.write(`const ${v} = ${o}[${l}];`);let b=ee(p,n,d,v);p.write(`${c}[${l}] = ${b};`)}),m.write("} else {"),m.indented(p=>{if(hc(d)){p.write(`${c}.length = ${l};`);return}let v=N(n),b=N(n);p.write(`const ${v} = undefined;`),p.write(`const ${b} = (() => {`),p.indented(w=>{let z=ee(w,n,d,v);w.write(`return ${z};`)}),p.write("})();"),p.write(`if (${b} === INVALID || ${b} === undefined) ${c}.length = ${l};`),p.write(`else ${c}[${l}] = ${b};`)}),m.write("}")}),e.write("}");else{let m=N(n);e.write(`const ${m} = ${o}[${l}];`);let p=ee(e,n,d,m);e.write(`${c}[${l}] = ${p};`)}}if(a){let l=N(n),d=N(n);e.write(`for (let ${l} = ${r.length}; ${l} < ${o}.length; ${l}++) {`),e.indented(m=>{m.write(`const ${d} = ${o}[${l}];`);let p=ee(m,n,a,d);m.write(`${c}[${l}] = ${p};`)}),e.write("}")}return c}function gm(e,n){for(let i=e.length-1;i>=0;i--)if(!(n==="optin"?e[i]._zod.optin!==void 0:e[i]._zod.optout==="optional"))return i+1;return 0}function Yy(e,n,i,o){let t=i._zod.def,r=t.options;if(t.discriminator)return Qy(e,n,t,o);if(t.inclusive===!1)throw new E("exclusive unions (z.xor)");if(r.length===0)return e.write("return INVALID;"),o;if(r.length===1)return F(e,n,r[0],o);if(r.every(s=>s._zod.def.type==="literal"&&!s._zod.def.checks?.length)){let s=new Set(r.flatMap(l=>l._zod.def.values)),c=O(n,s);return e.write(`if (!${c}.has(${o})) return INVALID;`),o}let u=N(n);e.write(`let ${u};`);for(let s=0;s {`):e.write(`if (${u} === INVALID) ${u} = (() => {`),e.indented(l=>{let d=F(l,n,c,o);l.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${u} === INVALID) return INVALID;`),u}function Qy(e,n,i,o){if(i.unionFallback)throw new E("discriminated union with unionFallback");if(i.options.length===0)return e.write("return INVALID;"),o;let t=N(n),r=N(n);e.write(`const ${t} = ${o}?.[${te(i.discriminator)}];`),e.write(`let ${r};`);let a=!0,u=new Set;for(let s of i.options){let c=s._zod.propValues?.[i.discriminator];if(!c||c.size===0)throw new E("discriminated union option without static discriminator values");for(let m of c){if(u.has(m))throw new E(`duplicate discriminator value ${String(m)}`);u.add(m)}let l=Array.from(c,m=>e_(n,t,m)),d=a?"if":"else if";e.write(`${d} (${l.join(" || ")}) {`),e.indented(m=>{let p=F(m,n,s,o);m.write(`${r} = ${p};`)}),e.write("}"),a=!1}return e.write("else { return INVALID; }"),r}function e_(e,n,i){if(typeof i=="string")return`${n} === ${te(i)}`;if(typeof i=="number")return Number.isNaN(i)?`Number.isNaN(${n})`:`${n} === ${i}`;if(typeof i=="boolean")return`${n} === ${i}`;if(i===null)return`${n} === null`;if(i===void 0)return`${n} === undefined`;if(typeof i=="bigint")return`${n} === ${i}n`;if(typeof i=="symbol"){let o=O(e,i);return`${n} === ${o}`}throw new E(`literal discriminator value ${String(i)}`)}function t_(e,n,i,o){let t=i._zod.def;n.definite=!1;let r=ee(e,n,t.left,o),a=ee(e,n,t.right,o),u=O(n,jt),s=N(n);return e.write(`const ${s} = ${u}(${r}, ${a});`),e.write(`if (!${s}.valid) return INVALID;`),`${s}.data`}function n_(e,n,i,o){let t=i._zod.def,r=O(n,ge);e.write(`if (!${r}(${o})) return INVALID;`);let a=N(n),u=N(n),s=N(n);e.write(`const ${a} = {};`);let c=t,l=c.partial?void 0:t.keyType._zod.values;if(l){let p=[];for(let b of l){if(!(typeof b=="string"||typeof b=="number"||typeof b=="symbol"))throw new E(`record key value ${String(b)}`);let w=typeof b=="number"?b.toString():b;if(w==="__proto__")throw new E('record key "__proto__"');p.push(w);let z=O(n,b),$=F(e,n,t.keyType,z),S=N(n);e.write(`const ${S} = ${o}[${r_(n,w)}];`);let k=ee(e,n,t.valueType,S);e.write(`${a}[${$}] = ${k};`)}let v=O(n,new Set(p));return e.write(`for (const ${u} in ${o}) {`),e.indented(b=>{b.write(`if (${v}.has(${u})) continue;`),c.mode==="loose"?b.write(`if (${u} !== "__proto__") ${a}[${u}] = ${o}[${u}];`):b.write("return INVALID;")}),e.write("}"),a}let d=t.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let p=t.mode==="loose",v=di(t.keyType);v.definite===!1&&(n.definite=!1);let b=O(n,v),w=O(n,Oe),z=N(n);return vm(e,n,o,u,$=>{$.write(`let ${z} = ${b}(${u});`),$.write(`if (${z} === INVALID && typeof ${u} === "string" && ${w}.test(${u})) ${z} = ${b}(Number(${u}));`),p?$.write(`if (${z} === INVALID) { ${a}[${u}] = ${o}[${u}]; continue; }`):$.write(`if (${z} === INVALID) return INVALID;`),$.write(`if (${z} === "__proto__") continue;`);let S=N(n);$.write(`const ${S} = ${o}[${u}];`);let k=ee($,n,t.valueType,S);$.write(`${a}[${z}] = ${k};`)}),a}return vm(e,n,o,u,p=>{p.write(`const ${s} = ${o}[${u}];`);let v=ee(p,n,t.valueType,s);p.write(`${a}[${u}] = ${v};`)},"return INVALID;"),a}function vm(e,n,i,o,t,r){let a=O(n,Object.prototype.propertyIsEnumerable),u=N(n),s=N(n),c=N(n);e.write(`const ${u} = Object.getOwnPropertySymbols(${i});`),e.write(`const ${s} = Object.getOwnPropertyNames(${i});`),e.write(`for (let ${c} = 0; ${c} < ${s}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${o} = ${s}[${c}];`),l.write(`if (${o} === "__proto__" || !${a}.call(${i}, ${o})) continue;`),t(l)}),e.write("}"),e.write(`for (let ${c} = 0; ${c} < ${u}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${o} = ${u}[${c}];`),l.write(`if (!${a}.call(${i}, ${o})) continue;`),r?l.write(r):t(l)}),e.write("}")}function r_(e,n){return typeof n=="string"?te(n):O(e,n)}function i_(e,n,i,o){let t=i._zod.def;e.write(`if (!(${o} instanceof Map)) return INVALID;`),_c(e,i,`${o}.size`);let r=N(n),a=N(n),u=N(n);return e.write(`const ${r} = new Map();`),e.write(`for (const [${a}, ${u}] of ${o}) {`),e.indented(s=>{let c=F(s,n,t.keyType,a),l=F(s,n,t.valueType,u);s.write(`${r}.set(${c}, ${l});`)}),e.write("}"),r}function o_(e,n,i,o){let t=i._zod.def;e.write(`if (!(${o} instanceof Set)) return INVALID;`),_c(e,i,`${o}.size`);let r=N(n),a=N(n);return e.write(`const ${r} = new Set();`),e.write(`for (const ${a} of ${o}) {`),e.indented(u=>{let s=F(u,n,t.valueType,a);u.write(`${r}.add(${s});`)}),e.write("}"),r}function a_(e,n){return e.write(`if (!(${n} instanceof File)) return INVALID;`),n}function u_(e,n,i,o){e.write(`if (typeof ${o} !== "string") return INVALID;`);let t=i._zod.pattern;if(t){let r=O(n,t);e.write(`${r}.lastIndex = 0;`),e.write(`if (!${r}.test(${o})) return INVALID;`)}return o}function c_(e,n,i,o){let t=i._zod.def,r=it(n,t.getter),a=O(n,{parser:null});e.write(`if (!${a}.parser) {`),e.indented(s=>{s.write(`const inner = ${r}();`),s.write(`${a}.parser = function(input) {`),s.indented(c=>{c.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),c.write("return result.issues.length === 0 ? result.value : INVALID;")}),s.write("};")}),e.write("}");let u=N(n);return e.write(`const ${u} = ${a}.parser(${o});`),e.write(`if (${u} === INVALID) return INVALID;`),u}function s_(e,n,i,o){let t=i._zod.def,r=F(e,n,t.in,o);if(t.transform){if(ot(t.transform))throw new ye("z.compile: async transforms in pipes are not supported");let a=t.transform,s=it(n,l=>{let d={value:l,issues:[],addIssue:yc},m=a(l,d);return m instanceof Promise?re:d.issues.length===0?m:re}),c=N(n);return e.write(`const ${c} = ${s}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),F(e,n,t.out,c)}else return F(e,n,t.out,r)}function ot(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function l_(e,n,i,o){let t=i._zod.def;if(t.fn){if(ot(t.fn))throw new ye("z.compile: async custom predicates are not supported");let r=it(n,t.fn),a=O(n,vc),u=N(n);e.write(`const ${u} = ${r}(${o});`),e.write(`if (${u} instanceof Promise) ${a}();`),e.write(`if (!${u}) return INVALID;`)}else throw new E("custom schema without a predicate function");return o}function d_(e,n,i){let o=e._zod.run({value:i,issues:[]},{});if(o&&typeof o.then=="function")return re;let t=o;return t.issues.length===0?t.value:n()}function p_(e,n,i,o){let t=i._zod.def;if(!t.catchValue[vr])throw new E("catch with a callback (only a constant catch value compiles)",!1);let r=N(n);e.write(`let ${r} = (() => {`),e.indented(c=>{let l=ee(c,n,t.innerType,o);c.write(`return ${l};`)}),e.write("})();");let a=O(n,t.innerType),u=it(n,t.catchValue),s=O(n,d_);return e.write(`if (${r} === INVALID) {`),e.indented(c=>{c.write(`${r} = ${s}(${a}, ${u}, ${o});`),c.write(`if (${r} === INVALID) return INVALID;`)}),e.write("}"),r}function m_(e,n,i,o){let t=i._zod.def;if(t.transform){if(ot(t.transform))throw new ye("z.compile: async transforms are not supported");let r=t.transform,u=it(n,c=>{let l={value:c,issues:[],addIssue:yc},d=r(c,l);return d instanceof Promise?re:l.issues.length===0?d:re}),s=N(n);return e.write(`const ${s} = ${u}(${o});`),e.write(`if (${s} === INVALID) return INVALID;`),s}return o}function pi(e){return e.checks&&(e.checks=[...e.checks]),e}function bc(e,n){return new e(pi({type:"string",...I(n)}))}function xc(e,n){return new e(pi({type:"string",coerce:!0,...I(n)}))}function mi(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(n)})}function fi(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(n)})}function gi(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(n)})}function vi(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(n)})}function hi(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(n)})}function $i(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(n)})}function Vn(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(n)})}function yi(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(n)})}function _i(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(n)})}function bi(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(n)})}function xi(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(n)})}function ki(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(n)})}function Ii(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(n)})}function wi(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(n)})}function Si(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(n)})}function zi(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(n)})}function kc(e,n){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...I(n)})}function Pi(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(n)})}function Di(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(n)})}function Ni(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(n)})}function Oi(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(n)})}function ji(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(n)})}function Ic(e,n){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...I(n)})}function wc(e,n){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...I(n)})}function Ai(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(n)})}var Sc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Mn(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(n)})}function Fn(e,n){return new e({type:"string",format:"date",check:"string_format",...I(n)})}function Gn(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(n)})}function Jn(e,n){return new e({type:"string",format:"duration",check:"string_format",...I(n)})}function zc(e,n){return new e(pi({type:"number",checks:[],...I(n)}))}function Pc(e,n){return new e(pi({type:"number",coerce:!0,checks:[],...I(n)}))}function Dc(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(n)})}function Nc(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...I(n)})}function Oc(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...I(n)})}function jc(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...I(n)})}function Ac(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...I(n)})}function Uc(e,n){return new e({type:"boolean",...I(n)})}function Tc(e,n){return new e({type:"boolean",coerce:!0,...I(n)})}function Ec(e,n){return new e({type:"bigint",...I(n)})}function Lc(e,n){return new e({type:"bigint",coerce:!0,...I(n)})}function Cc(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...I(n)})}function Zc(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...I(n)})}function Rc(e,n){return new e({type:"symbol",...I(n)})}function Vc(e,n){return new e({type:"undefined",...I(n)})}function Mc(e,n){return new e({type:"null",...I(n)})}function Fc(e){return new e({type:"any"})}function Gc(e){return new e({type:"unknown"})}function Jc(e,n){return new e({type:"never",...I(n)})}function Bc(e,n){return new e({type:"void",...I(n)})}function Kc(e,n){return new e({type:"date",...I(n)})}function Wc(e,n){return new e({type:"date",coerce:!0,...I(n)})}function Hc(e,n){return new e({type:"nan",...I(n)})}function ke(e,n){return new jr({check:"less_than",...I(n),value:e,inclusive:!1})}function me(e,n){return new jr({check:"less_than",...I(n),value:e,inclusive:!0})}function Ie(e,n){return new Ar({check:"greater_than",...I(n),value:e,inclusive:!1})}function fe(e,n){return new Ar({check:"greater_than",...I(n),value:e,inclusive:!0})}function Ui(e){return Ie(0,e)}function Ti(e){return ke(0,e)}function Ei(e){return me(0,e)}function Li(e){return fe(0,e)}function Re(e,n){return new Oa({check:"multiple_of",...I(n),value:e})}function Ve(e,n){return new Ua({check:"max_size",...I(n),maximum:e})}function we(e,n){return new Ta({check:"min_size",...I(n),minimum:e})}function at(e,n){return new Ea({check:"size_equals",...I(n),size:e})}function ut(e,n){return new La({check:"max_length",...I(n),maximum:e})}function je(e,n){return new Ca({check:"min_length",...I(n),minimum:e})}function ct(e,n){return new Za({check:"length_equals",...I(n),length:e})}function Et(e,n){return new Ra({check:"string_format",format:"regex",...I(n),pattern:e})}function Lt(e){return new Va({check:"string_format",format:"lowercase",...I(e)})}function Ct(e){return new Ma({check:"string_format",format:"uppercase",...I(e)})}function Zt(e,n){return new Fa({check:"string_format",format:"includes",...I(n),includes:e})}function Rt(e,n){return new Ga({check:"string_format",format:"starts_with",...I(n),prefix:e})}function Vt(e,n){return new Ja({check:"string_format",format:"ends_with",...I(n),suffix:e})}function Ci(e,n,i){return new Ba({check:"property",property:e,schema:n,...I(i)})}function Mt(e,n){return new Ka({check:"properties",shape:e,...I(n)})}function Ft(e,n){return new Wa({check:"mime_type",mime:e,...I(n)})}function _e(e){return new Ha({check:"overwrite",tx:e})}function Gt(e){return _e(n=>n.normalize(e))}function Jt(){return _e(e=>e.trim())}function Bt(){return _e(e=>e.toLowerCase())}function Kt(){return _e(e=>e.toUpperCase())}function Wt(){return _e(e=>Ao(e))}function Xc(e,n,i){return new e({type:"array",element:n,...I(i)})}function f_(e,n,i){return new e({type:"union",options:n,...I(i)})}function g_(e,n,i){return new e({type:"union",options:n,inclusive:!1,...I(i)})}function v_(e,n,i,o){return new e({type:"union",options:i,discriminator:n,...I(o)})}function h_(e,n,i){return new e({type:"intersection",left:n,right:i})}function $_(e,n,i,o){let t=i instanceof j,r=t?o:i,a=t?i:null;return new e({type:"tuple",items:n,rest:a,...I(r)})}function y_(e,n,i,o){return new e({type:"record",keyType:n,valueType:i,...I(o)})}function __(e,n,i,o){return new e({type:"map",keyType:n,valueType:i,...I(o)})}function b_(e,n,i){return new e({type:"set",valueType:n,...I(i)})}function x_(e,n,i){let o=Array.isArray(n)?Object.fromEntries(n.map(t=>[t,t])):n;return new e({type:"enum",entries:o,...I(i)})}function k_(e,n,i){return new e({type:"enum",entries:n,...I(i)})}function I_(e,n,i){return new e({type:"literal",values:Array.isArray(n)?n:[n],...I(i)})}function qc(e,n){return new e({type:"file",...I(n)})}function w_(e,n){return new e({type:"transform",transform:n})}function S_(e,n){return new e({type:"optional",innerType:n})}function z_(e,n){return new e({type:"nullable",innerType:n})}function P_(e,n,i){return new e({type:"default",innerType:n,get defaultValue(){return typeof i=="function"?i():dn(i)}})}function D_(e,n,i){return new e({type:"nonoptional",innerType:n,...I(i)})}function N_(e,n){return new e({type:"success",innerType:n})}function O_(e,n,i){return new e({type:"catch",innerType:n,catchValue:typeof i=="function"?i:Zo(i)})}function j_(e,n,i){return new e({type:"pipe",in:n,out:i})}function A_(e,n){return new e({type:"readonly",innerType:n})}function U_(e,n,i){return new e({type:"template_literal",parts:n,...I(i)})}function T_(e,n){return new e({type:"lazy",getter:n})}function E_(e,n){return new e({type:"promise",innerType:n})}function Yc(e,n,i){let o=I(i);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:n,...o})}function Qc(e,n,i){return new e({type:"custom",check:"custom",fn:n,...I(i)})}function es(e,n){let i=_m(o=>(o.addIssue=t=>{if(typeof t=="string")o.issues.push(St(t,o.value,i._zod.def));else{let r=t;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),"input"in r||(r.input=o.value),r.inst??(r.inst=i),r.continue??(r.continue=!i._zod.def.abort),o.issues.push(St(r))}},e(o.value,o)),n);return i}function _m(e,n){let i=new M({check:"custom",...I(n)});return i._zod.check=e,i}function ts(e){let n=new M({check:"describe"});return n._zod.onattach=[i=>{let o=Q.get(i)??{};Q.add(i,{...o,description:e})}],n._zod.check=()=>{},n}function ns(e){let n=new M({check:"meta"});return n._zod.onattach=[i=>{let o=Q.get(i)??{};Q.add(i,{...o,...e})}],n._zod.check=()=>{},n}function rs(e,n){let i=I(n),o=i.truthy??["true","1","yes","on","y","enabled"],t=i.falsy??["false","0","no","off","n","disabled"];i.case!=="sensitive"&&(o=o.map(p=>typeof p=="string"?p.toLowerCase():p),t=t.map(p=>typeof p=="string"?p.toLowerCase():p));let r=new Set(o),a=new Set(t),u=e.Codec??Un,s=e.Boolean??jn,c=e.String??nt,l=new c({type:"string",error:i.error}),d=new s({type:"boolean",error:i.error}),m=new u({type:"pipe",in:l,out:d,transform:((p,v)=>{let b=p;return i.case!=="sensitive"&&(b=b.toLowerCase()),r.has(b)?!0:a.has(b)?!1:(v.issues.push({code:"invalid_value",expected:"stringbool",values:[...r,...a],input:v.value,inst:m,continue:!1}),{})}),reverseTransform:((p,v)=>p===!0?o[0]||"true":t[0]||"false"),error:i.error});return m._zod.bag.truthy=o,m._zod.bag.falsy=t,m._zod.bag.case=i.case??"insensitive",m}function st(e,n,i,o={}){let t=I(o),r={check:"string_format",type:"string",format:n,fn:typeof i=="function"?i:u=>i.test(u),...t};return i instanceof RegExp&&(r.pattern=i),new e(r)}function Bn(e,...n){for(let i of n)for(let o of Reflect.ownKeys(i))Object.prototype.propertyIsEnumerable.call(i,o)&&Y(e,o,i[o]);return e}function Me(e){let n=e?.target??"draft-2020-12";return n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Q,target:n,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function K(e,n,i,o,t){let r=typeof n.unrepresentable=="function"?n.unrepresentable({zodSchema:e,path:o.path,message:t}):n.unrepresentable;if(r==="any")return!1;if(r===void 0||r==="throw")throw new Error(t);return Object.assign(i,r),!0}function Z(e,n,i={path:[],schemaPath:[]}){var o;let t=e._zod.def,r=n.seen.get(e);if(r)return r.count++,i.schemaPath.includes(e)&&(r.cycle=i.path),r.schema;let a={schema:{},count:1,cycle:void 0,path:i.path};n.seen.set(e,a),n.sharedDefsExtractedFor=void 0,n.sharedEmitDoneFor=void 0;let u=e._zod.toJSONSchema?.();if(u)a.schema=u;else{let l={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,a.schema,l);else{let m=a.schema,p=n.processors[t.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${t.type}`);p(e,n,m,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),Z(d,n,l),n.seen.get(d).isParent=!0)}let s=n.metadataRegistry.get(e);return s&&Bn(a.schema,s),n.io==="input"&&ie(e)&&(delete a.schema.examples,delete a.schema.default),n.io==="input"&&"_prefault"in a.schema&&((o=a.schema).default??(o.default=a.schema._prefault)),delete a.schema._prefault,n.seen.get(e).schema}function bm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Fe(e,n){let i=e.seen.get(n);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let a of e.seen.entries()){let u=e.metadataRegistry.get(a[0])?.id;if(u){let s=o.get(u);if(s&&s!==a[0])throw new Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(u,a[0])}}let t=a=>{let u=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,m=e.external.uri??(v=>v);if(d)return{ref:m(d)};let p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${m("__shared")}#/${u}/${bm(p)}`}}let s="#",c=`${s}/${u}/`;if(a[1]===i&&!a[1].schema.id)return{ref:s};let l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+bm(l)}},r=a=>{if(a[1].schema.$ref)return;let u=a[1],{ref:s,defId:c}=t(a);u.def={...u.schema},c&&(u.defId=c);let l=u.schema;for(let d in l)delete l[d];l.$ref=s};if(e.cycles==="throw")for(let a of e.seen.entries()){let u=a[1];if(u.cycle)throw new Error(`Cycle detected: #/${u.cycle?.join("/")}/ +${u}`:u:"",l=Function,d=`return (input) => { +${u} +}`,p;try{p=new l(...a,d)(...s)}catch(f){throw new L(`this schema (generated code failed to evaluate: ${f.message})`)}return n?.debug&&(p.code=c),p.definite=o.definite,p}function D(e,n){for(let[o,t]of e.constants)if(t===n)return o;let i=`c${e.constantCounter++}`;return e.constants.set(i,n),i}function st(e,n){return e.definite=!1,D(e,n)}function T(e){return`v${e.varCounter++}`}function Ey(e,n){let i=e._zod.run({value:n,issues:[]},{});if(i&&typeof i.then=="function")return ie;let o=i;return o.issues.length===0?o.value:ie}function te(e,n,i,o,t=!0){let r=e.content.length,a=n.constants.size,s=n.constantCounter,u=n.varCounter;try{return G(e,n,i,o,t)}catch(c){if(!(c instanceof L)||!c.islandable)throw c;if(e.content.length=r,n.constants.size>a){let l=Array.from(n.constants.keys()).slice(a);for(let d of l)n.constants.delete(d)}return n.constantCounter=s,n.varCounter=u,jy(e,n,i,o)}}function jy(e,n,i,o){n.definite=!1;let t=D(n,i),r=D(n,Ey),a=T(n);return e.write(`const ${a} = ${r}(${t}, ${o});`),e.write(`if (${a} === INVALID) return INVALID;`),a}var Uy=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function Ly(e,n,i,o){let t=i._zod.def.checks;if(!t||t.length===0)return o;let r=o;for(let a of t){let s=a._zod.def;if(s.when&&!Uy.has(s.check))throw new L('check with a custom "when" condition');switch(s.check){case"greater_than":Cy(e,n,s,r);break;case"less_than":Ry(e,n,s,r);break;case"multiple_of":Zy(e,n,s,r);break;case"number_format":wm(e,s,r);break;case"min_length":{let u=Ze(s.minimum,"min_length"),c=_u(e,n,r,`${r}.length >= ${u} && ${r}.length < ${s.minimum*2}`);e.write(`if (${c} < ${u}) return INVALID;`);break}case"max_length":{let u=Ze(s.maximum,"max_length"),c=_u(e,n,r,`${r}.length > ${u}`);e.write(`if (${c} > ${u}) return INVALID;`);break}case"length_equals":{let u=Ze(s.length,"length_equals"),c=_u(e,n,r,`${r}.length >= ${u} && ${r}.length <= ${s.length*2}`);e.write(`if (${c} !== ${u}) return INVALID;`);break}case"min_size":e.write(`if (${r}.size < ${Ze(s.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${r}.size > ${Ze(s.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${r}.size !== ${Ze(s.size,"size_equals")}) return INVALID;`);break;case"string_format":r=Pm(e,n,s,r);break;case"custom":r=Jy(e,n,a,r);break;case"bigint_format":My(e,s,r);break;case"mime_type":Vy(e,n,s,r);break;case"property":Gy(e,n,s,r);break;case"properties":Fy(e,n,s,r);break;case"overwrite":{let u=T(n);By(e,n,a,r,u),r=u;break}default:throw new L(`check type ${s.check}`)}}return r}function _u(e,n,i,o){let t=D(n,nt),r=T(n);return e.write(`const ${r} = typeof ${i} === "string" && ${o} ? ${t}(${i}) : ${i}.length;`),r}function Ze(e,n){if(typeof e!="number"||!Number.isFinite(e))throw new L(`${n} bound of type ${typeof e}`);return`${e}`}function Sm(e,n){if(typeof n=="bigint")return`${n}n`;if(typeof n=="number"){if(Number.isNaN(n))throw new L("comparison check with NaN bound");return`${n}`}if(n instanceof Date){if(Number.isNaN(n.getTime()))throw new L("comparison check with Invalid Date bound");return D(e,n)}throw new L(`comparison check bound of type ${typeof n}`)}function Cy(e,n,i,o){let t=i.inclusive?"<":"<=";e.write(`if (${o} ${t} ${Sm(n,i.value)}) return INVALID;`)}function Ry(e,n,i,o){let t=i.inclusive?">":">=";e.write(`if (${o} ${t} ${Sm(n,i.value)}) return INVALID;`)}function Zy(e,n,i,o){if(typeof i.value=="bigint"){if(i.value===BigInt(0))throw new L("multiple_of check with a zero divisor");e.write(`if (${o} % ${i.value}n !== 0n) return INVALID;`)}else{let t=D(n,mn);e.write(`if (${t}(${o}, ${Ze(i.value,"multiple_of")}) !== 0) return INVALID;`)}}function wm(e,n,i){let o=n.format;switch(o){case"safeint":e.write(`if (!Number.isSafeInteger(${i})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${i}) || ${i} < -2147483648 || ${i} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${i}) || ${i} < 0 || ${i} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${i}) || ${i} < -3.4028234663852886e38 || ${i} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${i})) return INVALID;`);break;default:throw new L(`number format ${o}`)}}function My(e,n,i){let o=n.format;if(o)switch(o){case"int64":e.write(`if (${i} < -9223372036854775808n || ${i} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${i} < 0n || ${i} > 18446744073709551615n) return INVALID;`);break;default:throw new L(`bigint format ${o}`)}}function Vy(e,n,i,o){let t=i.mime;if(t&&t.length>0){let r=D(n,new Set(t));e.write(`if (!${r}.has(${o}.type)) return INVALID;`)}}function Fy(e,n,i,o){if(i.when)throw new L('check with a custom "when" condition');e.write(`if (${o} == null) return INVALID;`);let t=i.shape;for(let r of Reflect.ownKeys(t)){let a=typeof r=="symbol"?D(n,r):ne(r),s=T(n);e.write(`const ${s} = ${o}[${a}];`),te(e,n,t[r],s,!1)}}function Gy(e,n,i,o){let t=`${o}[${JSON.stringify(i.property)}]`;G(e,n,i.schema,t)}function By(e,n,i,o,t){let r=i._zod.def.tx;if(!r)throw new L("overwrite check without a transform function");if(ut(r))throw new be("z.compile: async overwrite transforms are not supported");let a=D(n,r);e.write(`const ${t} = ${a}(${o});`)}function bu(){throw new le}function Iu(e){this.issues.push(e)}function Jy(e,n,i,o){let t=i._zod.def;if(t.fn){if(ut(t.fn))throw new be("z.compile: async .refine() predicates are not supported");let r=st(n,t.fn),a=D(n,bu),s=T(n);return e.write(`const ${s} = ${r}(${o});`),e.write(`if (${s} instanceof Promise) ${a}();`),e.write(`if (!${s}) return INVALID;`),o}if(i._zod.check){if(ut(i._zod.check))throw new be("z.compile: async .superRefine() / check functions are not supported");let r=i._zod.check,s=st(n,c=>{let l={value:c,issues:[],addIssue:Iu};return r(l)instanceof Promise&&bu(),l.issues.length===0?l.value:ie}),u=T(n);return e.write(`const ${u} = ${s}(${o});`),e.write(`if (${u} === INVALID) return INVALID;`),u}throw new L("custom check without a predicate or check function")}var Ky=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function Pm(e,n,i,o,t=!0){let r=i.format;if(r==="base64"){let c=D(n,On);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(r==="base64url"){let c=D(n,Hr);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(r==="jwt"){let c=D(n,qr),l=D(n,i.alg??null);return e.write(`if (!${c}(${o}, ${l})) return INVALID;`),o}if(r==="ipv6"){let c=D(n,Dn);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(r==="cidrv6"){let c=D(n,Jr);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(r==="credit_card"){let c=D(n,Wr);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(r==="iban"){let c=D(n,Xr);return e.write(`if (!${c}(${o})) return INVALID;`),o}let a=i;if(r==="url"||r==="httpurl"||a.normalize||a.hostname!==void 0||a.protocol!==void 0){let c=D(n,Fr),l=D(n,i),d=T(n),p=T(n);if(e.write(`const ${d} = ${o}.trim();`),e.write(`const ${p} = ${c}(${d}, ${l});`),e.write(`if (typeof ${p} === "number") return INVALID;`),a.hostname!==void 0){let y=D(n,Gr);e.write(`if (!${y}(${p}, ${l}.hostname)) return INVALID;`)}if(a.protocol!==void 0){let y=D(n,Br);e.write(`if (!${y}(${p}, ${l}.protocol)) return INVALID;`)}if(!t)return null;let f=T(n),h=a.normalize?`${p}.href`:`${D(n,Tn)}(${d})`;return e.write(`const ${f} = ${h};`),f}let s=i.fn;if(s){if(ut(s))throw new L(`async string format ${r}`);let c=D(n,s);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(Ky.has(r)&&i.pattern){let c=D(n,i.pattern);return e.write(`${c}.lastIndex = 0;`),e.write(`if (!${c}.test(${o})) return INVALID;`),o}let u=i.format;switch(u){case"regex":throw new L("regex format without a pattern");case"lowercase":e.write(`if (${o} !== ${o}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${o} !== ${o}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${o}.includes(${ne(i.includes)})) return INVALID;`);break;case"starts_with":{let c=i.prefix;e.write(`if (${o}.slice(0, ${c.length}) !== ${ne(c)}) return INVALID;`);break}case"ends_with":{let c=i.suffix;e.write(`if (${o}.slice(-${c.length}) !== ${ne(c)}) return INVALID;`);break}default:throw new L(`string format ${u}`)}return o}function G(e,n,i,o,t=!0){let r=i._zod.def,a=r.type;if(r.coerce)throw new L(`coercion (z.coerce.${a}())`);let s=t||!!r.checks?.length,u;switch(a){case"string":u=Hy(e,n,i,o,s);break;case"number":u=Wy(e,i,o);break;case"boolean":u=Xy(e,o);break;case"bigint":u=qy(e,i,o);break;case"symbol":u=Yy(e,o);break;case"undefined":u=Qy(e,o);break;case"null":u=e_(e,o);break;case"any":case"unknown":u=o;break;case"never":e.write("return INVALID;"),u=o;break;case"void":u=t_(e,o);break;case"nan":u=n_(e,o);break;case"date":u=r_(e,o);break;case"object":u=i_(e,n,i,o,s);break;case"optional":u=o_(e,n,i,o,s);break;case"nullable":u=u_(e,n,i,o,s);break;case"array":u=c_(e,n,i,o,s);break;case"literal":u=l_(e,n,i,o);break;case"enum":u=d_(e,n,i,o);break;case"readonly":{let c=xm(e,n,i,o),l=T(n);e.write(`const ${l} = Object.freeze(${c});`),u=l;break}case"success":xm(e,n,i,o),u="true";break;case"default":case"prefault":u=p_(e,n,i,o);break;case"nonoptional":u=m_(e,n,i,o);break;case"tuple":u=f_(e,n,i,o);break;case"union":u=g_(e,n,i,o);break;case"intersection":u=$_(e,n,i,o);break;case"record":u=y_(e,n,i,o);break;case"map":u=b_(e,n,i,o);break;case"set":u=x_(e,n,i,o);break;case"file":u=k_(e,o);break;case"template_literal":u=I_(e,n,i,o);break;case"lazy":u=S_(e,n,i,o);break;case"pipe":u=w_(e,n,i,o);break;case"custom":u=P_(e,n,i,o);break;case"transform":u=N_(e,n,i,o);break;case"catch":u=A_(e,n,i,o);break;default:throw new L(`schema type ${a}`)}return u===null?null:Ly(e,n,i,u)}function Hy(e,n,i,o,t=!0){e.write(`if (typeof ${o} !== "string") return INVALID;`);let r=i._zod.def;return r.format===void 0?o:Pm(e,n,r,o,t)}function Wy(e,n,i){e.write(`if (typeof ${i} !== "number" || !Number.isFinite(${i})) return INVALID;`);let o=n._zod.def;return o.check==="number_format"&&o.format&&wm(e,{format:o.format},i),i}function Xy(e,n){return e.write(`if (typeof ${n} !== "boolean") return INVALID;`),n}function qy(e,n,i){e.write(`if (typeof ${i} !== "bigint") return INVALID;`);let o=n._zod.def;if(o.format)switch(o.format){case"int64":e.write(`if (${i} < -9223372036854775808n || ${i} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${i} < 0n || ${i} > 18446744073709551615n) return INVALID;`);break}return i}function Yy(e,n){return e.write(`if (typeof ${n} !== "symbol") return INVALID;`),n}function Qy(e,n){return e.write(`if (${n} !== undefined) return INVALID;`),n}function e_(e,n){return e.write(`if (${n} !== null) return INVALID;`),n}function t_(e,n){return e.write(`if (${n} !== undefined) return INVALID;`),n}function n_(e,n){return e.write(`if (typeof ${n} !== "number" || !Number.isNaN(${n})) return INVALID;`),n}function r_(e,n){return e.write(`if (!(${n} instanceof Date) || Number.isNaN(${n}.getTime())) return INVALID;`),n}function i_(e,n,i,o,t=!0){let r=i._zod.def;e.write(`if (typeof ${o} !== "object" || ${o} === null || Array.isArray(${o})) return INVALID;`);let a=r.shape,s=Object.keys(a),u=Object.getOwnPropertySymbols(a),c=u.length?[...s,...u]:s,l=S=>typeof S=="symbol"?D(n,S):ne(S),d=S=>typeof S=="symbol"?`[${l(S)}]`:ne(S),p=a;if(s.includes("__proto__"))throw new L('object shape key "__proto__"');let f=new Map;for(let S of c){let N=p[S],x=l(S),A=T(n);if(e.write(`const ${A} = ${o}[${x}];`),N._zod.optin!==void 0){let w=T(n);e.write(`let ${w} = (() => {`),e.indented(O=>{let ye=te(O,n,N,A);O.write(`return ${ye};`)}),e.write("})();"),N._zod.optout==="optional"?(e.write(`if (${w} === INVALID) {`),e.indented(O=>{O.write(`if (${x} in ${o}) return INVALID;`),O.write(`${w} = undefined;`)}),e.write("}")):e.write(`if (${w} === INVALID) return INVALID;`),f.set(S,w)}else{s_(N)&&e.write(`if (!(${x} in ${o})) return INVALID;`);let w=te(e,n,N,A,t);w!==null&&f.set(S,w)}}let h=r.catchall,y="none";if(h){let S=h._zod.def.type;if(S==="never"){let N=s.map(x=>`k !== ${ne(x)}`).join(" && ")||"true";e.write(`for (const k in ${o}) {`),e.indented(x=>{x.write(`if (${N}) return INVALID;`)}),e.write("}")}else(S==="unknown"||S==="any")&&!h._zod.def.checks?.length?y="passthrough":y="schema"}let k=T(n),P=c.some(S=>bm(p[S])||xu(p[S]));if(!t){if(y==="schema"){let S=s.length>0?D(n,new Set(s)):null;e.write(`for (const k in ${o}) {`),e.indented(N=>{N.write('if (k === "__proto__") continue;'),S&&N.write(`if (${S}.has(k)) continue;`);let x=T(n);N.write(`const ${x} = ${o}[k];`),te(N,n,h,x,!1)}),e.write("}")}return null}if(P){e.write(`const ${k} = {};`);for(let S of c){let N=l(S),x=f.get(S);xu(p[S])?e.write(`if (${N} in ${o}) ${k}[${N}] = ${x};`):bm(p[S])?e.write(`if (${x} !== undefined || ${N} in ${o}) ${k}[${N}] = ${x};`):e.write(`${k}[${N}] = ${x};`)}}else{let S=c.map(N=>`${d(N)}: ${f.get(N)}`).join(", ");e.write(`const ${k} = { ${S} };`)}if(y!=="none"){let S=s.length>0?D(n,new Set(s)):null;e.write(`for (const k in ${o}) {`),e.indented(N=>{if(N.write('if (k === "__proto__") continue;'),S&&N.write(`if (${S}.has(k)) continue;`),y==="passthrough")N.write(`${k}[k] = ${o}[k];`);else{let x=T(n);N.write(`const ${x} = ${o}[k];`);let A=te(N,n,h,x);N.write(`${k}[k] = ${A};`)}}),e.write("}")}return k}function o_(e,n,i,o,t=!0){let r=i._zod.def;if(a_(i))return G(e,n,r.innerType,o,t);if(r.innerType._zod.optin==="defaulted"){let s=T(n),u=T(n);return e.write(`let ${s};`),e.write(`if (${o} === undefined) {`),e.indented(c=>{c.write(`const ${u} = (() => {`),c.indented(l=>{let d=G(l,n,r.innerType,o);l.write(`return ${d};`)}),c.write("})();"),c.write(`if (${u} !== INVALID) ${s} = ${u};`)}),e.write("} else {"),e.indented(c=>{let l=G(c,n,r.innerType,o);c.write(`${s} = ${l};`)}),e.write("}"),s}let a=t?T(n):null;return a&&e.write(`let ${a};`),e.write(`if (${o} !== undefined) {`),e.indented(s=>{let u=G(s,n,r.innerType,o,t);a&&u!==null&&s.write(`${a} = ${u};`)}),e.write("}"),a}function a_(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function s_(e){return e._zod.optin===void 0&&at(e)}function at(e){if(e._zod.def.coerce)return!0;let n=e._zod.def;switch(n.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return n.innerType?at(n.innerType):!1;case"literal":return!!n.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return n.innerType?at(n.innerType):!0;case"catch":return!0;case"union":return n.options?n.options.some(at):!0;case"intersection":return!n.left||!n.right?!0:at(n.left)&&at(n.right);case"pipe":return n.in?at(n.in):!0;default:return!0}}function xu(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function bm(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Lt(e)}function Lt(e){let n=e._zod.def;switch(n.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!n.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return n.innerType?Lt(n.innerType):!0;case"union":return n.options?n.options.some(Lt):!0;case"intersection":return!n.left||!n.right||Lt(n.left)||Lt(n.right);case"pipe":return n.out?Lt(n.out):!0;default:return!0}}function u_(e,n,i,o,t=!0){let r=i._zod.def,a=t?T(n):null;return a&&e.write(`let ${a} = null;`),e.write(`if (${o} !== null) {`),e.indented(s=>{let u=G(s,n,r.innerType,o,t);a&&u!==null&&s.write(`${a} = ${u};`)}),e.write("}"),a}function Su(e,n,i){for(let[o,t]of Pt(n._zod.def.checks))e.write(`if (${i} > ${Ze(o,t._zod.def.check)}) return INVALID;`)}function c_(e,n,i,o,t=!0){let r=i._zod.def;e.write(`if (!Array.isArray(${o})) return INVALID;`),Su(e,i,`${o}.length`);let a=t?T(n):null,s=T(n),u=T(n);return a&&e.write(`const ${a} = new Array(${o}.length);`),e.write(`for (let ${s} = 0; ${s} < ${o}.length; ${s}++) {`),e.indented(c=>{c.write(`const ${u} = ${o}[${s}];`);let l=te(c,n,r.element,u,t);a&&l!==null&&c.write(`${a}[${s}] = ${l};`)}),e.write("}"),a}function l_(e,n,i,o){let r=i._zod.def.values;if(r.length!==1){let s=D(n,new Set(r));return e.write(`if (!${s}.has(${o})) return INVALID;`),o}let a=r[0];if(typeof a=="number"&&Number.isNaN(a)){let s=D(n,new Set(r));return e.write(`if (!${s}.has(${o})) return INVALID;`),o}if(typeof a=="string")e.write(`if (${o} !== ${ne(a)}) return INVALID;`);else if(typeof a=="number"||typeof a=="boolean")e.write(`if (${o} !== ${a}) return INVALID;`);else if(a===null)e.write(`if (${o} !== null) return INVALID;`);else if(a===void 0)e.write(`if (${o} !== undefined) return INVALID;`);else if(typeof a=="bigint")e.write(`if (${o} !== ${a}n) return INVALID;`);else throw new L(`literal type ${typeof a}`);return o}function d_(e,n,i,o){let t=i._zod.values;if(!t)throw new L("enum schema without enumerated values");let r=D(n,t);return e.write(`if (!${r}.has(${o})) return INVALID;`),o}function xm(e,n,i,o){let t=i._zod.def;return G(e,n,t.innerType,o)}function p_(e,n,i,o){let t=i._zod.def,a=Object.getOwnPropertyDescriptor(i._zod.def,"defaultValue")?()=>i._zod.def.defaultValue:void 0;if(i._zod.def.type==="prefault"){if(!a)return G(e,n,t.innerType,o);let u=D(n,a),c=T(n);return e.write(`let ${c} = ${o};`),e.write(`if (${o} === undefined) ${c} = ${u}();`),G(e,n,t.innerType,c)}let s=T(n);if(a){let u=D(n,a),c=D(n,fn);e.write(`let ${s};`),e.write(`if (${o} === undefined) {`),e.indented(l=>{l.write(`${s} = ${c}(${u}());`)}),e.write("} else {"),e.indented(l=>{let d=G(l,n,t.innerType,o);l.write(`${s} = ${d} === undefined ? ${c}(${u}()) : ${d};`)}),e.write("}")}else e.write(`let ${s};`),e.write(`if (${o} !== undefined) {`),e.indented(u=>{let c=G(u,n,t.innerType,o);u.write(`${s} = ${c};`)}),e.write("}");return s}function m_(e,n,i,o){let t=i._zod.def,r=G(e,n,t.innerType,o),a=T(n);return e.write(`const ${a} = ${r};`),e.write(`if (${a} === undefined) return INVALID;`),a}function f_(e,n,i,o){let t=i._zod.def,r=t.items,a=t.rest;e.write(`if (!Array.isArray(${o})) return INVALID;`);let s=km(r,"optin"),u=km(r,"optout");a?e.write(`if (${o}.length < ${s}) return INVALID;`):e.write(`if (${o}.length < ${s} || ${o}.length > ${r.length}) return INVALID;`);let c=T(n);e.write(`const ${c} = [];`);for(let l=0;l=u)e.write(`if (${c}.length === ${l}) {`),e.indented(p=>{p.write(`if (${l} < ${o}.length) {`),p.indented(f=>{let h=T(n);f.write(`const ${h} = ${o}[${l}];`);let y=te(f,n,d,h);f.write(`${c}[${l}] = ${y};`)}),p.write("} else {"),p.indented(f=>{if(xu(d)){f.write(`${c}.length = ${l};`);return}let h=T(n),y=T(n);f.write(`const ${h} = undefined;`),f.write(`const ${y} = (() => {`),f.indented(k=>{let P=te(k,n,d,h);k.write(`return ${P};`)}),f.write("})();"),f.write(`if (${y} === INVALID || ${y} === undefined) ${c}.length = ${l};`),f.write(`else ${c}[${l}] = ${y};`)}),p.write("}")}),e.write("}");else{let p=T(n);e.write(`const ${p} = ${o}[${l}];`);let f=te(e,n,d,p);e.write(`${c}[${l}] = ${f};`)}}if(a){let l=T(n),d=T(n);e.write(`for (let ${l} = ${r.length}; ${l} < ${o}.length; ${l}++) {`),e.indented(p=>{p.write(`const ${d} = ${o}[${l}];`);let f=te(p,n,a,d);p.write(`${c}[${l}] = ${f};`)}),e.write("}")}return c}function km(e,n){for(let i=e.length-1;i>=0;i--)if(!(n==="optin"?e[i]._zod.optin!==void 0:e[i]._zod.optout==="optional"))return i+1;return 0}function g_(e,n,i,o){let t=i._zod.def,r=t.options;if(t.discriminator)return v_(e,n,t,o);if(t.inclusive===!1)throw new L("exclusive unions (z.xor)");if(r.length===0)return e.write("return INVALID;"),o;if(r.length===1)return G(e,n,r[0],o);if(r.every(u=>u._zod.def.type==="literal"&&!u._zod.def.checks?.length)){let u=new Set(r.flatMap(l=>l._zod.def.values)),c=D(n,u);return e.write(`if (!${c}.has(${o})) return INVALID;`),o}let s=T(n);e.write(`let ${s};`);for(let u=0;u {`):e.write(`if (${s} === INVALID) ${s} = (() => {`),e.indented(l=>{let d=G(l,n,c,o);l.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${s} === INVALID) return INVALID;`),s}function v_(e,n,i,o){if(i.unionFallback)throw new L("discriminated union with unionFallback");if(i.options.length===0)return e.write("return INVALID;"),o;let t=T(n),r=T(n);e.write(`const ${t} = ${o}?.[${ne(i.discriminator)}];`),e.write(`let ${r};`);let a=!0,s=new Set;for(let u of i.options){let c=u._zod.propValues?.[i.discriminator];if(!c||c.size===0)throw new L("discriminated union option without static discriminator values");for(let p of c){if(s.has(p))throw new L(`duplicate discriminator value ${String(p)}`);s.add(p)}let l=Array.from(c,p=>h_(n,t,p)),d=a?"if":"else if";e.write(`${d} (${l.join(" || ")}) {`),e.indented(p=>{let f=G(p,n,u,o);p.write(`${r} = ${f};`)}),e.write("}"),a=!1}return e.write("else { return INVALID; }"),r}function h_(e,n,i){if(typeof i=="string")return`${n} === ${ne(i)}`;if(typeof i=="number")return Number.isNaN(i)?`Number.isNaN(${n})`:`${n} === ${i}`;if(typeof i=="boolean")return`${n} === ${i}`;if(i===null)return`${n} === null`;if(i===void 0)return`${n} === undefined`;if(typeof i=="bigint")return`${n} === ${i}n`;if(typeof i=="symbol"){let o=D(e,i);return`${n} === ${o}`}throw new L(`literal discriminator value ${String(i)}`)}function $_(e,n,i,o){let t=i._zod.def;n.definite=!1;let r=te(e,n,t.left,o),a=te(e,n,t.right,o),s=D(n,Et),u=T(n);return e.write(`const ${u} = ${s}(${r}, ${a});`),e.write(`if (!${u}.valid) return INVALID;`),`${u}.data`}function y_(e,n,i,o){let t=i._zod.def,r=D(n,ve);e.write(`if (!${r}(${o})) return INVALID;`);let a=T(n),s=T(n),u=T(n);e.write(`const ${a} = {};`);let c=t,l=c.partial?void 0:t.keyType._zod.values;if(l){let f=[];for(let y of l){if(!(typeof y=="string"||typeof y=="number"||typeof y=="symbol"))throw new L(`record key value ${String(y)}`);let k=typeof y=="number"?y.toString():y;if(k==="__proto__")throw new L('record key "__proto__"');f.push(k);let P=D(n,y),S=G(e,n,t.keyType,P),N=T(n);e.write(`const ${N} = ${o}[${__(n,k)}];`);let x=te(e,n,t.valueType,N);e.write(`${a}[${S}] = ${x};`)}let h=D(n,new Set(f));return e.write(`for (const ${s} in ${o}) {`),e.indented(y=>{y.write(`if (${h}.has(${s})) continue;`),c.mode==="loose"?y.write(`if (${s} !== "__proto__") ${a}[${s}] = ${o}[${s}];`):y.write("return INVALID;")}),e.write("}"),a}let d=t.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let f=t.mode==="loose",h=gi(t.keyType);h.definite===!1&&(n.definite=!1);let y=D(n,h),k=D(n,Oe),P=T(n);return Im(e,n,o,s,S=>{S.write(`let ${P} = ${y}(${s});`),S.write(`if (${P} === INVALID && typeof ${s} === "string" && ${k}.test(${s})) ${P} = ${y}(Number(${s}));`),f?S.write(`if (${P} === INVALID) { ${a}[${s}] = ${o}[${s}]; continue; }`):S.write(`if (${P} === INVALID) return INVALID;`),S.write(`if (${P} === "__proto__") continue;`);let N=T(n);S.write(`const ${N} = ${o}[${s}];`);let x=te(S,n,t.valueType,N);S.write(`${a}[${P}] = ${x};`)}),a}return Im(e,n,o,s,f=>{f.write(`const ${u} = ${o}[${s}];`);let h=te(f,n,t.valueType,u);f.write(`${a}[${s}] = ${h};`)},"return INVALID;"),a}function Im(e,n,i,o,t,r){let a=D(n,Object.prototype.propertyIsEnumerable),s=T(n),u=T(n),c=T(n);e.write(`const ${s} = Object.getOwnPropertySymbols(${i});`),e.write(`const ${u} = Object.getOwnPropertyNames(${i});`),e.write(`for (let ${c} = 0; ${c} < ${u}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${o} = ${u}[${c}];`),l.write(`if (${o} === "__proto__" || !${a}.call(${i}, ${o})) continue;`),t(l)}),e.write("}"),e.write(`for (let ${c} = 0; ${c} < ${s}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${o} = ${s}[${c}];`),l.write(`if (!${a}.call(${i}, ${o})) continue;`),r?l.write(r):t(l)}),e.write("}")}function __(e,n){return typeof n=="string"?ne(n):D(e,n)}function b_(e,n,i,o){let t=i._zod.def;e.write(`if (!(${o} instanceof Map)) return INVALID;`),Su(e,i,`${o}.size`);let r=T(n),a=T(n),s=T(n);return e.write(`const ${r} = new Map();`),e.write(`for (const [${a}, ${s}] of ${o}) {`),e.indented(u=>{let c=G(u,n,t.keyType,a),l=G(u,n,t.valueType,s);u.write(`${r}.set(${c}, ${l});`)}),e.write("}"),r}function x_(e,n,i,o){let t=i._zod.def;e.write(`if (!(${o} instanceof Set)) return INVALID;`),Su(e,i,`${o}.size`);let r=T(n),a=T(n);return e.write(`const ${r} = new Set();`),e.write(`for (const ${a} of ${o}) {`),e.indented(s=>{let u=G(s,n,t.valueType,a);s.write(`${r}.add(${u});`)}),e.write("}"),r}function k_(e,n){return e.write(`if (!(${n} instanceof File)) return INVALID;`),n}function I_(e,n,i,o){e.write(`if (typeof ${o} !== "string") return INVALID;`);let t=i._zod.pattern;if(t){let r=D(n,t);e.write(`${r}.lastIndex = 0;`),e.write(`if (!${r}.test(${o})) return INVALID;`)}return o}function S_(e,n,i,o){let t=i._zod.def,r=st(n,t.getter),a=D(n,{parser:null});e.write(`if (!${a}.parser) {`),e.indented(u=>{u.write(`const inner = ${r}();`),u.write(`${a}.parser = function(input) {`),u.indented(c=>{c.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),c.write("return result.issues.length === 0 ? result.value : INVALID;")}),u.write("};")}),e.write("}");let s=T(n);return e.write(`const ${s} = ${a}.parser(${o});`),e.write(`if (${s} === INVALID) return INVALID;`),s}function w_(e,n,i,o){let t=i._zod.def,r=G(e,n,t.in,o);if(t.transform){if(ut(t.transform))throw new be("z.compile: async transforms in pipes are not supported");let a=t.transform,u=st(n,l=>{let d={value:l,issues:[],addIssue:Iu},p=a(l,d);return p instanceof Promise?ie:d.issues.length===0?p:ie}),c=T(n);return e.write(`const ${c} = ${u}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),G(e,n,t.out,c)}else return G(e,n,t.out,r)}function ut(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function P_(e,n,i,o){let t=i._zod.def;if(t.fn){if(ut(t.fn))throw new be("z.compile: async custom predicates are not supported");let r=st(n,t.fn),a=D(n,bu),s=T(n);e.write(`const ${s} = ${r}(${o});`),e.write(`if (${s} instanceof Promise) ${a}();`),e.write(`if (!${s}) return INVALID;`)}else throw new L("custom schema without a predicate function");return o}function z_(e,n,i){let o=e._zod.run({value:i,issues:[]},{});if(o&&typeof o.then=="function")return ie;let t=o;return t.issues.length===0?t.value:n()}function A_(e,n,i,o){let t=i._zod.def;if(!t.catchValue[_r])throw new L("catch with a callback (only a constant catch value compiles)",!1);let r=T(n);e.write(`let ${r} = (() => {`),e.indented(c=>{let l=te(c,n,t.innerType,o);c.write(`return ${l};`)}),e.write("})();");let a=D(n,t.innerType),s=st(n,t.catchValue),u=D(n,z_);return e.write(`if (${r} === INVALID) {`),e.indented(c=>{c.write(`${r} = ${u}(${a}, ${s}, ${o});`),c.write(`if (${r} === INVALID) return INVALID;`)}),e.write("}"),r}function N_(e,n,i,o){let t=i._zod.def;if(t.transform){if(ut(t.transform))throw new be("z.compile: async transforms are not supported");let r=t.transform,s=st(n,c=>{let l={value:c,issues:[],addIssue:Iu},d=r(c,l);return d instanceof Promise?ie:l.issues.length===0?d:ie}),u=T(n);return e.write(`const ${u} = ${s}(${o});`),e.write(`if (${u} === INVALID) return INVALID;`),u}return o}function vi(e){return e.checks&&(e.checks=[...e.checks]),e}function wu(e,n){return new e(vi({type:"string",...I(n)}))}function Pu(e,n){return new e(vi({type:"string",coerce:!0,...I(n)}))}function hi(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(n)})}function $i(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(n)})}function yi(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(n)})}function _i(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(n)})}function bi(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(n)})}function xi(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(n)})}function Gn(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(n)})}function ki(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(n)})}function Ii(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(n)})}function Si(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(n)})}function wi(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(n)})}function Pi(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(n)})}function zi(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(n)})}function Ai(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(n)})}function Ni(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(n)})}function Ti(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(n)})}function zu(e,n){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...I(n)})}function Di(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(n)})}function Oi(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(n)})}function Ei(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(n)})}function ji(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(n)})}function Ui(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(n)})}function Au(e,n){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...I(n)})}function Nu(e,n){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...I(n)})}function Li(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(n)})}var Tu={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Bn(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(n)})}function Jn(e,n){return new e({type:"string",format:"date",check:"string_format",...I(n)})}function Kn(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(n)})}function Hn(e,n){return new e({type:"string",format:"duration",check:"string_format",...I(n)})}function Du(e,n){return new e(vi({type:"number",checks:[],...I(n)}))}function Ou(e,n){return new e(vi({type:"number",coerce:!0,checks:[],...I(n)}))}function Eu(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(n)})}function ju(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...I(n)})}function Uu(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...I(n)})}function Lu(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...I(n)})}function Cu(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...I(n)})}function Ru(e,n){return new e({type:"boolean",...I(n)})}function Zu(e,n){return new e({type:"boolean",coerce:!0,...I(n)})}function Mu(e,n){return new e({type:"bigint",...I(n)})}function Vu(e,n){return new e({type:"bigint",coerce:!0,...I(n)})}function Fu(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...I(n)})}function Gu(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...I(n)})}function Bu(e,n){return new e({type:"symbol",...I(n)})}function Ju(e,n){return new e({type:"undefined",...I(n)})}function Ku(e,n){return new e({type:"null",...I(n)})}function Hu(e){return new e({type:"any"})}function Wu(e){return new e({type:"unknown"})}function Xu(e,n){return new e({type:"never",...I(n)})}function qu(e,n){return new e({type:"void",...I(n)})}function Yu(e,n){return new e({type:"date",...I(n)})}function Qu(e,n){return new e({type:"date",coerce:!0,...I(n)})}function ec(e,n){return new e({type:"nan",...I(n)})}function Se(e,n){return new Ur({check:"less_than",...I(n),value:e,inclusive:!1})}function fe(e,n){return new Ur({check:"less_than",...I(n),value:e,inclusive:!0})}function we(e,n){return new Lr({check:"greater_than",...I(n),value:e,inclusive:!1})}function ge(e,n){return new Lr({check:"greater_than",...I(n),value:e,inclusive:!0})}function Ci(e){return we(0,e)}function Ri(e){return Se(0,e)}function Zi(e){return fe(0,e)}function Mi(e){return ge(0,e)}function Me(e,n){return new Ua({check:"multiple_of",...I(n),value:e})}function Ve(e,n){return new Ra({check:"max_size",...I(n),maximum:e})}function Pe(e,n){return new Za({check:"min_size",...I(n),minimum:e})}function ct(e,n){return new Ma({check:"size_equals",...I(n),size:e})}function lt(e,n){return new Va({check:"max_length",...I(n),maximum:e})}function Ee(e,n){return new Fa({check:"min_length",...I(n),minimum:e})}function dt(e,n){return new Ga({check:"length_equals",...I(n),length:e})}function Ct(e,n){return new Ba({check:"string_format",format:"regex",...I(n),pattern:e})}function Rt(e){return new Ja({check:"string_format",format:"lowercase",...I(e)})}function Zt(e){return new Ka({check:"string_format",format:"uppercase",...I(e)})}function Mt(e,n){return new Ha({check:"string_format",format:"includes",...I(n),includes:e})}function Vt(e,n){return new Wa({check:"string_format",format:"starts_with",...I(n),prefix:e})}function Ft(e,n){return new Xa({check:"string_format",format:"ends_with",...I(n),suffix:e})}function Vi(e,n,i){return new qa({check:"property",property:e,schema:n,...I(i)})}function Gt(e,n){return new Ya({check:"properties",shape:e,...I(n)})}function Bt(e,n){return new Qa({check:"mime_type",mime:e,...I(n)})}function xe(e){return new es({check:"overwrite",tx:e})}function Jt(e){return xe(n=>n.normalize(e))}function Kt(){return xe(e=>e.trim())}function Ht(){return xe(e=>e.toLowerCase())}function Wt(){return xe(e=>e.toUpperCase())}function Xt(){return xe(e=>Co(e))}function tc(e,n,i){return new e({type:"array",element:n,...I(i)})}function T_(e,n,i){return new e({type:"union",options:n,...I(i)})}function D_(e,n,i){return new e({type:"union",options:n,inclusive:!1,...I(i)})}function O_(e,n,i,o){return new e({type:"union",options:i,discriminator:n,...I(o)})}function E_(e,n,i){return new e({type:"intersection",left:n,right:i})}function j_(e,n,i,o){let t=i instanceof E,r=t?o:i,a=t?i:null;return new e({type:"tuple",items:n,rest:a,...I(r)})}function U_(e,n,i,o){return new e({type:"record",keyType:n,valueType:i,...I(o)})}function L_(e,n,i,o){return new e({type:"map",keyType:n,valueType:i,...I(o)})}function C_(e,n,i){return new e({type:"set",valueType:n,...I(i)})}function R_(e,n,i){let o=Array.isArray(n)?Object.fromEntries(n.map(t=>[t,t])):n;return new e({type:"enum",entries:o,...I(i)})}function Z_(e,n,i){return new e({type:"enum",entries:n,...I(i)})}function M_(e,n,i){return new e({type:"literal",values:Array.isArray(n)?n:[n],...I(i)})}function nc(e,n){return new e({type:"file",...I(n)})}function V_(e,n){return new e({type:"transform",transform:n})}function F_(e,n){return new e({type:"optional",innerType:n})}function G_(e,n){return new e({type:"nullable",innerType:n})}function B_(e,n,i){return new e({type:"default",innerType:n,get defaultValue(){return typeof i=="function"?i():fn(i)}})}function J_(e,n,i){return new e({type:"nonoptional",innerType:n,...I(i)})}function K_(e,n){return new e({type:"success",innerType:n})}function H_(e,n,i){return new e({type:"catch",innerType:n,catchValue:typeof i=="function"?i:Go(i)})}function W_(e,n,i){return new e({type:"pipe",in:n,out:i})}function X_(e,n){return new e({type:"readonly",innerType:n})}function q_(e,n,i){return new e({type:"template_literal",parts:n,...I(i)})}function Y_(e,n){return new e({type:"lazy",getter:n})}function Q_(e,n){return new e({type:"promise",innerType:n})}function rc(e,n,i){let o=I(i);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:n,...o})}function ic(e,n,i){return new e({type:"custom",check:"custom",fn:n,...I(i)})}function oc(e,n){let i=zm(o=>(o.addIssue=t=>{if(typeof t=="string")o.issues.push(zt(t,o.value,i._zod.def));else{let r=t;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),"input"in r||(r.input=o.value),r.inst??(r.inst=i),r.continue??(r.continue=!i._zod.def.abort),o.issues.push(zt(r))}},e(o.value,o)),n);return i}function zm(e,n){let i=new F({check:"custom",...I(n)});return i._zod.check=e,i}function ac(e){let n=new F({check:"describe"});return n._zod.onattach=[i=>{let o=ee.get(i)??{};ee.add(i,{...o,description:e})}],n._zod.check=()=>{},n}function sc(e){let n=new F({check:"meta"});return n._zod.onattach=[i=>{let o=ee.get(i)??{};ee.add(i,{...o,...e})}],n._zod.check=()=>{},n}function uc(e,n){let i=I(n),o=i.truthy??["true","1","yes","on","y","enabled"],t=i.falsy??["false","0","no","off","n","disabled"];i.case!=="sensitive"&&(o=o.map(f=>typeof f=="string"?f.toLowerCase():f),t=t.map(f=>typeof f=="string"?f.toLowerCase():f));let r=new Set(o),a=new Set(t),s=e.Codec??Ln,u=e.Boolean??jn,c=e.String??ot,l=new c({type:"string",error:i.error}),d=new u({type:"boolean",error:i.error}),p=new s({type:"pipe",in:l,out:d,transform:((f,h)=>{let y=f;return i.case!=="sensitive"&&(y=y.toLowerCase()),r.has(y)?!0:a.has(y)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...r,...a],input:h.value,inst:p,continue:!1}),{})}),reverseTransform:((f,h)=>f===!0?o[0]||"true":t[0]||"false"),error:i.error});return p._zod.bag.truthy=o,p._zod.bag.falsy=t,p._zod.bag.case=i.case??"insensitive",p}function pt(e,n,i,o={}){let t=I(o),r={check:"string_format",type:"string",format:n,fn:typeof i=="function"?i:s=>i.test(s),...t};return i instanceof RegExp&&(r.pattern=i),new e(r)}function Wn(e,...n){for(let i of n)for(let o of Reflect.ownKeys(i))Object.prototype.propertyIsEnumerable.call(i,o)&&Q(e,o,i[o]);return e}function Fe(e){let n=e?.target??"draft-2020-12";return n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ee,target:n,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function H(e,n,i,o,t){let r=typeof n.unrepresentable=="function"?n.unrepresentable({zodSchema:e,path:o.path,message:t}):n.unrepresentable;if(r==="any")return!1;if(r===void 0||r==="throw")throw new Error(t);return Object.assign(i,r),!0}function Z(e,n,i={path:[],schemaPath:[]}){var o;let t=e._zod.def,r=n.seen.get(e);if(r)return r.count++,i.schemaPath.includes(e)&&(r.cycle=i.path),r.schema;let a={schema:{},count:1,cycle:void 0,path:i.path};n.seen.set(e,a),n.sharedDefsExtractedFor=void 0,n.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let l={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,a.schema,l);else{let p=a.schema,f=n.processors[t.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${t.type}`);f(e,n,p,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),Z(d,n,l),n.seen.get(d).isParent=!0)}let u=n.metadataRegistry.get(e);return u&&Wn(a.schema,u),n.io==="input"&&oe(e)&&(delete a.schema.examples,delete a.schema.default),n.io==="input"&&"_prefault"in a.schema&&((o=a.schema).default??(o.default=a.schema._prefault)),delete a.schema._prefault,n.seen.get(e).schema}function Am(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ge(e,n){let i=e.seen.get(n);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let u=o.get(s);if(u&&u!==a[0])throw new Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(s,a[0])}}let t=a=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,p=e.external.uri??(h=>h);if(d)return{ref:p(d)};let f=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=f,{defId:f,ref:`${p("__shared")}#/${s}/${Am(f)}`}}let u="#",c=`${u}/${s}/`;if(a[1]===i&&!a[1].schema.id)return{ref:u};let l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+Am(l)}},r=a=>{if(a[1].schema.$ref)return;let s=a[1],{ref:u,defId:c}=t(a);s.def={...s.schema},c&&(s.defId=c);let l=s.schema;for(let d in l)delete l[d];l.$ref=u};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/ -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let u=a[1];if(n===a[0]){r(a);continue}if(e.external){let c=e.external.registry.get(a[0])?.id;if(n!==a[0]&&c){r(a);continue}}if(e.metadataRegistry.get(a[0])?.id){r(a);continue}if(u.cycle){r(a);continue}u.count>1&&e.reused==="ref"&&r(a)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Im(e){let n=e.anyOf;if(!Array.isArray(n)||n.length===0||e.type!==void 0)return;let i=[];for(let o of n){if(!o||typeof o!="object")return;Im(o);let t=Object.keys(o);if(t.length!==1||t[0]!=="type")return;let r=o.type;for(let a of Array.isArray(r)?r:[r]){if(typeof a!="string")return;i.includes(a)||i.push(a)}}delete e.anyOf,e.type=i.length===1?i[0]:i}var wm=new Set(["type","properties","required","additionalProperties"]),xm=["oneOf","anyOf"];function km(e){let n=e.additionalProperties;return n===void 0||n===!1||typeof n!="object"||n===null?null:Object.keys(n).length?n:null}function is(e){let n=[];for(let r of e){if(typeof r!="object"||r.type!=="object")return null;for(let a in r)if(!wm.has(a))return null;n.push(r)}let i={},o=new Set;for(let r of n){for(let a in r.properties){if(Object.prototype.hasOwnProperty.call(i,a))continue;let u=[];for(let c of n){let l=c.properties?.[a]??km(c);l!=null&&(u.some(d=>JSON.stringify(d)===JSON.stringify(l))||u.push(l))}let s=u.length===1?u[0]:is(u)??{allOf:u};Y(i,a,s)}for(let a of r.required??[])o.add(a)}let t={type:"object",properties:i};if(o.size&&(t.required=[...o]),n.every(r=>r.additionalProperties===!1))t.additionalProperties=!1;else{let r=[];for(let a of n){let u=km(a);u&&!r.some(s=>JSON.stringify(s)===JSON.stringify(u))&&r.push(u)}r.length===1?t.additionalProperties=r[0]:r.length>1&&(t.additionalProperties={allOf:r})}return t}function L_(e){let n=e.allOf;if(!Array.isArray(n)||n.length<2)return;for(let t of wm)if(t in e)return;let i=n.filter(t=>xm.some(r=>Array.isArray(t[r]))),o=null;if(!i.length)o=is(n);else{let t=i[0],r=xm.find(s=>Array.isArray(t[s]));if(Object.keys(t).length!==1)return;let a=n.filter(s=>s!==t),u=t[r].map(s=>is([...a,s]));if(u.some(s=>!s))return;o={[r]:u}}o&&(delete e.allOf,Bn(e,o))}function Ge(e,n){let i=e.seen.get(n);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=u=>{let s=e.seen.get(u);if(s.ref===null)return;let c=s.def??s.schema,l={...c},d=s.ref;if(s.ref=null,d){o(d);let p=e.seen.get(d),v=p.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(v)):Bn(c,v),Bn(c,l),u._zod.parent===d)for(let w in c)w==="$ref"||w==="allOf"||w in l||delete c[w];if(v.$ref&&p.def)for(let w in c)w==="$ref"||w==="allOf"||w in p.def&&JSON.stringify(c[w])===JSON.stringify(p.def[w])&&delete c[w]}let m=u._zod.parent;if(m&&m!==d){o(m);let p=e.seen.get(m);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(let v in c)v==="$ref"||v==="allOf"||v in p.def&&JSON.stringify(c[v])===JSON.stringify(p.def[v])&&delete c[v]}e.override({zodSchema:u,jsonSchema:c,path:s.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let u of[...e.seen.entries()].reverse())o(u[0]);if(e.target!=="openapi-3.0")for(let u of e.seen.entries())Im(u[1].def??u[1].schema);for(let u of e.deferred)u();if(e.intersections.length){let u=new Map;for(let s of e.seen.values())for(let c of[s.schema,s.def]){let l=c?.allOf;if(!Array.isArray(l))continue;let d=u.get(l);d?d.push(c):u.set(l,[c])}for(let s of e.intersections)for(let c of u.get(s)??[])L_(c)}}let t={};if(e.target==="draft-2020-12"?t.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?t.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?t.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let u=e.external.registry.get(n)?.id;if(!u)throw new Error("Schema is missing an `id` property");t.$id=e.external.uri(u)}Bn(t,i.defId?i.schema:i.def??i.schema);let r=e.metadataRegistry.get(n)?.id;r!==void 0&&t.id===r&&delete t.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let u of e.seen.entries()){let s=u[1];s.def&&s.defId&&(s.def.id===s.defId&&delete s.def.id,Y(a,s.defId,s.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?t.$defs=a:t.definitions=a);try{let u=JSON.parse(JSON.stringify(t));return Object.defineProperty(u,"~standard",{value:{...n["~standard"],jsonSchema:{input:Ht(n,"input",e.processors),output:Ht(n,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function ie(e,n){let i=n??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ie(o.element,i);if(o.type==="set")return ie(o.valueType,i);if(o.type==="lazy")return ie(o.getter(),i);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return ie(o.innerType,i);if(o.type==="intersection")return ie(o.left,i)||ie(o.right,i);if(o.type==="record"||o.type==="map")return ie(o.keyType,i)||ie(o.valueType,i);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ie(o.in,i)||ie(o.out,i);if(o.type==="object"){for(let t in o.shape)if(ie(o.shape[t],i))return!0;return!1}if(o.type==="union"){for(let t of o.options)if(ie(t,i))return!0;return!1}if(o.type==="tuple"){for(let t of o.items)if(ie(t,i))return!0;return!!(o.rest&&ie(o.rest,i))}return!1}var os=(e,n={})=>i=>{let o=Me({...i,processors:n});return Z(e,o),Fe(o,e),Ge(o,e)},Ht=(e,n,i={})=>o=>{let{libraryOptions:t,target:r}=o??{},a=Me({...t??{},target:r,io:n,processors:i});return Z(e,a),Fe(a,e),Ge(a,e)};var Xt=(e,n,i)=>{(e[n]===void 0||i>e[n])&&(e[n]=i)},qt=(e,n,i)=>{(e[n]===void 0||i{Xt(e,"minimum",n),qt(e,"maximum",n)},Nm=(e,n)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(n)||e.multipleOf.push(n)},Om=(e,n)=>{e.patterns??(e.patterns=new Set),e.patterns.add(n)},jm=(e,n)=>{e.mime=e.mime?e.mime.filter(i=>n.includes(i)):[...n]},Am=(e,n)=>{e.format=n,n.includes("int")&&(e.isInt=!0)},zm=(e,n)=>Xt(e,"minimum",n.minimum),Pm=(e,n)=>qt(e,"maximum",n.maximum),Dm=e=>(n,i)=>{Am(n,i.format);let[o,t]=e[i.format];Xt(n,"minimum",o),qt(n,"maximum",t)},C_={greater_than:(e,n)=>Xt(e,n.inclusive?"minimum":"exclusiveMinimum",n.value),less_than:(e,n)=>qt(e,n.inclusive?"maximum":"exclusiveMaximum",n.value),multiple_of:(e,n)=>Nm(e,n.value),number_format:Dm(mn),bigint_format:Dm(fn),min_length:zm,max_length:Pm,length_equals:(e,n)=>Sm(e,n.length),min_size:zm,max_size:Pm,size_equals:(e,n)=>Sm(e,n.size),string_format:(e,n)=>{Am(e,n.format),n.pattern&&Om(e,n.pattern),(n.format==="base64"||n.format==="base64url")&&(e.contentEncoding=n.format),(n.local||n.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,n)=>jm(e,n.mime)};function W(e){let n={},i=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...i.checks??[]]:i.checks??[];for(let r of o)C_[r._zod.def.check]?.(n,r._zod.def);let t=e._zod.bag;t.minimum!==void 0&&Xt(n,"minimum",t.minimum),t.exclusiveMinimum!==void 0&&Xt(n,"exclusiveMinimum",t.exclusiveMinimum),t.maximum!==void 0&&qt(n,"maximum",t.maximum),t.exclusiveMaximum!==void 0&&qt(n,"exclusiveMaximum",t.exclusiveMaximum),t.multipleOf!==void 0&&Nm(n,t.multipleOf),t.format!==void 0&&(n.format??(n.format=t.format),t.format.includes("int")&&(n.isInt=!0)),t.mime&&jm(n,t.mime);for(let r of t.patterns??[])Om(n,r);return n}var Z_={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},R_=new Map([[Fr,da],[On,pa]]),Um=e=>R_.get(e)??e,cs=(e,n,i,o)=>{let t=i;t.type="string";let{minimum:r,maximum:a,format:u,patterns:s,contentEncoding:c,laxFormat:l}=W(e);if(typeof r=="number"&&(t.minLength=r),typeof a=="number"&&(t.maxLength=a),u&&(t.format=Z_[u]??u,t.format===""&&delete t.format,(u==="time"||l)&&delete t.format),c&&(t.contentEncoding=c),s&&s.size>0){let d=[...s].map(Um);d.length===1?t.pattern=d[0].source:d.length>1&&(t.allOf=[...d.map(m=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},ss=(e,n,i,o)=>{let t=i,{minimum:r,maximum:a,multipleOf:u,exclusiveMaximum:s,exclusiveMinimum:c,isInt:l}=W(e);t.type=l?"integer":"number";let d=typeof c=="number"&&c>=(r??Number.NEGATIVE_INFINITY),m=typeof s=="number"&&s<=(a??Number.POSITIVE_INFINITY),p=n.target==="draft-04"||n.target==="openapi-3.0";if(d?p?(t.minimum=c,t.exclusiveMinimum=!0):t.exclusiveMinimum=c:typeof r=="number"&&(t.minimum=r),m?p?(t.maximum=s,t.exclusiveMaximum=!0):t.exclusiveMaximum=s:typeof a=="number"&&(t.maximum=a),u){let v=new Set;for(let z of u)Number.isFinite(z)&&z!==0?v.add(Math.abs(z)):K(e,n,t,o,`A multipleOf divisor of ${z} cannot be represented in JSON Schema`);let[b,...w]=v;b!==void 0&&(t.multipleOf=b),w.length&&(t.allOf=[...t.allOf??[],...w.map(z=>({multipleOf:z}))])}},ls=(e,n,i,o)=>{i.type="boolean"},ds=(e,n,i,o)=>{K(e,n,i,o,"BigInt cannot be represented in JSON Schema")},ps=(e,n,i,o)=>{K(e,n,i,o,"Symbols cannot be represented in JSON Schema")},ms=(e,n,i,o)=>{n.target==="openapi-3.0"?(i.type="string",i.nullable=!0,i.enum=[null]):i.type="null"},fs=(e,n,i,o)=>{K(e,n,i,o,"Undefined cannot be represented in JSON Schema")},gs=(e,n,i,o)=>{K(e,n,i,o,"Void cannot be represented in JSON Schema")},vs=(e,n,i,o)=>{i.not={}},hs=(e,n,i,o)=>{},$s=(e,n,i,o)=>{},ys=(e,n,i,o)=>{K(e,n,i,o,"Date cannot be represented in JSON Schema")},_s=(e,n,i,o)=>{let t=e._zod.def,r=bt(t.entries);if(r.length===0){i.not={};return}r.every(a=>typeof a=="number")&&(i.type="number"),r.every(a=>typeof a=="string")&&(i.type="string"),i.enum=r},bs=(e,n,i,o)=>{let t=e._zod.def;if(t.values.length===0){i.not={};return}let r=[];for(let a of t.values)if(a===void 0){if(K(e,n,i,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(K(e,n,i,o,"BigInt literals cannot be represented in JSON Schema"))return;r.push(Number(a))}else r.push(a);if(r.length!==0)if(r.length===1){let a=r[0];i.type=a===null?"null":typeof a,n.target==="draft-04"||n.target==="openapi-3.0"?i.enum=[a]:i.const=a}else r.every(a=>typeof a=="number")&&(i.type="number"),r.every(a=>typeof a=="string")&&(i.type="string"),r.every(a=>typeof a=="boolean")&&(i.type="boolean"),r.every(a=>a===null)&&(i.type="null"),i.enum=r},xs=(e,n,i,o)=>{K(e,n,i,o,"NaN cannot be represented in JSON Schema")},ks=(e,n,i,o)=>{let t=i,r=e._zod.pattern;if(!r)throw new Error("Pattern not found in template literal");t.type="string",t.pattern=r.source},Is=(e,n,i,o)=>{let t=i;t.type="string",t.format="binary",t.contentEncoding="binary";let{minimum:r,maximum:a,mime:u}=W(e);r!==void 0&&(t.minLength=r),a!==void 0&&(t.maxLength=a),u&&(u.length===0?t.not={}:u.length===1?t.contentMediaType=u[0]:t.anyOf=u.map(s=>({contentMediaType:s})))},ws=(e,n,i,o)=>{i.type="boolean"},Ss=(e,n,i,o)=>{K(e,n,i,o,"Custom types cannot be represented in JSON Schema")},zs=(e,n,i,o)=>{K(e,n,i,o,"Function types cannot be represented in JSON Schema")},Ps=(e,n,i,o)=>{K(e,n,i,o,"Transforms cannot be represented in JSON Schema")},Ds=(e,n,i,o)=>{K(e,n,i,o,"Map cannot be represented in JSON Schema")},Ns=(e,n,i,o)=>{K(e,n,i,o,"Set cannot be represented in JSON Schema")},Os=(e,n,i,o)=>{let t=i,r=e._zod.def,{minimum:a,maximum:u}=W(e);typeof a=="number"&&(t.minItems=a),typeof u=="number"&&(t.maxItems=u),t.type="array",t.items=Z(r.element,n,{...o,path:[...o.path,"items"]})};function Kn(e){let n=e._zod.def;return n.type==="pipe"&&n.in._zod.traits.has("$ZodTransform")?Kn(n.out):n.type==="catch"?Kn(n.innerType):e._zod.optin}var js=(e,n,i,o)=>{let t=i,r=e._zod.def,a=r.shape;if(Object.getOwnPropertySymbols(a).length&&K(e,n,t,o,"Symbol keys cannot be represented in JSON Schema"))return;t.type="object",t.properties={};for(let c in a)Y(t.properties,c,Z(a[c],n,{...o,path:[...o.path,"properties",c]}));let s=[];for(let c of Object.keys(a)){let l=r.shape[c];(n.io==="input"?Kn(l)===void 0:l._zod.optout===void 0)&&s.push(c)}s.length>0&&(t.required=s),r.catchall?._zod.def.type==="never"?t.additionalProperties=!1:r.catchall?r.catchall&&(t.additionalProperties=Z(r.catchall,n,{...o,path:[...o.path,"additionalProperties"]})):n.io==="output"&&(t.additionalProperties=!1)},Ri=(e,n,i,o)=>{let t=e._zod.def,r=t.inclusive===!1,a=t.options.map((u,s)=>Z(u,n,{...o,path:[...o.path,r?"oneOf":"anyOf",s]}));r?i.oneOf=a:i.anyOf=a},As=(e,n,i,o)=>{let t=e._zod.def,r=Z(t.left,n,{...o,path:[...o.path,"allOf",0]}),a=Z(t.right,n,{...o,path:[...o.path,"allOf",1]}),u=c=>"allOf"in c&&Object.keys(c).length===1,s=[...u(r)?r.allOf:[r],...u(a)?a.allOf:[a]];i.allOf=s,n.intersections.push(s)},Us=(e,n,i,o)=>{let t=i,r=e._zod.def;t.type="array";let a=n.target==="draft-2020-12"?"prefixItems":"items",u=n.target==="draft-2020-12"||n.target==="openapi-3.0"?"items":"additionalItems",s=r.items.map((b,w)=>Z(b,n,{...o,path:[...o.path,a,w]})),c=r.rest?Z(r.rest,n,{...o,path:[...o.path,u,...n.target==="openapi-3.0"?[r.items.length]:[]]}):null,l=r.items.length;for(;l>0;){let b=r.items[l-1];if(!(n.io==="input"?Kn(b)!==void 0:b._zod.optout==="optional"))break;l--}let d=r.items.length,m=!r.rest;n.target==="draft-2020-12"?(t.prefixItems=s,m?t.items=!1:c&&(t.items=c),l>0&&(t.minItems=l),m&&(t.maxItems=d)):n.target==="openapi-3.0"?(t.items={anyOf:s},c&&t.items.anyOf.push(c),l>0&&(t.minItems=l),m&&(t.maxItems=d)):(t.items=s,m?t.additionalItems=!1:c&&(t.additionalItems=c),l>0&&(t.minItems=l),m&&(t.maxItems=d));let{minimum:p,maximum:v}=W(e);typeof p=="number"&&(t.minItems=p),typeof v=="number"&&(t.maxItems=v)};function as(e,n,i){if(n.$ref){if(i.has(n))return n;i.add(n);let v=e.get(n)?.def;if(!v)return n;let b=as(e,v,i);return b===v?n:b}for(let v of["anyOf","oneOf"]){let b=n[v];if(!Array.isArray(b))continue;let w=b.map(z=>as(e,z,i));w.some((z,$)=>z!==b[$])&&(n={...n,[v]:w})}let o=Array.isArray(n.type)?n.type:[n.type],t=!o.includes("string")&&o.some(v=>v==="number"||v==="integer"),r=n.enum??(n.const!==void 0?[n.const]:void 0);if(!t&&!r?.some(v=>typeof v=="number"))return n;let{minimum:a,maximum:u,exclusiveMinimum:s,exclusiveMaximum:c,multipleOf:l,format:d,id:m,...p}=n;return p.enum?p.enum=p.enum.map(v=>typeof v=="number"?String(v):v):typeof p.const=="number"&&(p.const=String(p.const)),t&&(p.type="string",r||(p.pattern=(o.includes("number")?Oe:In).source)),p}var us=new WeakMap;function V_(e){let n=new Map;for(let o of e.seen.values())o.def&&!n.has(o.schema)&&n.set(o.schema,o);let i=new Map;for(let o of us.get(e)??[]){let t=e.seen.get(o),r=(t?.def??t?.schema)?.propertyNames;if(!r||r===!0||i.has(r))continue;let a=as(n,r,new Set);a!==r&&i.set(r,a)}if(i.size)for(let o of e.seen.values())for(let t of[o.schema,o.def]){let r=t&&i.get(t.propertyNames);r&&(t.propertyNames=r)}}var Ts=(e,n,i,o)=>{let t=i,r=e._zod.def;t.type="object";let a=r.keyType,u=W(a).patterns;if(r.mode==="loose"&&u&&u.size>0){let l=Z(r.valueType,n,{...o,path:[...o.path,"patternProperties","*"]});t.patternProperties={};for(let d of u)Y(t.patternProperties,Um(d).source,l)}else{if(n.target==="draft-07"||n.target==="draft-2020-12"){t.propertyNames=Z(r.keyType,n,{...o,path:[...o.path,"propertyNames"]});let l=us.get(n);l||(l=[],us.set(n,l),n.deferred.push(()=>V_(n))),l.push(e)}t.additionalProperties=Z(r.valueType,n,{...o,path:[...o.path,"additionalProperties"]})}let s=a._zod.values,c=n.io==="input"&&Kn(r.valueType)!==void 0;if(s&&!r.partial&&!c){let l=[...s].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(t.required=l.map(String))}},Es=(e,n,i,o)=>{let t=e._zod.def,r=Z(t.innerType,n,o),a=n.seen.get(e);n.target==="openapi-3.0"?(a.ref=t.innerType,i.nullable=!0):i.anyOf=[r,{type:"null"}]},Ls=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);r.ref=t.innerType},Cs=Symbol();function Tm(e,n,i,o,t){let r=!1,a=JSON.stringify(e,(u,s)=>typeof s!="bigint"?s:(r=!0,null));return r?(K(n,i,o,t,"BigInt defaults cannot be represented in JSON Schema"),Cs):JSON.parse(a)}var Zs=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);r.ref=t.innerType;let a=Tm(t.defaultValue,e,n,i,o);a!==Cs&&(i.default=a)},Rs=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);if(r.ref=t.innerType,n.io!=="input")return;let a=Tm(t.defaultValue,e,n,i,o);a!==Cs&&(i._prefault=a)},Vs=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);r.ref=t.innerType;let a;try{a=t.catchValue(void 0)}catch{K(e,n,i,o,"Dynamic catch values are not supported in JSON Schema");return}i.default=a},Ms=(e,n,i,o)=>{let t=e._zod.def,r=t.in._zod.traits.has("$ZodTransform"),a=n.io==="input"?r?t.out:t.in:t.out;Z(a,n,o);let u=n.seen.get(e);u.ref=a},Fs=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);r.ref=t.innerType,i.readOnly=!0},Gs=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);r.ref=t.innerType},Vi=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);r.ref=t.innerType},Js=(e,n,i,o)=>{let t=e._zod.innerType;Z(t,n,o);let r=n.seen.get(e);r.ref=t},Zi={string:cs,number:ss,boolean:ls,bigint:ds,symbol:ps,null:ms,undefined:fs,void:gs,never:vs,any:hs,unknown:$s,date:ys,enum:_s,literal:bs,nan:xs,template_literal:ks,file:Is,success:ws,custom:Ss,function:zs,transform:Ps,map:Ds,set:Ns,array:Os,object:js,union:Ri,intersection:As,tuple:Us,record:Ts,nullable:Es,nonoptional:Ls,default:Zs,prefault:Rs,catch:Vs,pipe:Ms,readonly:Fs,promise:Gs,optional:Vi,lazy:Js};function Mi(e,n){if("_idmap"in e){let o=e,t=Me({...n,processors:Zi}),r={};for(let s of o._idmap.entries()){let[c,l]=s;Z(l,t)}let a={},u={registry:o,uri:n?.uri,defs:r};t.external=u;for(let s of o._idmap.entries()){let[c,l]=s;Fe(t,l),Y(a,c,Ge(t,l))}if(Object.keys(r).length>0){let s=t.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[s]:r}}return{schemas:a}}let i=Me({...n,processors:Zi});return Z(e,i),Fe(i,e),Ge(i,e)}var Fi=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(n){this.ctx.counter=n}get seen(){return this.ctx.seen}constructor(n){let i=n?.target??"draft-2020-12";i==="draft-4"&&(i="draft-04"),i==="draft-7"&&(i="draft-07"),this.ctx=Me({processors:Zi,target:i,...n?.metadata&&{metadata:n.metadata},...n?.unrepresentable&&{unrepresentable:n.unrepresentable},...n?.override&&{override:n.override},...n?.io&&{io:n.io}})}process(n,i={path:[],schemaPath:[]}){return Z(n,this.ctx,i)}emit(n,i){i&&(i.cycles&&(this.ctx.cycles=i.cycles),i.reused&&(this.ctx.reused=i.reused),i.external&&(this.ctx.external=i.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Fe(this.ctx,n);let o=Ge(this.ctx,n),{"~standard":t,...r}=o;return r}};var Em={};var an={};Pe(an,{ZodAny:()=>ml,ZodArray:()=>hl,ZodBase64:()=>co,ZodBase64URL:()=>so,ZodBigInt:()=>rn,ZodBigIntFormat:()=>mo,ZodBoolean:()=>nn,ZodCIDRv4:()=>ao,ZodCIDRv6:()=>uo,ZodCUID:()=>Qi,ZodCUID2:()=>eo,ZodCatch:()=>Cl,ZodCodec:()=>rr,ZodCreditCard:()=>ol,ZodCustom:()=>ir,ZodCustomStringFormat:()=>mt,ZodDate:()=>qn,ZodDefault:()=>jl,ZodDiscriminatedUnion:()=>yl,ZodE164:()=>lo,ZodEmail:()=>Hi,ZodEmoji:()=>qi,ZodEnum:()=>Qt,ZodExactOptional:()=>ho,ZodFile:()=>Pl,ZodFunction:()=>Wl,ZodGUID:()=>Xi,ZodIBAN:()=>al,ZodIPv4:()=>io,ZodIPv6:()=>oo,ZodISODate:()=>Be,ZodISODateTime:()=>Je,ZodISODuration:()=>We,ZodISOTime:()=>Ke,ZodInstanceOf:()=>ql,ZodIntersection:()=>_l,ZodJWT:()=>po,ZodKSUID:()=>ro,ZodLazy:()=>Jl,ZodLiteral:()=>zl,ZodMAC:()=>il,ZodMap:()=>wl,ZodNaN:()=>Rl,ZodNanoID:()=>Yi,ZodNever:()=>gl,ZodNonOptional:()=>$o,ZodNull:()=>dl,ZodNullable:()=>Ol,ZodNumber:()=>tn,ZodNumberFormat:()=>ft,ZodObject:()=>Qn,ZodOptional:()=>tr,ZodPipe:()=>nr,ZodPrefault:()=>Ul,ZodPreprocess:()=>Vl,ZodPromise:()=>Kl,ZodReadonly:()=>Ml,ZodRecord:()=>Yt,ZodSet:()=>Sl,ZodString:()=>en,ZodStringFormat:()=>R,ZodSuccess:()=>Ll,ZodSymbol:()=>sl,ZodTemplateLiteral:()=>Gl,ZodTransform:()=>Dl,ZodTuple:()=>xl,ZodType:()=>A,ZodULID:()=>to,ZodURL:()=>Xn,ZodUUID:()=>Se,ZodUndefined:()=>ll,ZodUnion:()=>er,ZodUnknown:()=>fl,ZodVoid:()=>vl,ZodXID:()=>no,ZodXor:()=>$l,_ZodString:()=>Wi,_default:()=>Al,_function:()=>Hf,any:()=>Sf,array:()=>Yn,base64:()=>af,base64url:()=>uf,bigint:()=>bf,boolean:()=>cl,catch:()=>Zl,check:()=>Xf,cidrv4:()=>rf,cidrv6:()=>of,codec:()=>Jf,creditCard:()=>sf,cuid:()=>Hm,cuid2:()=>Xm,currencyCode:()=>gf,custom:()=>qf,date:()=>Pf,describe:()=>Yf,discriminatedUnion:()=>Uf,e164:()=>cf,email:()=>Zm,emoji:()=>Km,enum:()=>go,exactOptional:()=>Nl,file:()=>Vf,float32:()=>hf,float64:()=>$f,function:()=>Hf,guid:()=>Rm,hash:()=>vf,hex:()=>ff,hostname:()=>mf,httpUrl:()=>Bm,iban:()=>lf,instanceof:()=>eg,int:()=>Bi,int32:()=>yf,int64:()=>xf,intersection:()=>bl,invertCodec:()=>Bf,ipv4:()=>ef,ipv6:()=>nf,json:()=>ng,jwt:()=>df,keyof:()=>Df,ksuid:()=>Qm,lazy:()=>Bl,literal:()=>Rf,looseObject:()=>jf,looseRecord:()=>Ef,mac:()=>tf,map:()=>Lf,meta:()=>Qf,nan:()=>Gf,nanoid:()=>Wm,nativeEnum:()=>Zf,never:()=>fo,nonoptional:()=>El,null:()=>pl,nullable:()=>Hn,nullish:()=>Mf,number:()=>ul,object:()=>Nf,optional:()=>dt,partialRecord:()=>Tf,pipe:()=>Ki,prefault:()=>Tl,preprocess:()=>rg,promise:()=>Wf,readonly:()=>Fl,record:()=>Il,refine:()=>Hl,set:()=>Cf,strictObject:()=>Of,string:()=>Wn,stringFormat:()=>pf,stringbool:()=>tg,success:()=>Ff,superRefine:()=>Xl,symbol:()=>If,templateLiteral:()=>Kf,transform:()=>vo,tuple:()=>kl,uint32:()=>_f,uint64:()=>kf,ulid:()=>qm,undefined:()=>wf,union:()=>on,unknown:()=>lt,url:()=>Jm,uuid:()=>Vm,uuidv4:()=>Mm,uuidv6:()=>Fm,uuidv7:()=>Gm,void:()=>zf,xid:()=>Ym,xor:()=>Af});var Gi={};Pe(Gi,{endsWith:()=>Vt,gt:()=>Ie,gte:()=>fe,includes:()=>Zt,length:()=>ct,lowercase:()=>Lt,lt:()=>ke,lte:()=>me,maxLength:()=>ut,maxSize:()=>Ve,mime:()=>Ft,minLength:()=>je,minSize:()=>we,multipleOf:()=>Re,negative:()=>Ti,nonnegative:()=>Li,nonpositive:()=>Ei,normalize:()=>Gt,overwrite:()=>_e,positive:()=>Ui,properties:()=>Mt,property:()=>Ci,regex:()=>Et,size:()=>at,slugify:()=>Wt,startsWith:()=>Rt,toLowerCase:()=>Bt,toUpperCase:()=>Kt,trim:()=>Jt,uppercase:()=>Ct});var Lm=new WeakSet([Object.prototype,Error.prototype]);function Ji(e,n,i){Object.defineProperty(e,n,{configurable:!0,enumerable:!1,get(){let o=i(this);return Object.defineProperty(this,n,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,n,{value:o,configurable:!0,writable:!0})}})}var Cm=(e,n)=>{Jo.init(e,n),e.name="ZodError";let i=Object.getPrototypeOf(e);Lm.has(i)||(Lm.add(i),Ji(i,"format",o=>t=>_n(o,t)),Ji(i,"flatten",o=>t=>yn(o,t)),Ji(i,"addIssue",o=>t=>{o.issues.push(t),o.message=JSON.stringify(o.issues,xt,2)}),Ji(i,"addIssues",o=>t=>{o.issues.push(...t),o.message=JSON.stringify(o.issues,xt,2)}),Object.defineProperty(i,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},F_=f("ZodError",Cm),de=f("ZodError",Cm,void 0,{Parent:Error});var Bs=zt(de),Ks=Pt(de),Ws=Dt(de),Hs=Nt(de),Xs=_r(de),qs=br(de),Ys=xr(de),Qs=kr(de),el=Ir(de),tl=wr(de),nl=Sr(de),rl=zr(de);function J_(){q.localeError||G(oi())}function pt(){q.memoizer||G({memoizer:Cn()})}var A=f("ZodType",(e,n)=>(J_(),j.init(e,n),e.def=n,e.type=n.type,e),{check(...e){let n=this.def;return this.clone(y.mergeDefs(n,{checks:[...n.checks??[],...e.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,n){return L(this,e,n)},brand(){return this},register(e,n){return e.add(this,n),this},refine(e,n){return this.check(Hl(e,n))},superRefine(e,n){return this.check(Xl(e,n))},overwrite(e){return this.check(_e(e))},optional(){return dt(this)},exactOptional(){return Nl(this)},nullable(){return Hn(this)},nullish(){return dt(Hn(this))},nonoptional(e){return El(this,e)},array(){return Yn(this)},or(e){return on([this,e])},and(e){return bl(this,e)},transform(e){return Ki(this,vo(e))},default(e){return Al(this,e)},prefault(e){return Tl(this,e)},catch(e){return Zl(this,e)},pipe(e){return Ki(this,e)},readonly(){return Fl(this)},describe(e){let n=this.clone();return Q.add(n,{description:e}),n},meta(...e){if(e.length===0)return Q.get(this);let n=this.clone();return Q.add(n,e[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...n){return n.length===0?e(this):e(this,...n)},get"~standard"(){return y.hide(this,"~standard",{...Cr(this),jsonSchema:{input:Ht(this,"input"),output:Ht(this,"output")}})},set"~standard"(e){y.own(this,"~standard",e)},parse:function e(n,i){return Bs(this,n,i,{callee:e})},parseAsync:async function e(n,i){return await Ks(this,n,i,{callee:e})},safeParse(e,n){return Ws(this,e,n)},async safeParseAsync(e,n){return Hs(this,e,n)},get spa(){return this?.safeParseAsync},set spa(e){y.own(this,"spa",e)},validate(e,n){return bn(this,e,n)},validateAsync(e,n){return xn(this,e,n)},encode:function e(n,i){return Xs(this,n,i,{callee:e})},decode:function e(n,i){return qs(this,n,i,{callee:e})},encodeAsync:async function e(n,i){return await Ys(this,n,i,{callee:e})},decodeAsync:async function e(n,i){return await Qs(this,n,i,{callee:e})},safeEncode(e,n){return el(this,e,n)},safeDecode(e,n){return tl(this,e,n)},async safeEncodeAsync(e,n){return nl(this,e,n)},async safeDecodeAsync(e,n){return rl(this,e,n)},toJSONSchema(e){return os(this,{})(e)},get description(){return Q.get(this)?.description},get _def(){return this._zod.def}}),Wi=f("_ZodString",(e,n)=>{nt.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>cs(e,i,o,t)},y.derived({format:e=>W(e).format??null,minLength:e=>W(e).minimum??null,maxLength:e=>W(e).maximum??null},{regex(...e){return this.check(Et(...e))},includes(...e){return this.check(Zt(...e))},startsWith(...e){return this.check(Rt(...e))},endsWith(...e){return this.check(Vt(...e))},min(...e){return this.check(je(...e))},max(...e){return this.check(ut(...e))},length(...e){return this.check(ct(...e))},nonempty(...e){return this.check(je(1,...e))},lowercase(e){return this.check(Lt(e))},uppercase(e){return this.check(Ct(e))},trim(){return this.check(Jt())},normalize(...e){return this.check(Gt(...e))},toLowerCase(){return this.check(Bt())},toUpperCase(){return this.check(Kt())},slugify(){return this.check(Wt())}})),en=f("ZodString",(e,n)=>{nt.init(e,n),Wi.init(e,n)},{email(e){return this.check(mi(Hi,e))},url(e){return this.check(Vn(Xn,e))},jwt(e){return this.check(Ai(po,e))},emoji(e){return this.check(yi(qi,e))},guid(e){return this.check(fi(Xi,e))},uuid(e){return this.check(gi(Se,e))},uuidv4(e){return this.check(vi(Se,e))},uuidv6(e){return this.check(hi(Se,e))},uuidv7(e){return this.check($i(Se,e))},nanoid(e){return this.check(_i(Yi,e))},cuid(e){return this.check(bi(Qi,e))},cuid2(e){return this.check(xi(eo,e))},ulid(e){return this.check(ki(to,e))},base64(e){return this.check(Ni(co,e))},base64url(e){return this.check(Oi(so,e))},xid(e){return this.check(Ii(no,e))},ksuid(e){return this.check(wi(ro,e))},ipv4(e){return this.check(Si(io,e))},ipv6(e){return this.check(zi(oo,e))},cidrv4(e){return this.check(Pi(ao,e))},cidrv6(e){return this.check(Di(uo,e))},e164(e){return this.check(ji(lo,e))},datetime(e){return this.check(Mn(Je,e))},date(e){return this.check(Fn(Be,e))},time(e){return this.check(Gn(Ke,e))},duration(e){return this.check(Jn(We,e))}});function Wn(e){return bc(en,e)}var R=f("ZodStringFormat",(e,n)=>{C.init(e,n),Wi.init(e,n)}),Je=f("ZodISODateTime",(e,n)=>{du.init(e,n),R.init(e,n)}),Be=f("ZodISODate",(e,n)=>{pu.init(e,n),R.init(e,n)}),Ke=f("ZodISOTime",(e,n)=>{mu.init(e,n),R.init(e,n)}),We=f("ZodISODuration",(e,n)=>{fu.init(e,n),R.init(e,n)}),Hi=f("ZodEmail",(e,n)=>{eu.init(e,n),R.init(e,n)});function Zm(e){return mi(Hi,e)}var Xi=f("ZodGUID",(e,n)=>{Ya.init(e,n),R.init(e,n)});function Rm(e){return fi(Xi,e)}var Se=f("ZodUUID",(e,n)=>{Qa.init(e,n),R.init(e,n)});function Vm(e){return gi(Se,e)}function Mm(e){return vi(Se,e)}function Fm(e){return hi(Se,e)}function Gm(e){return $i(Se,e)}var Xn=f("ZodURL",(e,n)=>{ru.init(e,n),R.init(e,n)});function Jm(e){return Vn(Xn,e)}function Bm(e){return Vn(Xn,{protocol:kn,hostname:fa,...y.normalizeParams(e)})}var qi=f("ZodEmoji",(e,n)=>{iu.init(e,n),R.init(e,n)});function Km(e){return yi(qi,e)}var Yi=f("ZodNanoID",(e,n)=>{ou.init(e,n),R.init(e,n)});function Wm(e){return _i(Yi,e)}var Qi=f("ZodCUID",(e,n)=>{au.init(e,n),R.init(e,n)});function Hm(e){return bi(Qi,e)}var eo=f("ZodCUID2",(e,n)=>{uu.init(e,n),R.init(e,n)});function Xm(e){return xi(eo,e)}var to=f("ZodULID",(e,n)=>{cu.init(e,n),R.init(e,n)});function qm(e){return ki(to,e)}var no=f("ZodXID",(e,n)=>{su.init(e,n),R.init(e,n)});function Ym(e){return Ii(no,e)}var ro=f("ZodKSUID",(e,n)=>{lu.init(e,n),R.init(e,n)});function Qm(e){return wi(ro,e)}var io=f("ZodIPv4",(e,n)=>{gu.init(e,n),R.init(e,n)});function ef(e){return Si(io,e)}var il=f("ZodMAC",(e,n)=>{hu.init(e,n),R.init(e,n)});function tf(e){return kc(il,e)}var oo=f("ZodIPv6",(e,n)=>{vu.init(e,n),R.init(e,n)});function nf(e){return zi(oo,e)}var ao=f("ZodCIDRv4",(e,n)=>{$u.init(e,n),R.init(e,n)});function rf(e){return Pi(ao,e)}var uo=f("ZodCIDRv6",(e,n)=>{yu.init(e,n),R.init(e,n)});function of(e){return Di(uo,e)}var co=f("ZodBase64",(e,n)=>{_u.init(e,n),R.init(e,n)});function af(e){return Ni(co,e)}var so=f("ZodBase64URL",(e,n)=>{bu.init(e,n),R.init(e,n)});function uf(e){return Oi(so,e)}var lo=f("ZodE164",(e,n)=>{xu.init(e,n),R.init(e,n)});function cf(e){return ji(lo,e)}var ol=f("ZodCreditCard",(e,n)=>{ku.init(e,n),R.init(e,n)});function sf(e){return Ic(ol,e)}var al=f("ZodIBAN",(e,n)=>{Iu.init(e,n),R.init(e,n)});function lf(e){return wc(al,e)}var po=f("ZodJWT",(e,n)=>{wu.init(e,n),R.init(e,n)});function df(e){return Ai(po,e)}var mt=f("ZodCustomStringFormat",(e,n)=>{Su.init(e,n),R.init(e,n)});function pf(e,n,i={}){return st(mt,e,n,i)}function mf(e){return st(mt,"hostname",ma,e)}function ff(e){return st(mt,"hex",Pa,e)}function gf(e){return st(mt,"currency_code",va,e)}function vf(e,n){let i=n?.enc??"hex",o=`${e}_${i}`,t=he[o];if(!t)throw new Error(`Unrecognized hash format: ${o}`);return st(mt,o,t,n)}var tn=f("ZodNumber",(e,n)=>{Wr.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>ss(e,i,o,t),e.isFinite=!0},y.derived({minValue:e=>{let{minimum:n,exclusiveMinimum:i}=W(e);return Math.max(n??Number.NEGATIVE_INFINITY,i??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:n,exclusiveMaximum:i}=W(e);return Math.min(n??Number.POSITIVE_INFINITY,i??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:n,multipleOf:i}=W(e);return!!n||!!i?.some(Number.isSafeInteger)},format:e=>W(e).format??null},{gt(e,n){return this.check(Ie(e,n))},gte(e,n){return this.check(fe(e,n))},min(e,n){return this.check(fe(e,n))},lt(e,n){return this.check(ke(e,n))},lte(e,n){return this.check(me(e,n))},max(e,n){return this.check(me(e,n))},int(e){return this.check(Bi(e))},safe(e){return this.check(Bi(e))},positive(e){return this.check(Ie(0,e))},nonnegative(e){return this.check(fe(0,e))},negative(e){return this.check(ke(0,e))},nonpositive(e){return this.check(me(0,e))},multipleOf(e,n){return this.check(Re(e,n))},step(e,n){return this.check(Re(e,n))},finite(){return this}}));function ul(e){return zc(tn,e)}var ft=f("ZodNumberFormat",(e,n)=>{zu.init(e,n),tn.init(e,n)});function Bi(e){return Dc(ft,e)}function hf(e){return Nc(ft,e)}function $f(e){return Oc(ft,e)}function yf(e){return jc(ft,e)}function _f(e){return Ac(ft,e)}var nn=f("ZodBoolean",(e,n)=>{jn.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>ls(e,i,o,t)});function cl(e){return Uc(nn,e)}var rn=f("ZodBigInt",(e,n)=>{Hr.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>ds(e,i,o,t)},y.derived({minValue:e=>W(e).minimum??null,maxValue:e=>W(e).maximum??null,format:e=>W(e).format??null},{gte(e,n){return this.check(fe(e,n))},min(e,n){return this.check(fe(e,n))},gt(e,n){return this.check(Ie(e,n))},lt(e,n){return this.check(ke(e,n))},lte(e,n){return this.check(me(e,n))},max(e,n){return this.check(me(e,n))},positive(e){return this.check(Ie(BigInt(0),e))},negative(e){return this.check(ke(BigInt(0),e))},nonpositive(e){return this.check(me(BigInt(0),e))},nonnegative(e){return this.check(fe(BigInt(0),e))},multipleOf(e,n){return this.check(Re(e,n))}}));function bf(e){return Ec(rn,e)}var mo=f("ZodBigIntFormat",(e,n)=>{Pu.init(e,n),rn.init(e,n)});function xf(e){return Cc(mo,e)}function kf(e){return Zc(mo,e)}var sl=f("ZodSymbol",(e,n)=>{Du.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>ps(e,i,o,t)});function If(e){return Rc(sl,e)}var ll=f("ZodUndefined",(e,n)=>{Nu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>fs(e,i,o,t)});function wf(e){return Vc(ll,e)}var dl=f("ZodNull",(e,n)=>{Ou.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>ms(e,i,o,t)});function pl(e){return Mc(dl,e)}var ml=f("ZodAny",(e,n)=>{ju.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>hs(e,i,o,t)});function Sf(){return Fc(ml)}var fl=f("ZodUnknown",(e,n)=>{Au.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>$s(e,i,o,t)});function lt(){return Gc(fl)}var gl=f("ZodNever",(e,n)=>{Uu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>vs(e,i,o,t)});function fo(e){return Jc(gl,e)}var vl=f("ZodVoid",(e,n)=>{Tu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>gs(e,i,o,t)});function zf(e){return Bc(vl,e)}var qn=f("ZodDate",(e,n)=>{Eu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>ys(e,i,o,t),e.min=(i,o)=>e.check(fe(i,o)),e.max=(i,o)=>e.check(me(i,o))},y.derived({minDate:e=>{let{minimum:n}=W(e);return n?new Date(n):null},maxDate:e=>{let{maximum:n}=W(e);return n?new Date(n):null}},{}));function Pf(e){return Kc(qn,e)}var hl=f("ZodArray",(e,n)=>{pt(),Cu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Os(e,i,o,t),e.element=n.element},{min(e,n){return this.check(je(e,n))},nonempty(e){return this.check(je(1,e))},max(e,n){return this.check(ut(e,n))},length(e,n){return this.check(ct(e,n))},unwrap(){return this.element}});function Yn(e,n){return Xc(hl,e,n)}function Df(e){let n=e._zod.def.shape;return go(Object.keys(n))}var Qn=f("ZodObject",(e,n)=>{pt(),Zu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>js(e,i,o,t),y.installLazyProp(e,"shape",i=>i._zod.def.shape,!1)},{keyof(){return go(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(y.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(y.mergeDefs(this._zod.def,{catchall:lt()}))},loose(){return this.clone(y.mergeDefs(this._zod.def,{catchall:lt()}))},strict(){return this.clone(y.mergeDefs(this._zod.def,{catchall:fo()}))},strip(){return this.clone(y.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return y.extend(this,e)},safeExtend(e){return y.safeExtend(this,e)},merge(e){return y.merge(this,e)},pick(e){return y.pick(this,e)},omit(e){return y.omit(this,e)},partial(...e){return y.partial(tr,this,e[0])},exactPartial(...e){return y.partial(ho,this,e[0],"exactPartial")},required(...e){return y.required($o,this,e[0])}});function Nf(e,n){let i={type:"object",shape:e??{},...y.normalizeParams(n)};return new Qn(i)}function Of(e,n){return new Qn({type:"object",shape:e,catchall:fo(),...y.normalizeParams(n)})}function jf(e,n){return new Qn({type:"object",shape:e,catchall:lt(),...y.normalizeParams(n)})}var er=f("ZodUnion",(e,n)=>{An.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Ri(e,i,o,t),e.options=n.options});function on(e,n){return new er({type:"union",options:e,...y.normalizeParams(n)})}var $l=f("ZodXor",(e,n)=>{er.init(e,n),Ru.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Ri(e,i,o,t),e.options=n.options});function Af(e,n){return new $l({type:"union",options:e,inclusive:!1,...y.normalizeParams(n)})}var yl=f("ZodDiscriminatedUnion",(e,n)=>{er.init(e,n),Mu.init(e,n)});function Uf(e,n,i){return new yl({type:"union",options:n,discriminator:e,...y.normalizeParams(i)})}var _l=f("ZodIntersection",(e,n)=>{Fu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>As(e,i,o,t)});function bl(e,n){return new _l({type:"intersection",left:e,right:n})}var xl=f("ZodTuple",(e,n)=>{pt(),Xr.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Us(e,i,o,t)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(n=>new tr({type:"optional",innerType:n}))})}});function kl(e,n,i){let o=n instanceof j,t=o?i:n,r=o?n:null;return new xl({type:"tuple",items:e,rest:r,...y.normalizeParams(t)})}var Yt=f("ZodRecord",(e,n)=>{pt(),Gu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Ts(e,i,o,t),e.keyType=n.keyType,e.valueType=n.valueType});function Il(e,n,i){return!n||!n._zod?new Yt({type:"record",keyType:Wn(),valueType:e,...y.normalizeParams(n)}):new Yt({type:"record",keyType:e,valueType:n,...y.normalizeParams(i)})}function Tf(e,n,i){return new Yt({type:"record",keyType:e,valueType:n,...y.normalizeParams(i),partial:!0})}function Ef(e,n,i){return new Yt({type:"record",keyType:e,valueType:n,mode:"loose",...y.normalizeParams(i)})}var wl=f("ZodMap",(e,n)=>{pt(),Ju.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Ds(e,i,o,t),e.keyType=n.keyType,e.valueType=n.valueType,e.min=(...i)=>e.check(we(...i)),e.nonempty=i=>e.check(we(1,i)),e.max=(...i)=>e.check(Ve(...i)),e.size=(...i)=>e.check(at(...i))});function Lf(e,n,i){return new wl({type:"map",keyType:e,valueType:n,...y.normalizeParams(i)})}var Sl=f("ZodSet",(e,n)=>{pt(),Bu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Ns(e,i,o,t),e.min=(...i)=>e.check(we(...i)),e.nonempty=i=>e.check(we(1,i)),e.max=(...i)=>e.check(Ve(...i)),e.size=(...i)=>e.check(at(...i))});function Cf(e,n){return new Sl({type:"set",valueType:e,...y.normalizeParams(n)})}var Qt=f("ZodEnum",(e,n)=>{Ku.init(e,n),A.init(e,n),e._zod.processJSONSchema=(o,t,r)=>_s(e,o,t,r),e.enum=n.entries,e.options=[...e._zod.values];let i=new Set(Object.keys(n.entries));e.extract=(o,t)=>{let r={};for(let a of o)if(i.has(a))r[a]=n.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Qt({...n,checks:[],...y.normalizeParams(t),entries:r})},e.exclude=(o,t)=>{let r={...n.entries};for(let a of o)if(i.has(a))delete r[a];else throw new Error(`Key ${a} not found in enum`);return new Qt({...n,checks:[],...y.normalizeParams(t),entries:r})}});function go(e,n){let i=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Qt({type:"enum",entries:i,...y.normalizeParams(n)})}function Zf(e,n){return new Qt({type:"enum",entries:e,...y.normalizeParams(n)})}var zl=f("ZodLiteral",(e,n)=>{Wu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>bs(e,i,o,t),e.values=new Set(n.values),Object.defineProperty(e,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function Rf(e,n){return new zl({type:"literal",values:Array.isArray(e)?e:[e],...y.normalizeParams(n)})}var Pl=f("ZodFile",(e,n)=>{Hu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Is(e,i,o,t),e.min=(i,o)=>e.check(we(i,o)),e.max=(i,o)=>e.check(Ve(i,o)),e.mime=(i,o)=>e.check(Ft(Array.isArray(i)?i:[i],o))});function Vf(e){return qc(Pl,e)}var Dl=f("ZodTransform",(e,n)=>{pt(),Xu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Ps(e,i,o,t),e._zod.parse=(i,o)=>{if(o.direction==="backward")throw new Ce(e.constructor.name);i.addIssue=r=>{if(typeof r=="string")i.issues.push(y.issue(r,i.value,n));else{let a=r;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=i.value),a.inst??(a.inst=e),i.issues.push(y.issue(a))}};let t=n.transform(i.value,i);return t instanceof Promise?t.then(r=>(i.value=r,i)):(i.value=t,i)}});function vo(e){return new Dl({type:"transform",transform:e})}var tr=f("ZodOptional",(e,n)=>{qr.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Vi(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function dt(e){return new tr({type:"optional",innerType:e})}var ho=f("ZodExactOptional",(e,n)=>{qu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Vi(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Nl(e){return new ho({type:"optional",innerType:e})}var Ol=f("ZodNullable",(e,n)=>{Yu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Es(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Hn(e){return new Ol({type:"nullable",innerType:e})}function Mf(e){return dt(Hn(e))}var jl=f("ZodDefault",(e,n)=>{Qu.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Zs(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Al(e,n){return new jl({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():y.shallowClone(n)}})}var Ul=f("ZodPrefault",(e,n)=>{ec.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Rs(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Tl(e,n){return new Ul({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():y.shallowClone(n)}})}var $o=f("ZodNonOptional",(e,n)=>{tc.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Ls(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function El(e,n){return new $o({type:"nonoptional",innerType:e,...y.normalizeParams(n)})}var Ll=f("ZodSuccess",(e,n)=>{nc.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>ws(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Ff(e){return new Ll({type:"success",innerType:e})}var Cl=f("ZodCatch",(e,n)=>{rc.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Vs(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Zl(e,n){return new Cl({type:"catch",innerType:e,catchValue:typeof n=="function"?n:y.constantCatch(n)})}var Rl=f("ZodNaN",(e,n)=>{ic.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>xs(e,i,o,t)});function Gf(e){return Hc(Rl,e)}var nr=f("ZodPipe",(e,n)=>{Yr.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Ms(e,i,o,t),e.in=n.in,e.out=n.out});function Ki(e,n){return new nr({type:"pipe",in:e,out:n})}var rr=f("ZodCodec",(e,n)=>{nr.init(e,n),Un.init(e,n)});function Jf(e,n,i){return new rr({type:"pipe",in:e,out:n,transform:i.decode,reverseTransform:i.encode})}function Bf(e){let n=e._zod.def;return new rr({type:"pipe",in:n.out,out:n.in,transform:n.reverseTransform,reverseTransform:n.transform})}var Vl=f("ZodPreprocess",(e,n)=>{nr.init(e,n),oc.init(e,n)}),Ml=f("ZodReadonly",(e,n)=>{ac.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Fs(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Fl(e){return new Ml({type:"readonly",innerType:e})}var Gl=f("ZodTemplateLiteral",(e,n)=>{uc.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>ks(e,i,o,t)});function Kf(e,n){return new Gl({type:"template_literal",parts:e,...y.normalizeParams(n)})}var Jl=f("ZodLazy",(e,n)=>{Tn.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Js(e,i,o,t),e.unwrap=()=>e._zod.def.getter()});function Bl(e){return new Jl({type:"lazy",getter:e})}var Kl=f("ZodPromise",(e,n)=>{sc.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Gs(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Wf(e){return new Kl({type:"promise",innerType:e})}var Wl=f("ZodFunction",(e,n)=>{cc.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>zs(e,i,o,t)});function Hf(e){return new Wl({type:"function",input:Array.isArray(e?.input)?kl(e?.input):e?.input??Yn(lt()),output:e?.output??lt()})}var ir=f("ZodCustom",(e,n)=>{lc.init(e,n),A.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Ss(e,i,o,t)});function Xf(e){let n=new M({check:"custom"});return n._zod.check=e,n}function qf(e,n){return Yc(ir,e??(()=>!0),n)}function Hl(e,n={}){return Qc(ir,e,n)}function Xl(e,n){return es(e,n)}var Yf=ts,Qf=ns,ql=f("ZodInstanceOf",(e,n)=>{ir.init(e,n)},{properties(e,n){return this.check(Mt(e,n))}});function eg(e,n={}){let i=new ql({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...y.normalizeParams(n)});return i._zod.bag.Class=e,i._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:i,path:[...i._zod.def.path??[]]})},i}var tg=(...e)=>rs({Codec:rr,Boolean:nn,String:en},...e);function ng(e){let n=Bl(()=>on([Wn(e),ul(),cl(),pl(),Yn(n),Il(Wn(),n)]));return n}function rg(e,n){return new Vl({type:"pipe",in:vo(e),out:n})}var B_={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function K_(e){G({customError:e})}function W_(){return G().customError}var Yl;Yl||(Yl={});var or={};Pe(or,{ZodISODate:()=>Be,ZodISODateTime:()=>Je,ZodISODuration:()=>We,ZodISOTime:()=>Ke,date:()=>X_,datetime:()=>H_,duration:()=>Y_,time:()=>q_});function H_(e){return Mn(Je,e)}function X_(e){return Fn(Be,e)}function q_(e){return Gn(Ke,e)}function Y_(e){return Jn(We,e)}var P={...an,...Gi,iso:or},Q_=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function eb(e,n){let i=e.$schema;return i==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":i==="http://json-schema.org/draft-07/schema#"?"draft-7":i==="http://json-schema.org/draft-04/schema#"?"draft-4":n??"draft-2020-12"}function ig(e,n){return e.map((i,o)=>oo).check(o=>{let t=o.value;if(typeof t!="object"||t===null||Array.isArray(t))return;let r=Object.getOwnPropertyNames(t);if(n.minProperties!==void 0&&r.length=${n.minProperties} properties`,input:t,inst:e,continue:!0}),n.maxProperties!==void 0&&r.length>n.maxProperties&&o.issues.push({origin:"object",code:"too_big",maximum:n.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${n.maxProperties} properties`,input:t,inst:e,continue:!0}),n.keySchema)for(let a of r){let u=n.keySchema.safeParse(a);u.success||o.issues.push({code:"invalid_key",origin:"record",issues:u.error.issues,input:a,path:[a],continue:!0})}}).pipe(e)}function Ql(e,n){if(e===null)return"z";let i=typeof e;if(i!=="object"){if(i==="number"&&Number.isNaN(e))return null;let o=String(e);return`${i[0]}${o.length}:${o}`}if(n.has(e))return null;n.add(e);try{if(Array.isArray(e)){let r=[];for(let a of e){let u=Ql(a,n);if(u===null)return null;r.push(u)}return`a${r.length}:[${r.join(",")}]`}let o=Object.keys(e).sort(),t=[];for(let r of o){let a=Ql(e[r],n);if(a===null)return null;t.push(`${r.length}:${r}=${a}`)}return`o${t.length}:{${t.join(",")}}`}finally{n.delete(e)}}var ib=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),ob=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function ar(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(ar):typeof e.$ref=="string"?!0:Object.entries(e).some(([n,i])=>ib.has(n)?ar(i):!ob.has(n)||typeof i!="object"||i===null?!1:Object.values(i).some(ar))}function og(e){return e===1?"element":"elements"}function ab(e,n){return P.transform(o=>o).check(o=>{let t=o.value;if(Array.isArray(t)){if(n.uniqueItems===!0){let r=new Map;for(let a=0;a=a)break;un.maxContains&&o.issues.push({code:"custom",message:`Array must contain at most ${n.maxContains} matching ${og(n.maxContains)}`,input:t,continue:!0})}}}).pipe(e)}function ag(e,n){if(e!==!1)return e===void 0||e===!0?P.any():oe(e,n)}var ub=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function ug(e,n){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return P.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let t=e.$ref;if(n.refs.has(t))return n.refs.get(t);if(n.processing.has(t))return P.lazy(()=>{if(!n.refs.has(t))throw new Error(`Circular reference not resolved: ${t}`);return n.refs.get(t)});n.processing.add(t);let r=nb(t,n),a=oe(r,n);return n.refs.set(t,a),n.processing.delete(t),a}if(e.enum!==void 0){let t=e.enum;if(n.version==="openapi-3.0"&&e.nullable===!0&&t.length===1&&t[0]===null)return P.null();if(t.length===0)return P.never();if(t.length===1)return P.literal(t[0]);if(t.every(a=>typeof a=="string"))return P.enum(t);let r=t.map(a=>P.literal(a));return r.length<2?r[0]:P.union([r[0],r[1],...r.slice(2)])}if(e.const!==void 0)return P.literal(e.const);let i=e.type;if(Array.isArray(i)){let t=i.map(r=>{let a={...e,type:r};return ug(a,n)});return t.length===0?P.never():t.length===1?t[0]:P.union(t)}if(!i)return P.any();let o;switch(i){case"string":{let t=P.string();if(e.format){let r=e.format;r==="email"?t=t.check(P.email()):r==="uri"||r==="uri-reference"?t=t.check(P.url()):r==="uuid"||r==="guid"?t=t.check(P.uuid()):r==="date-time"?t=t.check(P.iso.datetime({offset:!0})):r==="date"?t=t.check(P.iso.date()):r==="time"?t=t.check(P.regex(ub)):r==="duration"?t=t.check(P.iso.duration()):r==="hostname"?t=t.check(P.hostname()):r==="ipv4"?t=t.check(P.ipv4()):r==="ipv6"?t=t.check(P.ipv6()):r==="mac"?t=t.check(P.mac()):r==="cidr"?t=t.check(P.cidrv4()):r==="cidr-v6"?t=t.check(P.cidrv6()):r==="base64"?t=t.check(P.base64()):r==="base64url"?t=t.check(P.base64url()):r==="e164"?t=t.check(P.e164()):r==="credit_card"?t=t.check(P.creditCard()):r==="iban"?t=t.check(P.iban()):r==="jwt"?t=t.check(P.jwt()):r==="emoji"?t=t.check(P.emoji()):r==="nanoid"?t=t.check(P.nanoid()):r==="cuid"?t=t.check(P.cuid()):r==="cuid2"?t=t.check(P.cuid2()):r==="ulid"?t=t.check(P.ulid()):r==="xid"?t=t.check(P.xid()):r==="ksuid"&&(t=t.check(P.ksuid()))}typeof e.minLength=="number"&&(t=t.min(e.minLength)),typeof e.maxLength=="number"&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),o=t;break}case"number":case"integer":{let t=i==="integer"?P.number().int():P.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(t=t.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum=="number"?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(t=t.lt(e.maximum)),typeof e.multipleOf=="number"&&(t=t.multipleOf(e.multipleOf)),o=t;break}case"boolean":{o=P.boolean();break}case"null":{o=P.null();break}case"object":{let t={},r=e.properties||{},a=new Set(e.required||[]),u=typeof e.additionalProperties=="object"?oe(e.additionalProperties,n):void 0;for(let[d,m]of Object.entries(r)){let p=oe(m,n);Y(t,d,a.has(d)?p:p.optional())}if(e.patternProperties){let d=e.patternProperties,m=Object.keys(d),p=[];for(let b of m){let w=oe(d[b],n),z=P.string().regex(new RegExp(b));p.push(P.looseRecord(z,w))}let v=[];if(Object.keys(t).length>0&&v.push(P.object(t).passthrough()),v.push(...p),v.length===0)o=P.object({}).passthrough();else if(v.length===1)o=v[0];else{let b=P.intersection(v[0],v[1]);for(let w=2;wnew RegExp($)),z=o;o=o.check($=>{if(!ge($.value))return;let S=[];for(let k of Object.keys($.value))b.includes(k)||w.some(D=>D.test(k))||S.push(k);S.length&&$.issues.push({code:"unrecognized_keys",keys:S,input:$.value,inst:z})})}}else{let d=P.object(t);e.additionalProperties===!1?o=d.strict():u?o=d.catchall(u):o=d.passthrough()}let s=e.propertyNames!==void 0&&e.propertyNames!==!0,c=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(s||c!==void 0||l!==void 0){let d;if(s){let m=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=oe(m,n)}o=rb(o,{keySchema:d,minProperties:c,maxProperties:l})}break}case"array":{let t=e.prefixItems,r=e.items;if(t&&Array.isArray(t)){let a=typeof e.minItems=="number"?e.minItems:0,u=t.map(d=>oe(d,n)),s=ig(u,a),c=Array.isArray(r)?void 0:ag(r,n),l=P.tuple(s);o=c?l.rest(c):l,typeof e.minItems=="number"&&(o=o.check(P.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(P.maxLength(e.maxItems)))}else if(Array.isArray(r)){let a=typeof e.minItems=="number"?e.minItems:0,u=r.map(d=>oe(d,n)),s=ig(u,a),c=ag(e.additionalItems,n),l=P.tuple(s);o=c?l.rest(c):l,typeof e.minItems=="number"&&(o=o.check(P.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(P.maxLength(e.maxItems)))}else if(r!==void 0){let a=oe(r,n),u=P.array(a);typeof e.minItems=="number"&&(u=u.min(e.minItems)),typeof e.maxItems=="number"&&(u=u.max(e.maxItems)),o=u}else o=P.array(P.any());(e.uniqueItems===!0||e.contains!==void 0)&&(o=ab(o,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?oe(e.contains,n):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${i}`)}return o}function oe(e,n){if(typeof e=="boolean")return e?P.any():P.never();let i=ug(e,n),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let u=e.anyOf.map(c=>oe(c,n)),s=P.union(u);i=o?P.intersection(i,s):s}if(e.oneOf&&Array.isArray(e.oneOf)){let u=e.oneOf.map(c=>oe(c,n)),s=P.xor(u);i=o?P.intersection(i,s):s}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)i=o?i:P.any();else{let u=o?i:oe(e.allOf[0],n),s=o?0:1;for(let c=s;c0&&n.registry.add(i,t),e.description&&(i=i.describe(e.description)),i}function cg(e,n){if(typeof e=="boolean")return e?P.any():P.never();let i;try{i=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=eb(i,n?.defaultTarget),t=i.$defs||i.definitions||{},r={version:o,defs:t,refs:new Map,processing:new Set,rootSchema:i,registry:n?.registry??Q};return oe(i,r)}var sg=Symbol("z.visit/resolving");function ur(e,n){let i=typeof n=="function"?n:(a,u)=>{let s=n[a._zod.def.type];return s?s(a,u):a},o=new Map;function t(a){let u=o.get(a);if(u===sg)return new Tn({type:"lazy",getter:()=>o.get(a)});if(u!==void 0)return u;o.set(a,sg);let s=r(a),c=i(s,s!==a);return o.set(a,c),c}function r(a){let u=a._zod.def,s=u.type;switch(s){case"object":{let c=u.shape,l=Object.keys(c),d=!1,m={};for(let v of l){let b=t(c[v]);b!==c[v]&&(d=!0),m[v]=b}let p=u.catchall;return u.catchall&&(p=t(u.catchall),p!==u.catchall&&(d=!0)),d?L(a,{...u,shape:m,catchall:p}):a}case"array":{let c=t(u.element);return c===u.element?a:L(a,{...u,element:c})}case"tuple":{let c=u.items,l=!1,d=[];for(let p of c){let v=t(p);v!==p&&(l=!0),d.push(v)}let m=u.rest;return u.rest&&(m=t(u.rest),m!==u.rest&&(l=!0)),l?L(a,{...u,items:d,rest:m}):a}case"record":case"map":{let c=t(u.keyType),l=t(u.valueType);return c===u.keyType&&l===u.valueType?a:L(a,{...u,keyType:c,valueType:l})}case"set":{let c=t(u.valueType);return c===u.valueType?a:L(a,{...u,valueType:c})}case"union":{let c=u.options,l=!1,d=[];for(let m of c){let p=t(m);p!==m&&(l=!0),d.push(p)}return l?L(a,{...u,options:d}):a}case"intersection":{let c=t(u.left),l=t(u.right);return c===u.left&&l===u.right?a:L(a,{...u,left:c,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let c=t(u.innerType);return c===u.innerType?a:L(a,{...u,innerType:c})}case"pipe":{let c=t(u.in),l=t(u.out);return c===u.in&&l===u.out?a:L(a,{...u,in:c,out:l})}case"function":{let c=t(u.input),l=t(u.output);return c===u.input&&l===u.output?a:L(a,{...u,input:c,output:l})}case"lazy":{let c=u.getter,{_cachedInner:l,...d}=u;return L(a,{...d,getter:()=>t(c())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return a;default:return a}}return t(e)}function lg(e){return ur(e,{object:n=>n.partial(),union:n=>{let i=n._zod.def;return i.discriminator===void 0?n:on(i.options)}})}function cb(e,n){if(!n?.length)return e;let i=e._zod.def;return L(e,$e(i,{checks:[...i.checks??[],...n]}),{parent:!0})}function dg(e){return cb(e.out,e.checks)}function sb(e){return e.in._zod.traits.has("$ZodTransform")?dg(e):e.in}function pg(e){return ur(e,{pipe:n=>sb(n._zod.def),default:(n,i)=>i?dt(n._zod.def.innerType):n,catch:(n,i)=>i?n._zod.def.innerType:n})}function mg(e){return ur(e,{pipe:n=>dg(n._zod.def),prefault:(n,i)=>i?n._zod.def.innerType:n})}var ed={};Pe(ed,{bigint:()=>mb,boolean:()=>pb,date:()=>fb,number:()=>db,string:()=>lb});function lb(e){return xc(en,e)}function db(e){return Pc(tn,e)}function pb(e){return Tc(nn,e)}function mb(e){return Lc(rn,e)}function fb(e){return Wc(qn,e)}var gb=new Set(["__proto__","prototype","constructor"]),gt=h.string().min(1).max(256).refine(e=>!gb.has(e),"reserved storage key"),yo=h.json(),_o=256*1024,vb=5*1024*1024,fg=1024,gg=h.strictObject({key:gt}),vg=h.object({value:yo}),hg=h.strictObject({key:gt,value:yo}),$g=h.object({ok:h.literal(!0)}),yg=h.strictObject({key:gt}),_g=h.object({ok:h.literal(!0)}),bg=h.strictObject({}).optional(),xg=h.object({keys:h.array(h.string()).max(fg)}),kg=h.strictObject({key:gt}),Ig=h.object({value:h.string().nullable()}),wg=h.strictObject({key:gt,value:h.string().max(64*1024)}),Sg=h.object({ok:h.literal(!0)}),zg=h.strictObject({key:gt}),Pg=h.object({ok:h.literal(!0)}),Dg=h.strictObject({}).optional(),Ng=h.object({status:h.enum(["os-keyring","unavailable"])}),Og=h.strictObject({}).optional(),jg=h.object({settings:h.record(h.string(),yo)}),Ag=h.strictObject({key:gt,value:yo}),Ug=h.object({ok:h.literal(!0)});var $b=4096,yb=50,Tg=512,Zg=1024,_b=h.strictObject({}).optional(),bb=h.object({branch:h.string().max(Tg),displayName:h.string().max(Tg),terminals:h.array(h.object({id:h.string().min(1).max(Zg)}).strict()).max(yb)}).strict().nullable(),xb=h.strictObject({terminalId:h.string().min(1).max(Zg),text:h.string().min(1).max($b),enter:h.boolean().default(!1)}),kb=h.object({accepted:h.boolean()}),Ib=h.strictObject({title:h.string().min(1).max(120),body:h.string().max(1e3).optional()}),wb=h.object({delivered:h.boolean()});var Sb=8192,zb=["http:","https:","mailto:"],Eg=64*1024*1024,Pb=h.strictObject({url:h.string().min(1).max(Sb).refine(Ab,"url must be an http:, https: or mailto: URL")}),Db=h.object({opened:h.boolean()}),Nb=h.union([h.string().max(Eg),h.custom(e=>e instanceof ArrayBuffer||e instanceof Uint8Array,"data must be a string or ArrayBuffer").refine(e=>e.byteLength<=Eg,"data exceeds 64 MiB").meta({type:"ArrayBuffer"})]),Ob=h.strictObject({suggestedName:h.string().min(1).max(255).optional(),mimeType:h.string().min(1).max(255).optional(),data:Nb}),jb=h.object({status:h.enum(["saved","cancelled"])});function Ab(e){try{return zb.includes(new URL(e).protocol)}catch{return!1}}var Lg=["worker","panel","editor"],be=["worker"],Cg=["panel","editor"],ae=e=>e,vt={"workspace.readContext":ae({summary:"Branch, name and terminal ids of the focused workspace, or null when none is focused.",since:0,scope:"active-workspace",capability:"workspace:read",mutation:!1,surfaces:Lg,params:_b,result:bb}),"terminal.sendText":ae({summary:"Types text into one terminal named by id, optionally pressing Enter.",since:0,scope:"explicit-terminal",capability:"terminal:send",mutation:!0,surfaces:be,params:xb,result:kb}),"notifications.show":ae({summary:"Shows a desktop notification.",since:0,scope:"desktop",capability:"notifications:show",mutation:!0,surfaces:Lg,params:Ib,result:wb}),"storage.get":ae({summary:"Reads a JSON value from the plugin's private store; null when absent.",since:0,scope:"plugin-private",capability:"storage:own",mutation:!1,surfaces:be,params:gg,result:vg}),"storage.set":ae({summary:"Writes a JSON value to the plugin's private store.",since:0,scope:"plugin-private",capability:"storage:own",mutation:!0,surfaces:be,params:hg,result:$g}),"storage.delete":ae({summary:"Removes a key from the plugin's private store.",since:0,scope:"plugin-private",capability:"storage:own",mutation:!0,surfaces:be,params:yg,result:_g}),"storage.keys":ae({summary:"Lists the keys in the plugin's private store.",since:0,scope:"plugin-private",capability:"storage:own",mutation:!1,surfaces:be,params:bg,result:xg}),"secrets.get":ae({summary:"Reads a secret from the plugin's encrypted secrets file; null when absent.",since:0,scope:"plugin-private",capability:"secrets:own",mutation:!1,surfaces:be,params:kg,result:Ig}),"secrets.set":ae({summary:"Stores a secret in the plugin's encrypted secrets file.",since:0,scope:"plugin-private",capability:"secrets:own",mutation:!0,surfaces:be,params:wg,result:Sg}),"secrets.delete":ae({summary:"Removes a secret from the plugin's encrypted secrets file.",since:0,scope:"plugin-private",capability:"secrets:own",mutation:!0,surfaces:be,params:zg,result:Pg}),"secrets.protection":ae({summary:"How secrets are protected at rest: `os-keyring`, or `unavailable` (no OS key store, or Linux `basic_text`), where `secrets.set` fails.",since:1,scope:"plugin-private",capability:"secrets:own",mutation:!1,surfaces:be,params:Dg,result:Ng}),"settings.get":ae({summary:"Reads every setting the plugin owns.",since:0,scope:"plugin-private",capability:"settings:own",mutation:!1,surfaces:be,params:Og,result:jg}),"settings.set":ae({summary:"Writes one setting the plugin owns.",since:0,scope:"plugin-private",capability:"settings:own",mutation:!0,surfaces:be,params:Ag,result:Ug}),"shell.openExternal":ae({summary:"Opens an http:, https: or mailto: URL in the default browser. Needs a click or key press in the frame; desktop app only. Orca asks the person before an http(s) host the plugin was not allowed; `opened` is false if they cancel.",since:1,scope:"desktop",capability:null,userActivation:!0,mutation:!1,surfaces:Cg,params:Pb,result:Db}),"files.saveAs":ae({summary:"Offers data (a string or ArrayBuffer, up to 64 MiB) in Orca's save dialog; the plugin never learns the path. Needs a click or key press in the frame; desktop app only.",since:1,scope:"desktop",capability:null,userActivation:!0,mutation:!0,surfaces:Cg,params:Ob,result:jb})},Rg=Object.keys(vt).filter(Vg);function Vg(e){return Object.hasOwn(vt,e)}function Mg(e){return Vg(e)?vt[e]:null}var NS=Math.max(...Rg.map(e=>vt[e].since));function Ub(e){return Rg.filter(n=>vt[n].surfaces.includes(e))}function Fg(e,n){return Ub(e).filter(i=>n||vt[i].userActivation!==!0)}function Gg(e){return Math.max(0,...e.map(n=>vt[n].since))}var ht=1,US=h.number().refine(e=>e===ht,{error:e=>typeof e.input=="number"&&e.input>ht?`targets host API ${e.input}, but this Orca supports only ${ht}; update Orca`:`must be ${ht}`}).meta({const:ht});var Tb=new Set(["rate_limited","unavailable","timeout","conflict"]);function $t(e,n=e,i){return Object.assign(new Error(n),{code:e,retryable:Tb.has(e),...i===void 0?{}:{retryAfterMs:i}})}function Eb(e){return typeof e=="function"}var Jg={"workspace.readContext":null,"notifications.show":{delivered:!0},"shell.openExternal":{opened:!0},"files.saveAs":{status:"saved"}};function Bg(e,n){let i=new Set(e.capabilities??n),o=new Map(Object.entries(e.results??{})),t=Fg("panel",!0),r=[],a=new Set,u=0;async function s(c,l){let d=Mg(c);if(!d)throw $t("unknown_method",`${c} does not exist in this Orca`);if(!d.surfaces.includes("panel"))throw $t("not_permitted",`${c} is not available to panels`);if(d.userActivation===!0){if(u===0)throw $t("not_permitted",`${c} needs a click or key press in the frame`);u-=1}if(d.capability&&!i.has(d.capability))throw $t("capability_denied",`${c} needs the ${d.capability} capability`);let m=d.params.safeParse(l);if(!m.success)throw $t("invalid_params",m.error.issues[0]?.message??"invalid params");if(!o.has(c)&&!Object.hasOwn(Jg,c))throw $t("unavailable",`the test configured no result for ${c}`);let p=o.has(c)?o.get(c):Jg[c],v=Eb(p)?await p(m.data):p,b=d.result.safeParse(v);if(!b.success)throw new TypeError(`mockHost: the result configured for ${c} does not match the host API: ${b.error.issues[0]?.message??"invalid result"}`);return b.data}return{calls:r,callsOf:c=>r.filter(l=>l.method===c).map(l=>l.params),respond:(c,l)=>o.set(c,l),grantGesture:()=>{u=1},async idle(){for(;a.size>0;)await Promise.allSettled(a)},bridge:{api:{major:ht,minor:Gg(t)},call(c,l){r.push({method:c,params:l});let d=s(c,l);return a.add(d),d.catch(()=>{}).finally(()=>a.delete(d)),d},has:c=>t.some(l=>l===c)}}}var ze={render:"ui.render",event:"ui.event",error:"ui.error",ack:"ui.ack",ready:"ui.ready",hydrate:"ui.hydrate",visibility:"ui.visibility",persist:"ui.persist",retain:"ui.retain"};var bo="$edit";var Lb=/[\p{Cc}\p{Cf}\p{Cs}\p{Zl}\p{Zp}]/u,Cb=new Set(["‌","‍"]);function Zb(e){return Cb.has(e)||!Lb.test(e)}function Kg(e){return[...e].filter(Zb).join("")}var Rb=/[\t\n\v\f\r\u0085\u2028\u2029]+/g;function Vb(e){return Kg(e.replace(Rb," "))}function Wg(e){let n=e.overwrite(Vb);return e.minLength?n.min(e.minLength,"must contain visible characters"):n}var Mb=/^(?:con|prn|aux|nul|clock\$|conin\$|conout\$|com[1-9\u00B9\u00B2\u00B3]|lpt[1-9\u00B9\u00B2\u00B3])(?:\..*)?$/i,Fb=/[<>:"|?*]/,xo=String.raw`[^<>:"|?*\x00-\x1f\\/]*[^<>:"|?*\x00-\x1f\\/. ]`,td=new RegExp(`^${xo}(?:[\\\\/]${xo})*$`),FS=new RegExp(`^${xo}(?:/${xo})*$`);function Gb(e){return e.length===0||e==="."||e===".."?"empty and dot path segments are not allowed":e.endsWith(".")||e.endsWith(" ")?"path segments may not end with a dot or space":Fb.test(e)||[...e].some(n=>n.charCodeAt(0)<=31)?"path segment contains a Windows-forbidden character or alternate-data-stream colon":Mb.test(e)?"path segment is a Windows reserved device name":null}function Jb(e){if(e.length===0||e.startsWith("/")||e.startsWith("\\"))return"must be a non-empty relative path";let n=e.split(/[\\/]/);for(let i of n){let o=Gb(i);if(o)return o}return null}function nd(e){return Jb(e)===null}var Hg=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,Bb=new Set(["__proto__","prototype","constructor"]),rd=64;function Xg(e){return Bb.has(e)}var id="must be a portable relative path inside the plugin directory",qg=h.string().max(rd).regex(Hg,"must be kebab-case (a-z, 0-9, dashes)").refine(e=>!Xg(e),"must not be a reserved name"),Yg=h.string().min(1).max(1024).regex(td,id).refine(e=>!td.test(e)||nd(e),id),qS=h.string().min(1).max(1024).transform(e=>e.replace(/[\\/]+$/,"")).refine(nd,id),YS=h.string().min(1).max(256).regex(/^[A-Za-z0-9]+(?:[._-][A-Za-z0-9]+)*$/,"must be a portable command id");var Qg="x-orca-enum-since";var cr="1.4.160";var ko="1.4.246",ev=ko,Kb="Relative to the plugin root; `..` segments and Windows device names such as `CON` are refused.";function tv(e,n,i){return un(`${e} ${Kb}`,n,i)}function un(e,n,i){return i?{description:e,"x-orca-since":n,examples:[...i]}:{description:e,"x-orca-since":n}}var cn=["activity","bar-chart-3","bell","blocks","book","bot","bug","calendar","cloud","code","database","file-text","flag","folder","gauge","globe","hammer","layers","lightbulb","package","plug","puzzle","rocket","star","terminal","wrench","zap","add","remove","delete","edit","refresh","search","settings","check","close","info","warning","error","open-external","copy","download","upload","play","pause","stop","more","expand","collapse","next","filter","branch","file","agent","link"],Wb=Object.fromEntries(cn.slice(cn.indexOf("add")).map(e=>[e,ko])),cz=new Map(cn.map(e=>[e.replaceAll("-",""),e]));var Hb=["html","components"],Xb=/\.(?:m?js|tsx?|mts|jsx)$/i,sz=h.object({id:qg.meta(un("Panel id, unique among this plugin's panels. The reserved names `constructor` and `prototype` are refused.",cr,["dashboard"])),title:Wg(h.string().min(1).max(256)).meta(un("Title shown on the panel tab and its tooltip.",cr,["Dashboard"])),icon:h.enum(cn).optional().meta({...un("Icon shown in the right-sidebar activity bar. Defaults to `plug`.",cr,["database"]),[Qg]:Wb}),entry:Yg.meta(tv(`What the panel runs: an HTML page for \`ui: "html"\`, a \`.js\`/\`.mjs\` module for \`ui: "components"\`. Either may instead be a \`.ts\`/\`.tsx\`/\`.mts\`/\`.jsx\` file, which Orca transpiles when it loads (needs \`engines.orca\` \`>=${ev}\`; an \`html\` panel then gets a generated page around it). It is trusted code: install panels you trust.`,cr,["dist/panel.html"])),ui:h.enum(Hb).optional().meta(un("How the panel draws its UI. `html` (default) shows `entry` as a web page in an isolated frame; `components` runs `entry` as a hidden module and Orca draws the component tree it returns with its own controls.",ko,["components"]))}).strict().refine(e=>e.ui!=="components"||Xb.test(e.entry),{path:["entry"],message:"a components panel entry must be a .js, .mjs, .ts, .tsx, .mts or .jsx module"}).meta({id:"PanelContribution",description:"A sidebar panel. Requires the `sandboxed-ui` execution profile or higher."});var V={maxNodes:5e3,maxDepth:64,maxTreeBytes:524288,maxTextLength:16384,maxLabelLength:1024,maxPropsPerNode:32,maxSelectOptions:500,maxEventArgs:8,maxCallbackIdLength:64},dz={maxBytes:640*1024,maxMessages:200,perMs:1e4,maxDepth:V.maxDepth*2+24,maxObjects:V.maxNodes*8+1024};var qb=cn,rv=new Set(qb),od=/^[A-Za-z0-9_.:-]+$/,Yb=h.object({$callback:h.string().min(1).max(V.maxCallbackIdLength).regex(od)}).strict(),Qb=["neutral","accent","success","warning","danger"],xe=h.string().max(V.maxLabelLength),Ue=xe.min(1),He=Yb.optional(),Io=h.string().regex(/^[a-z0-9-]{1,64}$/),iv=h.enum(["none","xs","sm","md","lg"]).optional(),ov=h.enum(["start","center","end","stretch"]).optional(),wo=h.enum(Qb).optional(),ad=h.enum(["xs","sm","md"]).optional(),av=h.enum(["solid","outline","ghost"]).optional(),X=h.boolean().optional(),nv=h.string().max(V.maxTextLength),ud={[bo]:h.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional()},ex=h.object({gap:iv,align:ov}).strict(),tx=h.object({gap:iv,align:ov,justify:h.enum(["start","center","end","between"]).optional(),wrap:X}).strict(),nx=h.object({tone:wo,muted:X,size:ad,weight:h.enum(["regular","medium","semibold"]).optional(),truncate:X}).strict(),rx=h.object({level:h.union([h.literal(1),h.literal(2),h.literal(3)]).optional()}).strict(),ix=h.object({variant:av,tone:wo,size:ad,icon:Io.optional(),disabled:X,onPress:He}).strict(),ox=h.object({icon:Io,label:Ue,variant:av,tone:wo,size:ad,disabled:X,onPress:He}).strict(),ax=h.object({tone:wo}).strict(),ux=h.object({title:xe.optional(),description:xe.optional()}).strict(),cx=h.object({label:xe.optional()}).strict(),sx=h.object({title:xe.optional(),description:xe.optional(),icon:Io.optional(),current:X,disabled:X,onPress:He}).strict(),lx=h.object({label:Ue,labelHidden:X,value:nv.optional(),defaultValue:nv.optional(),placeholder:xe.optional(),type:h.enum(["text","search","password"]).optional(),maxLength:h.number().int().positive().max(V.maxTextLength).optional(),invalid:X,disabled:X,onChange:He,onSubmit:He,...ud}).strict(),dx=h.object({label:Ue,checked:X,defaultChecked:X,disabled:X,onChange:He,...ud}).strict(),px=h.object({label:Ue,labelHidden:X,value:xe.optional(),defaultValue:xe.optional(),placeholder:xe.optional(),options:h.array(h.object({value:Ue,label:Ue,disabled:X}).strict()).max(V.maxSelectOptions),disabled:X,onChange:He,...ud}).strict(),mx=h.object({orientation:h.enum(["horizontal","vertical"]).optional()}).strict(),fx=h.object({label:Ue,labelHidden:X,value:h.number().min(0).max(100).optional()}).strict(),gx=h.object({label:Ue,labelHidden:X}).strict(),vx=h.object({title:Ue,description:xe.optional(),icon:Io.optional()}).strict(),hx=h.object({href:h.string().max(2048).regex(/^(https?:\/\/|mailto:)/i).optional(),onPress:He}).strict(),$x=h.object({block:X}).strict();function H(e,n){return{props:e,children:n}}var sr={Stack:H(ex,"any"),Row:H(tx,"any"),Text:H(nx,"inline"),Heading:H(rx,"inline"),Button:H(ix,"text"),IconButton:H(ox,"none"),Badge:H(ax,"text"),Card:H(ux,"any"),List:H(cx,"items"),ListItem:H(sx,"any"),Input:H(lx,"none"),Switch:H(dx,"none"),Select:H(px,"none"),Separator:H(mx,"none"),Progress:H(fx,"none"),Spinner:H(gx,"none"),EmptyState:H(vx,"any"),Link:H(hx,"text"),Code:H($x,"text")};function cd(e){return typeof e=="string"&&Object.hasOwn(sr,e)}var hz=Object.keys(sr).filter(cd),uv=new Set(["Text","Link","Code","Badge"]),cv=new Set(["Button","IconButton","Input","Switch","Select","Link","ListItem"]);function sd(e){return typeof e=="object"&&e!==null}var yx=new Set(["type","key","props","children"]),ld=32,_x=8,bx=/^[A-Z][A-Za-z0-9]{0,63}$/,xx=20,So=class extends Error{};function B(e,n){throw new So(`${e}: ${n}`)}function kx(e,n){return e===void 0?[]:(Array.isArray(e)||B(n,"children must be an array"),e)}function Ix(e,n,i){let o=sr[e].props.shape,t={};for(let[r,a]of Object.entries(n)){if(a===void 0)continue;if(!Object.hasOwn(o,r)){i(`${e}: ignored unknown prop "${r.slice(0,64)}"`);continue}let u=o[r].safeParse(a);if(!u.success){i(`${e}: ignored invalid ${r}`);continue}t[r]=u.data}for(let[r,a]of Object.entries(o))if(!Object.hasOwn(t,r)&&!a.safeParse(void 0).success)return i(`${e}: missing required ${r}; showing a placeholder`),null;return typeof t.icon=="string"&&!rv.has(t.icon)&&i(`${e}: unknown icon "${t.icon}"; showing a fallback glyph`),t}function sv(e){if(e===null)return{ok:!0,tree:null,nodes:0,warnings:[]};let n=new Set,i=c=>{n.sizeV.maxTextLength&&B(z,"text is too long"),r+ ++a>V.maxNodes&&B(z,`more than ${V.maxNodes} nodes`),u+=_x+pe.length,u>V.maxTreeBytes&&B(z,`tree exceeds ${V.maxTreeBytes} bytes`),w.push(pe);continue}sd(l)||B(z,"expected a node, string or number");let $=l.type,S=cd($);!S&&(typeof $!="string"||!bx.test($))&&B(z,`invalid component name ${JSON.stringify(String($)).slice(0,80)}`),(p==="none"||p==="text")&&B(z,`${m} accepts only text`),p==="inline"&&S&&!uv.has($)&&B(z,`${m} accepts only text, Text, Link, Code and Badge`),p==="items"!=($==="ListItem")&&B(z,"ListItem must be a direct child of List, and List holds only ListItem"),v&&cv.has($)&&B(z,`a ListItem with onPress cannot contain a ${$}`),++r+a>V.maxNodes&&B(z,`more than ${V.maxNodes} nodes`),d>V.maxDepth&&B(z,`deeper than ${V.maxDepth}`);for(let pe of Object.keys(l))yx.has(pe)||B(z,`unknown node field ${pe.slice(0,64)}`);let k=l.key;k!==void 0&&((typeof k!="string"||k.length>V.maxLabelLength)&&B(z,"key must be a short string"),b.has(k)&&B(z,`duplicate key ${JSON.stringify(k.slice(0,64))} among siblings`),b.add(k));let D=k===void 0?{}:{key:k};if(!S){i(`unknown component ${$}; showing a placeholder`),w.push({type:"Unsupported",...D,props:{name:$},children:[]}),u+=ld+$.length;continue}let U=l.props??{};(!sd(U)||Object.keys(U).length>V.maxPropsPerNode)&&B(z,"props must be an object with few fields");let J=Ix($,U,i);if(!J){w.push({type:"Unsupported",...D,props:{name:$},children:[]}),u+=ld+$.length;continue}u+=ld+JSON.stringify(J).length,u>V.maxTreeBytes&&B(z,`tree exceeds ${V.maxTreeBytes} bytes`);let Te=[],dr={type:$,...D,props:J,children:Te};w.push(dr);let Xe=kx(l.children,z);Xe.length>V.maxNodes&&B(z,`more than ${V.maxNodes} children`);let pr=new Set,Po=v||$==="ListItem"&&J.onPress!==void 0;for(let pe=Xe.length-1;pe>=0;pe--)t.push({raw:Xe[pe],depth:d+1,parentType:$,policy:sr[$].children,inPressable:Po,siblingKeys:pr,out:Te,path:`${z}.children.${pe}`})}}catch(c){if(c instanceof So)return{ok:!1,error:c.message};throw c}let s=o[0];return typeof s=="object"?{ok:!0,tree:s,nodes:r,warnings:[...n]}:{ok:!1,error:"tree: expected a node"}}var lr=h.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),yt=h.string().min(1).max(64),wx=h.union([h.string().max(V.maxTextLength),h.number().refine(Number.isFinite),h.boolean(),h.null()]),Dz=h.object({document:yt,revision:lr,callback:h.string().min(1).max(V.maxCallbackIdLength).regex(od),args:h.array(wx).max(V.maxEventArgs),edit:lr.optional()}).strict(),Sx=h.object({document:yt,revision:lr,tree:h.unknown()}).strict(),lv=h.object({document:yt.optional(),revision:lr,message:h.string().max(V.maxLabelLength*4),stack:h.string().max(8192).optional()}).strict();function dv(e){let n=Sx.safeParse(e);if(!n.success)return{ok:!1,document:null,revision:null,error:"malformed render"};let{document:i,revision:o}=n.data,t=sv(n.data.tree);return t.ok?{...t,document:i,revision:o}:{ok:!1,document:i,revision:o,error:t.error}}var Nz=h.object({document:yt,revision:lr,accepted:h.boolean(),retryAfterMs:h.number().int().nonnegative().max(6e4).optional()}).strict(),Oz=h.object({document:yt}).strict(),pv=/^[A-Za-z0-9_.:-]{1,128}$/,zx=["plugin","workspace"],dd=h.number().int().min(0).max(1e6),jz=h.object({version:dd,value:h.json()}).strict().refine(e=>JSON.stringify(e.value).length<=_o,"persisted value is too large"),mv=h.object({document:yt,entries:h.array(h.object({scope:h.enum(zx),key:h.string().regex(pv),version:dd,value:h.json()}).strict()).min(1).max(64)}).strict(),Az=h.object({document:yt,entries:h.array(h.object({key:h.string().regex(pv),version:dd,value:h.json().optional()}).strict().refine(e=>JSON.stringify(e.value??null).length<=_o,"retained value is too large")).min(1).max(64)}).strict();import{installOrcaDeclarativeRuntime as Ox}from"./orca-runtime.mjs";var Px={Stack:"group",Row:"group",Card:"region",Text:"text",Heading:"heading",Button:"button",IconButton:"button",Badge:"status",List:"list",ListItem:"listitem",Input:"textbox",Switch:"switch",Select:"combobox",Separator:"separator",Progress:"progressbar",Spinner:"status",EmptyState:"group",Link:"link",Code:"code",Unsupported:"unsupported"};function gv(e){if(typeof e=="string")return e;let n=e.props;return[...["title","description"].map(o=>n[o]).filter(o=>typeof o=="string"),...e.children.map(gv)].join(" ")}var pd=e=>e.replace(/\s+/g," ").trim();function Dx(e){let n=e.props,i=n.label??n.title;return typeof i=="string"?i:void 0}function Nx(e,n){let i=e.props,o=e.type==="ListItem"&&i.onPress!==void 0;return{type:e.type,key:e.key?.startsWith("#")?void 0:e.key,role:o?"button":Px[e.type]??"generic",label:Dx(e),text:pd(gv(e)),props:i,disabled:i.disabled===!0,path:n}}function zo(e){let n=[],i=(o,t)=>{n.push(Nx(o,t)),o.children.forEach((r,a)=>{typeof r!="string"&&i(r,`${t}/${r.key??`#${a}`}`)})};return e&&i(e,e.key??"#0"),n}function fv(e,n){return e===void 0?!1:typeof n=="string"?pd(e)===pd(n):n.test(e)}function vv(e,n){return(n.type===void 0||e.type===n.type)&&(n.role===void 0||e.role===n.role)&&(n.text===void 0||fv(e.text,n.text))&&(n.label===void 0||fv(e.label,n.label))&&(n.testId===void 0||e.key===n.testId)}function hv(e){return e.filter(n=>!e.some(i=>i.path.startsWith(`${n.path}/`)))}function $v(e){return Object.entries(e).map(([n,i])=>`${n}: ${i instanceof RegExp?String(i):JSON.stringify(i)}`).join(", ")}function md(e){if(typeof e=="string")return e;let n={};for(let[i,o]of Object.entries(e.props)){if(i.startsWith("$"))continue;let t=typeof o=="object"&&o!==null&&"$callback"in o;n[i]=t?"[handler]":o}return{type:e.type,...e.key&&!e.key.startsWith("#")?{key:e.key}:{},...Object.keys(n).length>0?{props:n}:{},...e.children.length>0?{children:e.children.map(md)}:{}}}var fd={Input:"value",Select:"value",Switch:"checked"};function yv(){let e=new Map;function n(o){let t=e.get(o.path);if(t)return t;let r=fd[o.type];if(!r)throw new Error(`a ${o.type} has no value; expected an Input, Switch or Select`);let a=o.props[r],u=o.props[r==="checked"?"defaultChecked":"defaultValue"],s=a??u??(r==="checked"?!1:""),c={value:typeof s=="boolean"?s:String(s),sent:0};return e.set(o.path,c),c}function i(o,t){let r=fd[o.type];if(r&&o.props[r]!==void 0&&o.props.onChange===void 0)throw new Error(`the ${o.type} is read-only: it has a ${r} and no onChange`);let a=n(o);return a.sent+=1,a.value=t,{value:t,id:a.sent}}return{observe(o){let t=new Map;for(let r of o){let a=fd[r.type];if(!a)continue;let u=e.get(r.path)??n(r),s=r.props[a],c=r.props[bo];s!==void 0&&(typeof c=="number"?c:0)>=u.sent&&(u.value=typeof s=="boolean"?s:String(s)),t.set(r.path,u)}e=t},valueOf:o=>n(o).value,typeInto(o,t,r){if(o.type!=="Input")throw new Error(`type: a ${o.type} takes no text; expected an Input`);let a=r?"":String(n(o).value),u=[];r&&u.push(i(o,a));for(let s of t)a+=s,u.push(i(o,a));return u},toggle(o){if(o.type!=="Switch")throw new Error(`toggle: expected a Switch, not a ${o.type}`);return i(o,!n(o).value)},select(o,t){if(o.type!=="Select")throw new Error(`select: expected a Select, not a ${o.type}`);let a=(Array.isArray(o.props.options)?o.props.options:[]).find(u=>typeof u=="object"&&u!==null&&"value"in u&&u.value===t);if(!a||typeof a=="object"&&"disabled"in a&&a.disabled===!0)throw new Error(`select: the Select has no enabled option "${t}"`);return i(o,t)}}}var bv=Symbol.for("orca.testing.stored");function jx(e,n){return Object.freeze({[bv]:!0,version:n,value:e})}function Ax(e){return typeof e=="object"&&e!==null&&bv in e}function _v(e){return"path"in e}var Ux=100,Tx=()=>new Promise(e=>typeof setImmediate=="function"?setImmediate(e):setTimeout(e,0));async function xv(e,n){let i=n.host,o=new Map,t=($,S)=>{for(let k of o.get($)??[])k(S)},r=[],a=[],u=[],s={plugin:new Map,workspace:new Map};for(let $ of["plugin","workspace"])for(let[S,k]of Object.entries(n.persisted?.[$]??{}))s[$].set(S,Ax(k)?{version:k.version,value:k.value}:{version:1,value:k});let c=n.visible??!0,l={document:"",revision:0,tree:null},d=yv();function m($,S){if($===ze.ready)t(ze.hydrate,{panel:{id:n.panelId??"panel"},visible:c,plugin:Object.fromEntries(s.plugin),workspace:Object.fromEntries(s.workspace)});else if($===ze.render){let k=dv(S);if(!k.ok){a.push({kind:"refused",message:k.error}),k.document!==null&&k.revision!==null&&t(ze.ack,{document:k.document,revision:k.revision,accepted:!1});return}u.push(...k.warnings.filter(D=>!u.includes(D))),l={document:k.document,revision:k.revision,tree:k.tree},d.observe(zo(k.tree)),t(ze.ack,{document:k.document,revision:k.revision,accepted:!0})}else if($===ze.error){let k=lv.safeParse(S);a.push(k.success?{kind:"plugin",message:k.data.message,...k.data.stack?{stack:k.data.stack}:{}}:{kind:"plugin",message:String(S)})}else if($===ze.persist){let k=mv.safeParse(S);if(!k.success){a.push({kind:"refused",message:"persisted state Orca would not store"});return}for(let D of k.data.entries)s[D.scope].set(D.key,{version:D.version,value:D.value})}}let p=Ox({post:m,awaitHydration:!0,colorScheme:n.theme??"dark",schedule:$=>r.push($),bridge:{api:i.bridge.api,locale:n.locale??"en",host:{call:i.bridge.call,has:i.bridge.has},on($,S){let k=o.get($)??new Set;return k.add(S),o.set($,k),{dispose:()=>k.delete(S)}}}});async function v(){for(let $=0;$hv(zo(l.tree).filter(S=>vv(S,$)));function w($,S){let k=_v($)?zo(l.tree).find(D=>D.path===$.path):b($)[0];if(!k)throw new Error(_v($)?`${S}: the element is no longer in the panel`:`${S}: nothing in the panel matches { ${$v($)} }`);if(k.disabled)throw new Error(`${S}: the ${k.type} is disabled`);return k}function z($,S,k){let D=typeof $=="object"&&$!==null&&"$callback"in $?$.$callback:null;typeof D=="string"&&t(ze.event,{document:l.document,revision:l.revision,callback:D,args:S,...k===void 0?{}:{edit:k}})}return await Promise.resolve(typeof e=="function"?{default:e}:e).then($=>p.boot($)).catch($=>a.push({kind:"plugin",message:$ instanceof Error?$.message:String($),...$ instanceof Error&&$.stack?{stack:$.stack}:{}})),await v(),{host:i,errors:a,warnings:u,find:$=>b($)[0]??null,findAll:b,tree:()=>l.tree?md(l.tree):null,get persisted(){let $=S=>Object.fromEntries([...s[S]].map(([k,D])=>[k,D.value]));return{plugin:$("plugin"),workspace:$("workspace")}},settled:v,async press($){let S=w($,"press"),{href:k,onPress:D}=S.props;if(S.type==="Link"&&typeof k=="string")i.grantGesture(),i.bridge.call("shell.openExternal",{url:k}).catch(()=>{});else{if(D===void 0)throw new Error(`press: the ${S.type} has no onPress`);i.grantGesture()}z(D,[]),await v()},async type($,S,k={}){let D=w($,"type");for(let U of d.typeInto(D,S,k.replace===!0))z(D.props.onChange,[U.value],U.id),await v();k.submit&&(z(D.props.onSubmit,[d.valueOf(D)]),await v())},async submit($){let S=w($,"submit");z(S.props.onSubmit,[d.valueOf(S)]),await v()},async toggle($){let S=w($,"toggle"),k=d.toggle(S);z(S.props.onChange,[k.value],k.id),await v()},async select($,S){let k=w($,"select"),D=d.select(k,S);z(k.props.onChange,[D.value],D.id),await v()},valueOf:$=>d.valueOf(w($,"valueOf")),async emit($,S){t($,S),await v()},async setVisible($){c=$,t(ze.visibility,{visible:$}),await v()},async rerender(){p.rerender(),await v()},async unmount(){p.dispose(),o.clear()}}}import{test as Yz,describe as Qz,beforeEach as eP,afterEach as tP}from"node:test";import{default as rP}from"node:assert/strict";function Cx(){for(let e=process.cwd();;e=kv(e))try{let n=JSON.parse(Ex(Lx(e,"orca-plugin.json"),"utf8")),i=typeof n=="object"&&n!==null&&"capabilities"in n?n.capabilities:[];return Array.isArray(i)?i.flatMap(o=>typeof o=="object"&&o!==null&&"kind"in o&&typeof o.kind=="string"?[o.kind]:[]):[]}catch{if(kv(e)===e)return[]}}function Zx(e={}){return Bg(e,Cx())}function Wz(e,n={}){return xv(e,{...n,host:n.host??Zx()})}export{tP as afterEach,rP as assert,eP as beforeEach,Qz as describe,$t as hostError,Zx as mockHost,Wz as mount,jx as stored,Yz as test}; +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(n===a[0]){r(a);continue}if(e.external){let c=e.external.registry.get(a[0])?.id;if(n!==a[0]&&c){r(a);continue}}if(e.metadataRegistry.get(a[0])?.id){r(a);continue}if(s.cycle){r(a);continue}s.count>1&&e.reused==="ref"&&r(a)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Dm(e){let n=e.anyOf;if(!Array.isArray(n)||n.length===0||e.type!==void 0)return;let i=[];for(let o of n){if(!o||typeof o!="object")return;Dm(o);let t=Object.keys(o);if(t.length!==1||t[0]!=="type")return;let r=o.type;for(let a of Array.isArray(r)?r:[r]){if(typeof a!="string")return;i.includes(a)||i.push(a)}}delete e.anyOf,e.type=i.length===1?i[0]:i}var Om=new Set(["type","properties","required","additionalProperties"]),Nm=["oneOf","anyOf"];function Tm(e){let n=e.additionalProperties;return n===void 0||n===!1||typeof n!="object"||n===null?null:Object.keys(n).length?n:null}function cc(e){let n=[];for(let r of e){if(typeof r!="object"||r.type!=="object")return null;for(let a in r)if(!Om.has(a))return null;n.push(r)}let i={},o=new Set;for(let r of n){for(let a in r.properties){if(Object.prototype.hasOwnProperty.call(i,a))continue;let s=[];for(let c of n){let l=c.properties?.[a]??Tm(c);l!=null&&(s.some(d=>JSON.stringify(d)===JSON.stringify(l))||s.push(l))}let u=s.length===1?s[0]:cc(s)??{allOf:s};Q(i,a,u)}for(let a of r.required??[])o.add(a)}let t={type:"object",properties:i};if(o.size&&(t.required=[...o]),n.every(r=>r.additionalProperties===!1))t.additionalProperties=!1;else{let r=[];for(let a of n){let s=Tm(a);s&&!r.some(u=>JSON.stringify(u)===JSON.stringify(s))&&r.push(s)}r.length===1?t.additionalProperties=r[0]:r.length>1&&(t.additionalProperties={allOf:r})}return t}function eb(e){let n=e.allOf;if(!Array.isArray(n)||n.length<2)return;for(let t of Om)if(t in e)return;let i=n.filter(t=>Nm.some(r=>Array.isArray(t[r]))),o=null;if(!i.length)o=cc(n);else{let t=i[0],r=Nm.find(u=>Array.isArray(t[u]));if(Object.keys(t).length!==1)return;let a=n.filter(u=>u!==t),s=t[r].map(u=>cc([...a,u]));if(s.some(u=>!u))return;o={[r]:s}}o&&(delete e.allOf,Wn(e,o))}function Be(e,n){let i=e.seen.get(n);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=s=>{let u=e.seen.get(s);if(u.ref===null)return;let c=u.def??u.schema,l={...c},d=u.ref;if(u.ref=null,d){o(d);let f=e.seen.get(d),h=f.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(h)):Wn(c,h),Wn(c,l),s._zod.parent===d)for(let k in c)k==="$ref"||k==="allOf"||k in l||delete c[k];if(h.$ref&&f.def)for(let k in c)k==="$ref"||k==="allOf"||k in f.def&&JSON.stringify(c[k])===JSON.stringify(f.def[k])&&delete c[k]}let p=s._zod.parent;if(p&&p!==d){o(p);let f=e.seen.get(p);if(f?.schema.$ref&&(c.$ref=f.schema.$ref,f.def))for(let h in c)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(c[h])===JSON.stringify(f.def[h])&&delete c[h]}e.override({zodSchema:s,jsonSchema:c,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let s of[...e.seen.entries()].reverse())o(s[0]);if(e.target!=="openapi-3.0")for(let s of e.seen.entries())Dm(s[1].def??s[1].schema);for(let s of e.deferred)s();if(e.intersections.length){let s=new Map;for(let u of e.seen.values())for(let c of[u.schema,u.def]){let l=c?.allOf;if(!Array.isArray(l))continue;let d=s.get(l);d?d.push(c):s.set(l,[c])}for(let u of e.intersections)for(let c of s.get(u)??[])eb(c)}}let t={};if(e.target==="draft-2020-12"?t.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?t.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?t.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(n)?.id;if(!s)throw new Error("Schema is missing an `id` property");t.$id=e.external.uri(s)}Wn(t,i.defId?i.schema:i.def??i.schema);let r=e.metadataRegistry.get(n)?.id;r!==void 0&&t.id===r&&delete t.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let s of e.seen.entries()){let u=s[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,Q(a,u.defId,u.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?t.$defs=a:t.definitions=a);try{let s=JSON.parse(JSON.stringify(t));return Object.defineProperty(s,"~standard",{value:{...n["~standard"],jsonSchema:{input:qt(n,"input",e.processors),output:qt(n,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function oe(e,n){let i=n??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return oe(o.element,i);if(o.type==="set")return oe(o.valueType,i);if(o.type==="lazy")return oe(o.getter(),i);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return oe(o.innerType,i);if(o.type==="intersection")return oe(o.left,i)||oe(o.right,i);if(o.type==="record"||o.type==="map")return oe(o.keyType,i)||oe(o.valueType,i);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:oe(o.in,i)||oe(o.out,i);if(o.type==="object"){for(let t in o.shape)if(oe(o.shape[t],i))return!0;return!1}if(o.type==="union"){for(let t of o.options)if(oe(t,i))return!0;return!1}if(o.type==="tuple"){for(let t of o.items)if(oe(t,i))return!0;return!!(o.rest&&oe(o.rest,i))}return!1}var lc=(e,n={})=>i=>{let o=Fe({...i,processors:n});return Z(e,o),Ge(o,e),Be(o,e)},qt=(e,n,i={})=>o=>{let{libraryOptions:t,target:r}=o??{},a=Fe({...t??{},target:r,io:n,processors:i});return Z(e,a),Ge(a,e),Be(a,e)};var Yt=(e,n,i)=>{(e[n]===void 0||i>e[n])&&(e[n]=i)},Qt=(e,n,i)=>{(e[n]===void 0||i{Yt(e,"minimum",n),Qt(e,"maximum",n)},Cm=(e,n)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(n)||e.multipleOf.push(n)},Rm=(e,n)=>{e.patterns??(e.patterns=new Set),e.patterns.add(n)},Zm=(e,n)=>{e.mime=e.mime?e.mime.filter(i=>n.includes(i)):[...n]},Mm=(e,n)=>{e.format=n,n.includes("int")&&(e.isInt=!0)},jm=(e,n)=>Yt(e,"minimum",n.minimum),Um=(e,n)=>Qt(e,"maximum",n.maximum),Lm=e=>(n,i)=>{Mm(n,i.format);let[o,t]=e[i.format];Yt(n,"minimum",o),Qt(n,"maximum",t)},tb={greater_than:(e,n)=>Yt(e,n.inclusive?"minimum":"exclusiveMinimum",n.value),less_than:(e,n)=>Qt(e,n.inclusive?"maximum":"exclusiveMaximum",n.value),multiple_of:(e,n)=>Cm(e,n.value),number_format:Lm(vn),bigint_format:Lm(hn),min_length:jm,max_length:Um,length_equals:(e,n)=>Em(e,n.length),min_size:jm,max_size:Um,size_equals:(e,n)=>Em(e,n.size),string_format:(e,n)=>{Mm(e,n.format),n.pattern&&Rm(e,n.pattern),(n.format==="base64"||n.format==="base64url")&&(e.contentEncoding=n.format),(n.local||n.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,n)=>Zm(e,n.mime)};function W(e){let n={},i=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...i.checks??[]]:i.checks??[];for(let r of o)tb[r._zod.def.check]?.(n,r._zod.def);let t=e._zod.bag;t.minimum!==void 0&&Yt(n,"minimum",t.minimum),t.exclusiveMinimum!==void 0&&Yt(n,"exclusiveMinimum",t.exclusiveMinimum),t.maximum!==void 0&&Qt(n,"maximum",t.maximum),t.exclusiveMaximum!==void 0&&Qt(n,"exclusiveMaximum",t.exclusiveMaximum),t.multipleOf!==void 0&&Cm(n,t.multipleOf),t.format!==void 0&&(n.format??(n.format=t.format),t.format.includes("int")&&(n.isInt=!0)),t.mime&&Zm(n,t.mime);for(let r of t.patterns??[])Rm(n,r);return n}var nb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rb=new Map([[Kr,va],[En,ha]]),Vm=e=>rb.get(e)??e,mc=(e,n,i,o)=>{let t=i;t.type="string";let{minimum:r,maximum:a,format:s,patterns:u,contentEncoding:c,laxFormat:l}=W(e);if(typeof r=="number"&&(t.minLength=r),typeof a=="number"&&(t.maxLength=a),s&&(t.format=nb[s]??s,t.format===""&&delete t.format,(s==="time"||l)&&delete t.format),c&&(t.contentEncoding=c),u&&u.size>0){let d=[...u].map(Vm);d.length===1?t.pattern=d[0].source:d.length>1&&(t.allOf=[...d.map(p=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},fc=(e,n,i,o)=>{let t=i,{minimum:r,maximum:a,multipleOf:s,exclusiveMaximum:u,exclusiveMinimum:c,isInt:l}=W(e);t.type=l?"integer":"number";let d=typeof c=="number"&&c>=(r??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(a??Number.POSITIVE_INFINITY),f=n.target==="draft-04"||n.target==="openapi-3.0";if(d?f?(t.minimum=c,t.exclusiveMinimum=!0):t.exclusiveMinimum=c:typeof r=="number"&&(t.minimum=r),p?f?(t.maximum=u,t.exclusiveMaximum=!0):t.exclusiveMaximum=u:typeof a=="number"&&(t.maximum=a),s){let h=new Set;for(let P of s)Number.isFinite(P)&&P!==0?h.add(Math.abs(P)):H(e,n,t,o,`A multipleOf divisor of ${P} cannot be represented in JSON Schema`);let[y,...k]=h;y!==void 0&&(t.multipleOf=y),k.length&&(t.allOf=[...t.allOf??[],...k.map(P=>({multipleOf:P}))])}},gc=(e,n,i,o)=>{i.type="boolean"},vc=(e,n,i,o)=>{H(e,n,i,o,"BigInt cannot be represented in JSON Schema")},hc=(e,n,i,o)=>{H(e,n,i,o,"Symbols cannot be represented in JSON Schema")},$c=(e,n,i,o)=>{n.target==="openapi-3.0"?(i.type="string",i.nullable=!0,i.enum=[null]):i.type="null"},yc=(e,n,i,o)=>{H(e,n,i,o,"Undefined cannot be represented in JSON Schema")},_c=(e,n,i,o)=>{H(e,n,i,o,"Void cannot be represented in JSON Schema")},bc=(e,n,i,o)=>{i.not={}},xc=(e,n,i,o)=>{},kc=(e,n,i,o)=>{},Ic=(e,n,i,o)=>{H(e,n,i,o,"Date cannot be represented in JSON Schema")},Sc=(e,n,i,o)=>{let t=e._zod.def,r=kt(t.entries);if(r.length===0){i.not={};return}r.every(a=>typeof a=="number")&&(i.type="number"),r.every(a=>typeof a=="string")&&(i.type="string"),i.enum=r},wc=(e,n,i,o)=>{let t=e._zod.def;if(t.values.length===0){i.not={};return}let r=[];for(let a of t.values)if(a===void 0){if(H(e,n,i,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(H(e,n,i,o,"BigInt literals cannot be represented in JSON Schema"))return;r.push(Number(a))}else r.push(a);if(r.length!==0)if(r.length===1){let a=r[0];i.type=a===null?"null":typeof a,n.target==="draft-04"||n.target==="openapi-3.0"?i.enum=[a]:i.const=a}else r.every(a=>typeof a=="number")&&(i.type="number"),r.every(a=>typeof a=="string")&&(i.type="string"),r.every(a=>typeof a=="boolean")&&(i.type="boolean"),r.every(a=>a===null)&&(i.type="null"),i.enum=r},Pc=(e,n,i,o)=>{H(e,n,i,o,"NaN cannot be represented in JSON Schema")},zc=(e,n,i,o)=>{let t=i,r=e._zod.pattern;if(!r)throw new Error("Pattern not found in template literal");t.type="string",t.pattern=r.source},Ac=(e,n,i,o)=>{let t=i;t.type="string",t.format="binary",t.contentEncoding="binary";let{minimum:r,maximum:a,mime:s}=W(e);r!==void 0&&(t.minLength=r),a!==void 0&&(t.maxLength=a),s&&(s.length===0?t.not={}:s.length===1?t.contentMediaType=s[0]:t.anyOf=s.map(u=>({contentMediaType:u})))},Nc=(e,n,i,o)=>{i.type="boolean"},Tc=(e,n,i,o)=>{H(e,n,i,o,"Custom types cannot be represented in JSON Schema")},Dc=(e,n,i,o)=>{H(e,n,i,o,"Function types cannot be represented in JSON Schema")},Oc=(e,n,i,o)=>{H(e,n,i,o,"Transforms cannot be represented in JSON Schema")},Ec=(e,n,i,o)=>{H(e,n,i,o,"Map cannot be represented in JSON Schema")},jc=(e,n,i,o)=>{H(e,n,i,o,"Set cannot be represented in JSON Schema")},Uc=(e,n,i,o)=>{let t=i,r=e._zod.def,{minimum:a,maximum:s}=W(e);typeof a=="number"&&(t.minItems=a),typeof s=="number"&&(t.maxItems=s),t.type="array",t.items=Z(r.element,n,{...o,path:[...o.path,"items"]})};function Xn(e){let n=e._zod.def;return n.type==="pipe"&&n.in._zod.traits.has("$ZodTransform")?Xn(n.out):n.type==="catch"?Xn(n.innerType):e._zod.optin}var Lc=(e,n,i,o)=>{let t=i,r=e._zod.def,a=r.shape;if(Object.getOwnPropertySymbols(a).length&&H(e,n,t,o,"Symbol keys cannot be represented in JSON Schema"))return;t.type="object",t.properties={};for(let c in a)Q(t.properties,c,Z(a[c],n,{...o,path:[...o.path,"properties",c]}));let u=[];for(let c of Object.keys(a)){let l=r.shape[c];(n.io==="input"?Xn(l)===void 0:l._zod.optout===void 0)&&u.push(c)}u.length>0&&(t.required=u),r.catchall?._zod.def.type==="never"?t.additionalProperties=!1:r.catchall?r.catchall&&(t.additionalProperties=Z(r.catchall,n,{...o,path:[...o.path,"additionalProperties"]})):n.io==="output"&&(t.additionalProperties=!1)},Gi=(e,n,i,o)=>{let t=e._zod.def,r=t.inclusive===!1,a=t.options.map((s,u)=>Z(s,n,{...o,path:[...o.path,r?"oneOf":"anyOf",u]}));r?i.oneOf=a:i.anyOf=a},Cc=(e,n,i,o)=>{let t=e._zod.def,r=Z(t.left,n,{...o,path:[...o.path,"allOf",0]}),a=Z(t.right,n,{...o,path:[...o.path,"allOf",1]}),s=c=>"allOf"in c&&Object.keys(c).length===1,u=[...s(r)?r.allOf:[r],...s(a)?a.allOf:[a]];i.allOf=u,n.intersections.push(u)},Rc=(e,n,i,o)=>{let t=i,r=e._zod.def;t.type="array";let a=n.target==="draft-2020-12"?"prefixItems":"items",s=n.target==="draft-2020-12"||n.target==="openapi-3.0"?"items":"additionalItems",u=r.items.map((y,k)=>Z(y,n,{...o,path:[...o.path,a,k]})),c=r.rest?Z(r.rest,n,{...o,path:[...o.path,s,...n.target==="openapi-3.0"?[r.items.length]:[]]}):null,l=r.items.length;for(;l>0;){let y=r.items[l-1];if(!(n.io==="input"?Xn(y)!==void 0:y._zod.optout==="optional"))break;l--}let d=r.items.length,p=!r.rest;n.target==="draft-2020-12"?(t.prefixItems=u,p?t.items=!1:c&&(t.items=c),l>0&&(t.minItems=l),p&&(t.maxItems=d)):n.target==="openapi-3.0"?(t.items={anyOf:u},c&&t.items.anyOf.push(c),l>0&&(t.minItems=l),p&&(t.maxItems=d)):(t.items=u,p?t.additionalItems=!1:c&&(t.additionalItems=c),l>0&&(t.minItems=l),p&&(t.maxItems=d));let{minimum:f,maximum:h}=W(e);typeof f=="number"&&(t.minItems=f),typeof h=="number"&&(t.maxItems=h)};function dc(e,n,i){if(n.$ref){if(i.has(n))return n;i.add(n);let h=e.get(n)?.def;if(!h)return n;let y=dc(e,h,i);return y===h?n:y}for(let h of["anyOf","oneOf"]){let y=n[h];if(!Array.isArray(y))continue;let k=y.map(P=>dc(e,P,i));k.some((P,S)=>P!==y[S])&&(n={...n,[h]:k})}let o=Array.isArray(n.type)?n.type:[n.type],t=!o.includes("string")&&o.some(h=>h==="number"||h==="integer"),r=n.enum??(n.const!==void 0?[n.const]:void 0);if(!t&&!r?.some(h=>typeof h=="number"))return n;let{minimum:a,maximum:s,exclusiveMinimum:u,exclusiveMaximum:c,multipleOf:l,format:d,id:p,...f}=n;return f.enum?f.enum=f.enum.map(h=>typeof h=="number"?String(h):h):typeof f.const=="number"&&(f.const=String(f.const)),t&&(f.type="string",r||(f.pattern=(o.includes("number")?Oe:Pn).source)),f}var pc=new WeakMap;function ib(e){let n=new Map;for(let o of e.seen.values())o.def&&!n.has(o.schema)&&n.set(o.schema,o);let i=new Map;for(let o of pc.get(e)??[]){let t=e.seen.get(o),r=(t?.def??t?.schema)?.propertyNames;if(!r||r===!0||i.has(r))continue;let a=dc(n,r,new Set);a!==r&&i.set(r,a)}if(i.size)for(let o of e.seen.values())for(let t of[o.schema,o.def]){let r=t&&i.get(t.propertyNames);r&&(t.propertyNames=r)}}var Zc=(e,n,i,o)=>{let t=i,r=e._zod.def;t.type="object";let a=r.keyType,s=W(a).patterns;if(r.mode==="loose"&&s&&s.size>0){let l=Z(r.valueType,n,{...o,path:[...o.path,"patternProperties","*"]});t.patternProperties={};for(let d of s)Q(t.patternProperties,Vm(d).source,l)}else{if(n.target==="draft-07"||n.target==="draft-2020-12"){t.propertyNames=Z(r.keyType,n,{...o,path:[...o.path,"propertyNames"]});let l=pc.get(n);l||(l=[],pc.set(n,l),n.deferred.push(()=>ib(n))),l.push(e)}t.additionalProperties=Z(r.valueType,n,{...o,path:[...o.path,"additionalProperties"]})}let u=a._zod.values,c=n.io==="input"&&Xn(r.valueType)!==void 0;if(u&&!r.partial&&!c){let l=[...u].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(t.required=l.map(String))}},Mc=(e,n,i,o)=>{let t=e._zod.def,r=Z(t.innerType,n,o),a=n.seen.get(e);n.target==="openapi-3.0"?(a.ref=t.innerType,i.nullable=!0):i.anyOf=[r,{type:"null"}]},Vc=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);r.ref=t.innerType},Fc=Symbol();function Fm(e,n,i,o,t){let r=!1,a=JSON.stringify(e,(s,u)=>typeof u!="bigint"?u:(r=!0,null));return r?(H(n,i,o,t,"BigInt defaults cannot be represented in JSON Schema"),Fc):JSON.parse(a)}var Gc=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);r.ref=t.innerType;let a=Fm(t.defaultValue,e,n,i,o);a!==Fc&&(i.default=a)},Bc=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);if(r.ref=t.innerType,n.io!=="input")return;let a=Fm(t.defaultValue,e,n,i,o);a!==Fc&&(i._prefault=a)},Jc=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);r.ref=t.innerType;let a;try{a=t.catchValue(void 0)}catch{H(e,n,i,o,"Dynamic catch values are not supported in JSON Schema");return}i.default=a},Kc=(e,n,i,o)=>{let t=e._zod.def,r=t.in._zod.traits.has("$ZodTransform"),a=n.io==="input"?r?t.out:t.in:t.out;Z(a,n,o);let s=n.seen.get(e);s.ref=a},Hc=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);r.ref=t.innerType,i.readOnly=!0},Wc=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);r.ref=t.innerType},Bi=(e,n,i,o)=>{let t=e._zod.def;Z(t.innerType,n,o);let r=n.seen.get(e);r.ref=t.innerType},Xc=(e,n,i,o)=>{let t=e._zod.innerType;Z(t,n,o);let r=n.seen.get(e);r.ref=t},Fi={string:mc,number:fc,boolean:gc,bigint:vc,symbol:hc,null:$c,undefined:yc,void:_c,never:bc,any:xc,unknown:kc,date:Ic,enum:Sc,literal:wc,nan:Pc,template_literal:zc,file:Ac,success:Nc,custom:Tc,function:Dc,transform:Oc,map:Ec,set:jc,array:Uc,object:Lc,union:Gi,intersection:Cc,tuple:Rc,record:Zc,nullable:Mc,nonoptional:Vc,default:Gc,prefault:Bc,catch:Jc,pipe:Kc,readonly:Hc,promise:Wc,optional:Bi,lazy:Xc};function Ji(e,n){if("_idmap"in e){let o=e,t=Fe({...n,processors:Fi}),r={};for(let u of o._idmap.entries()){let[c,l]=u;Z(l,t)}let a={},s={registry:o,uri:n?.uri,defs:r};t.external=s;for(let u of o._idmap.entries()){let[c,l]=u;Ge(t,l),Q(a,c,Be(t,l))}if(Object.keys(r).length>0){let u=t.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[u]:r}}return{schemas:a}}let i=Fe({...n,processors:Fi});return Z(e,i),Ge(i,e),Be(i,e)}var Ki=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(n){this.ctx.counter=n}get seen(){return this.ctx.seen}constructor(n){let i=n?.target??"draft-2020-12";i==="draft-4"&&(i="draft-04"),i==="draft-7"&&(i="draft-07"),this.ctx=Fe({processors:Fi,target:i,...n?.metadata&&{metadata:n.metadata},...n?.unrepresentable&&{unrepresentable:n.unrepresentable},...n?.override&&{override:n.override},...n?.io&&{io:n.io}})}process(n,i={path:[],schemaPath:[]}){return Z(n,this.ctx,i)}emit(n,i){i&&(i.cycles&&(this.ctx.cycles=i.cycles),i.reused&&(this.ctx.reused=i.reused),i.external&&(this.ctx.external=i.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Ge(this.ctx,n);let o=Be(this.ctx,n),{"~standard":t,...r}=o;return r}};var Gm={};var un={};Ne(un,{ZodAny:()=>$l,ZodArray:()=>xl,ZodBase64:()=>mo,ZodBase64URL:()=>fo,ZodBigInt:()=>an,ZodBigIntFormat:()=>ho,ZodBoolean:()=>on,ZodCIDRv4:()=>lo,ZodCIDRv6:()=>po,ZodCUID:()=>ro,ZodCUID2:()=>io,ZodCatch:()=>Fl,ZodCodec:()=>ar,ZodCreditCard:()=>ll,ZodCustom:()=>sr,ZodCustomStringFormat:()=>vt,ZodDate:()=>er,ZodDefault:()=>Ll,ZodDiscriminatedUnion:()=>Il,ZodE164:()=>go,ZodEmail:()=>Qi,ZodEmoji:()=>to,ZodEnum:()=>tn,ZodExactOptional:()=>bo,ZodFile:()=>Ol,ZodFunction:()=>Ql,ZodGUID:()=>eo,ZodIBAN:()=>dl,ZodIPv4:()=>uo,ZodIPv6:()=>co,ZodISODate:()=>Ke,ZodISODateTime:()=>Je,ZodISODuration:()=>We,ZodISOTime:()=>He,ZodInstanceOf:()=>nd,ZodIntersection:()=>Sl,ZodJWT:()=>vo,ZodKSUID:()=>so,ZodLazy:()=>Xl,ZodLiteral:()=>Dl,ZodMAC:()=>cl,ZodMap:()=>Nl,ZodNaN:()=>Bl,ZodNanoID:()=>no,ZodNever:()=>_l,ZodNonOptional:()=>xo,ZodNull:()=>vl,ZodNullable:()=>Ul,ZodNumber:()=>rn,ZodNumberFormat:()=>ht,ZodObject:()=>nr,ZodOptional:()=>ir,ZodPipe:()=>or,ZodPrefault:()=>Rl,ZodPreprocess:()=>Jl,ZodPromise:()=>Yl,ZodReadonly:()=>Kl,ZodRecord:()=>en,ZodSet:()=>Tl,ZodString:()=>nn,ZodStringFormat:()=>M,ZodSuccess:()=>Vl,ZodSymbol:()=>fl,ZodTemplateLiteral:()=>Wl,ZodTransform:()=>El,ZodTuple:()=>Pl,ZodType:()=>j,ZodULID:()=>oo,ZodURL:()=>Qn,ZodUUID:()=>ze,ZodUndefined:()=>gl,ZodUnion:()=>rr,ZodUnknown:()=>yl,ZodVoid:()=>bl,ZodXID:()=>ao,ZodXor:()=>kl,_ZodString:()=>Yi,_default:()=>Cl,_function:()=>rg,any:()=>Ef,array:()=>tr,base64:()=>ff,base64url:()=>gf,bigint:()=>Af,boolean:()=>ml,catch:()=>Gl,check:()=>ig,cidrv4:()=>pf,cidrv6:()=>mf,codec:()=>Qf,creditCard:()=>hf,cuid:()=>rf,cuid2:()=>of,currencyCode:()=>kf,custom:()=>og,date:()=>Uf,describe:()=>ag,discriminatedUnion:()=>Vf,e164:()=>vf,email:()=>Km,emoji:()=>tf,enum:()=>yo,exactOptional:()=>jl,file:()=>Wf,float32:()=>Sf,float64:()=>wf,function:()=>rg,guid:()=>Hm,hash:()=>If,hex:()=>xf,hostname:()=>bf,httpUrl:()=>ef,iban:()=>$f,instanceof:()=>ug,int:()=>Xi,int32:()=>Pf,int64:()=>Nf,intersection:()=>wl,invertCodec:()=>eg,ipv4:()=>cf,ipv6:()=>df,json:()=>lg,jwt:()=>yf,keyof:()=>Lf,ksuid:()=>uf,lazy:()=>ql,literal:()=>Hf,looseObject:()=>Zf,looseRecord:()=>Gf,mac:()=>lf,map:()=>Bf,meta:()=>sg,nan:()=>Yf,nanoid:()=>nf,nativeEnum:()=>Kf,never:()=>$o,nonoptional:()=>Ml,null:()=>hl,nullable:()=>Yn,nullish:()=>Xf,number:()=>pl,object:()=>Cf,optional:()=>ft,partialRecord:()=>Ff,pipe:()=>qi,prefault:()=>Zl,preprocess:()=>dg,promise:()=>ng,readonly:()=>Hl,record:()=>Al,refine:()=>ed,set:()=>Jf,strictObject:()=>Rf,string:()=>qn,stringFormat:()=>_f,stringbool:()=>cg,success:()=>qf,superRefine:()=>td,symbol:()=>Df,templateLiteral:()=>tg,transform:()=>_o,tuple:()=>zl,uint32:()=>zf,uint64:()=>Tf,ulid:()=>af,undefined:()=>Of,union:()=>sn,unknown:()=>mt,url:()=>Qm,uuid:()=>Wm,uuidv4:()=>Xm,uuidv6:()=>qm,uuidv7:()=>Ym,void:()=>jf,xid:()=>sf,xor:()=>Mf});var Hi={};Ne(Hi,{endsWith:()=>Ft,gt:()=>we,gte:()=>ge,includes:()=>Mt,length:()=>dt,lowercase:()=>Rt,lt:()=>Se,lte:()=>fe,maxLength:()=>lt,maxSize:()=>Ve,mime:()=>Bt,minLength:()=>Ee,minSize:()=>Pe,multipleOf:()=>Me,negative:()=>Ri,nonnegative:()=>Mi,nonpositive:()=>Zi,normalize:()=>Jt,overwrite:()=>xe,positive:()=>Ci,properties:()=>Gt,property:()=>Vi,regex:()=>Ct,size:()=>ct,slugify:()=>Xt,startsWith:()=>Vt,toLowerCase:()=>Ht,toUpperCase:()=>Wt,trim:()=>Kt,uppercase:()=>Zt});var Bm=new WeakSet([Object.prototype,Error.prototype]);function Wi(e,n,i){Object.defineProperty(e,n,{configurable:!0,enumerable:!1,get(){let o=i(this);return Object.defineProperty(this,n,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,n,{value:o,configurable:!0,writable:!0})}})}var Jm=(e,n)=>{Xo.init(e,n),e.name="ZodError";let i=Object.getPrototypeOf(e);Bm.has(i)||(Bm.add(i),Wi(i,"format",o=>t=>kn(o,t)),Wi(i,"flatten",o=>t=>xn(o,t)),Wi(i,"addIssue",o=>t=>{o.issues.push(t),o.message=JSON.stringify(o.issues,It,2)}),Wi(i,"addIssues",o=>t=>{o.issues.push(...t),o.message=JSON.stringify(o.issues,It,2)}),Object.defineProperty(i,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},ab=g("ZodError",Jm),pe=g("ZodError",Jm,void 0,{Parent:Error});var qc=At(pe),Yc=Nt(pe),Qc=Tt(pe),el=Dt(pe),tl=Ir(pe),nl=Sr(pe),rl=wr(pe),il=Pr(pe),ol=zr(pe),al=Ar(pe),sl=Nr(pe),ul=Tr(pe);function ub(){Y.localeError||B(ci())}function gt(){Y.memoizer||B({memoizer:Mn()})}var j=g("ZodType",(e,n)=>(ub(),E.init(e,n),e.def=n,e.type=n.type,e),{check(...e){let n=this.def;return this.clone($.mergeDefs(n,{checks:[...n.checks??[],...e.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,n){return C(this,e,n)},brand(){return this},register(e,n){return e.add(this,n),this},refine(e,n){return this.check(ed(e,n))},superRefine(e,n){return this.check(td(e,n))},overwrite(e){return this.check(xe(e))},optional(){return ft(this)},exactOptional(){return jl(this)},nullable(){return Yn(this)},nullish(){return ft(Yn(this))},nonoptional(e){return Ml(this,e)},array(){return tr(this)},or(e){return sn([this,e])},and(e){return wl(this,e)},transform(e){return qi(this,_o(e))},default(e){return Cl(this,e)},prefault(e){return Zl(this,e)},catch(e){return Gl(this,e)},pipe(e){return qi(this,e)},readonly(){return Hl(this)},describe(e){let n=this.clone();return ee.add(n,{description:e}),n},meta(...e){if(e.length===0)return ee.get(this);let n=this.clone();return ee.add(n,e[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...n){return n.length===0?e(this):e(this,...n)},get"~standard"(){return $.hide(this,"~standard",{...Vr(this),jsonSchema:{input:qt(this,"input"),output:qt(this,"output")}})},set"~standard"(e){$.own(this,"~standard",e)},parse:function e(n,i){return qc(this,n,i,{callee:e})},parseAsync:async function e(n,i){return await Yc(this,n,i,{callee:e})},safeParse(e,n){return Qc(this,e,n)},async safeParseAsync(e,n){return el(this,e,n)},get spa(){return this?.safeParseAsync},set spa(e){$.own(this,"spa",e)},validate(e,n){return In(this,e,n)},validateAsync(e,n){return Sn(this,e,n)},encode:function e(n,i){return tl(this,n,i,{callee:e})},decode:function e(n,i){return nl(this,n,i,{callee:e})},encodeAsync:async function e(n,i){return await rl(this,n,i,{callee:e})},decodeAsync:async function e(n,i){return await il(this,n,i,{callee:e})},safeEncode(e,n){return ol(this,e,n)},safeDecode(e,n){return al(this,e,n)},async safeEncodeAsync(e,n){return sl(this,e,n)},async safeDecodeAsync(e,n){return ul(this,e,n)},toJSONSchema(e){return lc(this,{})(e)},get description(){return ee.get(this)?.description},get _def(){return this._zod.def}}),Yi=g("_ZodString",(e,n)=>{ot.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>mc(e,i,o,t)},$.derived({format:e=>W(e).format??null,minLength:e=>W(e).minimum??null,maxLength:e=>W(e).maximum??null},{regex(...e){return this.check(Ct(...e))},includes(...e){return this.check(Mt(...e))},startsWith(...e){return this.check(Vt(...e))},endsWith(...e){return this.check(Ft(...e))},min(...e){return this.check(Ee(...e))},max(...e){return this.check(lt(...e))},length(...e){return this.check(dt(...e))},nonempty(...e){return this.check(Ee(1,...e))},lowercase(e){return this.check(Rt(e))},uppercase(e){return this.check(Zt(e))},trim(){return this.check(Kt())},normalize(...e){return this.check(Jt(...e))},toLowerCase(){return this.check(Ht())},toUpperCase(){return this.check(Wt())},slugify(){return this.check(Xt())}})),nn=g("ZodString",(e,n)=>{ot.init(e,n),Yi.init(e,n)},{email(e){return this.check(hi(Qi,e))},url(e){return this.check(Gn(Qn,e))},jwt(e){return this.check(Li(vo,e))},emoji(e){return this.check(ki(to,e))},guid(e){return this.check($i(eo,e))},uuid(e){return this.check(yi(ze,e))},uuidv4(e){return this.check(_i(ze,e))},uuidv6(e){return this.check(bi(ze,e))},uuidv7(e){return this.check(xi(ze,e))},nanoid(e){return this.check(Ii(no,e))},cuid(e){return this.check(Si(ro,e))},cuid2(e){return this.check(wi(io,e))},ulid(e){return this.check(Pi(oo,e))},base64(e){return this.check(Ei(mo,e))},base64url(e){return this.check(ji(fo,e))},xid(e){return this.check(zi(ao,e))},ksuid(e){return this.check(Ai(so,e))},ipv4(e){return this.check(Ni(uo,e))},ipv6(e){return this.check(Ti(co,e))},cidrv4(e){return this.check(Di(lo,e))},cidrv6(e){return this.check(Oi(po,e))},e164(e){return this.check(Ui(go,e))},datetime(e){return this.check(Bn(Je,e))},date(e){return this.check(Jn(Ke,e))},time(e){return this.check(Kn(He,e))},duration(e){return this.check(Hn(We,e))}});function qn(e){return wu(nn,e)}var M=g("ZodStringFormat",(e,n)=>{R.init(e,n),Yi.init(e,n)}),Je=g("ZodISODateTime",(e,n)=>{vs.init(e,n),M.init(e,n)}),Ke=g("ZodISODate",(e,n)=>{hs.init(e,n),M.init(e,n)}),He=g("ZodISOTime",(e,n)=>{$s.init(e,n),M.init(e,n)}),We=g("ZodISODuration",(e,n)=>{ys.init(e,n),M.init(e,n)}),Qi=g("ZodEmail",(e,n)=>{os.init(e,n),M.init(e,n)});function Km(e){return hi(Qi,e)}var eo=g("ZodGUID",(e,n)=>{rs.init(e,n),M.init(e,n)});function Hm(e){return $i(eo,e)}var ze=g("ZodUUID",(e,n)=>{is.init(e,n),M.init(e,n)});function Wm(e){return yi(ze,e)}function Xm(e){return _i(ze,e)}function qm(e){return bi(ze,e)}function Ym(e){return xi(ze,e)}var Qn=g("ZodURL",(e,n)=>{us.init(e,n),M.init(e,n)});function Qm(e){return Gn(Qn,e)}function ef(e){return Gn(Qn,{protocol:wn,hostname:ya,...$.normalizeParams(e)})}var to=g("ZodEmoji",(e,n)=>{cs.init(e,n),M.init(e,n)});function tf(e){return ki(to,e)}var no=g("ZodNanoID",(e,n)=>{ls.init(e,n),M.init(e,n)});function nf(e){return Ii(no,e)}var ro=g("ZodCUID",(e,n)=>{ds.init(e,n),M.init(e,n)});function rf(e){return Si(ro,e)}var io=g("ZodCUID2",(e,n)=>{ps.init(e,n),M.init(e,n)});function of(e){return wi(io,e)}var oo=g("ZodULID",(e,n)=>{ms.init(e,n),M.init(e,n)});function af(e){return Pi(oo,e)}var ao=g("ZodXID",(e,n)=>{fs.init(e,n),M.init(e,n)});function sf(e){return zi(ao,e)}var so=g("ZodKSUID",(e,n)=>{gs.init(e,n),M.init(e,n)});function uf(e){return Ai(so,e)}var uo=g("ZodIPv4",(e,n)=>{_s.init(e,n),M.init(e,n)});function cf(e){return Ni(uo,e)}var cl=g("ZodMAC",(e,n)=>{xs.init(e,n),M.init(e,n)});function lf(e){return zu(cl,e)}var co=g("ZodIPv6",(e,n)=>{bs.init(e,n),M.init(e,n)});function df(e){return Ti(co,e)}var lo=g("ZodCIDRv4",(e,n)=>{ks.init(e,n),M.init(e,n)});function pf(e){return Di(lo,e)}var po=g("ZodCIDRv6",(e,n)=>{Is.init(e,n),M.init(e,n)});function mf(e){return Oi(po,e)}var mo=g("ZodBase64",(e,n)=>{Ss.init(e,n),M.init(e,n)});function ff(e){return Ei(mo,e)}var fo=g("ZodBase64URL",(e,n)=>{ws.init(e,n),M.init(e,n)});function gf(e){return ji(fo,e)}var go=g("ZodE164",(e,n)=>{Ps.init(e,n),M.init(e,n)});function vf(e){return Ui(go,e)}var ll=g("ZodCreditCard",(e,n)=>{zs.init(e,n),M.init(e,n)});function hf(e){return Au(ll,e)}var dl=g("ZodIBAN",(e,n)=>{As.init(e,n),M.init(e,n)});function $f(e){return Nu(dl,e)}var vo=g("ZodJWT",(e,n)=>{Ns.init(e,n),M.init(e,n)});function yf(e){return Li(vo,e)}var vt=g("ZodCustomStringFormat",(e,n)=>{Ts.init(e,n),M.init(e,n)});function _f(e,n,i={}){return pt(vt,e,n,i)}function bf(e){return pt(vt,"hostname",$a,e)}function xf(e){return pt(vt,"hex",Oa,e)}function kf(e){return pt(vt,"currency_code",ba,e)}function If(e,n){let i=n?.enc??"hex",o=`${e}_${i}`,t=$e[o];if(!t)throw new Error(`Unrecognized hash format: ${o}`);return pt(vt,o,t,n)}var rn=g("ZodNumber",(e,n)=>{Yr.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>fc(e,i,o,t),e.isFinite=!0},$.derived({minValue:e=>{let{minimum:n,exclusiveMinimum:i}=W(e);return Math.max(n??Number.NEGATIVE_INFINITY,i??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:n,exclusiveMaximum:i}=W(e);return Math.min(n??Number.POSITIVE_INFINITY,i??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:n,multipleOf:i}=W(e);return!!n||!!i?.some(Number.isSafeInteger)},format:e=>W(e).format??null},{gt(e,n){return this.check(we(e,n))},gte(e,n){return this.check(ge(e,n))},min(e,n){return this.check(ge(e,n))},lt(e,n){return this.check(Se(e,n))},lte(e,n){return this.check(fe(e,n))},max(e,n){return this.check(fe(e,n))},int(e){return this.check(Xi(e))},safe(e){return this.check(Xi(e))},positive(e){return this.check(we(0,e))},nonnegative(e){return this.check(ge(0,e))},negative(e){return this.check(Se(0,e))},nonpositive(e){return this.check(fe(0,e))},multipleOf(e,n){return this.check(Me(e,n))},step(e,n){return this.check(Me(e,n))},finite(){return this}}));function pl(e){return Du(rn,e)}var ht=g("ZodNumberFormat",(e,n)=>{Ds.init(e,n),rn.init(e,n)});function Xi(e){return Eu(ht,e)}function Sf(e){return ju(ht,e)}function wf(e){return Uu(ht,e)}function Pf(e){return Lu(ht,e)}function zf(e){return Cu(ht,e)}var on=g("ZodBoolean",(e,n)=>{jn.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>gc(e,i,o,t)});function ml(e){return Ru(on,e)}var an=g("ZodBigInt",(e,n)=>{Qr.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>vc(e,i,o,t)},$.derived({minValue:e=>W(e).minimum??null,maxValue:e=>W(e).maximum??null,format:e=>W(e).format??null},{gte(e,n){return this.check(ge(e,n))},min(e,n){return this.check(ge(e,n))},gt(e,n){return this.check(we(e,n))},lt(e,n){return this.check(Se(e,n))},lte(e,n){return this.check(fe(e,n))},max(e,n){return this.check(fe(e,n))},positive(e){return this.check(we(BigInt(0),e))},negative(e){return this.check(Se(BigInt(0),e))},nonpositive(e){return this.check(fe(BigInt(0),e))},nonnegative(e){return this.check(ge(BigInt(0),e))},multipleOf(e,n){return this.check(Me(e,n))}}));function Af(e){return Mu(an,e)}var ho=g("ZodBigIntFormat",(e,n)=>{Os.init(e,n),an.init(e,n)});function Nf(e){return Fu(ho,e)}function Tf(e){return Gu(ho,e)}var fl=g("ZodSymbol",(e,n)=>{Es.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>hc(e,i,o,t)});function Df(e){return Bu(fl,e)}var gl=g("ZodUndefined",(e,n)=>{js.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>yc(e,i,o,t)});function Of(e){return Ju(gl,e)}var vl=g("ZodNull",(e,n)=>{Us.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>$c(e,i,o,t)});function hl(e){return Ku(vl,e)}var $l=g("ZodAny",(e,n)=>{Ls.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>xc(e,i,o,t)});function Ef(){return Hu($l)}var yl=g("ZodUnknown",(e,n)=>{Cs.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>kc(e,i,o,t)});function mt(){return Wu(yl)}var _l=g("ZodNever",(e,n)=>{Rs.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>bc(e,i,o,t)});function $o(e){return Xu(_l,e)}var bl=g("ZodVoid",(e,n)=>{Zs.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>_c(e,i,o,t)});function jf(e){return qu(bl,e)}var er=g("ZodDate",(e,n)=>{Ms.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Ic(e,i,o,t),e.min=(i,o)=>e.check(ge(i,o)),e.max=(i,o)=>e.check(fe(i,o))},$.derived({minDate:e=>{let{minimum:n}=W(e);return n?new Date(n):null},maxDate:e=>{let{maximum:n}=W(e);return n?new Date(n):null}},{}));function Uf(e){return Yu(er,e)}var xl=g("ZodArray",(e,n)=>{gt(),Fs.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Uc(e,i,o,t),e.element=n.element},{min(e,n){return this.check(Ee(e,n))},nonempty(e){return this.check(Ee(1,e))},max(e,n){return this.check(lt(e,n))},length(e,n){return this.check(dt(e,n))},unwrap(){return this.element}});function tr(e,n){return tc(xl,e,n)}function Lf(e){let n=e._zod.def.shape;return yo(Object.keys(n))}var nr=g("ZodObject",(e,n)=>{gt(),Gs.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Lc(e,i,o,t),$.installLazyProp(e,"shape",i=>i._zod.def.shape,!1)},{keyof(){return yo(Object.keys(this._zod.def.shape))},catchall(e){return this.clone($.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone($.mergeDefs(this._zod.def,{catchall:mt()}))},loose(){return this.clone($.mergeDefs(this._zod.def,{catchall:mt()}))},strict(){return this.clone($.mergeDefs(this._zod.def,{catchall:$o()}))},strip(){return this.clone($.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return $.extend(this,e)},safeExtend(e){return $.safeExtend(this,e)},merge(e){return $.merge(this,e)},pick(e){return $.pick(this,e)},omit(e){return $.omit(this,e)},partial(...e){return $.partial(ir,this,e[0])},exactPartial(...e){return $.partial(bo,this,e[0],"exactPartial")},required(...e){return $.required(xo,this,e[0])}});function Cf(e,n){let i={type:"object",shape:e??{},...$.normalizeParams(n)};return new nr(i)}function Rf(e,n){return new nr({type:"object",shape:e,catchall:$o(),...$.normalizeParams(n)})}function Zf(e,n){return new nr({type:"object",shape:e,catchall:mt(),...$.normalizeParams(n)})}var rr=g("ZodUnion",(e,n)=>{Un.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Gi(e,i,o,t),e.options=n.options});function sn(e,n){return new rr({type:"union",options:e,...$.normalizeParams(n)})}var kl=g("ZodXor",(e,n)=>{rr.init(e,n),Bs.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Gi(e,i,o,t),e.options=n.options});function Mf(e,n){return new kl({type:"union",options:e,inclusive:!1,...$.normalizeParams(n)})}var Il=g("ZodDiscriminatedUnion",(e,n)=>{rr.init(e,n),Ks.init(e,n)});function Vf(e,n,i){return new Il({type:"union",options:n,discriminator:e,...$.normalizeParams(i)})}var Sl=g("ZodIntersection",(e,n)=>{Hs.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Cc(e,i,o,t)});function wl(e,n){return new Sl({type:"intersection",left:e,right:n})}var Pl=g("ZodTuple",(e,n)=>{gt(),ei.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Rc(e,i,o,t)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(n=>new ir({type:"optional",innerType:n}))})}});function zl(e,n,i){let o=n instanceof E,t=o?i:n,r=o?n:null;return new Pl({type:"tuple",items:e,rest:r,...$.normalizeParams(t)})}var en=g("ZodRecord",(e,n)=>{gt(),Ws.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Zc(e,i,o,t),e.keyType=n.keyType,e.valueType=n.valueType});function Al(e,n,i){return!n||!n._zod?new en({type:"record",keyType:qn(),valueType:e,...$.normalizeParams(n)}):new en({type:"record",keyType:e,valueType:n,...$.normalizeParams(i)})}function Ff(e,n,i){return new en({type:"record",keyType:e,valueType:n,...$.normalizeParams(i),partial:!0})}function Gf(e,n,i){return new en({type:"record",keyType:e,valueType:n,mode:"loose",...$.normalizeParams(i)})}var Nl=g("ZodMap",(e,n)=>{gt(),Xs.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Ec(e,i,o,t),e.keyType=n.keyType,e.valueType=n.valueType,e.min=(...i)=>e.check(Pe(...i)),e.nonempty=i=>e.check(Pe(1,i)),e.max=(...i)=>e.check(Ve(...i)),e.size=(...i)=>e.check(ct(...i))});function Bf(e,n,i){return new Nl({type:"map",keyType:e,valueType:n,...$.normalizeParams(i)})}var Tl=g("ZodSet",(e,n)=>{gt(),qs.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>jc(e,i,o,t),e.min=(...i)=>e.check(Pe(...i)),e.nonempty=i=>e.check(Pe(1,i)),e.max=(...i)=>e.check(Ve(...i)),e.size=(...i)=>e.check(ct(...i))});function Jf(e,n){return new Tl({type:"set",valueType:e,...$.normalizeParams(n)})}var tn=g("ZodEnum",(e,n)=>{Ys.init(e,n),j.init(e,n),e._zod.processJSONSchema=(o,t,r)=>Sc(e,o,t,r),e.enum=n.entries,e.options=[...e._zod.values];let i=new Set(Object.keys(n.entries));e.extract=(o,t)=>{let r={};for(let a of o)if(i.has(a))r[a]=n.entries[a];else throw new Error(`Key ${a} not found in enum`);return new tn({...n,checks:[],...$.normalizeParams(t),entries:r})},e.exclude=(o,t)=>{let r={...n.entries};for(let a of o)if(i.has(a))delete r[a];else throw new Error(`Key ${a} not found in enum`);return new tn({...n,checks:[],...$.normalizeParams(t),entries:r})}});function yo(e,n){let i=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new tn({type:"enum",entries:i,...$.normalizeParams(n)})}function Kf(e,n){return new tn({type:"enum",entries:e,...$.normalizeParams(n)})}var Dl=g("ZodLiteral",(e,n)=>{Qs.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>wc(e,i,o,t),e.values=new Set(n.values),Object.defineProperty(e,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function Hf(e,n){return new Dl({type:"literal",values:Array.isArray(e)?e:[e],...$.normalizeParams(n)})}var Ol=g("ZodFile",(e,n)=>{eu.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Ac(e,i,o,t),e.min=(i,o)=>e.check(Pe(i,o)),e.max=(i,o)=>e.check(Ve(i,o)),e.mime=(i,o)=>e.check(Bt(Array.isArray(i)?i:[i],o))});function Wf(e){return nc(Ol,e)}var El=g("ZodTransform",(e,n)=>{gt(),tu.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Oc(e,i,o,t),e._zod.parse=(i,o)=>{if(o.direction==="backward")throw new Re(e.constructor.name);i.addIssue=r=>{if(typeof r=="string")i.issues.push($.issue(r,i.value,n));else{let a=r;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=i.value),a.inst??(a.inst=e),i.issues.push($.issue(a))}};let t=n.transform(i.value,i);return t instanceof Promise?t.then(r=>(i.value=r,i)):(i.value=t,i)}});function _o(e){return new El({type:"transform",transform:e})}var ir=g("ZodOptional",(e,n)=>{ti.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Bi(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function ft(e){return new ir({type:"optional",innerType:e})}var bo=g("ZodExactOptional",(e,n)=>{nu.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Bi(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function jl(e){return new bo({type:"optional",innerType:e})}var Ul=g("ZodNullable",(e,n)=>{ru.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Mc(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Yn(e){return new Ul({type:"nullable",innerType:e})}function Xf(e){return ft(Yn(e))}var Ll=g("ZodDefault",(e,n)=>{iu.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Gc(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Cl(e,n){return new Ll({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():$.shallowClone(n)}})}var Rl=g("ZodPrefault",(e,n)=>{ou.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Bc(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Zl(e,n){return new Rl({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():$.shallowClone(n)}})}var xo=g("ZodNonOptional",(e,n)=>{au.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Vc(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Ml(e,n){return new xo({type:"nonoptional",innerType:e,...$.normalizeParams(n)})}var Vl=g("ZodSuccess",(e,n)=>{su.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Nc(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function qf(e){return new Vl({type:"success",innerType:e})}var Fl=g("ZodCatch",(e,n)=>{uu.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Jc(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Gl(e,n){return new Fl({type:"catch",innerType:e,catchValue:typeof n=="function"?n:$.constantCatch(n)})}var Bl=g("ZodNaN",(e,n)=>{cu.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Pc(e,i,o,t)});function Yf(e){return ec(Bl,e)}var or=g("ZodPipe",(e,n)=>{ni.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Kc(e,i,o,t),e.in=n.in,e.out=n.out});function qi(e,n){return new or({type:"pipe",in:e,out:n})}var ar=g("ZodCodec",(e,n)=>{or.init(e,n),Ln.init(e,n)});function Qf(e,n,i){return new ar({type:"pipe",in:e,out:n,transform:i.decode,reverseTransform:i.encode})}function eg(e){let n=e._zod.def;return new ar({type:"pipe",in:n.out,out:n.in,transform:n.reverseTransform,reverseTransform:n.transform})}var Jl=g("ZodPreprocess",(e,n)=>{or.init(e,n),lu.init(e,n)}),Kl=g("ZodReadonly",(e,n)=>{du.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Hc(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Hl(e){return new Kl({type:"readonly",innerType:e})}var Wl=g("ZodTemplateLiteral",(e,n)=>{pu.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>zc(e,i,o,t)});function tg(e,n){return new Wl({type:"template_literal",parts:e,...$.normalizeParams(n)})}var Xl=g("ZodLazy",(e,n)=>{Cn.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Xc(e,i,o,t),e.unwrap=()=>e._zod.def.getter()});function ql(e){return new Xl({type:"lazy",getter:e})}var Yl=g("ZodPromise",(e,n)=>{fu.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Wc(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function ng(e){return new Yl({type:"promise",innerType:e})}var Ql=g("ZodFunction",(e,n)=>{mu.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Dc(e,i,o,t)});function rg(e){return new Ql({type:"function",input:Array.isArray(e?.input)?zl(e?.input):e?.input??tr(mt()),output:e?.output??mt()})}var sr=g("ZodCustom",(e,n)=>{gu.init(e,n),j.init(e,n),e._zod.processJSONSchema=(i,o,t)=>Tc(e,i,o,t)});function ig(e){let n=new F({check:"custom"});return n._zod.check=e,n}function og(e,n){return rc(sr,e??(()=>!0),n)}function ed(e,n={}){return ic(sr,e,n)}function td(e,n){return oc(e,n)}var ag=ac,sg=sc,nd=g("ZodInstanceOf",(e,n)=>{sr.init(e,n)},{properties(e,n){return this.check(Gt(e,n))}});function ug(e,n={}){let i=new nd({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...$.normalizeParams(n)});return i._zod.bag.Class=e,i._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:i,path:[...i._zod.def.path??[]]})},i}var cg=(...e)=>uc({Codec:ar,Boolean:on,String:nn},...e);function lg(e){let n=ql(()=>sn([qn(e),pl(),ml(),hl(),tr(n),Al(qn(),n)]));return n}function dg(e,n){return new Jl({type:"pipe",in:_o(e),out:n})}var cb={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function lb(e){B({customError:e})}function db(){return B().customError}var rd;rd||(rd={});var ur={};Ne(ur,{ZodISODate:()=>Ke,ZodISODateTime:()=>Je,ZodISODuration:()=>We,ZodISOTime:()=>He,date:()=>mb,datetime:()=>pb,duration:()=>gb,time:()=>fb});function pb(e){return Bn(Je,e)}function mb(e){return Jn(Ke,e)}function fb(e){return Kn(He,e)}function gb(e){return Hn(We,e)}var z={...un,...Hi,iso:ur},vb=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function hb(e,n){let i=e.$schema;return i==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":i==="http://json-schema.org/draft-07/schema#"?"draft-7":i==="http://json-schema.org/draft-04/schema#"?"draft-4":n??"draft-2020-12"}function pg(e,n){return e.map((i,o)=>oo).check(o=>{let t=o.value;if(typeof t!="object"||t===null||Array.isArray(t))return;let r=Object.getOwnPropertyNames(t);if(n.minProperties!==void 0&&r.length=${n.minProperties} properties`,input:t,inst:e,continue:!0}),n.maxProperties!==void 0&&r.length>n.maxProperties&&o.issues.push({origin:"object",code:"too_big",maximum:n.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${n.maxProperties} properties`,input:t,inst:e,continue:!0}),n.keySchema)for(let a of r){let s=n.keySchema.safeParse(a);s.success||o.issues.push({code:"invalid_key",origin:"record",issues:s.error.issues,input:a,path:[a],continue:!0})}}).pipe(e)}function id(e,n){if(e===null)return"z";let i=typeof e;if(i!=="object"){if(i==="number"&&Number.isNaN(e))return null;let o=String(e);return`${i[0]}${o.length}:${o}`}if(n.has(e))return null;n.add(e);try{if(Array.isArray(e)){let r=[];for(let a of e){let s=id(a,n);if(s===null)return null;r.push(s)}return`a${r.length}:[${r.join(",")}]`}let o=Object.keys(e).sort(),t=[];for(let r of o){let a=id(e[r],n);if(a===null)return null;t.push(`${r.length}:${r}=${a}`)}return`o${t.length}:{${t.join(",")}}`}finally{n.delete(e)}}var bb=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),xb=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function cr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(cr):typeof e.$ref=="string"?!0:Object.entries(e).some(([n,i])=>bb.has(n)?cr(i):!xb.has(n)||typeof i!="object"||i===null?!1:Object.values(i).some(cr))}function mg(e){return e===1?"element":"elements"}function kb(e,n){return z.transform(o=>o).check(o=>{let t=o.value;if(Array.isArray(t)){if(n.uniqueItems===!0){let r=new Map;for(let a=0;a=a)break;sn.maxContains&&o.issues.push({code:"custom",message:`Array must contain at most ${n.maxContains} matching ${mg(n.maxContains)}`,input:t,continue:!0})}}}).pipe(e)}function fg(e,n){if(e!==!1)return e===void 0||e===!0?z.any():ae(e,n)}var Ib=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function gg(e,n){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return z.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let t=e.$ref;if(n.refs.has(t))return n.refs.get(t);if(n.processing.has(t))return z.lazy(()=>{if(!n.refs.has(t))throw new Error(`Circular reference not resolved: ${t}`);return n.refs.get(t)});n.processing.add(t);let r=yb(t,n),a=ae(r,n);return n.refs.set(t,a),n.processing.delete(t),a}if(e.enum!==void 0){let t=e.enum;if(n.version==="openapi-3.0"&&e.nullable===!0&&t.length===1&&t[0]===null)return z.null();if(t.length===0)return z.never();if(t.length===1)return z.literal(t[0]);if(t.every(a=>typeof a=="string"))return z.enum(t);let r=t.map(a=>z.literal(a));return r.length<2?r[0]:z.union([r[0],r[1],...r.slice(2)])}if(e.const!==void 0)return z.literal(e.const);let i=e.type;if(Array.isArray(i)){let t=i.map(r=>{let a={...e,type:r};return gg(a,n)});return t.length===0?z.never():t.length===1?t[0]:z.union(t)}if(!i)return z.any();let o;switch(i){case"string":{let t=z.string();if(e.format){let r=e.format;r==="email"?t=t.check(z.email()):r==="uri"||r==="uri-reference"?t=t.check(z.url()):r==="uuid"||r==="guid"?t=t.check(z.uuid()):r==="date-time"?t=t.check(z.iso.datetime({offset:!0})):r==="date"?t=t.check(z.iso.date()):r==="time"?t=t.check(z.regex(Ib)):r==="duration"?t=t.check(z.iso.duration()):r==="hostname"?t=t.check(z.hostname()):r==="ipv4"?t=t.check(z.ipv4()):r==="ipv6"?t=t.check(z.ipv6()):r==="mac"?t=t.check(z.mac()):r==="cidr"?t=t.check(z.cidrv4()):r==="cidr-v6"?t=t.check(z.cidrv6()):r==="base64"?t=t.check(z.base64()):r==="base64url"?t=t.check(z.base64url()):r==="e164"?t=t.check(z.e164()):r==="credit_card"?t=t.check(z.creditCard()):r==="iban"?t=t.check(z.iban()):r==="jwt"?t=t.check(z.jwt()):r==="emoji"?t=t.check(z.emoji()):r==="nanoid"?t=t.check(z.nanoid()):r==="cuid"?t=t.check(z.cuid()):r==="cuid2"?t=t.check(z.cuid2()):r==="ulid"?t=t.check(z.ulid()):r==="xid"?t=t.check(z.xid()):r==="ksuid"&&(t=t.check(z.ksuid()))}typeof e.minLength=="number"&&(t=t.min(e.minLength)),typeof e.maxLength=="number"&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),o=t;break}case"number":case"integer":{let t=i==="integer"?z.number().int():z.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(t=t.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum=="number"?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(t=t.lt(e.maximum)),typeof e.multipleOf=="number"&&(t=t.multipleOf(e.multipleOf)),o=t;break}case"boolean":{o=z.boolean();break}case"null":{o=z.null();break}case"object":{let t={},r=e.properties||{},a=new Set(e.required||[]),s=typeof e.additionalProperties=="object"?ae(e.additionalProperties,n):void 0;for(let[d,p]of Object.entries(r)){let f=ae(p,n);Q(t,d,a.has(d)?f:f.optional())}if(e.patternProperties){let d=e.patternProperties,p=Object.keys(d),f=[];for(let y of p){let k=ae(d[y],n),P=z.string().regex(new RegExp(y));f.push(z.looseRecord(P,k))}let h=[];if(Object.keys(t).length>0&&h.push(z.object(t).passthrough()),h.push(...f),h.length===0)o=z.object({}).passthrough();else if(h.length===1)o=h[0];else{let y=z.intersection(h[0],h[1]);for(let k=2;knew RegExp(S)),P=o;o=o.check(S=>{if(!ve(S.value))return;let N=[];for(let x of Object.keys(S.value))y.includes(x)||k.some(A=>A.test(x))||N.push(x);N.length&&S.issues.push({code:"unrecognized_keys",keys:N,input:S.value,inst:P})})}}else{let d=z.object(t);e.additionalProperties===!1?o=d.strict():s?o=d.catchall(s):o=d.passthrough()}let u=e.propertyNames!==void 0&&e.propertyNames!==!0,c=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(u||c!==void 0||l!==void 0){let d;if(u){let p=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=ae(p,n)}o=_b(o,{keySchema:d,minProperties:c,maxProperties:l})}break}case"array":{let t=e.prefixItems,r=e.items;if(t&&Array.isArray(t)){let a=typeof e.minItems=="number"?e.minItems:0,s=t.map(d=>ae(d,n)),u=pg(s,a),c=Array.isArray(r)?void 0:fg(r,n),l=z.tuple(u);o=c?l.rest(c):l,typeof e.minItems=="number"&&(o=o.check(z.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(z.maxLength(e.maxItems)))}else if(Array.isArray(r)){let a=typeof e.minItems=="number"?e.minItems:0,s=r.map(d=>ae(d,n)),u=pg(s,a),c=fg(e.additionalItems,n),l=z.tuple(u);o=c?l.rest(c):l,typeof e.minItems=="number"&&(o=o.check(z.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(z.maxLength(e.maxItems)))}else if(r!==void 0){let a=ae(r,n),s=z.array(a);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),o=s}else o=z.array(z.any());(e.uniqueItems===!0||e.contains!==void 0)&&(o=kb(o,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ae(e.contains,n):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${i}`)}return o}function ae(e,n){if(typeof e=="boolean")return e?z.any():z.never();let i=gg(e,n),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map(c=>ae(c,n)),u=z.union(s);i=o?z.intersection(i,u):u}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map(c=>ae(c,n)),u=z.xor(s);i=o?z.intersection(i,u):u}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)i=o?i:z.any();else{let s=o?i:ae(e.allOf[0],n),u=o?0:1;for(let c=u;c0&&n.registry.add(i,t),e.description&&(i=i.describe(e.description)),i}function vg(e,n){if(typeof e=="boolean")return e?z.any():z.never();let i;try{i=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=hb(i,n?.defaultTarget),t=i.$defs||i.definitions||{},r={version:o,defs:t,refs:new Map,processing:new Set,rootSchema:i,registry:n?.registry??ee};return ae(i,r)}var hg=Symbol("z.visit/resolving");function lr(e,n){let i=typeof n=="function"?n:(a,s)=>{let u=n[a._zod.def.type];return u?u(a,s):a},o=new Map;function t(a){let s=o.get(a);if(s===hg)return new Cn({type:"lazy",getter:()=>o.get(a)});if(s!==void 0)return s;o.set(a,hg);let u=r(a),c=i(u,u!==a);return o.set(a,c),c}function r(a){let s=a._zod.def,u=s.type;switch(u){case"object":{let c=s.shape,l=Object.keys(c),d=!1,p={};for(let h of l){let y=t(c[h]);y!==c[h]&&(d=!0),p[h]=y}let f=s.catchall;return s.catchall&&(f=t(s.catchall),f!==s.catchall&&(d=!0)),d?C(a,{...s,shape:p,catchall:f}):a}case"array":{let c=t(s.element);return c===s.element?a:C(a,{...s,element:c})}case"tuple":{let c=s.items,l=!1,d=[];for(let f of c){let h=t(f);h!==f&&(l=!0),d.push(h)}let p=s.rest;return s.rest&&(p=t(s.rest),p!==s.rest&&(l=!0)),l?C(a,{...s,items:d,rest:p}):a}case"record":case"map":{let c=t(s.keyType),l=t(s.valueType);return c===s.keyType&&l===s.valueType?a:C(a,{...s,keyType:c,valueType:l})}case"set":{let c=t(s.valueType);return c===s.valueType?a:C(a,{...s,valueType:c})}case"union":{let c=s.options,l=!1,d=[];for(let p of c){let f=t(p);f!==p&&(l=!0),d.push(f)}return l?C(a,{...s,options:d}):a}case"intersection":{let c=t(s.left),l=t(s.right);return c===s.left&&l===s.right?a:C(a,{...s,left:c,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let c=t(s.innerType);return c===s.innerType?a:C(a,{...s,innerType:c})}case"pipe":{let c=t(s.in),l=t(s.out);return c===s.in&&l===s.out?a:C(a,{...s,in:c,out:l})}case"function":{let c=t(s.input),l=t(s.output);return c===s.input&&l===s.output?a:C(a,{...s,input:c,output:l})}case"lazy":{let c=s.getter,{_cachedInner:l,...d}=s;return C(a,{...d,getter:()=>t(c())})}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":return a;default:return a}}return t(e)}function $g(e){return lr(e,{object:n=>n.partial(),union:n=>{let i=n._zod.def;return i.discriminator===void 0?n:sn(i.options)}})}function Sb(e,n){if(!n?.length)return e;let i=e._zod.def;return C(e,_e(i,{checks:[...i.checks??[],...n]}),{parent:!0})}function yg(e){return Sb(e.out,e.checks)}function wb(e){return e.in._zod.traits.has("$ZodTransform")?yg(e):e.in}function _g(e){return lr(e,{pipe:n=>wb(n._zod.def),default:(n,i)=>i?ft(n._zod.def.innerType):n,catch:(n,i)=>i?n._zod.def.innerType:n})}function bg(e){return lr(e,{pipe:n=>yg(n._zod.def),prefault:(n,i)=>i?n._zod.def.innerType:n})}var od={};Ne(od,{bigint:()=>Nb,boolean:()=>Ab,date:()=>Tb,number:()=>zb,string:()=>Pb});function Pb(e){return Pu(nn,e)}function zb(e){return Ou(rn,e)}function Ab(e){return Zu(on,e)}function Nb(e){return Vu(an,e)}function Tb(e){return Qu(er,e)}var Db=new Set(["__proto__","prototype","constructor"]),$t=m.string().min(1).max(256).refine(e=>!Db.has(e),"reserved storage key"),ko=m.json(),Io=256*1024,Ob=5*1024*1024,xg=1024,kg=m.strictObject({key:$t}),Ig=m.object({value:ko}),Sg=m.strictObject({key:$t,value:ko}),wg=m.object({ok:m.literal(!0)}),Pg=m.strictObject({key:$t}),zg=m.object({ok:m.literal(!0)}),Ag=m.strictObject({}).optional(),Ng=m.object({keys:m.array(m.string()).max(xg)}),Tg=m.strictObject({key:$t}),Dg=m.object({value:m.string().nullable()}),Og=m.strictObject({key:$t,value:m.string().max(64*1024)}),Eg=m.object({ok:m.literal(!0)}),jg=m.strictObject({key:$t}),Ug=m.object({ok:m.literal(!0)}),Lg=m.strictObject({}).optional(),Cg=m.object({status:m.enum(["os-keyring","unavailable"])}),Rg=m.strictObject({}).optional(),Zg=m.object({settings:m.record(m.string(),ko)}),Mg=m.strictObject({key:$t,value:ko}),Vg=m.object({ok:m.literal(!0)});var So="x-orca-enum-since";var Xe="1.4.160",ad="1.4.245";var dr="1.4.246",Fg=dr,Gg=dr,jb="Relative to the plugin root; `..` segments and Windows device names such as `CON` are refused.";function Bg(e,n,i){return qe(`${e} ${jb}`,n,i)}function qe(e,n,i){return i?{description:e,"x-orca-since":n,examples:[...i]}:{description:e,"x-orca-since":n}}var cn=["workspace.created","workspace.removed","agent.status.changed","workspace.changed"],cP=cn.length,Ub={"workspace.created":ad,"workspace.removed":ad,"agent.status.changed":Xe,"workspace.changed":Gg};var lP=m.object({on:m.enum(cn).meta({...qe("Event delivered to the plugin worker.",Xe),[So]:Ub})}).strict().meta({id:"EventContribution",description:"An event subscription. Requires `main`, the `trusted-worker` execution profile and the capability of the event's domain: `workspace:read` for workspace events, `agent:read` for agent events."});var se=["worker","panel","editor"],Jg=["worker"],ln=["panel","editor"],J=e=>e;function Kg(e,n){return n==="worker"?e.since:Math.max(e.since,e.framesSince??0)}var Lb=["success","failure","cancellation","superseded"],mP=[...Lb,"interruption","unconfirmed"];var sd=["working","blocked","waiting","done"];var BP=new Set(sd);var pr=m.string().regex(/^[A-Za-z0-9_.:-]{1,128}$/,"is 1-128 letters, digits, or . _ : -");var qg=12e4,ez=1024*1024,tz=256*1024;var Rb=m.object({id:m.string().min(1).max(64),surface:m.enum(["panel","editor"]),contributionId:m.string().min(1).max(256)}),nz=m.object({name:pr,input:m.unknown(),panel:Rb}),rz=m.object({event:pr,payload:m.unknown(),panel:m.string().min(1).max(64).optional()}),Yg=["storage","settings"],iz=m.object({area:m.enum(Yg),key:m.string().min(1).max(256)}),oz=m.discriminatedUnion("kind",[m.object({kind:m.literal("message"),event:pr,payload:m.unknown()}),m.object({kind:m.literal("event"),event:m.enum(cn),payload:m.unknown()}),m.object({kind:m.literal("changed"),area:m.enum(Yg),key:m.string()})]);var Zb=m.strictObject({name:pr,input:m.json().optional(),timeoutMs:m.number().int().min(1).max(qg).optional()}),Mb=m.object({output:m.json()}),Vb=50,Fb=m.strictObject({}).optional(),Gb=m.object({agents:m.array(m.object({terminalId:m.string().min(1).max(1024).nullable(),title:m.string().max(512).nullable(),agent:m.string().max(128).nullable(),state:m.enum(sd),stateStartedAt:m.number().finite()})).max(Vb)}),Bb=m.strictObject({event:m.enum(cn)}),Jb=m.object({ok:m.literal(!0)}),Qg={"plugin.request":J({summary:"Asks the plugin's own worker to run the handler it registered with `orca.panels.handle(name)`, starting the worker if needed; resolves with what the handler returned. `unknown_method` when no handler has that name.",since:2,scope:"plugin-private",capability:null,mutation:!1,surfaces:ln,params:Zb,result:Mb}),"agents.list":J({summary:"The agents in the focused workspace: their terminal, title, agent kind and status. `agent.status.changed` reports each change after.",since:2,scope:"active-workspace",capability:"agent:read",mutation:!1,surfaces:se,params:Fb,result:Gb}),"events.subscribe":J({summary:"Delivers a workspace or agent event to this panel as `orca.on(event)`; needs the event's read capability. The frame APIs call it for you.",since:2,scope:"plugin-private",capability:null,mutation:!1,surfaces:ln,params:Bb,result:Jb})};var Kb=4096,Hb=50,ud=512,tv=1024,Wb=m.strictObject({}).optional(),Xb=m.object({branch:m.string().max(ud),displayName:m.string().max(ud),terminals:m.array(m.object({id:m.string().min(1).max(tv),title:m.string().max(ud).optional()}).strict()).max(Hb)}).strict().nullable(),qb=Xb,Yb=m.strictObject({terminalId:m.string().min(1).max(tv),text:m.string().min(1).max(Kb),enter:m.boolean().default(!1)}),Qb=m.object({accepted:m.boolean()}),ex=m.strictObject({title:m.string().min(1).max(120),body:m.string().max(1e3).optional()}),tx=m.object({delivered:m.boolean()});var nx=8192,rx=["http:","https:","mailto:"],ev=64*1024*1024,ix=m.strictObject({url:m.string().min(1).max(nx).refine(cx,"url must be an http:, https: or mailto: URL")}),ox=m.object({opened:m.boolean(),reason:m.enum(["cancelled","consent-unavailable"]).optional()}),ax=m.union([m.string().max(ev),m.custom(e=>e instanceof ArrayBuffer||e instanceof Uint8Array,"data must be a string or ArrayBuffer").refine(e=>e.byteLength<=ev,"data exceeds 64 MiB").meta({type:"ArrayBuffer"})]),sx=m.strictObject({suggestedName:m.string().min(1).max(255).optional(),mimeType:m.string().min(1).max(255).optional(),data:ax}),ux=m.object({status:m.enum(["saved","cancelled"])});function cx(e){try{return rx.includes(new URL(e).protocol)}catch{return!1}}var yt={"workspace.readContext":J({summary:"Branch, name and terminal ids of the focused workspace, or null when none is focused.",since:0,scope:"active-workspace",capability:"workspace:read",mutation:!1,surfaces:se,params:Wb,result:qb}),"terminal.sendText":J({summary:"Types text into one terminal named by id, optionally pressing Enter.",since:0,scope:"explicit-terminal",capability:"terminal:send",mutation:!0,surfaces:Jg,params:Yb,result:Qb}),"notifications.show":J({summary:"Shows a desktop notification.",since:0,scope:"desktop",capability:"notifications:show",mutation:!0,surfaces:se,params:ex,result:tx}),"storage.get":J({summary:"Reads a JSON value from the plugin's private store; null when absent.",since:0,scope:"plugin-private",capability:"storage:own",mutation:!1,framesSince:2,surfaces:se,params:kg,result:Ig}),"storage.set":J({summary:"Writes a JSON value to the plugin's private store.",since:0,scope:"plugin-private",capability:"storage:own",mutation:!0,framesSince:2,surfaces:se,params:Sg,result:wg}),"storage.delete":J({summary:"Removes a key from the plugin's private store.",since:0,scope:"plugin-private",capability:"storage:own",mutation:!0,framesSince:2,surfaces:se,params:Pg,result:zg}),"storage.keys":J({summary:"Lists the keys in the plugin's private store.",since:0,scope:"plugin-private",capability:"storage:own",mutation:!1,framesSince:2,surfaces:se,params:Ag,result:Ng}),"secrets.get":J({summary:"Reads a secret from the plugin's encrypted secrets file; null when absent.",since:0,scope:"plugin-private",capability:"secrets:own",mutation:!1,framesSince:2,surfaces:se,params:Tg,result:Dg}),"secrets.set":J({summary:"Stores a secret in the plugin's encrypted secrets file.",since:0,scope:"plugin-private",capability:"secrets:own",mutation:!0,framesSince:2,surfaces:se,params:Og,result:Eg}),"secrets.delete":J({summary:"Removes a secret from the plugin's encrypted secrets file.",since:0,scope:"plugin-private",capability:"secrets:own",mutation:!0,framesSince:2,surfaces:se,params:jg,result:Ug}),"secrets.protection":J({summary:"How secrets are protected at rest: `os-keyring`, or `unavailable` (no OS key store, or Linux `basic_text`), where `secrets.set` fails.",since:1,scope:"plugin-private",capability:"secrets:own",mutation:!1,framesSince:2,surfaces:se,params:Lg,result:Cg}),"settings.get":J({summary:"Reads every setting the plugin owns.",since:0,scope:"plugin-private",capability:"settings:own",mutation:!1,framesSince:2,surfaces:se,params:Rg,result:Zg}),"settings.set":J({summary:"Writes one setting the plugin owns.",since:0,scope:"plugin-private",capability:"settings:own",mutation:!0,framesSince:2,surfaces:se,params:Mg,result:Vg}),"shell.openExternal":J({summary:"Opens an http:, https: or mailto: URL in the default browser. Needs a click or key press in the frame; desktop app only. Orca asks the person before an http(s) host the plugin was not allowed; `opened` is false if they cancel.",since:1,scope:"desktop",capability:null,userActivation:!0,mutation:!1,surfaces:ln,params:ix,result:ox}),"files.saveAs":J({summary:"Offers data (a string or ArrayBuffer, up to 64 MiB) in Orca's save dialog; the plugin never learns the path. Needs a click or key press in the frame; desktop app only.",since:1,scope:"desktop",capability:null,userActivation:!0,mutation:!0,surfaces:ln,params:sx,result:ux}),...Qg},nv=Object.keys(yt).filter(rv);function rv(e){return Object.hasOwn(yt,e)}function iv(e){return rv(e)?yt[e]:null}var vz=Math.max(...nv.map(e=>yt[e].since));function lx(e){return nv.filter(n=>yt[n].surfaces.includes(e))}function ov(e,n){return lx(e).filter(i=>n||yt[i].userActivation!==!0)}function av(e,n="panel"){return Math.max(0,...e.map(i=>Kg(yt[i],n)))}var _t=1,_z=m.number().refine(e=>e===_t,{error:e=>typeof e.input=="number"&&e.input>_t?`targets host API ${e.input}, but this Orca supports only ${_t}; update Orca`:`must be ${_t}`}).meta({const:_t});var dx=new Set(["rate_limited","unavailable","timeout","conflict"]);function ke(e,n=e,i){return Object.assign(new Error(n),{code:e,retryable:dx.has(e),...i===void 0?{}:{retryAfterMs:i}})}var px=new Set(["plugin.request","events.subscribe","storage.get","storage.set","storage.delete","storage.keys","settings.get","settings.set","secrets.get","secrets.set","secrets.delete","secrets.protection"]);function wo(e,n){return typeof e=="object"&&e!==null&&n in e?Object.getOwnPropertyDescriptor(e,n)?.value:void 0}function sv(e){let n={storage:new Map(Object.entries(e.storage??{})),settings:new Map(Object.entries(e.settings??{})),secrets:new Map(Object.entries(e.secrets??{}))},i=new Set,o=(r,a,s)=>{if(s===void 0?n[r].delete(a):n[r].set(a,s),r!=="secrets")for(let u of i)u(r,a);return{ok:!0}};async function t(r){let a=String(wo(r,"name"));if(!e.requests||!Object.hasOwn(e.requests,a))throw ke("unknown_method",`no panel handler named ${a}`);let s=e.requests[a],u=wo(r,"input");return{output:(typeof s=="function"?await s(u):s)??null}}return{handles:r=>px.has(r),async answer(r,a){let s=String(wo(a,"key")),u=wo(a,"value");switch(r){case"plugin.request":return t(a);case"storage.get":return{value:n.storage.get(s)??null};case"storage.keys":return{keys:[...n.storage.keys()]};case"settings.get":return{settings:Object.fromEntries(n.settings)};case"secrets.get":return{value:n.secrets.get(s)??null};case"secrets.protection":return{status:"os-keyring"};case"storage.set":return o("storage",s,u);case"settings.set":return o("settings",s,u);case"secrets.set":return o("secrets",s,u);case"storage.delete":return o("storage",s,void 0);case"secrets.delete":return o("secrets",s,void 0);default:return{ok:!0}}},onChange(r){return i.add(r),()=>i.delete(r)},snapshot:()=>({storage:Object.fromEntries(n.storage),settings:Object.fromEntries(n.settings),secrets:Object.fromEntries(n.secrets)})}}function mx(e){return typeof e=="function"}var uv={"workspace.readContext":null,"notifications.show":{delivered:!0},"shell.openExternal":{opened:!0},"files.saveAs":{status:"saved"},"agents.list":{agents:[]}};function cv(e,n){let i=new Set(e.capabilities??n),o=new Map(Object.entries(e.results??{})),t=sv(e),r=ov("panel",!0),a=[],s=new Set,u=0;async function c(l,d){let p=iv(l);if(!p)throw ke("unknown_method",`${l} does not exist in this Orca`);if(!p.surfaces.includes("panel"))throw ke("not_permitted",`${l} is not available to panels`);if(p.userActivation===!0){if(u===0)throw ke("not_permitted",`${l} needs a click or key press in the frame`);u-=1}if(p.capability&&!i.has(p.capability))throw ke("capability_denied",`${l} needs the ${p.capability} capability`);let f=p.params.safeParse(d);if(!f.success)throw ke("invalid_params",f.error.issues[0]?.message??"invalid params");let h=!o.has(l)&&t.handles(l);if(!o.has(l)&&!h&&!Object.hasOwn(uv,l))throw ke("unavailable",`the test configured no result for ${l}`);let y=o.has(l)?o.get(l):uv[l],k=h?await t.answer(l,f.data):mx(y)?await y(f.data):y,P=p.result.safeParse(k);if(!P.success)throw new TypeError(`mockHost: the result configured for ${l} does not match the host API: ${P.error.issues[0]?.message??"invalid result"}`);return P.data}return{calls:a,callsOf:l=>a.filter(d=>d.method===l).map(d=>d.params),respond:(l,d)=>o.set(l,d),grantGesture:()=>{u=1},data:()=>t.snapshot(),onDataChange:l=>t.onChange(l),async idle(){for(;s.size>0;)await Promise.allSettled(s)},bridge:{api:{major:_t,minor:av(r)},call(l,d){a.push({method:l,params:d});let p=c(l,d);return s.add(p),p.catch(()=>{}).finally(()=>s.delete(p)),p},has:l=>r.some(d=>d===l)}}}var Ae={render:"ui.render",event:"ui.event",error:"ui.error",ack:"ui.ack",ready:"ui.ready",hydrate:"ui.hydrate",visibility:"ui.visibility",persist:"ui.persist",retain:"ui.retain"};var Po="$edit";var fx=/[\p{Cc}\p{Cf}\p{Cs}\p{Zl}\p{Zp}]/u,gx=new Set(["‌","‍"]);function vx(e){return gx.has(e)||!fx.test(e)}function lv(e){return[...e].filter(vx).join("")}var hx=/[\t\n\v\f\r\u0085\u2028\u2029]+/g;function $x(e){return lv(e.replace(hx," "))}function dv(e){let n=e.overwrite($x);return e.minLength?n.min(e.minLength,"must contain visible characters"):n}var yx=/^(?:con|prn|aux|nul|clock\$|conin\$|conout\$|com[1-9\u00B9\u00B2\u00B3]|lpt[1-9\u00B9\u00B2\u00B3])(?:\..*)?$/i,_x=/[<>:"|?*]/,zo=String.raw`[^<>:"|?*\x00-\x1f\\/]*[^<>:"|?*\x00-\x1f\\/. ]`,cd=new RegExp(`^${zo}(?:[\\\\/]${zo})*$`),jz=new RegExp(`^${zo}(?:/${zo})*$`);function bx(e){return e.length===0||e==="."||e===".."?"empty and dot path segments are not allowed":e.endsWith(".")||e.endsWith(" ")?"path segments may not end with a dot or space":_x.test(e)||[...e].some(n=>n.charCodeAt(0)<=31)?"path segment contains a Windows-forbidden character or alternate-data-stream colon":yx.test(e)?"path segment is a Windows reserved device name":null}function xx(e){if(e.length===0||e.startsWith("/")||e.startsWith("\\"))return"must be a non-empty relative path";let n=e.split(/[\\/]/);for(let i of n){let o=bx(i);if(o)return o}return null}function ld(e){return xx(e)===null}var pv=/^[a-z0-9]+(?:-[a-z0-9]+)*$/,kx=new Set(["__proto__","prototype","constructor"]),dd=64;function mv(e){return kx.has(e)}var pd="must be a portable relative path inside the plugin directory",fv=m.string().max(dd).regex(pv,"must be kebab-case (a-z, 0-9, dashes)").refine(e=>!mv(e),"must not be a reserved name"),gv=m.string().min(1).max(1024).regex(cd,pd).refine(e=>!cd.test(e)||ld(e),pd),Fz=m.string().min(1).max(1024).transform(e=>e.replace(/[\\/]+$/,"")).refine(ld,pd),Gz=m.string().min(1).max(256).regex(/^[A-Za-z0-9]+(?:[._-][A-Za-z0-9]+)*$/,"must be a portable command id");var dn=["activity","bar-chart-3","bell","blocks","book","bot","bug","calendar","cloud","code","database","file-text","flag","folder","gauge","globe","hammer","layers","lightbulb","package","plug","puzzle","rocket","star","terminal","wrench","zap","add","remove","delete","edit","refresh","search","settings","check","close","info","warning","error","open-external","copy","download","upload","play","pause","stop","more","expand","collapse","next","filter","branch","file","agent","link"],Ix=Object.fromEntries(dn.slice(dn.indexOf("add")).map(e=>[e,dr])),Yz=new Map(dn.map(e=>[e.replaceAll("-",""),e]));var Sx=["html","components"],wx=/\.(?:m?js|tsx?|mts|jsx)$/i,Qz=m.object({id:fv.meta(qe("Panel id, unique among this plugin's panels. The reserved names `constructor` and `prototype` are refused.",Xe,["dashboard"])),title:dv(m.string().min(1).max(256)).meta(qe("Title shown on the panel tab and its tooltip.",Xe,["Dashboard"])),icon:m.enum(dn).optional().meta({...qe("Icon shown in the right-sidebar activity bar. Defaults to `plug`.",Xe,["database"]),[So]:Ix}),entry:gv.meta(Bg(`What the panel runs: an HTML page for \`ui: "html"\`, a \`.js\`/\`.mjs\` module for \`ui: "components"\`. Either may instead be a \`.ts\`/\`.tsx\`/\`.mts\`/\`.jsx\` file, which Orca transpiles when it loads (needs \`engines.orca\` \`>=${Fg}\`; an \`html\` panel then gets a generated page around it). It is trusted code: install panels you trust.`,Xe,["dist/panel.html"])),ui:m.enum(Sx).optional().meta(qe("How the panel draws its UI. `html` (default) shows `entry` as a web page in an isolated frame; `components` runs `entry` as a hidden module and Orca draws the component tree it returns with its own controls.",dr,["components"]))}).strict().refine(e=>e.ui!=="components"||wx.test(e.entry),{path:["entry"],message:"a components panel entry must be a .js, .mjs, .ts, .tsx, .mts or .jsx module"}).meta({id:"PanelContribution",description:"A sidebar panel. Requires the `sandboxed-ui` execution profile or higher."});var V={maxNodes:5e3,maxDepth:64,maxTreeBytes:524288,maxTextLength:16384,maxLabelLength:1024,maxPropsPerNode:32,maxSelectOptions:500,maxEventArgs:8,maxCallbackIdLength:64},tA={maxBytes:640*1024,maxMessages:200,perMs:1e4,maxDepth:V.maxDepth*2+24,maxObjects:V.maxNodes*8+1024};var Px=dn,hv=new Set(Px),md=/^[A-Za-z0-9_.:-]+$/,zx=m.object({$callback:m.string().min(1).max(V.maxCallbackIdLength).regex(md)}).strict(),Ax=["neutral","accent","success","warning","danger"],Ie=m.string().max(V.maxLabelLength),Ue=Ie.min(1),Ye=zx.optional(),Ao=m.string().regex(/^[a-z0-9-]{1,64}$/),$v=m.enum(["none","xs","sm","md","lg"]).optional(),yv=m.enum(["start","center","end","stretch"]).optional(),No=m.enum(Ax).optional(),fd=m.enum(["xs","sm","md"]).optional(),_v=m.enum(["solid","outline","ghost"]).optional(),q=m.boolean().optional(),vv=m.string().max(V.maxTextLength),gd={[Po]:m.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).optional()},Nx=m.object({gap:$v,align:yv}).strict(),Tx=m.object({gap:$v,align:yv,justify:m.enum(["start","center","end","between"]).optional(),wrap:q}).strict(),Dx=m.object({tone:No,muted:q,size:fd,weight:m.enum(["regular","medium","semibold"]).optional(),truncate:q}).strict(),Ox=m.object({level:m.union([m.literal(1),m.literal(2),m.literal(3)]).optional()}).strict(),Ex=m.object({variant:_v,tone:No,size:fd,icon:Ao.optional(),disabled:q,onPress:Ye}).strict(),jx=m.object({icon:Ao,label:Ue,variant:_v,tone:No,size:fd,disabled:q,onPress:Ye}).strict(),Ux=m.object({tone:No}).strict(),Lx=m.object({title:Ie.optional(),description:Ie.optional()}).strict(),Cx=m.object({label:Ie.optional()}).strict(),Rx=m.object({title:Ie.optional(),description:Ie.optional(),icon:Ao.optional(),current:q,disabled:q,onPress:Ye}).strict(),Zx=m.object({label:Ue,labelHidden:q,value:vv.optional(),defaultValue:vv.optional(),placeholder:Ie.optional(),type:m.enum(["text","search","password"]).optional(),maxLength:m.number().int().positive().max(V.maxTextLength).optional(),invalid:q,disabled:q,onChange:Ye,onSubmit:Ye,...gd}).strict(),Mx=m.object({label:Ue,checked:q,defaultChecked:q,disabled:q,onChange:Ye,...gd}).strict(),Vx=m.object({label:Ue,labelHidden:q,value:Ie.optional(),defaultValue:Ie.optional(),placeholder:Ie.optional(),options:m.array(m.object({value:Ue,label:Ue,disabled:q}).strict()).max(V.maxSelectOptions),disabled:q,onChange:Ye,...gd}).strict(),Fx=m.object({orientation:m.enum(["horizontal","vertical"]).optional()}).strict(),Gx=m.object({label:Ue,labelHidden:q,value:m.number().min(0).max(100).optional()}).strict(),Bx=m.object({label:Ue,labelHidden:q}).strict(),Jx=m.object({title:Ue,description:Ie.optional(),icon:Ao.optional()}).strict(),Kx=m.object({href:m.string().max(2048).regex(/^(https?:\/\/|mailto:)/i).optional(),onPress:Ye}).strict(),Hx=m.object({block:q}).strict();function X(e,n){return{props:e,children:n}}var mr={Stack:X(Nx,"any"),Row:X(Tx,"any"),Text:X(Dx,"inline"),Heading:X(Ox,"inline"),Button:X(Ex,"text"),IconButton:X(jx,"none"),Badge:X(Ux,"text"),Card:X(Lx,"any"),List:X(Cx,"items"),ListItem:X(Rx,"any"),Input:X(Zx,"none"),Switch:X(Mx,"none"),Select:X(Vx,"none"),Separator:X(Fx,"none"),Progress:X(Gx,"none"),Spinner:X(Bx,"none"),EmptyState:X(Jx,"any"),Link:X(Kx,"text"),Code:X(Hx,"text")};function vd(e){return typeof e=="string"&&Object.hasOwn(mr,e)}var sA=Object.keys(mr).filter(vd),bv=new Set(["Text","Link","Code","Badge"]),xv=new Set(["Button","IconButton","Input","Switch","Select","Link","ListItem"]);function hd(e){return typeof e=="object"&&e!==null}var Wx=new Set(["type","key","props","children"]),$d=32,Xx=8,qx=/^[A-Z][A-Za-z0-9]{0,63}$/,Yx=20,To=class extends Error{};function K(e,n){throw new To(`${e}: ${n}`)}function Qx(e,n){return e===void 0?[]:(Array.isArray(e)||K(n,"children must be an array"),e)}function ek(e,n,i){let o=mr[e].props.shape,t={};for(let[r,a]of Object.entries(n)){if(a===void 0)continue;if(!Object.hasOwn(o,r)){i(`${e}: ignored unknown prop "${r.slice(0,64)}"`);continue}let s=o[r].safeParse(a);if(!s.success){i(`${e}: ignored invalid ${r}`);continue}t[r]=s.data}for(let[r,a]of Object.entries(o))if(!Object.hasOwn(t,r)&&!a.safeParse(void 0).success)return i(`${e}: missing required ${r}; showing a placeholder`),null;return typeof t.icon=="string"&&!hv.has(t.icon)&&i(`${e}: unknown icon "${t.icon}"; showing a fallback glyph`),t}function kv(e){if(e===null)return{ok:!0,tree:null,nodes:0,warnings:[]};let n=new Set,i=c=>{n.sizeV.maxTextLength&&K(P,"text is too long"),r+ ++a>V.maxNodes&&K(P,`more than ${V.maxNodes} nodes`),s+=Xx+me.length,s>V.maxTreeBytes&&K(P,`tree exceeds ${V.maxTreeBytes} bytes`),k.push(me);continue}hd(l)||K(P,"expected a node, string or number");let S=l.type,N=vd(S);!N&&(typeof S!="string"||!qx.test(S))&&K(P,`invalid component name ${JSON.stringify(String(S)).slice(0,80)}`),(f==="none"||f==="text")&&K(P,`${p} accepts only text`),f==="inline"&&N&&!bv.has(S)&&K(P,`${p} accepts only text, Text, Link, Code and Badge`),f==="items"!=(S==="ListItem")&&K(P,"ListItem must be a direct child of List, and List holds only ListItem"),h&&xv.has(S)&&K(P,`a ListItem with onPress cannot contain a ${S}`),++r+a>V.maxNodes&&K(P,`more than ${V.maxNodes} nodes`),d>V.maxDepth&&K(P,`deeper than ${V.maxDepth}`);for(let me of Object.keys(l))Wx.has(me)||K(P,`unknown node field ${me.slice(0,64)}`);let x=l.key;x!==void 0&&((typeof x!="string"||x.length>V.maxLabelLength)&&K(P,"key must be a short string"),y.has(x)&&K(P,`duplicate key ${JSON.stringify(x.slice(0,64))} among siblings`),y.add(x));let A=x===void 0?{}:{key:x};if(!N){i(`unknown component ${S}; showing a placeholder`),k.push({type:"Unsupported",...A,props:{name:S},children:[]}),s+=$d+S.length;continue}let w=l.props??{};(!hd(w)||Object.keys(w).length>V.maxPropsPerNode)&&K(P,"props must be an object with few fields");let O=ek(S,w,i);if(!O){k.push({type:"Unsupported",...A,props:{name:S},children:[]}),s+=$d+S.length;continue}s+=$d+JSON.stringify(O).length,s>V.maxTreeBytes&&K(P,`tree exceeds ${V.maxTreeBytes} bytes`);let ye=[],gr={type:S,...A,props:O,children:ye};k.push(gr);let Qe=Qx(l.children,P);Qe.length>V.maxNodes&&K(P,`more than ${V.maxNodes} children`);let vr=new Set,Oo=h||S==="ListItem"&&O.onPress!==void 0;for(let me=Qe.length-1;me>=0;me--)t.push({raw:Qe[me],depth:d+1,parentType:S,policy:mr[S].children,inPressable:Oo,siblingKeys:vr,out:ye,path:`${P}.children.${me}`})}}catch(c){if(c instanceof To)return{ok:!1,error:c.message};throw c}let u=o[0];return typeof u=="object"?{ok:!0,tree:u,nodes:r,warnings:[...n]}:{ok:!1,error:"tree: expected a node"}}var fr=m.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),bt=m.string().min(1).max(64),tk=m.union([m.string().max(V.maxTextLength),m.number().refine(Number.isFinite),m.boolean(),m.null()]),yA=m.object({document:bt,revision:fr,callback:m.string().min(1).max(V.maxCallbackIdLength).regex(md),args:m.array(tk).max(V.maxEventArgs),edit:fr.optional()}).strict(),nk=m.object({document:bt,revision:fr,tree:m.unknown()}).strict(),Iv=m.object({document:bt.optional(),revision:fr,message:m.string().max(V.maxLabelLength*4),stack:m.string().max(8192).optional()}).strict();function Sv(e){let n=nk.safeParse(e);if(!n.success)return{ok:!1,document:null,revision:null,error:"malformed render"};let{document:i,revision:o}=n.data,t=kv(n.data.tree);return t.ok?{...t,document:i,revision:o}:{ok:!1,document:i,revision:o,error:t.error}}var _A=m.object({document:bt,revision:fr,accepted:m.boolean(),retryAfterMs:m.number().int().nonnegative().max(6e4).optional()}).strict(),bA=m.object({document:bt}).strict(),wv=/^[A-Za-z0-9_.:-]{1,128}$/,rk=["plugin","workspace"],yd=m.number().int().min(0).max(1e6),xA=m.object({version:yd,value:m.json()}).strict().refine(e=>JSON.stringify(e.value).length<=Io,"persisted value is too large"),Pv=m.object({document:bt,entries:m.array(m.object({scope:m.enum(rk),key:m.string().regex(wv),version:yd,value:m.json()}).strict()).min(1).max(64)}).strict(),kA=m.object({document:bt,entries:m.array(m.object({key:m.string().regex(wv),version:yd,value:m.json().optional()}).strict().refine(e=>JSON.stringify(e.value??null).length<=Io,"retained value is too large")).min(1).max(64)}).strict();import{installOrcaDeclarativeRuntime as uk}from"./orca-runtime.mjs";var ik={Stack:"group",Row:"group",Card:"region",Text:"text",Heading:"heading",Button:"button",IconButton:"button",Badge:"status",List:"list",ListItem:"listitem",Input:"textbox",Switch:"switch",Select:"combobox",Separator:"separator",Progress:"progressbar",Spinner:"status",EmptyState:"group",Link:"link",Code:"code",Unsupported:"unsupported"};function Av(e){if(typeof e=="string")return e;let n=e.props;return[...["title","description"].map(o=>n[o]).filter(o=>typeof o=="string"),...e.children.map(Av)].join(" ")}var _d=e=>e.replace(/\s+/g," ").trim();function ok(e){let n=e.props,i=n.label??n.title;return typeof i=="string"?i:void 0}function ak(e,n){let i=e.props,o=e.type==="ListItem"&&i.onPress!==void 0;return{type:e.type,key:e.key?.startsWith("#")?void 0:e.key,role:o?"button":ik[e.type]??"generic",label:ok(e),text:_d(Av(e)),props:i,disabled:i.disabled===!0,path:n}}function Do(e){let n=[],i=(o,t)=>{n.push(ak(o,t)),o.children.forEach((r,a)=>{typeof r!="string"&&i(r,`${t}/${r.key??`#${a}`}`)})};return e&&i(e,e.key??"#0"),n}function zv(e,n){return e===void 0?!1:typeof n=="string"?_d(e)===_d(n):n.test(e)}function Nv(e,n){return(n.type===void 0||e.type===n.type)&&(n.role===void 0||e.role===n.role)&&(n.text===void 0||zv(e.text,n.text))&&(n.label===void 0||zv(e.label,n.label))&&(n.testId===void 0||e.key===n.testId)}function Tv(e){return e.filter(n=>!e.some(i=>i.path.startsWith(`${n.path}/`)))}function Dv(e){return Object.entries(e).map(([n,i])=>`${n}: ${i instanceof RegExp?String(i):JSON.stringify(i)}`).join(", ")}function bd(e){if(typeof e=="string")return e;let n={};for(let[i,o]of Object.entries(e.props)){if(i.startsWith("$"))continue;let t=typeof o=="object"&&o!==null&&"$callback"in o;n[i]=t?"[handler]":o}return{type:e.type,...e.key&&!e.key.startsWith("#")?{key:e.key}:{},...Object.keys(n).length>0?{props:n}:{},...e.children.length>0?{children:e.children.map(bd)}:{}}}var xd={Input:"value",Select:"value",Switch:"checked"};function Ov(){let e=new Map;function n(o){let t=e.get(o.path);if(t)return t;let r=xd[o.type];if(!r)throw new Error(`a ${o.type} has no value; expected an Input, Switch or Select`);let a=o.props[r],s=o.props[r==="checked"?"defaultChecked":"defaultValue"],u=a??s??(r==="checked"?!1:""),c={value:typeof u=="boolean"?u:String(u),sent:0};return e.set(o.path,c),c}function i(o,t){let r=xd[o.type];if(r&&o.props[r]!==void 0&&o.props.onChange===void 0)throw new Error(`the ${o.type} is read-only: it has a ${r} and no onChange`);let a=n(o);return a.sent+=1,a.value=t,{value:t,id:a.sent}}return{observe(o){let t=new Map;for(let r of o){let a=xd[r.type];if(!a)continue;let s=e.get(r.path)??n(r),u=r.props[a],c=r.props[Po];u!==void 0&&(typeof c=="number"?c:0)>=s.sent&&(s.value=typeof u=="boolean"?u:String(u)),t.set(r.path,s)}e=t},valueOf:o=>n(o).value,typeInto(o,t,r){if(o.type!=="Input")throw new Error(`type: a ${o.type} takes no text; expected an Input`);let a=r?"":String(n(o).value),s=[];r&&s.push(i(o,a));for(let u of t)a+=u,s.push(i(o,a));return s},toggle(o){if(o.type!=="Switch")throw new Error(`toggle: expected a Switch, not a ${o.type}`);return i(o,!n(o).value)},select(o,t){if(o.type!=="Select")throw new Error(`select: expected a Select, not a ${o.type}`);let a=(Array.isArray(o.props.options)?o.props.options:[]).find(s=>typeof s=="object"&&s!==null&&"value"in s&&s.value===t);if(!a||typeof a=="object"&&"disabled"in a&&a.disabled===!0)throw new Error(`select: the Select has no enabled option "${t}"`);return i(o,t)}}}function Ev(e){let n=new Map,i=(s,u)=>{let c=n.get(s)??new Set;return c.add(u),n.set(s,c),{dispose:()=>c.delete(u)}},o=(s,u)=>{for(let c of n.get(s)??[])c(u)},t=s=>u=>typeof u=="object"&&u!==null&&s in u?Object.getOwnPropertyDescriptor(u,s)?.value:void 0,r=()=>{};return{facades:{plugin:{request:(s,u,c)=>{let l=typeof c=="object"&&c!==null&&"timeoutMs"in c?c.timeoutMs:void 0;return e("plugin.request",{name:s,...u===void 0?{}:{input:u},...typeof l=="number"?{timeoutMs:l}:{}}).then(t("output"))},on:(s,u)=>i(`message:${s}`,u)},storage:{get:s=>e("storage.get",{key:s}).then(u=>t("value")(u)??null),set:(s,u)=>e("storage.set",{key:s,value:u}).then(r),delete:s=>e("storage.delete",{key:s}).then(r),keys:async()=>{let s=t("keys")(await e("storage.keys"));return Array.isArray(s)?s.map(String):[]},onDidChange:s=>i("changed:storage",u=>s({key:String(u)}))},settings:{get:async s=>{let u=t("settings")(await e("settings.get"));return s===void 0?u:t(s)(u)},set:(s,u)=>e("settings.set",{key:s,value:u}).then(r),onDidChange:s=>i("changed:settings",u=>s({key:String(u)}))},secrets:{get:async s=>{let u=t("value")(await e("secrets.get",{key:s}));return typeof u=="string"?u:null},set:(s,u)=>e("secrets.set",{key:s,value:u}).then(r),delete:s=>e("secrets.delete",{key:s}).then(r)}},post:(s,u)=>o(`message:${s}`,u),changed:(s,u)=>o(`changed:${s}`,u)}}var jv=Symbol.for("orca.testing.stored");function Uv(e,n){return Object.freeze({[jv]:!0,version:n,value:e})}function sk(e){return typeof e=="object"&&e!==null&&jv in e}function Lv(e,n){for(let i of["plugin","workspace"])for(let[o,t]of Object.entries(n?.[i]??{}))e[i].set(o,sk(t)?{version:t.version,value:t.value}:{version:1,value:t})}function Cv(e){return"path"in e}var ck=100,lk=()=>new Promise(e=>typeof setImmediate=="function"?setImmediate(e):setTimeout(e,0));async function Rv(e,n){let i=n.host,o=new Map,t=(x,A)=>{for(let w of o.get(x)??[])w(A)},r=[],a=[],s=[],u={plugin:new Map,workspace:new Map};Lv(u,n.persisted);let c=n.visible??!0,l={document:"",revision:0,tree:null},d=Ov(),p=Ev(i.bridge.call),f=i.onDataChange(p.changed);function h(x,A){if(x===Ae.ready)t(Ae.hydrate,{panel:{id:n.panelId??"panel"},visible:c,plugin:Object.fromEntries(u.plugin),workspace:Object.fromEntries(u.workspace)});else if(x===Ae.render){let w=Sv(A);if(!w.ok){a.push({kind:"refused",message:w.error}),w.document!==null&&w.revision!==null&&t(Ae.ack,{document:w.document,revision:w.revision,accepted:!1});return}s.push(...w.warnings.filter(O=>!s.includes(O))),l={document:w.document,revision:w.revision,tree:w.tree},d.observe(Do(w.tree)),t(Ae.ack,{document:w.document,revision:w.revision,accepted:!0})}else if(x===Ae.error){let w=Iv.safeParse(A);a.push(w.success?{kind:"plugin",message:w.data.message,...w.data.stack?{stack:w.data.stack}:{}}:{kind:"plugin",message:String(A)})}else if(x===Ae.persist){let w=Pv.safeParse(A);if(!w.success){a.push({kind:"refused",message:"persisted state Orca would not store"});return}for(let O of w.data.entries)u[O.scope].set(O.key,{version:O.version,value:O.value})}}let y=uk({post:h,awaitHydration:!0,colorScheme:n.theme??"dark",schedule:x=>r.push(x),bridge:{api:i.bridge.api,locale:n.locale??"en",host:{call:i.bridge.call,has:i.bridge.has},...p.facades,on(x,A){let w=o.get(x)??new Set;return w.add(A),o.set(x,w),{dispose:()=>w.delete(A)}}}});async function k(){for(let x=0;xTv(Do(l.tree).filter(A=>Nv(A,x)));function S(x,A){let w=Cv(x)?Do(l.tree).find(O=>O.path===x.path):P(x)[0];if(!w)throw new Error(Cv(x)?`${A}: the element is no longer in the panel`:`${A}: nothing in the panel matches { ${Dv(x)} }`);if(w.disabled)throw new Error(`${A}: the ${w.type} is disabled`);return w}function N(x,A,w){let O=typeof x=="object"&&x!==null&&"$callback"in x?x.$callback:null;typeof O=="string"&&t(Ae.event,{document:l.document,revision:l.revision,callback:O,args:A,...w===void 0?{}:{edit:w}})}return await Promise.resolve(typeof e=="function"?{default:e}:e).then(x=>y.boot(x)).catch(x=>a.push({kind:"plugin",message:x instanceof Error?x.message:String(x),...x instanceof Error&&x.stack?{stack:x.stack}:{}})),await k(),{host:i,errors:a,warnings:s,find:x=>P(x)[0]??null,findAll:P,tree:()=>l.tree?bd(l.tree):null,get persisted(){let x=A=>Object.fromEntries([...u[A]].map(([w,O])=>[w,O.value]));return{plugin:x("plugin"),workspace:x("workspace"),storage:i.data().storage}},settled:k,async press(x){let A=S(x,"press"),{href:w,onPress:O}=A.props;if(A.type==="Link"&&typeof w=="string")i.grantGesture(),i.bridge.call("shell.openExternal",{url:w}).catch(()=>{});else{if(O===void 0)throw new Error(`press: the ${A.type} has no onPress`);i.grantGesture()}N(O,[]),await k()},async type(x,A,w={}){let O=S(x,"type");for(let ye of d.typeInto(O,A,w.replace===!0))N(O.props.onChange,[ye.value],ye.id),await k();w.submit&&(N(O.props.onSubmit,[d.valueOf(O)]),await k())},async submit(x){let A=S(x,"submit");N(A.props.onSubmit,[d.valueOf(A)]),await k()},async toggle(x){let A=S(x,"toggle"),w=d.toggle(A);N(A.props.onChange,[w.value],w.id),await k()},async select(x,A){let w=S(x,"select"),O=d.select(w,A);N(w.props.onChange,[O.value],O.id),await k()},valueOf:x=>d.valueOf(S(x,"valueOf")),async emit(x,A){t(x,A),await k()},async post(x,A){p.post(x,A),await k()},async setVisible(x){c=x,t(Ae.visibility,{visible:x}),await k()},async rerender(){y.rerender(),await k()},async unmount(){y.dispose(),o.clear(),f()}}}import{test as KA,describe as HA,beforeEach as WA,afterEach as XA}from"node:test";import{default as YA}from"node:assert/strict";function mk(){for(let e=process.cwd();;e=Zv(e))try{let n=JSON.parse(dk(pk(e,"orca-plugin.json"),"utf8")),i=typeof n=="object"&&n!==null&&"capabilities"in n?n.capabilities:[];return Array.isArray(i)?i.flatMap(o=>typeof o=="object"&&o!==null&&"kind"in o&&typeof o.kind=="string"?[o.kind]:[]):[]}catch{if(Zv(e)===e)return[]}}function fk(e={}){return cv(e,mk())}function FA(e,n={}){return Rv(e,{...n,host:n.host??fk()})}export{XA as afterEach,YA as assert,WA as beforeEach,HA as describe,ke as hostError,fk as mockHost,FA as mount,Uv as stored,KA as test}; diff --git a/resources/plugins/declarative/orca.d.ts b/resources/plugins/declarative/orca.d.ts index 64c94dfcb6b..ed436d9bfa1 100644 --- a/resources/plugins/declarative/orca.d.ts +++ b/resources/plugins/declarative/orca.d.ts @@ -1,6 +1,7 @@ -// Author typings for Orca components panels (`"ui": "components"`). Copy this file into a plugin -// project and list it in tsconfig `files`/`include`. Mirrors src/shared/plugins/declarative/ -// (checked by plugin-declarative-typings.test.ts); host methods are generated from the host API. +// Author typings for Orca components panels (`"ui": "components"`); `orca plugin types` installs +// them with types/orca-services.d.ts, which adds `shell`, `files`, `on`, `plugin`, `storage`, +// `settings` and `secrets` to this module. Mirrors src/shared/plugins/declarative/ (checked by +// plugin-declarative-typings.test.ts); host methods are generated from the host API. declare module 'orca' { export type OrcaElement = { readonly $$typeof: symbol } @@ -209,10 +210,15 @@ declare module 'orca' { export const Fragment: unique symbol export function h(type: unknown, props: object | null, ...children: OrcaNode[]): OrcaElement - /** Where a keyed atom survives: this panel run, every run of the plugin, or per workspace. */ - export type PersistScope = 'memory' | 'plugin' | 'workspace' + /** + * Where a keyed atom survives: this panel run, every run of the plugin, per workspace, or the + * plugin's own storage under the atom's key (`storage:own`), shared with its worker and other + * panels and kept current when they change it. + */ + export type PersistScope = 'memory' | 'plugin' | 'workspace' | 'storage' export type AtomOptions = { - /** `plugin` and `workspace` values must be plain JSON; they load before the first render. */ + /** Persisted values must be plain JSON; they load before the first render. `storage` values + * are stored as they are, so `version` and `migrate` do not apply to them. */ persist?: PersistScope /** Bump when the stored shape changes; `migrate` then receives the older value. */ version?: number @@ -251,13 +257,50 @@ declare module 'orca' { // export type HostMethods = { /** Branch, name and terminal ids of the focused workspace, or null when none is focused. */ - "workspace.readContext": { params: Record | undefined; result: { branch: string; displayName: string; terminals: { id: string }[] } | null } + "workspace.readContext": { params: Record | undefined; result: { branch: string; displayName: string; terminals: { id: string; title?: string }[] } | null } /** Shows a desktop notification. */ "notifications.show": { params: { title: string; body?: string }; result: { delivered: boolean } } + /** Reads a JSON value from the plugin's private store; null when absent. */ + "storage.get": { params: { key: string }; result: { value: JsonValue } } + /** Writes a JSON value to the plugin's private store. */ + "storage.set": { params: { key: string; value: JsonValue }; result: { ok: true } } + /** Removes a key from the plugin's private store. */ + "storage.delete": { params: { key: string }; result: { ok: true } } + /** Lists the keys in the plugin's private store. */ + "storage.keys": { params: Record | undefined; result: { keys: string[] } } + /** Reads a secret from the plugin's encrypted secrets file; null when absent. */ + "secrets.get": { params: { key: string }; result: { value: string | null } } + /** Stores a secret in the plugin's encrypted secrets file. */ + "secrets.set": { params: { key: string; value: string }; result: { ok: true } } + /** Removes a secret from the plugin's encrypted secrets file. */ + "secrets.delete": { params: { key: string }; result: { ok: true } } + /** How secrets are protected at rest: `os-keyring`, or `unavailable` (no OS key store, or Linux `basic_text`), where `secrets.set` fails. */ + "secrets.protection": { params: Record | undefined; result: { status: "os-keyring" | "unavailable" } } + /** Reads every setting the plugin owns. */ + "settings.get": { params: Record | undefined; result: { settings: Record } } + /** Writes one setting the plugin owns. */ + "settings.set": { params: { key: string; value: JsonValue }; result: { ok: true } } /** Opens an http:, https: or mailto: URL in the default browser. Needs a click or key press in the frame; desktop app only. Orca asks the person before an http(s) host the plugin was not allowed; `opened` is false if they cancel. */ - "shell.openExternal": { params: { url: string }; result: { opened: boolean } } + "shell.openExternal": { params: { url: string }; result: { opened: boolean; reason?: "cancelled" | "consent-unavailable" } } /** Offers data (a string or ArrayBuffer, up to 64 MiB) in Orca's save dialog; the plugin never learns the path. Needs a click or key press in the frame; desktop app only. */ "files.saveAs": { params: { suggestedName?: string; mimeType?: string; data: string | ArrayBuffer }; result: { status: "saved" | "cancelled" } } + /** Asks the plugin's own worker to run the handler it registered with `orca.panels.handle(name)`, starting the worker if needed; resolves with what the handler returned. `unknown_method` when no handler has that name. */ + "plugin.request": { params: { name: string; input?: JsonValue; timeoutMs?: number }; result: { output: JsonValue } } + /** The agents in the focused workspace: their terminal, title, agent kind and status. `agent.status.changed` reports each change after. */ + "agents.list": { params: Record | undefined; result: { agents: { terminalId: string | null; title: string | null; agent: string | null; state: "working" | "blocked" | "waiting" | "done"; stateStartedAt: number }[] } } + /** Delivers a workspace or agent event to this panel as `orca.on(event)`; needs the event's read capability. The frame APIs call it for you. */ + "events.subscribe": { params: { event: "workspace.created" | "workspace.removed" | "agent.status.changed" | "workspace.changed" }; result: { ok: true } } + } + /** Workspace and agent events `on(event)` delivers, with the read capability of their domain. */ + export type PluginEvents = { + /** A worktree workspace was created. */ + "workspace.created": { workspaceId: string; kind: "worktree" | "folder"; path: string; branch: string } + /** A worktree workspace was removed. */ + "workspace.removed": { workspaceId: string; kind: "worktree" | "folder"; path: string } + /** An agent in a terminal pane changed status; `workspaceId` is null when Orca cannot tie the pane to a workspace, and `terminalId` names its terminal when Orca lists it. */ + "agent.status.changed": { workspaceId: string | null; paneKey: string; terminalId?: string; title?: string; state: "working" | "blocked" | "waiting" | "done"; receivedAt: number; mainAgent?: { state: "working" | "blocked" | "waiting" | "done"; outcome?: "success" | "failure" | "cancellation" | "superseded" | "interruption" | "unconfirmed"; stateStartedAt: number } } + /** The focused workspace changed, or its terminals were opened, closed or renamed; `context` is what `workspace.readContext` now answers. */ + "workspace.changed": { context: { branch: string; displayName: string; terminals: { id: string; title?: string }[] } | null } } // export type HostMethod = keyof HostMethods @@ -280,24 +323,6 @@ declare module 'orca' { readonly theme: Theme readonly client: 'desktop' } - /** Needs a press on one of the panel's controls; see "User gestures". */ - export const shell: { - openExternal(url: string): Promise - } - /** Needs a press on one of the panel's controls; see "User gestures". */ - export const files: { - saveAs( - options: HostMethods['files.saveAs']['params'] - ): Promise - } - /** Events a panel can subscribe to. */ - export type OrcaEvents = { - theme: { colorScheme: 'light' | 'dark' } - } - export function on( - event: E, - handler: (payload: OrcaEvents[E]) => void - ): Disposable export type ComponentName = | 'Stack' | 'Row' diff --git a/resources/plugins/types/orca-frame.d.ts b/resources/plugins/types/orca-frame.d.ts index 6d98b7af382..5cd9fb0cc6e 100644 --- a/resources/plugins/types/orca-frame.d.ts +++ b/resources/plugins/types/orca-frame.d.ts @@ -2,7 +2,16 @@ // Mirrors src/shared/plugins/frames/plugin-panel-shell.ts (checked by plugin-frame-typings.test.ts). declare module 'orca/frame' { - import type { Disposable, HostApi, HostApiVersion } from 'orca/host' + import type { + Disposable, + HostApi, + HostApiVersion, + PluginBridgeApi, + PluginEvents, + SecretsApi, + SettingsApi, + StorageApi + } from 'orca/host' export type FrameTheme = { colorScheme: 'light' | 'dark' } /** `bytes` documents come from editors whose manifest sets `"contentKind": "bytes"`. */ @@ -17,8 +26,9 @@ declare module 'orca/frame' { } /** The whole new content, made against document `baseVersion`. */ export type EditorEdit = { baseVersion: number; content: EditorContent } - /** Payloads of `orca.on(event, handler)`. */ - export type FrameEvents = { + /** Payloads of `orca.on(event, handler)`: frame events, and workspace and agent events (each + * needs the read capability of its domain: `workspace:read` or `agent:read`). */ + export type FrameEvents = PluginEvents & { /** The `--orca-*` variables and the `light`/`dark` class on `` already changed. */ theme: FrameTheme /** Custom editors: a new document; `orca.document.onDidChange` is the usual way to listen. */ @@ -47,8 +57,21 @@ declare module 'orca/frame' { ): Disposable /** Orca's UI language as a BCP-47 tag. */ readonly locale: string + /** Your plugin's own worker: `request` its handlers, hear what it `post`s. */ + readonly plugin: PluginBridgeApi + /** The plugin's own storage, the same its worker uses (`storage:own`). */ + readonly storage: StorageApi + /** The plugin's settings, declared ones with their defaults (`settings:own`). */ + readonly settings: SettingsApi + /** The plugin's encrypted secrets (`secrets:own`). */ + readonly secrets: SecretsApi /** Desktop isolated frames only; needs a click or key press in the frame. */ - readonly shell?: { openExternal(url: string): Promise<{ opened: boolean }> } + readonly shell?: { + /** `reason`: the person cancelled, or Orca's window was hidden so nobody could confirm. */ + openExternal( + url: string + ): Promise<{ opened: boolean; reason?: 'cancelled' | 'consent-unavailable' }> + } /** Desktop isolated frames only; `cancelled` when the person closes the dialog. */ readonly files?: { saveAs(options: SaveAsOptions): Promise<{ status: 'saved' | 'cancelled' }> diff --git a/resources/plugins/types/orca-host.d.ts b/resources/plugins/types/orca-host.d.ts index 3f9e50ec496..886d2923d4d 100644 --- a/resources/plugins/types/orca-host.d.ts +++ b/resources/plugins/types/orca-host.d.ts @@ -1,7 +1,23 @@ // Generated by `pnpm generate:plugin-author-typings` from src/shared/plugins. Do not edit. -// Host API 1.1 types shared by frames (`window.orca`) and workers (`activate(orca)`). +// Host API 1.2 types shared by frames (`window.orca`) and workers (`activate(orca)`). declare module 'orca/host' { + // Why from 'orca': authors declare `PluginRequests` and `PluginPanelEvents` there once, and + // workers, frames and components panels all read the same contract. + export type { + DataChange, + PluginBridgeApi, + PluginPanelEvents, + PluginRequestArgs, + PluginRequestInput, + PluginRequestOptions, + PluginRequestOutput, + PluginRequests, + SecretsApi, + SettingsApi, + StorageApi, + Undeclared + } from 'orca' export type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue } export type Disposable = { dispose(): void } /** `orca.api`: check `minor` (or `host.has`) before calling a method newer than your oldest Orca. */ @@ -21,7 +37,7 @@ declare module 'orca/host' { /** Branch, name and terminal ids of the focused workspace, or null when none is focused. Since host API 1.0. */ "workspace.readContext": { params: Record | undefined - result: { branch: string; displayName: string; terminals: { id: string }[] } | null + result: { branch: string; displayName: string; terminals: { id: string; title?: string }[] } | null surfaces: "worker" | "panel" | "editor" } /** Types text into one terminal named by id, optionally pressing Enter. Since host API 1.0. */ @@ -36,70 +52,70 @@ declare module 'orca/host' { result: { delivered: boolean } surfaces: "worker" | "panel" | "editor" } - /** Reads a JSON value from the plugin's private store; null when absent. Since host API 1.0. */ + /** Reads a JSON value from the plugin's private store; null when absent. Since host API 1.0 (panels and editors: 1.2). */ "storage.get": { params: { key: string } result: { value: JsonValue } - surfaces: "worker" + surfaces: "worker" | "panel" | "editor" } - /** Writes a JSON value to the plugin's private store. Since host API 1.0. */ + /** Writes a JSON value to the plugin's private store. Since host API 1.0 (panels and editors: 1.2). */ "storage.set": { params: { key: string; value: JsonValue } result: { ok: true } - surfaces: "worker" + surfaces: "worker" | "panel" | "editor" } - /** Removes a key from the plugin's private store. Since host API 1.0. */ + /** Removes a key from the plugin's private store. Since host API 1.0 (panels and editors: 1.2). */ "storage.delete": { params: { key: string } result: { ok: true } - surfaces: "worker" + surfaces: "worker" | "panel" | "editor" } - /** Lists the keys in the plugin's private store. Since host API 1.0. */ + /** Lists the keys in the plugin's private store. Since host API 1.0 (panels and editors: 1.2). */ "storage.keys": { params: Record | undefined result: { keys: string[] } - surfaces: "worker" + surfaces: "worker" | "panel" | "editor" } - /** Reads a secret from the plugin's encrypted secrets file; null when absent. Since host API 1.0. */ + /** Reads a secret from the plugin's encrypted secrets file; null when absent. Since host API 1.0 (panels and editors: 1.2). */ "secrets.get": { params: { key: string } result: { value: string | null } - surfaces: "worker" + surfaces: "worker" | "panel" | "editor" } - /** Stores a secret in the plugin's encrypted secrets file. Since host API 1.0. */ + /** Stores a secret in the plugin's encrypted secrets file. Since host API 1.0 (panels and editors: 1.2). */ "secrets.set": { params: { key: string; value: string } result: { ok: true } - surfaces: "worker" + surfaces: "worker" | "panel" | "editor" } - /** Removes a secret from the plugin's encrypted secrets file. Since host API 1.0. */ + /** Removes a secret from the plugin's encrypted secrets file. Since host API 1.0 (panels and editors: 1.2). */ "secrets.delete": { params: { key: string } result: { ok: true } - surfaces: "worker" + surfaces: "worker" | "panel" | "editor" } - /** How secrets are protected at rest: `os-keyring`, or `unavailable` (no OS key store, or Linux `basic_text`), where `secrets.set` fails. Since host API 1.1. */ + /** How secrets are protected at rest: `os-keyring`, or `unavailable` (no OS key store, or Linux `basic_text`), where `secrets.set` fails. Since host API 1.1 (panels and editors: 1.2). */ "secrets.protection": { params: Record | undefined result: { status: "os-keyring" | "unavailable" } - surfaces: "worker" + surfaces: "worker" | "panel" | "editor" } - /** Reads every setting the plugin owns. Since host API 1.0. */ + /** Reads every setting the plugin owns. Since host API 1.0 (panels and editors: 1.2). */ "settings.get": { params: Record | undefined result: { settings: Record } - surfaces: "worker" + surfaces: "worker" | "panel" | "editor" } - /** Writes one setting the plugin owns. Since host API 1.0. */ + /** Writes one setting the plugin owns. Since host API 1.0 (panels and editors: 1.2). */ "settings.set": { params: { key: string; value: JsonValue } result: { ok: true } - surfaces: "worker" + surfaces: "worker" | "panel" | "editor" } /** Opens an http:, https: or mailto: URL in the default browser. Needs a click or key press in the frame; desktop app only. Orca asks the person before an http(s) host the plugin was not allowed; `opened` is false if they cancel. Since host API 1.1. */ "shell.openExternal": { params: { url: string } - result: { opened: boolean } + result: { opened: boolean; reason?: "cancelled" | "consent-unavailable" } surfaces: "panel" | "editor" } /** Offers data (a string or ArrayBuffer, up to 64 MiB) in Orca's save dialog; the plugin never learns the path. Needs a click or key press in the frame; desktop app only. Since host API 1.1. */ @@ -108,6 +124,24 @@ declare module 'orca/host' { result: { status: "saved" | "cancelled" } surfaces: "panel" | "editor" } + /** Asks the plugin's own worker to run the handler it registered with `orca.panels.handle(name)`, starting the worker if needed; resolves with what the handler returned. `unknown_method` when no handler has that name. Since host API 1.2. */ + "plugin.request": { + params: { name: string; input?: JsonValue; timeoutMs?: number } + result: { output: JsonValue } + surfaces: "panel" | "editor" + } + /** The agents in the focused workspace: their terminal, title, agent kind and status. `agent.status.changed` reports each change after. Since host API 1.2. */ + "agents.list": { + params: Record | undefined + result: { agents: { terminalId: string | null; title: string | null; agent: string | null; state: "working" | "blocked" | "waiting" | "done"; stateStartedAt: number }[] } + surfaces: "worker" | "panel" | "editor" + } + /** Delivers a workspace or agent event to this panel as `orca.on(event)`; needs the event's read capability. The frame APIs call it for you. Since host API 1.2. */ + "events.subscribe": { + params: { event: "workspace.created" | "workspace.removed" | "agent.status.changed" | "workspace.changed" } + result: { ok: true } + surfaces: "panel" | "editor" + } } export type HostMethodName = keyof HostMethods /** Methods a surface may call; any other gets `not_permitted`. */ @@ -132,8 +166,10 @@ declare module 'orca/host' { "workspace.created": { workspaceId: string; kind: "worktree" | "folder"; path: string; branch: string } /** A worktree workspace was removed. */ "workspace.removed": { workspaceId: string; kind: "worktree" | "folder"; path: string } - /** An agent in a terminal pane changed status; `workspaceId` is null when Orca cannot tie the pane to a workspace. */ - "agent.status.changed": { workspaceId: string | null; paneKey: string; state: "working" | "blocked" | "waiting" | "done"; receivedAt: number; mainAgent?: { state: "working" | "blocked" | "waiting" | "done"; outcome?: "success" | "failure" | "cancellation" | "superseded" | "interruption" | "unconfirmed"; stateStartedAt: number } } + /** An agent in a terminal pane changed status; `workspaceId` is null when Orca cannot tie the pane to a workspace, and `terminalId` names its terminal when Orca lists it. */ + "agent.status.changed": { workspaceId: string | null; paneKey: string; terminalId?: string; title?: string; state: "working" | "blocked" | "waiting" | "done"; receivedAt: number; mainAgent?: { state: "working" | "blocked" | "waiting" | "done"; outcome?: "success" | "failure" | "cancellation" | "superseded" | "interruption" | "unconfirmed"; stateStartedAt: number } } + /** The focused workspace changed, or its terminals were opened, closed or renamed; `context` is what `workspace.readContext` now answers. */ + "workspace.changed": { context: { branch: string; displayName: string; terminals: { id: string; title?: string }[] } | null } } export type PluginEventName = keyof PluginEvents } diff --git a/resources/plugins/types/orca-services.d.ts b/resources/plugins/types/orca-services.d.ts new file mode 100644 index 00000000000..16cb25d8a93 --- /dev/null +++ b/resources/plugins/types/orca-services.d.ts @@ -0,0 +1,115 @@ +// Author typings for what a plugin reaches outside its own UI: shell and files, events, the panel +// ↔ worker contract and the plugin's own storage, settings and secrets. Merges into module 'orca' +// (orca.d.ts), which components panels import; 'orca/host' re-exports the shared types for frames +// and workers. Mirrors declarative-sdk.ts, plugin-panel-shell-facades.ts and +// plugin-worker-orca-api.ts. + +declare module 'orca' { + /** Needs a press on one of the panel's controls; see "User gestures". */ + export const shell: { + openExternal(url: string): Promise + } + /** Needs a press on one of the panel's controls; see "User gestures". */ + export const files: { + saveAs( + options: HostMethods['files.saveAs']['params'] + ): Promise + } + /** Events a panel can subscribe to: the theme, and workspace and agent events (each needs the + * read capability of its domain: `workspace:read` or `agent:read`). */ + export type OrcaEvents = { + theme: { colorScheme: 'light' | 'dark' } + } & PluginEvents + export function on( + event: E, + handler: (payload: OrcaEvents[E]) => void + ): Disposable + /** + * Your panel ↔ worker contract, declared once with declaration merging and imported by both + * sides, so requests and their answers are typed end to end: + * + * declare module 'orca' { + * interface PluginRequests { 'todos.list': { input: { done?: boolean }; output: Todo[] } } + * interface PluginPanelEvents { 'todos.changed': { count: number } } + * } + */ + // oxlint-disable-next-line typescript/consistent-type-definitions -- declaration merging needs an interface + export interface PluginRequests {} + /** Events your worker sends with `orca.panels.post(event, payload)`. */ + // oxlint-disable-next-line typescript/consistent-type-definitions -- declaration merging needs an interface + export interface PluginPanelEvents {} + /** What a declared request takes; `undefined` when it declares no `input`. */ + export type PluginRequestInput = PluginRequests[K] extends { + input: infer I + } + ? I + : undefined + /** What a declared request answers with; `null` when it declares no `output`. */ + export type PluginRequestOutput = PluginRequests[K] extends { + output: infer O + } + ? O + : null + /** `timeoutMs` (at most 120000, default 30000) is how long the worker may take. */ + export type PluginRequestOptions = { signal?: AbortSignal; timeoutMs?: number } + export type PluginRequestArgs = + undefined extends PluginRequestInput + ? [input?: PluginRequestInput, options?: PluginRequestOptions] + : [input: PluginRequestInput, options?: PluginRequestOptions] + /** A name the plugin did not declare, which then carries any JSON. */ + export type Undeclared = N extends keyof Declared ? never : N + /** Your plugin's own worker. */ + export type PluginBridgeApi = { + /** Runs the worker handler `orca.panels.handle(name)` registered, starting the worker if it + * is not running. Rejects with `unknown_method` (no such handler), `timeout`, `unavailable` + * (no worker), or the `code` the handler threw. */ + request( + name: K, + ...args: PluginRequestArgs + ): Promise> + request( + name: Undeclared, + input?: JsonValue, + options?: PluginRequestOptions + ): Promise + /** What the worker posts with `orca.panels.post(event, payload)`. */ + on( + event: K, + handler: (payload: PluginPanelEvents[K]) => void + ): Disposable + on( + event: Undeclared, + handler: (payload: JsonValue) => void + ): Disposable + } + /** A key someone (you, another panel, the worker or the person in Settings) changed. */ + export type DataChange = { key: string } + /** The plugin's own JSON store (`storage:own`), the same one its worker uses. */ + export type StorageApi = { + /** `null` when the key is absent. */ + get(key: string): Promise + set(key: string, value: JsonValue): Promise + delete(key: string): Promise + keys(): Promise + onDidChange(listener: (change: DataChange) => void): Disposable + } + /** The plugin's settings (`settings:own`): those it declares in `contributes.settings` read as + * their `default` until the person changes them in Settings. */ + export type SettingsApi = { + get(): Promise> + get(key: string): Promise + /** Declared settings refuse a value of the wrong type with `action_failed`. */ + set(key: string, value: JsonValue): Promise + onDidChange(listener: (change: DataChange) => void): Disposable + } + /** The plugin's encrypted secrets (`secrets:own`). */ + export type SecretsApi = { + get(key: string): Promise + set(key: string, value: string): Promise + delete(key: string): Promise + } + export const plugin: PluginBridgeApi + export const storage: StorageApi + export const settings: SettingsApi + export const secrets: SecretsApi +} diff --git a/resources/plugins/types/orca-testing.d.ts b/resources/plugins/types/orca-testing.d.ts index 2bd0483f324..d3543ed52eb 100644 --- a/resources/plugins/types/orca-testing.d.ts +++ b/resources/plugins/types/orca-testing.d.ts @@ -1,6 +1,16 @@ // Test kit for components panels: `orca plugin test` runs *.test.ts(x) files in plain Node. declare module 'orca/testing' { - import type { OrcaEvents, OrcaNode, PanelContext } from 'orca' + import type { + JsonValue, + OrcaEvents, + OrcaNode, + PanelContext, + PluginPanelEvents, + PluginRequestInput, + PluginRequestOutput, + PluginRequests, + Undeclared + } from 'orca' /** One element of the drawn panel. Actions take it, or a query that finds it. */ export type TestElement = { @@ -39,12 +49,32 @@ declare module 'orca/testing' { readonly calls: readonly { method: string; params: unknown }[] callsOf(method: string): unknown[] respond(method: string, result: unknown): void + /** The plugin's storage, settings and secrets as they are now. */ + data(): { + storage: Record + settings: Record + secrets: Record + } } + /** A stand-in for the plugin's worker: each `plugin.request` name's answer, or a function of + * its input (it may throw `hostError(...)`). An unlisted name rejects with `unknown_method`. */ + export type MockRequests = { + [K in keyof PluginRequests]?: + | PluginRequestOutput + | ((input: PluginRequestInput) => PluginRequestOutput | Promise>) + } & Record export type MockHostOptions = { /** Granted capabilities; defaults to those the plugin's orca-plugin.json declares. */ capabilities?: readonly string[] - /** Each method's answer: a value, or a function of the params that may throw `hostError(...)`. */ + /** Each method's answer: a value, or a function of the params that may throw `hostError(...)`. + * Overrides the built-in storage, settings, secrets and `requests`. */ results?: Record + requests?: MockRequests + /** What the plugin's storage, settings and secrets hold before the panel runs. Writes land + * here, and tell the panel's `onDidChange` listeners and `persist: 'storage'` atoms. */ + storage?: Record + settings?: Record + secrets?: Record } /** * A stand-in Orca host that refuses what Orca refuses, with the same codes: a missing @@ -76,8 +106,12 @@ declare module 'orca/testing' { readonly errors: readonly PanelIssue[] /** Props and components Orca would drop, as Orca would warn. */ readonly warnings: readonly string[] - /** What persisted atoms hold now, by scope and key. */ - readonly persisted: { plugin: Record; workspace: Record } + /** What persisted atoms hold now, by scope and key; `storage` is the plugin's storage. */ + readonly persisted: { + plugin: Record + workspace: Record + storage: Record + } /** The innermost match, or null. */ find(query: TestQuery): TestElement | null findAll(query: TestQuery): TestElement[] @@ -96,7 +130,14 @@ declare module 'orca/testing' { select(target: Target, value: string): Promise /** What Orca shows in an Input, Switch or Select. */ valueOf(target: Target): unknown + /** An Orca event: `theme`, or a workspace or agent event the panel subscribed to. */ emit(event: E, payload: OrcaEvents[E]): Promise + /** What the plugin's worker posts with `orca.panels.post`; `plugin.on` handlers hear it. */ + post(event: K, payload: PluginPanelEvents[K]): Promise + post( + event: Undeclared, + payload?: JsonValue + ): Promise setVisible(visible: boolean): Promise rerender(): Promise settled(): Promise diff --git a/resources/plugins/types/orca-worker.d.ts b/resources/plugins/types/orca-worker.d.ts index b4a509612a4..5521d4654d0 100644 --- a/resources/plugins/types/orca-worker.d.ts +++ b/resources/plugins/types/orca-worker.d.ts @@ -7,8 +7,17 @@ declare module 'orca/worker' { Disposable, HostApi, HostApiVersion, + JsonValue, PluginEventName, - PluginEvents + PluginEvents, + PluginPanelEvents, + PluginRequestInput, + PluginRequestOutput, + PluginRequests, + SecretsApi, + SettingsApi, + StorageApi, + Undeclared } from 'orca/host' export type { @@ -22,6 +31,38 @@ declare module 'orca/worker' { /** `signal` aborts when Orca stops waiting for the command. */ export type CommandContext = { signal: AbortSignal } + /** The open panel or editor that asked; `id` stays the same while it stays open. */ + export type PanelCaller = { id: string; surface: 'panel' | 'editor'; contributionId: string } + /** `signal` aborts when the request times out or its panel closes. */ + export type PanelRequestContext = { panel: PanelCaller; signal: AbortSignal } + export type PanelsApi = { + /** Answers a panel's `plugin.request(name, input)` with a JSON value. A thrown error whose + * `code` is a host error code (`invalid_params`, `conflict`, ...) reaches the panel with it; + * any other is `action_failed`. */ + handle( + name: K, + handler: ( + input: PluginRequestInput, + context: PanelRequestContext + ) => PluginRequestOutput | Promise> + ): Disposable + handle( + name: Undeclared, + handler: (input: JsonValue | undefined, context: PanelRequestContext) => unknown + ): Disposable + /** To every open panel of this plugin, or one (`panel` from a request's context). Fire and + * forget: at most 256 KiB, 200 per 10 s. */ + post( + event: K, + payload: PluginPanelEvents[K], + options?: { panel?: string } + ): void + post( + event: Undeclared, + payload?: JsonValue, + options?: { panel?: string } + ): void + } export type OrcaWorkerApi = { readonly api: HostApiVersion readonly commands: { @@ -39,11 +80,21 @@ declare module 'orca/worker' { ): Disposable } readonly host: HostApi<'worker'> + /** This plugin's panels and custom editors. */ + readonly panels: PanelsApi + /** Same store as panels' `storage` (`storage:own`); `onDidChange` hears their writes too. */ + readonly storage: StorageApi + /** `settings:own`; `onDidChange` also hears the person changing them in Settings. */ + readonly settings: SettingsApi + /** `secrets:own`. */ + readonly secrets: SecretsApi /** Consented capability kinds; informational, the host re-checks every call. */ readonly grantedCapabilities: readonly string[] /** Lands in `orca plugin logs`. */ log(message: string): void } - /** The default export of a worker's `main` module; `deactivate` may be exported beside it. */ + /** A worker's `main` must export it as the DEFAULT export (`export default function + * activate(orca)`); Orca calls it once when the worker starts and never calls a named + * `activate`. An optional `export function deactivate()` is awaited before it stops. */ export type Activate = (orca: OrcaWorkerApi) => void | Promise } diff --git a/skill-guides/orca-plugin-authoring.md b/skill-guides/orca-plugin-authoring.md index 32ca1fb60a4..34052ce4683 100644 --- a/skill-guides/orca-plugin-authoring.md +++ b/skill-guides/orca-plugin-authoring.md @@ -21,8 +21,9 @@ Pass `--json` to every `ORCA plugin` command and branch on `error.code`, not on runs Orca; with `--environment` pass an absolute path on that server. - **Types:** `ORCA plugin types ` (also run by `dev load` and `dev watch`) writes `.orca/types/`: `orca` (components panels), `orca-frame` (the global `orca` in HTML panels and - editors), `orca-worker` (`import type { OrcaWorkerApi } from 'orca/worker'`) and `orca-host` - (host methods and event payloads). The plugin's `tsconfig.json` extends + editors), `orca-worker` (`import type { OrcaWorkerApi } from 'orca/worker'`), `orca-host` + (host methods and event payloads), `orca-services` (the panel ↔ worker contract and plugin data, + merged into `orca`) and `orca-testing`. The plugin's `tsconfig.json` extends `./.orca/types/tsconfig.json`. Never edit `.orca/`; it ignores itself in Git. - **Ground truth:** the generated references below describe the Orca this CLI belongs to. Read them instead of guessing props, methods or fields. @@ -43,14 +44,63 @@ Use the lowest `execution` profile that covers the request; it decides what the | A sidebar panel needing its own HTML, canvas or libraries | `sandboxed-ui`; `panels` entry `.html` (or `.ts`/`.tsx`) | `--template panel` | | A palette command or shortcut for a built-in Orca action | `declarative`; `commands[].action`, `keybindings` | hand-written; fields in `references/manifest.md` | | A command that runs code, storage, secrets, terminal text | `trusted-worker`; `main`, `commands` (no `action`), `capabilities` | example `hello-orca` | +| A panel backed by its own Node code, storage or settings | `trusted-worker`; `main`, a panel, `capabilities`, `settings` | example `hello-worker-panel` | +| Settings the user edits in Orca's Settings | `contributes.settings` and `settings:own` | `references/manifest.md` | | Reacting to workspace or agent status changes | `trusted-worker`; `main`, `contributes.events`, `*:read` capability | example `hello-orca` | | A virtual machine environment recipe | `declarative`; `contributes.vmRecipes` | hand-written; fields in `references/manifest.md` | Examples are in `examples/plugins/` of github.com/stablyai/orca. Status bar items, sidebar cards, -task sources, connections, MCP servers, skills, hooks and plugin settings UI are reserved and not -buildable yet: say so instead of faking them. A panel cannot type into a terminal; only a worker +task sources, connections, MCP servers, skills and hooks are reserved and not buildable yet: say +so instead of faking them. A panel cannot type into a terminal; only a worker with `terminal:send` can. +## Panels, workers and data + +A plugin's panels and its worker are one program. Use this when a panel needs Node, long work, +secrets or state the worker also uses; a panel alone needs none of it. + +- Declare the contract once in a file both include (`src/protocol.ts`): + `declare module 'orca' { interface PluginRequests { 'todos.list': { input: { done?: boolean }; output: Todo[] } } interface PluginPanelEvents { 'todos.changed': { count: number } } }`. + Declared names are typed on both sides; any other name carries JSON. +- Worker: `orca.panels.handle(name, async (input, { panel, signal }) => output)` answers; + `orca.panels.post(event, payload, { panel? })` pushes to every open panel of the plugin, or to + `panel.id` from a request. Answers are JSON (1 MiB); posts 256 KiB, 200 per 10 s. +- Panel: `plugin.request(name, input, { signal, timeoutMs })` (frames: `orca.plugin.request`) + starts the worker when needed; `plugin.on(event, handler)` hears posts. It rejects with + `unknown_method` (no handler), `timeout` (default 30 s, max 120 s; the handler's `signal` + aborts then and when the panel closes), `unavailable` (no worker), or the host error `code` the + handler threw. It needs `main`, so the plugin is `trusted-worker`. +- Every surface shares the plugin's `storage` (`storage:own`), `settings` (`settings:own`) and + `secrets` (`secrets:own`), each with `onDidChange(({ key }) => ...)` heard on all surfaces. + `atom('todos', [], { persist: 'storage' })` keeps an atom in storage under its key: the worker + reads `orca.storage.get('todos')`, and its writes update the atom. +- `contributes.settings` (with `settings:own`) declares settings the user edits under the plugin + in Orca's Settings: `{ key, title, type: 'string'|'number'|'integer'|'boolean', default, enum, + minimum, maximum, multiline, ... }`. `settings.get(key)` reads the user's value or the default. +- Panels hear workspace and agent events with `on('agent.status.changed', ...)` (frames: + `orca.on`) and the same `*:read` capability as workers, without `contributes.events`. +- Test with `mockHost({ requests, storage, settings, secrets })` and `panel.post(event, payload)` + (see Test and check). +- The worker's `main` must `export default function activate(orca)`; a named + `export function activate` is never called (the worker fails to start, saying so). It runs once + when the worker starts; an optional `export function deactivate()` is awaited before it stops. + An idle worker stops and restarts on its next command, event or panel request. + +### Recipe: live agent status in a panel + +`sandboxed-ui` is enough; capabilities `agent:read` and `workspace:read`. + +1. In `setup(ctx)`, `host.call('agents.list')` once: each agent's `terminalId`, `title`, `agent`, + `state` and `stateStartedAt` in the focused workspace. +2. Push `on('agent.status.changed', ({ terminalId, title, state }) => ...)` into + `ctx.subscriptions` and update the row with that `terminalId` (the id + `workspace.readContext` lists and `terminal.sendText` takes; `paneKey` is Orca's own id). +3. Push `on('workspace.changed', ...)` too and re-run `agents.list`: it fires when focus moves + or terminals open, close or are renamed, with the new `readContext` answer in `context`. +4. Keep the rows in an atom and render them as `List`/`ListItem`. Never poll. +5. Test it with `mockHost({ results: { 'agents.list': { agents: [...] } } })` and + `panel.emit('agent.status.changed', payload)`. + ## No build step - `.ts`, `.tsx`, `.mts` and `.jsx` load as written; transpiling strips types and never @@ -126,6 +176,10 @@ test('adds a task', async () => { - `mockHost({ capabilities, results })` (pass as `host`) refuses what Orca refuses: undeclared capabilities, bad params, and `shell.openExternal`/`files.saveAs` without a `press` first. `results` values or functions may throw `hostError(code)`; `callsOf(method)` records calls. +- It keeps `storage`, `settings` and `secrets` in memory (seed them in `mockHost({ ... })`, read + them with `host.data()`), so `persist: 'storage'` atoms and `onDidChange` work under `mount`. + `requests: { name: answer | (input) => answer }` fakes the worker for `plugin.request`; + `panel.post(event, payload)` is a worker post (`plugin.on`); `panel.emit` is an Orca event. - Mount the module, never call its default export: without `mount` there is no runtime. A control with `value` but no `onChange` is read-only, so `type`/`toggle` throw on it. @@ -161,7 +215,8 @@ Settings → Plugins (on a windowless `orca serve` host, `ORCA plugin system on` - `update(atom, fn)` takes an updater function only; `set(atom, value)` stores a value. - Keyed atoms (`atom('draft', '')`) survive a hot reload; unkeyed `atom(0)`, module variables and `setup` start over. `persist: 'plugin'` or `'workspace'` survive restarts and must be plain - JSON; bump `version` (with `migrate`) when the stored shape changes. + JSON; bump `version` (with `migrate`) when the stored shape changes. `persist: 'storage'` lives + in the plugin's storage (`storage:own`), unversioned, shared with the worker. - Components panels have no hooks and no DOM: state lives in atoms, and `read()` while rendering subscribes. `set` and `update` throw while rendering. Give reordering list items a `key`. - A save that fails to load keeps the last good render with an inline `file:line:column` error. diff --git a/skill-guides/orca-plugin-authoring/references/components.md b/skill-guides/orca-plugin-authoring/references/components.md index ece178e1f79..808dc61a7e3 100644 --- a/skill-guides/orca-plugin-authoring/references/components.md +++ b/skill-guides/orca-plugin-authoring/references/components.md @@ -53,18 +53,32 @@ Everything a components panel (`"ui": "components"`) imports comes from `orca`. - `env.locale: string`: Orca's UI language (BCP-47). - `env.theme: Theme`: Reading it while rendering re-renders on light/dark switches. - `env.client: 'desktop'` -- `shell.openExternal(url: string)`: Needs a press on one of the panel's controls; see "User gestures". -- `files.saveAs(options: HostMethods['files.saveAs']['params'])`: Needs a press on one of the panel's controls; see "User gestures". - `ui.catalog: number`: Grows with the component catalog. - `ui.has(component: string, prop?: string)`: Whether this Orca draws `component` (and accepts `prop` on it, when given). +- `shell.openExternal(url: string)`: Needs a press on one of the panel's controls; see "User gestures". +- `files.saveAs(options: HostMethods['files.saveAs']['params'])`: Needs a press on one of the panel's controls; see "User gestures". +- `plugin: PluginBridgeApi` +- `storage: StorageApi` +- `settings: SettingsApi` +- `secrets: SecretsApi` + +## Panel ↔ worker contract + +Declare requests and worker posts once with declaration merging, in a file both the panel and the worker include: `declare module 'orca' { interface PluginRequests { 'todos.list': { input: { done?: boolean }; output: Todo[] } } interface PluginPanelEvents { 'todos.changed': { count: number } } }`. Declared names are typed end to end (`plugin.request`, `plugin.on`, the worker's `orca.panels.handle` and `orca.panels.post`, and `orca/testing`'s `requests` and `panel.post`); any other name carries JSON. ## Types -- `PersistScope = 'memory' | 'plugin' | 'workspace'`: Where a keyed atom survives: this panel run, every run of the plugin, or per workspace. +- `PersistScope = 'memory' | 'plugin' | 'workspace' | 'storage'`: Where a keyed atom survives: this panel run, every run of the plugin, per workspace, or the plugin's own storage under the atom's key (`storage:own`), shared with its worker and other panels and kept current when they change it. - `AtomOptions = { persist?: PersistScope; version?: number; migrate?: (stored: JsonValue, fromVersion: number) => T }` - `PanelContext = { subscriptions: Disposable[]; signal: AbortSignal; visible: ReadonlyAtom; panel: { id: string } }`: Passed to the module's optional `export function setup(ctx)`. - `PanelSetup = (ctx: PanelContext) => void | (() => void)`: Runs once, after persisted atoms load and before the first render. - `HostError = Error & { code: string; retryable: boolean; retryAfterMs?: number }`: Rejections carry a `code` (`not_permitted`, `capability_denied`, `timeout`, ...). +- `PluginRequestOptions = { signal?: AbortSignal; timeoutMs?: number }`: `timeoutMs` (at most 120000, default 30000) is how long the worker may take. +- `PluginBridgeApi = { request(name: K, ...args: PluginRequestArgs): Promise>; request(name: Undeclared, input?: JsonValue, options?: PluginRequestOptions): Promise; on(event: K, handler: (payload: PluginPanelEvents[K]) => void): Disposable; on(event: Undeclared, handler: (payload: JsonValue) => void): Disposable }`: Your plugin's own worker. +- `DataChange = { key: string }`: A key someone (you, another panel, the worker or the person in Settings) changed. +- `StorageApi = { get(key: string): Promise; set(key: string, value: JsonValue): Promise; delete(key: string): Promise; keys(): Promise; onDidChange(listener: (change: DataChange) => void): Disposable }`: The plugin's own JSON store (`storage:own`), the same one its worker uses. +- `SettingsApi = { get(): Promise>; get(key: string): Promise; set(key: string, value: JsonValue): Promise; onDidChange(listener: (change: DataChange) => void): Disposable }`: The plugin's settings (`settings:own`): those it declares in `contributes.settings` read as their `default` until the person changes them in Settings. +- `SecretsApi = { get(key: string): Promise; set(key: string, value: string): Promise; delete(key: string): Promise }`: The plugin's encrypted secrets (`secrets:own`). ## Limits diff --git a/skill-guides/orca-plugin-authoring/references/events.md b/skill-guides/orca-plugin-authoring/references/events.md index 459dc3b5e67..fc6ad165c2c 100644 --- a/skill-guides/orca-plugin-authoring/references/events.md +++ b/skill-guides/orca-plugin-authoring/references/events.md @@ -10,8 +10,10 @@ List each in `contributes.events` (`{ "on": "" }`), with `main`, the `tru `{ workspaceId: string; kind: "worktree" | "folder"; path: string; branch: string }` - `workspace.removed` (capability `workspace:read`; since 1.4.245): A worktree workspace was removed. `{ workspaceId: string; kind: "worktree" | "folder"; path: string }` -- `agent.status.changed` (capability `agent:read`; since 1.4.160): An agent in a terminal pane changed status; `workspaceId` is null when Orca cannot tie the pane to a workspace. - `{ workspaceId: string | null; paneKey: string; state: "working" | "blocked" | "waiting" | "done"; receivedAt: number; mainAgent?: { state: "working" | "blocked" | "waiting" | "done"; outcome?: "success" | "failure" | "cancellation" | "superseded" | "interruption" | "unconfirmed"; stateStartedAt: number } }` +- `agent.status.changed` (capability `agent:read`; since 1.4.160): An agent in a terminal pane changed status; `workspaceId` is null when Orca cannot tie the pane to a workspace, and `terminalId` names its terminal when Orca lists it. + `{ workspaceId: string | null; paneKey: string; terminalId?: string; title?: string; state: "working" | "blocked" | "waiting" | "done"; receivedAt: number; mainAgent?: { state: "working" | "blocked" | "waiting" | "done"; outcome?: "success" | "failure" | "cancellation" | "superseded" | "interruption" | "unconfirmed"; stateStartedAt: number } }` +- `workspace.changed` (capability `workspace:read`; since 1.4.246): The focused workspace changed, or its terminals were opened, closed or renamed; `context` is what `workspace.readContext` now answers. + `{ context: { branch: string; displayName: string; terminals: { id: string; title?: string }[] } | null }` ## Frame events (`orca.on(event, handler)` in HTML panels and custom editors) @@ -22,3 +24,4 @@ List each in `contributes.events` (`{ "on": "" }`), with `main`, the `tru ## Components panel events (`on(event, handler)` from `orca`) - `theme: { colorScheme: 'light' | 'dark' }` +- Every worker event above, with the same payload and capability; a panel needs no `contributes.events` entry, it subscribes while it is open. HTML panels get them on `orca.on` too. diff --git a/skill-guides/orca-plugin-authoring/references/host-api.md b/skill-guides/orca-plugin-authoring/references/host-api.md index bb6fc147ce2..501031be449 100644 --- a/skill-guides/orca-plugin-authoring/references/host-api.md +++ b/skill-guides/orca-plugin-authoring/references/host-api.md @@ -2,13 +2,13 @@ -Host API 1.1 (`"pluginApi": 1`). Call `host.call(method, params, { signal })`; a surface not listed for a method gets `not_permitted`. Params are strict: a field this Orca does not know is refused with `invalid_params`, so check `host.has(method)` or `api.minor` before using a method newer than your `engines.orca` floor. Each call also needs the manifest capability and the user's approval. +Host API 1.2 (`"pluginApi": 1`). Call `host.call(method, params, { signal })`; a surface not listed for a method gets `not_permitted`. Params are strict: a field this Orca does not know is refused with `invalid_params`, so check `host.has(method)` or `api.minor` before using a method newer than your `engines.orca` floor. Each call also needs the manifest capability and the user's approval. ## Methods per surface -- Worker (`trusted-worker`, `main`): `orca` passed to `activate(orca)`: `workspace.readContext`, `terminal.sendText`, `notifications.show`, `storage.get`, `storage.set`, `storage.delete`, `storage.keys`, `secrets.get`, `secrets.set`, `secrets.delete`, `secrets.protection`, `settings.get`, `settings.set` -- Panel: global `orca` in an HTML panel; `host` imported from `orca` in a components panel: `workspace.readContext`, `notifications.show`, `shell.openExternal`, `files.saveAs` -- Custom editor: global `orca` in the editor frame: `workspace.readContext`, `notifications.show`, `shell.openExternal`, `files.saveAs` +- Worker (`trusted-worker`, `main`): `orca` passed to `activate(orca)`: `workspace.readContext`, `terminal.sendText`, `notifications.show`, `storage.get`, `storage.set`, `storage.delete`, `storage.keys`, `secrets.get`, `secrets.set`, `secrets.delete`, `secrets.protection`, `settings.get`, `settings.set`, `agents.list` +- Panel: global `orca` in an HTML panel; `host` imported from `orca` in a components panel: `workspace.readContext`, `notifications.show`, `storage.get`, `storage.set`, `storage.delete`, `storage.keys`, `secrets.get`, `secrets.set`, `secrets.delete`, `secrets.protection`, `settings.get`, `settings.set`, `shell.openExternal`, `files.saveAs`, `plugin.request`, `agents.list`, `events.subscribe` +- Custom editor: global `orca` in the editor frame: `workspace.readContext`, `notifications.show`, `storage.get`, `storage.set`, `storage.delete`, `storage.keys`, `secrets.get`, `secrets.set`, `secrets.delete`, `secrets.protection`, `settings.get`, `settings.set`, `shell.openExternal`, `files.saveAs`, `plugin.request`, `agents.list`, `events.subscribe` ## Worker API (`import type { OrcaWorkerApi } from 'orca/worker'`) @@ -16,6 +16,10 @@ Host API 1.1 (`"pluginApi": 1`). Call `host.call(method, params, { signal })`; a - `commands.register(commandId: string, handler: (args: unknown, context: CommandContext) => unknown)`: A string result is shown as-is in Orca; anything else as JSON. - `events.on(event: E, handler: (payload: PluginEvents[E]) => void | Promise)`: Only events listed in the manifest's `contributes.events` arrive. - `host: HostApi<'worker'>` +- `panels: PanelsApi`: This plugin's panels and custom editors. +- `storage: StorageApi`: Same store as panels' `storage` (`storage:own`); `onDidChange` hears their writes too. +- `settings: SettingsApi`: `settings:own`; `onDidChange` also hears the person changing them in Settings. +- `secrets: SecretsApi`: `secrets:own`. - `grantedCapabilities: readonly string[]`: Consented capability kinds; informational, the host re-checks every call. - `log(message: string)`: Lands in `orca plugin logs`. @@ -25,7 +29,11 @@ Host API 1.1 (`"pluginApi": 1`). Call `host.call(method, params, { signal })`; a - `host: HostApi<'panel' | 'editor'>` - `on(event: E, handler: (payload: FrameEvents[E]) => unknown)` - `locale: string`: Orca's UI language as a BCP-47 tag. -- `shell.openExternal(url: string)`: Desktop isolated frames only; needs a click or key press in the frame. +- `plugin: PluginBridgeApi`: Your plugin's own worker: `request` its handlers, hear what it `post`s. +- `storage: StorageApi`: The plugin's own storage, the same its worker uses (`storage:own`). +- `settings: SettingsApi`: The plugin's settings, declared ones with their defaults (`settings:own`). +- `secrets: SecretsApi`: The plugin's encrypted secrets (`secrets:own`). +- `shell.openExternal(url: string)`: `reason`: the person cancelled, or Orca's window was hidden so nobody could confirm. - `files.saveAs(options: SaveAsOptions)`: Desktop isolated frames only; `cancelled` when the person closes the dialog. - `document?: EditorDocumentApi`: Custom editors only. - `document.get()` @@ -35,35 +43,41 @@ Host API 1.1 (`"pluginApi": 1`). Call `host.call(method, params, { signal })`; a ## Methods - `workspace.readContext` (capability `workspace:read`; worker, panel, editor; since 1.0): Branch, name and terminal ids of the focused workspace, or null when none is focused. - `(params?: {}) => { branch: string; displayName: string; terminals: { id: string }[] } | null` + `(params?: {}) => { branch: string; displayName: string; terminals: { id: string; title?: string }[] } | null` - `terminal.sendText` (capability `terminal:send`; worker; since 1.0): Types text into one terminal named by id, optionally pressing Enter. `(params: { terminalId: string; text: string; enter?: boolean }) => { accepted: boolean }` - `notifications.show` (capability `notifications:show`; worker, panel, editor; since 1.0): Shows a desktop notification. `(params: { title: string; body?: string }) => { delivered: boolean }` -- `storage.get` (capability `storage:own`; worker; since 1.0): Reads a JSON value from the plugin's private store; null when absent. +- `storage.get` (capability `storage:own`; worker, panel, editor; since 1.0): Reads a JSON value from the plugin's private store; null when absent. `(params: { key: string }) => { value: JSON }` -- `storage.set` (capability `storage:own`; worker; since 1.0): Writes a JSON value to the plugin's private store. +- `storage.set` (capability `storage:own`; worker, panel, editor; since 1.0): Writes a JSON value to the plugin's private store. `(params: { key: string; value: JSON }) => { ok: true }` -- `storage.delete` (capability `storage:own`; worker; since 1.0): Removes a key from the plugin's private store. +- `storage.delete` (capability `storage:own`; worker, panel, editor; since 1.0): Removes a key from the plugin's private store. `(params: { key: string }) => { ok: true }` -- `storage.keys` (capability `storage:own`; worker; since 1.0): Lists the keys in the plugin's private store. +- `storage.keys` (capability `storage:own`; worker, panel, editor; since 1.0): Lists the keys in the plugin's private store. `(params?: {}) => { keys: string[] }` -- `secrets.get` (capability `secrets:own`; worker; since 1.0): Reads a secret from the plugin's encrypted secrets file; null when absent. +- `secrets.get` (capability `secrets:own`; worker, panel, editor; since 1.0): Reads a secret from the plugin's encrypted secrets file; null when absent. `(params: { key: string }) => { value: string | null }` -- `secrets.set` (capability `secrets:own`; worker; since 1.0): Stores a secret in the plugin's encrypted secrets file. +- `secrets.set` (capability `secrets:own`; worker, panel, editor; since 1.0): Stores a secret in the plugin's encrypted secrets file. `(params: { key: string; value: string }) => { ok: true }` -- `secrets.delete` (capability `secrets:own`; worker; since 1.0): Removes a secret from the plugin's encrypted secrets file. +- `secrets.delete` (capability `secrets:own`; worker, panel, editor; since 1.0): Removes a secret from the plugin's encrypted secrets file. `(params: { key: string }) => { ok: true }` -- `secrets.protection` (capability `secrets:own`; worker; since 1.1): How secrets are protected at rest: `os-keyring`, or `unavailable` (no OS key store, or Linux `basic_text`), where `secrets.set` fails. +- `secrets.protection` (capability `secrets:own`; worker, panel, editor; since 1.1): How secrets are protected at rest: `os-keyring`, or `unavailable` (no OS key store, or Linux `basic_text`), where `secrets.set` fails. `(params?: {}) => { status: "os-keyring" | "unavailable" }` -- `settings.get` (capability `settings:own`; worker; since 1.0): Reads every setting the plugin owns. +- `settings.get` (capability `settings:own`; worker, panel, editor; since 1.0): Reads every setting the plugin owns. `(params?: {}) => { settings: Record }` -- `settings.set` (capability `settings:own`; worker; since 1.0): Writes one setting the plugin owns. +- `settings.set` (capability `settings:own`; worker, panel, editor; since 1.0): Writes one setting the plugin owns. `(params: { key: string; value: JSON }) => { ok: true }` - `shell.openExternal` (no capability; panel, editor; since 1.1; needs a user gesture): Opens an http:, https: or mailto: URL in the default browser. Needs a click or key press in the frame; desktop app only. Orca asks the person before an http(s) host the plugin was not allowed; `opened` is false if they cancel. - `(params: { url: string }) => { opened: boolean }` + `(params: { url: string }) => { opened: boolean; reason?: "cancelled" | "consent-unavailable" }` - `files.saveAs` (no capability; panel, editor; since 1.1; needs a user gesture): Offers data (a string or ArrayBuffer, up to 64 MiB) in Orca's save dialog; the plugin never learns the path. Needs a click or key press in the frame; desktop app only. `(params: { suggestedName?: string; mimeType?: string; data: string | ArrayBuffer }) => { status: "saved" | "cancelled" }` +- `plugin.request` (no capability; panel, editor; since 1.2): Asks the plugin's own worker to run the handler it registered with `orca.panels.handle(name)`, starting the worker if needed; resolves with what the handler returned. `unknown_method` when no handler has that name. + `(params: { name: string; input?: JSON; timeoutMs?: number }) => { output: JSON }` +- `agents.list` (capability `agent:read`; worker, panel, editor; since 1.2): The agents in the focused workspace: their terminal, title, agent kind and status. `agent.status.changed` reports each change after. + `(params?: {}) => { agents: { terminalId: string | null; title: string | null; agent: string | null; state: "working" | "blocked" | "waiting" | "done"; stateStartedAt: number }[] }` +- `events.subscribe` (no capability; panel, editor; since 1.2): Delivers a workspace or agent event to this panel as `orca.on(event)`; needs the event's read capability. The frame APIs call it for you. + `(params: { event: "workspace.created" | "workspace.removed" | "agent.status.changed" | "workspace.changed" }) => { ok: true }` ## Capabilities diff --git a/skill-guides/orca-plugin-authoring/references/manifest.md b/skill-guides/orca-plugin-authoring/references/manifest.md index 9cfe8d98aca..52ffeb56236 100644 --- a/skill-guides/orca-plugin-authoring/references/manifest.md +++ b/skill-guides/orca-plugin-authoring/references/manifest.md @@ -35,7 +35,7 @@ - `panels` (PanelContribution[], since 1.4.160): Sidebar panels. At most 64. - `commands` (CommandContribution[], since 1.4.160): Command palette entries. At most 256. -- `events` (EventContribution[], since 1.4.160): Events delivered to the plugin worker. At most 3. +- `events` (EventContribution[], since 1.4.160): Events delivered to the plugin worker. At most 4. - `languagePacks` (LanguagePackContribution[], since 1.4.160): Interface translations. At most 16. - `keybindings` (KeybindingContribution[], since 1.4.160): Keyboard shortcuts for contributed commands. At most 256. - `vmRecipes` (VmRecipeContribution[], since 1.4.160): Virtual machine environment recipes. At most 64. @@ -45,8 +45,9 @@ - `syntaxes` (SyntaxContribution[], since 1.4.245): Syntax highlighting for editor languages. At most 16. - `customEditors` (CustomEditorContribution[], since 1.4.245): Editors that open files of given types in the editor tab. At most 16. - `newFiles` (NewFileContribution[], since 1.4.245): Untitled files the user can create from the + menu and the command palette. At most 16. +- `settings` (SettingContribution[], since 1.4.246): Settings Orca shows under the plugin in Settings; code reads them with `settings.get` (`settings:own`). At most 64. -Reserved (must stay empty arrays): `agentHarnesses`, `skills`, `mcpServers`, `hooks`, `taskSources`, `connections`, `settings`, `statusBarItems`, `sidebarCards`. +Reserved (must stay empty arrays): `agentHarnesses`, `skills`, `mcpServers`, `hooks`, `taskSources`, `connections`, `statusBarItems`, `sidebarCards`. ## PanelContribution @@ -71,7 +72,7 @@ A command palette entry. Requires the `declarative` execution profile or higher. An event subscription. Requires `main`, the `trusted-worker` execution profile and the capability of the event's domain: `workspace:read` for workspace events, `agent:read` for agent events. -- `on` ("workspace.created" | "workspace.removed" | "agent.status.changed", required, since 1.4.160): Event delivered to the plugin worker. +- `on` ("workspace.created" | "workspace.removed" | "agent.status.changed" | "workspace.changed", required, since 1.4.160): Event delivered to the plugin worker. ## LanguagePackContribution @@ -138,6 +139,23 @@ A kind of untitled file the user can create from the tab bar + menu or the comma - `template` (string, since 1.4.245): UTF-8 file copied into the new file, at most 256 KB. Without one the file starts empty. - `icon` (string, since 1.4.245): Square image shown beside the menu item. Defaults to the plugin icon. PNG, WEBP, static, at least 128×128, square, at most 256 KB. +## SettingContribution + +A setting shown under the plugin in Settings. Requires the `settings:own` capability, which is also how code reads it. + +- `key` (string, required, since 1.4.246): Key code reads and writes, unique in this plugin. +- `title` (string, required, since 1.4.246): Label shown in Settings. +- `description` (string, since 1.4.246): Help text shown under the label. +- `type` ("string" | "number" | "integer" | "boolean", required, since 1.4.246): JSON Schema type of the value. +- `default` (string | number | boolean, since 1.4.246): Value read while the person has not set one. +- `enum` (string | number[], since 1.4.246): Allowed values; Settings shows a picker. +- `enumLabels` (string[], since 1.4.246): Picker labels, one per `enum` value. +- `minimum` (number, since 1.4.246): Numbers: smallest value. +- `maximum` (number, since 1.4.246): Numbers: largest value. +- `maxLength` (integer, since 1.4.246): Strings: most characters. +- `multiline` (boolean, since 1.4.246): Strings: a multi-line text box. +- `placeholder` (string, since 1.4.246): Strings and numbers: hint shown while empty. + ## Capability A host API the plugin may call once the user consents. diff --git a/src/cli/bundled-skill-guides.ts b/src/cli/bundled-skill-guides.ts index 62926a99118..8a19b8c833b 100644 --- a/src/cli/bundled-skill-guides.ts +++ b/src/cli/bundled-skill-guides.ts @@ -2527,8 +2527,9 @@ const ORCA_PLUGIN_AUTHORING_MARKDOWN = [ " runs Orca; with `--environment` pass an absolute path on that server.", "- **Types:** `ORCA plugin types ` (also run by `dev load` and `dev watch`) writes", " `.orca/types/`: `orca` (components panels), `orca-frame` (the global `orca` in HTML panels and", - " editors), `orca-worker` (`import type { OrcaWorkerApi } from 'orca/worker'`) and `orca-host`", - " (host methods and event payloads). The plugin's `tsconfig.json` extends", + " editors), `orca-worker` (`import type { OrcaWorkerApi } from 'orca/worker'`), `orca-host`", + " (host methods and event payloads), `orca-services` (the panel ↔ worker contract and plugin data,", + " merged into `orca`) and `orca-testing`. The plugin's `tsconfig.json` extends", " `./.orca/types/tsconfig.json`. Never edit `.orca/`; it ignores itself in Git.", "- **Ground truth:** the generated references below describe the Orca this CLI belongs to. Read", " them instead of guessing props, methods or fields.", @@ -2549,14 +2550,63 @@ const ORCA_PLUGIN_AUTHORING_MARKDOWN = [ "| A sidebar panel needing its own HTML, canvas or libraries | `sandboxed-ui`; `panels` entry `.html` (or `.ts`/`.tsx`) | `--template panel` |", "| A palette command or shortcut for a built-in Orca action | `declarative`; `commands[].action`, `keybindings` | hand-written; fields in `references/manifest.md` |", "| A command that runs code, storage, secrets, terminal text | `trusted-worker`; `main`, `commands` (no `action`), `capabilities` | example `hello-orca` |", + "| A panel backed by its own Node code, storage or settings | `trusted-worker`; `main`, a panel, `capabilities`, `settings` | example `hello-worker-panel` |", + "| Settings the user edits in Orca's Settings | `contributes.settings` and `settings:own` | `references/manifest.md` |", "| Reacting to workspace or agent status changes | `trusted-worker`; `main`, `contributes.events`, `*:read` capability | example `hello-orca` |", "| A virtual machine environment recipe | `declarative`; `contributes.vmRecipes` | hand-written; fields in `references/manifest.md` |", "", "Examples are in `examples/plugins/` of github.com/stablyai/orca. Status bar items, sidebar cards,", - "task sources, connections, MCP servers, skills, hooks and plugin settings UI are reserved and not", - "buildable yet: say so instead of faking them. A panel cannot type into a terminal; only a worker", + "task sources, connections, MCP servers, skills and hooks are reserved and not buildable yet: say", + "so instead of faking them. A panel cannot type into a terminal; only a worker", "with `terminal:send` can.", "", + "## Panels, workers and data", + "", + "A plugin's panels and its worker are one program. Use this when a panel needs Node, long work,", + "secrets or state the worker also uses; a panel alone needs none of it.", + "", + "- Declare the contract once in a file both include (`src/protocol.ts`):", + " `declare module 'orca' { interface PluginRequests { 'todos.list': { input: { done?: boolean }; output: Todo[] } } interface PluginPanelEvents { 'todos.changed': { count: number } } }`.", + " Declared names are typed on both sides; any other name carries JSON.", + "- Worker: `orca.panels.handle(name, async (input, { panel, signal }) => output)` answers;", + " `orca.panels.post(event, payload, { panel? })` pushes to every open panel of the plugin, or to", + " `panel.id` from a request. Answers are JSON (1 MiB); posts 256 KiB, 200 per 10 s.", + "- Panel: `plugin.request(name, input, { signal, timeoutMs })` (frames: `orca.plugin.request`)", + " starts the worker when needed; `plugin.on(event, handler)` hears posts. It rejects with", + " `unknown_method` (no handler), `timeout` (default 30 s, max 120 s; the handler's `signal`", + " aborts then and when the panel closes), `unavailable` (no worker), or the host error `code` the", + " handler threw. It needs `main`, so the plugin is `trusted-worker`.", + "- Every surface shares the plugin's `storage` (`storage:own`), `settings` (`settings:own`) and", + " `secrets` (`secrets:own`), each with `onDidChange(({ key }) => ...)` heard on all surfaces.", + " `atom('todos', [], { persist: 'storage' })` keeps an atom in storage under its key: the worker", + " reads `orca.storage.get('todos')`, and its writes update the atom.", + "- `contributes.settings` (with `settings:own`) declares settings the user edits under the plugin", + " in Orca's Settings: `{ key, title, type: 'string'|'number'|'integer'|'boolean', default, enum,", + " minimum, maximum, multiline, ... }`. `settings.get(key)` reads the user's value or the default.", + "- Panels hear workspace and agent events with `on('agent.status.changed', ...)` (frames:", + " `orca.on`) and the same `*:read` capability as workers, without `contributes.events`.", + "- Test with `mockHost({ requests, storage, settings, secrets })` and `panel.post(event, payload)`", + " (see Test and check).", + "- The worker's `main` must `export default function activate(orca)`; a named", + " `export function activate` is never called (the worker fails to start, saying so). It runs once", + " when the worker starts; an optional `export function deactivate()` is awaited before it stops.", + " An idle worker stops and restarts on its next command, event or panel request.", + "", + "### Recipe: live agent status in a panel", + "", + "`sandboxed-ui` is enough; capabilities `agent:read` and `workspace:read`.", + "", + "1. In `setup(ctx)`, `host.call('agents.list')` once: each agent's `terminalId`, `title`, `agent`,", + " `state` and `stateStartedAt` in the focused workspace.", + "2. Push `on('agent.status.changed', ({ terminalId, title, state }) => ...)` into", + " `ctx.subscriptions` and update the row with that `terminalId` (the id", + " `workspace.readContext` lists and `terminal.sendText` takes; `paneKey` is Orca's own id).", + "3. Push `on('workspace.changed', ...)` too and re-run `agents.list`: it fires when focus moves", + " or terminals open, close or are renamed, with the new `readContext` answer in `context`.", + "4. Keep the rows in an atom and render them as `List`/`ListItem`. Never poll.", + "5. Test it with `mockHost({ results: { 'agents.list': { agents: [...] } } })` and", + " `panel.emit('agent.status.changed', payload)`.", + "", "## No build step", "", "- `.ts`, `.tsx`, `.mts` and `.jsx` load as written; transpiling strips types and never", @@ -2632,6 +2682,10 @@ const ORCA_PLUGIN_AUTHORING_MARKDOWN = [ "- `mockHost({ capabilities, results })` (pass as `host`) refuses what Orca refuses: undeclared", " capabilities, bad params, and `shell.openExternal`/`files.saveAs` without a `press` first.", " `results` values or functions may throw `hostError(code)`; `callsOf(method)` records calls.", + "- It keeps `storage`, `settings` and `secrets` in memory (seed them in `mockHost({ ... })`, read", + " them with `host.data()`), so `persist: 'storage'` atoms and `onDidChange` work under `mount`.", + " `requests: { name: answer | (input) => answer }` fakes the worker for `plugin.request`;", + " `panel.post(event, payload)` is a worker post (`plugin.on`); `panel.emit` is an Orca event.", "- Mount the module, never call its default export: without `mount` there is no runtime. A", " control with `value` but no `onChange` is read-only, so `type`/`toggle` throw on it.", "", @@ -2667,7 +2721,8 @@ const ORCA_PLUGIN_AUTHORING_MARKDOWN = [ "- `update(atom, fn)` takes an updater function only; `set(atom, value)` stores a value.", "- Keyed atoms (`atom('draft', '')`) survive a hot reload; unkeyed `atom(0)`, module variables and", " `setup` start over. `persist: 'plugin'` or `'workspace'` survive restarts and must be plain", - " JSON; bump `version` (with `migrate`) when the stored shape changes.", + " JSON; bump `version` (with `migrate`) when the stored shape changes. `persist: 'storage'` lives", + " in the plugin's storage (`storage:own`), unversioned, shared with the worker.", "- Components panels have no hooks and no DOM: state lives in atoms, and `read()` while rendering", " subscribes. `set` and `update` throw while rendering. Give reordering list items a `key`.", "- A save that fails to load keeps the last good render with an inline `file:line:column` error.", @@ -2786,18 +2841,32 @@ const ORCA_PLUGIN_AUTHORING_COMPONENTS_REFERENCE_MARKDOWN = [ "- `env.locale: string`: Orca's UI language (BCP-47).", "- `env.theme: Theme`: Reading it while rendering re-renders on light/dark switches.", "- `env.client: 'desktop'`", - "- `shell.openExternal(url: string)`: Needs a press on one of the panel's controls; see \"User gestures\".", - "- `files.saveAs(options: HostMethods['files.saveAs']['params'])`: Needs a press on one of the panel's controls; see \"User gestures\".", "- `ui.catalog: number`: Grows with the component catalog.", "- `ui.has(component: string, prop?: string)`: Whether this Orca draws `component` (and accepts `prop` on it, when given).", + "- `shell.openExternal(url: string)`: Needs a press on one of the panel's controls; see \"User gestures\".", + "- `files.saveAs(options: HostMethods['files.saveAs']['params'])`: Needs a press on one of the panel's controls; see \"User gestures\".", + "- `plugin: PluginBridgeApi`", + "- `storage: StorageApi`", + "- `settings: SettingsApi`", + "- `secrets: SecretsApi`", + "", + "## Panel ↔ worker contract", + "", + "Declare requests and worker posts once with declaration merging, in a file both the panel and the worker include: `declare module 'orca' { interface PluginRequests { 'todos.list': { input: { done?: boolean }; output: Todo[] } } interface PluginPanelEvents { 'todos.changed': { count: number } } }`. Declared names are typed end to end (`plugin.request`, `plugin.on`, the worker's `orca.panels.handle` and `orca.panels.post`, and `orca/testing`'s `requests` and `panel.post`); any other name carries JSON.", "", "## Types", "", - "- `PersistScope = 'memory' | 'plugin' | 'workspace'`: Where a keyed atom survives: this panel run, every run of the plugin, or per workspace.", + "- `PersistScope = 'memory' | 'plugin' | 'workspace' | 'storage'`: Where a keyed atom survives: this panel run, every run of the plugin, per workspace, or the plugin's own storage under the atom's key (`storage:own`), shared with its worker and other panels and kept current when they change it.", "- `AtomOptions = { persist?: PersistScope; version?: number; migrate?: (stored: JsonValue, fromVersion: number) => T }`", "- `PanelContext = { subscriptions: Disposable[]; signal: AbortSignal; visible: ReadonlyAtom; panel: { id: string } }`: Passed to the module's optional `export function setup(ctx)`.", "- `PanelSetup = (ctx: PanelContext) => void | (() => void)`: Runs once, after persisted atoms load and before the first render.", "- `HostError = Error & { code: string; retryable: boolean; retryAfterMs?: number }`: Rejections carry a `code` (`not_permitted`, `capability_denied`, `timeout`, ...).", + "- `PluginRequestOptions = { signal?: AbortSignal; timeoutMs?: number }`: `timeoutMs` (at most 120000, default 30000) is how long the worker may take.", + "- `PluginBridgeApi = { request(name: K, ...args: PluginRequestArgs): Promise>; request(name: Undeclared, input?: JsonValue, options?: PluginRequestOptions): Promise; on(event: K, handler: (payload: PluginPanelEvents[K]) => void): Disposable; on(event: Undeclared, handler: (payload: JsonValue) => void): Disposable }`: Your plugin's own worker.", + "- `DataChange = { key: string }`: A key someone (you, another panel, the worker or the person in Settings) changed.", + "- `StorageApi = { get(key: string): Promise; set(key: string, value: JsonValue): Promise; delete(key: string): Promise; keys(): Promise; onDidChange(listener: (change: DataChange) => void): Disposable }`: The plugin's own JSON store (`storage:own`), the same one its worker uses.", + "- `SettingsApi = { get(): Promise>; get(key: string): Promise; set(key: string, value: JsonValue): Promise; onDidChange(listener: (change: DataChange) => void): Disposable }`: The plugin's settings (`settings:own`): those it declares in `contributes.settings` read as their `default` until the person changes them in Settings.", + "- `SecretsApi = { get(key: string): Promise; set(key: string, value: string): Promise; delete(key: string): Promise }`: The plugin's encrypted secrets (`secrets:own`).", "", "## Limits", "", @@ -2819,8 +2888,10 @@ const ORCA_PLUGIN_AUTHORING_EVENTS_REFERENCE_MARKDOWN = [ " `{ workspaceId: string; kind: \"worktree\" | \"folder\"; path: string; branch: string }`", "- `workspace.removed` (capability `workspace:read`; since 1.4.245): A worktree workspace was removed.", " `{ workspaceId: string; kind: \"worktree\" | \"folder\"; path: string }`", - "- `agent.status.changed` (capability `agent:read`; since 1.4.160): An agent in a terminal pane changed status; `workspaceId` is null when Orca cannot tie the pane to a workspace.", - " `{ workspaceId: string | null; paneKey: string; state: \"working\" | \"blocked\" | \"waiting\" | \"done\"; receivedAt: number; mainAgent?: { state: \"working\" | \"blocked\" | \"waiting\" | \"done\"; outcome?: \"success\" | \"failure\" | \"cancellation\" | \"superseded\" | \"interruption\" | \"unconfirmed\"; stateStartedAt: number } }`", + "- `agent.status.changed` (capability `agent:read`; since 1.4.160): An agent in a terminal pane changed status; `workspaceId` is null when Orca cannot tie the pane to a workspace, and `terminalId` names its terminal when Orca lists it.", + " `{ workspaceId: string | null; paneKey: string; terminalId?: string; title?: string; state: \"working\" | \"blocked\" | \"waiting\" | \"done\"; receivedAt: number; mainAgent?: { state: \"working\" | \"blocked\" | \"waiting\" | \"done\"; outcome?: \"success\" | \"failure\" | \"cancellation\" | \"superseded\" | \"interruption\" | \"unconfirmed\"; stateStartedAt: number } }`", + "- `workspace.changed` (capability `workspace:read`; since 1.4.246): The focused workspace changed, or its terminals were opened, closed or renamed; `context` is what `workspace.readContext` now answers.", + " `{ context: { branch: string; displayName: string; terminals: { id: string; title?: string }[] } | null }`", "", "## Frame events (`orca.on(event, handler)` in HTML panels and custom editors)", "", @@ -2831,6 +2902,7 @@ const ORCA_PLUGIN_AUTHORING_EVENTS_REFERENCE_MARKDOWN = [ "## Components panel events (`on(event, handler)` from `orca`)", "", "- `theme: { colorScheme: 'light' | 'dark' }`", + "- Every worker event above, with the same payload and capability; a panel needs no `contributes.events` entry, it subscribes while it is open. HTML panels get them on `orca.on` too.", "", ].join('\n') @@ -2840,13 +2912,13 @@ const ORCA_PLUGIN_AUTHORING_HOST_API_REFERENCE_MARKDOWN = [ "", "", "", - "Host API 1.1 (`\"pluginApi\": 1`). Call `host.call(method, params, { signal })`; a surface not listed for a method gets `not_permitted`. Params are strict: a field this Orca does not know is refused with `invalid_params`, so check `host.has(method)` or `api.minor` before using a method newer than your `engines.orca` floor. Each call also needs the manifest capability and the user's approval.", + "Host API 1.2 (`\"pluginApi\": 1`). Call `host.call(method, params, { signal })`; a surface not listed for a method gets `not_permitted`. Params are strict: a field this Orca does not know is refused with `invalid_params`, so check `host.has(method)` or `api.minor` before using a method newer than your `engines.orca` floor. Each call also needs the manifest capability and the user's approval.", "", "## Methods per surface", "", - "- Worker (`trusted-worker`, `main`): `orca` passed to `activate(orca)`: `workspace.readContext`, `terminal.sendText`, `notifications.show`, `storage.get`, `storage.set`, `storage.delete`, `storage.keys`, `secrets.get`, `secrets.set`, `secrets.delete`, `secrets.protection`, `settings.get`, `settings.set`", - "- Panel: global `orca` in an HTML panel; `host` imported from `orca` in a components panel: `workspace.readContext`, `notifications.show`, `shell.openExternal`, `files.saveAs`", - "- Custom editor: global `orca` in the editor frame: `workspace.readContext`, `notifications.show`, `shell.openExternal`, `files.saveAs`", + "- Worker (`trusted-worker`, `main`): `orca` passed to `activate(orca)`: `workspace.readContext`, `terminal.sendText`, `notifications.show`, `storage.get`, `storage.set`, `storage.delete`, `storage.keys`, `secrets.get`, `secrets.set`, `secrets.delete`, `secrets.protection`, `settings.get`, `settings.set`, `agents.list`", + "- Panel: global `orca` in an HTML panel; `host` imported from `orca` in a components panel: `workspace.readContext`, `notifications.show`, `storage.get`, `storage.set`, `storage.delete`, `storage.keys`, `secrets.get`, `secrets.set`, `secrets.delete`, `secrets.protection`, `settings.get`, `settings.set`, `shell.openExternal`, `files.saveAs`, `plugin.request`, `agents.list`, `events.subscribe`", + "- Custom editor: global `orca` in the editor frame: `workspace.readContext`, `notifications.show`, `storage.get`, `storage.set`, `storage.delete`, `storage.keys`, `secrets.get`, `secrets.set`, `secrets.delete`, `secrets.protection`, `settings.get`, `settings.set`, `shell.openExternal`, `files.saveAs`, `plugin.request`, `agents.list`, `events.subscribe`", "", "## Worker API (`import type { OrcaWorkerApi } from 'orca/worker'`)", "", @@ -2854,6 +2926,10 @@ const ORCA_PLUGIN_AUTHORING_HOST_API_REFERENCE_MARKDOWN = [ "- `commands.register(commandId: string, handler: (args: unknown, context: CommandContext) => unknown)`: A string result is shown as-is in Orca; anything else as JSON.", "- `events.on(event: E, handler: (payload: PluginEvents[E]) => void | Promise)`: Only events listed in the manifest's `contributes.events` arrive.", "- `host: HostApi<'worker'>`", + "- `panels: PanelsApi`: This plugin's panels and custom editors.", + "- `storage: StorageApi`: Same store as panels' `storage` (`storage:own`); `onDidChange` hears their writes too.", + "- `settings: SettingsApi`: `settings:own`; `onDidChange` also hears the person changing them in Settings.", + "- `secrets: SecretsApi`: `secrets:own`.", "- `grantedCapabilities: readonly string[]`: Consented capability kinds; informational, the host re-checks every call.", "- `log(message: string)`: Lands in `orca plugin logs`.", "", @@ -2863,7 +2939,11 @@ const ORCA_PLUGIN_AUTHORING_HOST_API_REFERENCE_MARKDOWN = [ "- `host: HostApi<'panel' | 'editor'>`", "- `on(event: E, handler: (payload: FrameEvents[E]) => unknown)`", "- `locale: string`: Orca's UI language as a BCP-47 tag.", - "- `shell.openExternal(url: string)`: Desktop isolated frames only; needs a click or key press in the frame.", + "- `plugin: PluginBridgeApi`: Your plugin's own worker: `request` its handlers, hear what it `post`s.", + "- `storage: StorageApi`: The plugin's own storage, the same its worker uses (`storage:own`).", + "- `settings: SettingsApi`: The plugin's settings, declared ones with their defaults (`settings:own`).", + "- `secrets: SecretsApi`: The plugin's encrypted secrets (`secrets:own`).", + "- `shell.openExternal(url: string)`: `reason`: the person cancelled, or Orca's window was hidden so nobody could confirm.", "- `files.saveAs(options: SaveAsOptions)`: Desktop isolated frames only; `cancelled` when the person closes the dialog.", "- `document?: EditorDocumentApi`: Custom editors only.", "- `document.get()`", @@ -2873,35 +2953,41 @@ const ORCA_PLUGIN_AUTHORING_HOST_API_REFERENCE_MARKDOWN = [ "## Methods", "", "- `workspace.readContext` (capability `workspace:read`; worker, panel, editor; since 1.0): Branch, name and terminal ids of the focused workspace, or null when none is focused.", - " `(params?: {}) => { branch: string; displayName: string; terminals: { id: string }[] } | null`", + " `(params?: {}) => { branch: string; displayName: string; terminals: { id: string; title?: string }[] } | null`", "- `terminal.sendText` (capability `terminal:send`; worker; since 1.0): Types text into one terminal named by id, optionally pressing Enter.", " `(params: { terminalId: string; text: string; enter?: boolean }) => { accepted: boolean }`", "- `notifications.show` (capability `notifications:show`; worker, panel, editor; since 1.0): Shows a desktop notification.", " `(params: { title: string; body?: string }) => { delivered: boolean }`", - "- `storage.get` (capability `storage:own`; worker; since 1.0): Reads a JSON value from the plugin's private store; null when absent.", + "- `storage.get` (capability `storage:own`; worker, panel, editor; since 1.0): Reads a JSON value from the plugin's private store; null when absent.", " `(params: { key: string }) => { value: JSON }`", - "- `storage.set` (capability `storage:own`; worker; since 1.0): Writes a JSON value to the plugin's private store.", + "- `storage.set` (capability `storage:own`; worker, panel, editor; since 1.0): Writes a JSON value to the plugin's private store.", " `(params: { key: string; value: JSON }) => { ok: true }`", - "- `storage.delete` (capability `storage:own`; worker; since 1.0): Removes a key from the plugin's private store.", + "- `storage.delete` (capability `storage:own`; worker, panel, editor; since 1.0): Removes a key from the plugin's private store.", " `(params: { key: string }) => { ok: true }`", - "- `storage.keys` (capability `storage:own`; worker; since 1.0): Lists the keys in the plugin's private store.", + "- `storage.keys` (capability `storage:own`; worker, panel, editor; since 1.0): Lists the keys in the plugin's private store.", " `(params?: {}) => { keys: string[] }`", - "- `secrets.get` (capability `secrets:own`; worker; since 1.0): Reads a secret from the plugin's encrypted secrets file; null when absent.", + "- `secrets.get` (capability `secrets:own`; worker, panel, editor; since 1.0): Reads a secret from the plugin's encrypted secrets file; null when absent.", " `(params: { key: string }) => { value: string | null }`", - "- `secrets.set` (capability `secrets:own`; worker; since 1.0): Stores a secret in the plugin's encrypted secrets file.", + "- `secrets.set` (capability `secrets:own`; worker, panel, editor; since 1.0): Stores a secret in the plugin's encrypted secrets file.", " `(params: { key: string; value: string }) => { ok: true }`", - "- `secrets.delete` (capability `secrets:own`; worker; since 1.0): Removes a secret from the plugin's encrypted secrets file.", + "- `secrets.delete` (capability `secrets:own`; worker, panel, editor; since 1.0): Removes a secret from the plugin's encrypted secrets file.", " `(params: { key: string }) => { ok: true }`", - "- `secrets.protection` (capability `secrets:own`; worker; since 1.1): How secrets are protected at rest: `os-keyring`, or `unavailable` (no OS key store, or Linux `basic_text`), where `secrets.set` fails.", + "- `secrets.protection` (capability `secrets:own`; worker, panel, editor; since 1.1): How secrets are protected at rest: `os-keyring`, or `unavailable` (no OS key store, or Linux `basic_text`), where `secrets.set` fails.", " `(params?: {}) => { status: \"os-keyring\" | \"unavailable\" }`", - "- `settings.get` (capability `settings:own`; worker; since 1.0): Reads every setting the plugin owns.", + "- `settings.get` (capability `settings:own`; worker, panel, editor; since 1.0): Reads every setting the plugin owns.", " `(params?: {}) => { settings: Record }`", - "- `settings.set` (capability `settings:own`; worker; since 1.0): Writes one setting the plugin owns.", + "- `settings.set` (capability `settings:own`; worker, panel, editor; since 1.0): Writes one setting the plugin owns.", " `(params: { key: string; value: JSON }) => { ok: true }`", "- `shell.openExternal` (no capability; panel, editor; since 1.1; needs a user gesture): Opens an http:, https: or mailto: URL in the default browser. Needs a click or key press in the frame; desktop app only. Orca asks the person before an http(s) host the plugin was not allowed; `opened` is false if they cancel.", - " `(params: { url: string }) => { opened: boolean }`", + " `(params: { url: string }) => { opened: boolean; reason?: \"cancelled\" | \"consent-unavailable\" }`", "- `files.saveAs` (no capability; panel, editor; since 1.1; needs a user gesture): Offers data (a string or ArrayBuffer, up to 64 MiB) in Orca's save dialog; the plugin never learns the path. Needs a click or key press in the frame; desktop app only.", " `(params: { suggestedName?: string; mimeType?: string; data: string | ArrayBuffer }) => { status: \"saved\" | \"cancelled\" }`", + "- `plugin.request` (no capability; panel, editor; since 1.2): Asks the plugin's own worker to run the handler it registered with `orca.panels.handle(name)`, starting the worker if needed; resolves with what the handler returned. `unknown_method` when no handler has that name.", + " `(params: { name: string; input?: JSON; timeoutMs?: number }) => { output: JSON }`", + "- `agents.list` (capability `agent:read`; worker, panel, editor; since 1.2): The agents in the focused workspace: their terminal, title, agent kind and status. `agent.status.changed` reports each change after.", + " `(params?: {}) => { agents: { terminalId: string | null; title: string | null; agent: string | null; state: \"working\" | \"blocked\" | \"waiting\" | \"done\"; stateStartedAt: number }[] }`", + "- `events.subscribe` (no capability; panel, editor; since 1.2): Delivers a workspace or agent event to this panel as `orca.on(event)`; needs the event's read capability. The frame APIs call it for you.", + " `(params: { event: \"workspace.created\" | \"workspace.removed\" | \"agent.status.changed\" | \"workspace.changed\" }) => { ok: true }`", "", "## Capabilities", "", @@ -2972,7 +3058,7 @@ const ORCA_PLUGIN_AUTHORING_MANIFEST_REFERENCE_MARKDOWN = [ "", "- `panels` (PanelContribution[], since 1.4.160): Sidebar panels. At most 64.", "- `commands` (CommandContribution[], since 1.4.160): Command palette entries. At most 256.", - "- `events` (EventContribution[], since 1.4.160): Events delivered to the plugin worker. At most 3.", + "- `events` (EventContribution[], since 1.4.160): Events delivered to the plugin worker. At most 4.", "- `languagePacks` (LanguagePackContribution[], since 1.4.160): Interface translations. At most 16.", "- `keybindings` (KeybindingContribution[], since 1.4.160): Keyboard shortcuts for contributed commands. At most 256.", "- `vmRecipes` (VmRecipeContribution[], since 1.4.160): Virtual machine environment recipes. At most 64.", @@ -2982,8 +3068,9 @@ const ORCA_PLUGIN_AUTHORING_MANIFEST_REFERENCE_MARKDOWN = [ "- `syntaxes` (SyntaxContribution[], since 1.4.245): Syntax highlighting for editor languages. At most 16.", "- `customEditors` (CustomEditorContribution[], since 1.4.245): Editors that open files of given types in the editor tab. At most 16.", "- `newFiles` (NewFileContribution[], since 1.4.245): Untitled files the user can create from the + menu and the command palette. At most 16.", + "- `settings` (SettingContribution[], since 1.4.246): Settings Orca shows under the plugin in Settings; code reads them with `settings.get` (`settings:own`). At most 64.", "", - "Reserved (must stay empty arrays): `agentHarnesses`, `skills`, `mcpServers`, `hooks`, `taskSources`, `connections`, `settings`, `statusBarItems`, `sidebarCards`.", + "Reserved (must stay empty arrays): `agentHarnesses`, `skills`, `mcpServers`, `hooks`, `taskSources`, `connections`, `statusBarItems`, `sidebarCards`.", "", "## PanelContribution", "", @@ -3008,7 +3095,7 @@ const ORCA_PLUGIN_AUTHORING_MANIFEST_REFERENCE_MARKDOWN = [ "", "An event subscription. Requires `main`, the `trusted-worker` execution profile and the capability of the event's domain: `workspace:read` for workspace events, `agent:read` for agent events.", "", - "- `on` (\"workspace.created\" | \"workspace.removed\" | \"agent.status.changed\", required, since 1.4.160): Event delivered to the plugin worker.", + "- `on` (\"workspace.created\" | \"workspace.removed\" | \"agent.status.changed\" | \"workspace.changed\", required, since 1.4.160): Event delivered to the plugin worker.", "", "## LanguagePackContribution", "", @@ -3075,6 +3162,23 @@ const ORCA_PLUGIN_AUTHORING_MANIFEST_REFERENCE_MARKDOWN = [ "- `template` (string, since 1.4.245): UTF-8 file copied into the new file, at most 256 KB. Without one the file starts empty.", "- `icon` (string, since 1.4.245): Square image shown beside the menu item. Defaults to the plugin icon. PNG, WEBP, static, at least 128×128, square, at most 256 KB.", "", + "## SettingContribution", + "", + "A setting shown under the plugin in Settings. Requires the `settings:own` capability, which is also how code reads it.", + "", + "- `key` (string, required, since 1.4.246): Key code reads and writes, unique in this plugin.", + "- `title` (string, required, since 1.4.246): Label shown in Settings.", + "- `description` (string, since 1.4.246): Help text shown under the label.", + "- `type` (\"string\" | \"number\" | \"integer\" | \"boolean\", required, since 1.4.246): JSON Schema type of the value.", + "- `default` (string | number | boolean, since 1.4.246): Value read while the person has not set one.", + "- `enum` (string | number[], since 1.4.246): Allowed values; Settings shows a picker.", + "- `enumLabels` (string[], since 1.4.246): Picker labels, one per `enum` value.", + "- `minimum` (number, since 1.4.246): Numbers: smallest value.", + "- `maximum` (number, since 1.4.246): Numbers: largest value.", + "- `maxLength` (integer, since 1.4.246): Strings: most characters.", + "- `multiline` (boolean, since 1.4.246): Strings: a multi-line text box.", + "- `placeholder` (string, since 1.4.246): Strings and numbers: hint shown while empty.", + "", "## Capability", "", "A host API the plugin may call once the user consents.", diff --git a/src/cli/plugin-authoring/plugin-type-files.test.ts b/src/cli/plugin-authoring/plugin-type-files.test.ts index 3836ea18807..a9e033da1df 100644 --- a/src/cli/plugin-authoring/plugin-type-files.test.ts +++ b/src/cli/plugin-authoring/plugin-type-files.test.ts @@ -32,6 +32,7 @@ describe('orca plugin types', () => { '.orca/types/orca-host/index.d.ts', '.orca/types/orca-frame/index.d.ts', '.orca/types/orca-worker/index.d.ts', + '.orca/types/orca-services/index.d.ts', '.orca/types/orca-testing/index.d.ts', '.orca/types/tsconfig.json' ]) @@ -47,13 +48,14 @@ describe('orca plugin types', () => { expect(await read('orca-frame')).toContain('var orca: OrcaFrameApi') expect(await read('orca-worker')).toContain("declare module 'orca/worker'") expect(await read('orca-testing')).toContain("declare module 'orca/testing'") + expect(await read('orca-services')).toContain('export interface PluginRequests {}') const tsconfig = JSON.parse( await readFile(join(dir, '.orca', 'types', 'tsconfig.json'), 'utf8') ) expect(tsconfig.compilerOptions).toMatchObject({ jsxImportSource: 'orca', typeRoots: ['.'], - types: ['orca', 'orca-host', 'orca-frame', 'orca-worker', 'orca-testing'] + types: ['orca', 'orca-host', 'orca-frame', 'orca-worker', 'orca-services', 'orca-testing'] }) expect(await readFile(join(dir, '.orca', '.gitignore'), 'utf8')).toBe('*\n') }) diff --git a/src/cli/plugin-authoring/plugin-type-files.ts b/src/cli/plugin-authoring/plugin-type-files.ts index 5003696e53e..599593f3043 100644 --- a/src/cli/plugin-authoring/plugin-type-files.ts +++ b/src/cli/plugin-authoring/plugin-type-files.ts @@ -13,6 +13,7 @@ const PLUGIN_SURFACE_TYPINGS = [ { dir: 'orca-host', file: 'orca-host.d.ts' }, { dir: 'orca-frame', file: 'orca-frame.d.ts' }, { dir: 'orca-worker', file: 'orca-worker.d.ts' }, + { dir: 'orca-services', file: 'orca-services.d.ts' }, { dir: 'orca-testing', file: 'orca-testing.d.ts' } ] as const diff --git a/src/main/ipc/plugin-panel-push-ipc.ts b/src/main/ipc/plugin-panel-push-ipc.ts new file mode 100644 index 00000000000..c55eb8a23bf --- /dev/null +++ b/src/main/ipc/plugin-panel-push-ipc.ts @@ -0,0 +1,53 @@ +import { ipcMain } from 'electron' +import { z } from 'zod' +import { panelSessionTokenSchema } from '../../shared/plugins/frames/plugin-frame-bridge' +import type { PluginService } from '../plugins/plugin-service' +import { rendererPanelOwner } from './plugin-frame-entry-ipc' + +const panelPushArgsSchema = z.object({ sessionToken: panelSessionTokenSchema }).strict() + +/** main → renderer: one open panel's worker posts, events and data changes. */ +export const PLUGIN_PANEL_PUSH_CHANNEL = 'plugins:panelPush' + +/** + * Desktop push channel per open panel session. It closes by itself when the session ends (the + * window navigates or reloads, the plugin goes away); the renderer closes it when its last frame + * for that session unmounts. + */ +export function registerPluginPanelPushHandlers(pluginService: PluginService): void { + const stops = new Map void>() + ipcMain.handle('plugins:openPanelPush', async (event, args: unknown): Promise => { + await pluginService.whenReady() + const parsed = panelPushArgsSchema.safeParse(args) + const { sender } = event + const session = parsed.success + ? pluginService.panels.sessionCaller(rendererPanelOwner(sender.id), parsed.data.sessionToken) + : null + if (!parsed.success || !session) { + return false + } + const { sessionToken } = parsed.data + const key = `${sender.id}\0${sessionToken}` + if (!stops.has(key)) { + sender.once('destroyed', () => stops.delete(key)) + } + stops.get(key)?.() + stops.set( + key, + pluginService.panelBridge.open(session.caller, session.pluginKey, (push) => { + if (!sender.isDestroyed()) { + sender.send(PLUGIN_PANEL_PUSH_CHANNEL, { sessionToken, push }) + } + }) + ) + return true + }) + ipcMain.handle('plugins:closePanelPush', (event, args: unknown): void => { + const parsed = panelPushArgsSchema.safeParse(args) + if (parsed.success) { + const key = `${event.sender.id}\0${parsed.data.sessionToken}` + stops.get(key)?.() + stops.delete(key) + } + }) +} diff --git a/src/main/ipc/plugin-settings-ipc.ts b/src/main/ipc/plugin-settings-ipc.ts new file mode 100644 index 00000000000..ee9734bb571 --- /dev/null +++ b/src/main/ipc/plugin-settings-ipc.ts @@ -0,0 +1,33 @@ +import { ipcMain } from 'electron' +import { z } from 'zod' +import { isQualifiedPluginKey } from '../../shared/plugins/manifest/plugin-manifest' +import type { PluginService } from '../plugins/plugin-service' +import { + readPluginDeclaredSettings, + writePluginDeclaredSetting +} from '../plugins/plugin-declared-settings' + +const pluginKeySchema = z.string().refine(isQualifiedPluginKey, 'invalid plugin key') +const readArgsSchema = z.object({ pluginKey: pluginKeySchema }).strict() +const writeArgsSchema = z + .object({ pluginKey: pluginKeySchema, key: z.string().min(1).max(64), value: z.json() }) + .strict() + +/** The plugin settings Orca's Settings page shows and edits (`contributes.settings`). */ +export function registerPluginSettingsHandlers(pluginService: PluginService): void { + const host = () => ({ + findValidPlugin: (pluginKey: string) => pluginService.findValidPlugin(pluginKey), + userDataPath: pluginService.options.userDataPath, + dataChanged: (pluginKey: string, key: string) => + pluginService.panelBridge.dataChanged(pluginKey, 'settings', key) + }) + ipcMain.handle('plugins:getSettings', async (_event, args: unknown) => { + await pluginService.whenReady() + return readPluginDeclaredSettings(host(), readArgsSchema.parse(args).pluginKey) + }) + ipcMain.handle('plugins:setSetting', async (_event, args: unknown) => { + await pluginService.whenReady() + const { pluginKey, key, value } = writeArgsSchema.parse(args) + return writePluginDeclaredSetting(host(), pluginKey, key, value) + }) +} diff --git a/src/main/ipc/plugins.ts b/src/main/ipc/plugins.ts index 95b2d1e4c2e..3cf77518f23 100644 --- a/src/main/ipc/plugins.ts +++ b/src/main/ipc/plugins.ts @@ -15,6 +15,8 @@ import { readApprovedPluginNewFileTemplate } from '../plugins/plugin-new-file-te import { handlePluginPanelStateRequest } from '../plugins/panels/plugin-panel-state' import type { PluginService } from '../plugins/plugin-service' import { registerPluginFrameEntryHandlers, rendererPanelOwner } from './plugin-frame-entry-ipc' +import { registerPluginPanelPushHandlers } from './plugin-panel-push-ipc' +import { registerPluginSettingsHandlers } from './plugin-settings-ipc' import { bindPluginFrameGuests, clearPluginFrameStorage @@ -148,6 +150,8 @@ export function registerPluginHandlers( bindPluginFrameGuests(pluginService) registerPluginFrameEntryHandlers(store, pluginService) + registerPluginPanelPushHandlers(pluginService) + registerPluginSettingsHandlers(pluginService) ipcMain.handle('plugins:readNewFileTemplate', async (_event, args: unknown) => { const parsed = readNewFileTemplateArgsSchema.parse(args) diff --git a/src/main/plugins/panels/plugin-external-open-consent.test.ts b/src/main/plugins/panels/plugin-external-open-consent.test.ts index ac7b559eba2..6dc6734788f 100644 --- a/src/main/plugins/panels/plugin-external-open-consent.test.ts +++ b/src/main/plugins/panels/plugin-external-open-consent.test.ts @@ -19,15 +19,29 @@ function grantStore() { } } -function confirm(store: ReturnType, url: string, pluginId = 'acme.draw') { +type FakeWindow = { visible: boolean; minimized: boolean } + +function confirm( + store: ReturnType, + url: string, + pluginId = 'acme.draw', + shown: FakeWindow = { visible: true, minimized: false }, + log?: (line: string) => void +) { + const window = { + isDestroyed: () => false, + isVisible: () => shown.visible, + isMinimized: () => shown.minimized + } return confirmPluginExternalOpen({ - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the window is only handed to the mocked dialog. - window: {} as never, + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: consent reads only these three window methods and hands it to the mocked dialog. + window: window as never, // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the consent reads and writes only pluginExternalHostGrants. store: store as never, pluginId, pluginName: 'Draw', - url + url, + log }) } @@ -35,7 +49,7 @@ describe('confirmPluginExternalOpen', () => { it('asks per host, shows the URL, and opens only on Open', async () => { const store = grantStore() showMessageBox.mockResolvedValueOnce({ response: 1, checkboxChecked: false }) - await expect(confirm(store, 'https://Evil.example/?d=secret')).resolves.toBe(false) + await expect(confirm(store, 'https://Evil.example/?d=secret')).resolves.toBe('cancelled') expect(showMessageBox).toHaveBeenLastCalledWith( expect.anything(), expect.objectContaining({ @@ -47,29 +61,49 @@ describe('confirmPluginExternalOpen', () => { }) ) showMessageBox.mockResolvedValueOnce({ response: 0, checkboxChecked: false }) - await expect(confirm(store, 'https://evil.example/')).resolves.toBe(true) + await expect(confirm(store, 'https://evil.example/')).resolves.toBe('allowed') expect(store.updateSettings).not.toHaveBeenCalled() }) it('remembers "always allow" per plugin and host only', async () => { const store = grantStore() showMessageBox.mockResolvedValueOnce({ response: 0, checkboxChecked: true }) - await expect(confirm(store, 'https://docs.example/a')).resolves.toBe(true) + await expect(confirm(store, 'https://docs.example/a')).resolves.toBe('allowed') showMessageBox.mockClear() - await expect(confirm(store, 'https://docs.example/b')).resolves.toBe(true) + await expect(confirm(store, 'https://docs.example/b')).resolves.toBe('allowed') expect(showMessageBox).not.toHaveBeenCalled() showMessageBox.mockResolvedValue({ response: 1, checkboxChecked: false }) - await expect(confirm(store, 'https://docs.example:8443/')).resolves.toBe(false) - await expect(confirm(store, 'https://docs.example/', 'acme.other')).resolves.toBe(false) + await expect(confirm(store, 'https://docs.example:8443/')).resolves.toBe('cancelled') + await expect(confirm(store, 'https://docs.example/', 'acme.other')).resolves.toBe('cancelled') expect(store.getSettings().pluginExternalHostGrants).toEqual({ 'acme.draw': ['docs.example'] }) }) it('never asks about mailto:, and truncates long URLs', async () => { showMessageBox.mockClear() - await expect(confirm(grantStore(), 'mailto:a@example.com?body=x')).resolves.toBe(true) + await expect(confirm(grantStore(), 'mailto:a@example.com?body=x')).resolves.toBe('allowed') expect(showMessageBox).not.toHaveBeenCalled() const long = truncatedUrl(`https://x.example/?d=${'a'.repeat(1000)}`) expect(long).toHaveLength(300) expect(long.endsWith('…')).toBe(true) }) + + it('never prompts on a hidden or minimized window, and says why in the log', async () => { + showMessageBox.mockClear() + const log = vi.fn() + const hidden = { visible: false, minimized: false } + await expect( + confirm(grantStore(), 'https://a.example/', 'acme.draw', hidden, log) + ).resolves.toBe('unavailable') + const minimized = { visible: true, minimized: true } + await expect(confirm(grantStore(), 'https://a.example/', 'acme.draw', minimized)).resolves.toBe( + 'unavailable' + ) + expect(showMessageBox).not.toHaveBeenCalled() + expect(log).toHaveBeenCalledWith(expect.stringContaining('window is hidden')) + showMessageBox.mockResolvedValueOnce({ response: 1, checkboxChecked: false }) + await confirm(grantStore(), 'https://a.example/', 'acme.draw', undefined, log) + expect(log).toHaveBeenLastCalledWith( + expect.stringContaining('waiting for the person to confirm') + ) + }) }) diff --git a/src/main/plugins/panels/plugin-external-open-consent.ts b/src/main/plugins/panels/plugin-external-open-consent.ts index 7c1bb9e5f61..397cfb42775 100644 --- a/src/main/plugins/panels/plugin-external-open-consent.ts +++ b/src/main/plugins/panels/plugin-external-open-consent.ts @@ -17,6 +17,8 @@ function rememberHost(store: GrantStore, pluginId: string, host: string): void { store.updateSettings({ pluginExternalHostGrants: grants }) } +export type PluginExternalOpenConsent = 'allowed' | 'cancelled' | 'unavailable' + export function truncatedUrl(url: string): string { return url.length > URL_DETAIL_MAX_LENGTH ? `${url.slice(0, URL_DETAIL_MAX_LENGTH - 1)}…` : url } @@ -32,16 +34,26 @@ export async function confirmPluginExternalOpen(input: { pluginId: string pluginName: string url: string -}): Promise { + log?: (line: string) => void + /** Spends the rate budget (it may throw): before an open or a prompt, never for nothing. */ + admit?: () => void +}): Promise { const parsed = new URL(input.url) - if (parsed.protocol === 'mailto:') { - return true - } // Punycode host (`URL` normalizes it), so a lookalike name shows as what it is. const host = parsed.host.toLowerCase() - if (grantedHosts(input.store, input.pluginId).includes(host)) { - return true + if (parsed.protocol === 'mailto:' || grantedHosts(input.store, input.pluginId).includes(host)) { + input.admit?.() + return 'allowed' } + // A sheet on a hidden or minimized window would wait, unseen, forever. + if (input.window.isDestroyed() || !input.window.isVisible() || input.window.isMinimized()) { + input.log?.( + `shell.openExternal(${host}): not opened; Orca's window is hidden, so nobody can confirm it` + ) + return 'unavailable' + } + input.admit?.() + input.log?.(`shell.openExternal(${host}): waiting for the person to confirm`) const { response, checkboxChecked } = await dialog.showMessageBox(input.window, { type: 'question', buttons: [ @@ -67,10 +79,10 @@ export async function confirmPluginExternalOpen(input: { ) }) if (response !== 0) { - return false + return 'cancelled' } if (checkboxChecked) { rememberHost(input.store, input.pluginId, host) } - return true + return 'allowed' } diff --git a/src/main/plugins/panels/plugin-frame-desktop-services.ts b/src/main/plugins/panels/plugin-frame-desktop-services.ts index 954f1def473..10676c17f5d 100644 --- a/src/main/plugins/panels/plugin-frame-desktop-services.ts +++ b/src/main/plugins/panels/plugin-frame-desktop-services.ts @@ -83,15 +83,26 @@ export function installPluginDesktopFrameServices( throw new Error('url must be an http:, https: or mailto: URL') } const window = callingWindow(scope) - admit(window, pluginId) const pluginName = scope.pluginName ?? pluginId - if (!(await confirmPluginExternalOpen({ window, store, pluginId, pluginName, url }))) { - return false + const consent = await confirmPluginExternalOpen({ + window, + store, + pluginId, + pluginName, + url, + log: scope.log, + admit: () => admit(window, pluginId) + }) + if (consent !== 'allowed') { + return { + opened: false, + reason: consent === 'cancelled' ? 'cancelled' : 'consent-unavailable' + } } // The prompt may have stayed open while the plugin was disabled or removed. scope.assertActive() await shell.openExternal(url) - return true + return { opened: true } }, async saveFile(pluginId, input, scope) { const parent = callingWindow(scope) diff --git a/src/main/plugins/panels/plugin-panel-bridge.test.ts b/src/main/plugins/panels/plugin-panel-bridge.test.ts new file mode 100644 index 00000000000..09c3a9fa51a --- /dev/null +++ b/src/main/plugins/panels/plugin-panel-bridge.test.ts @@ -0,0 +1,174 @@ +import { describe, expect, it, vi } from 'vitest' +import type { PluginCapabilityKind } from '../../../shared/plugins/capabilities/plugin-capabilities' +import type { ValidDiscoveredPlugin } from '../plugin-discovery' +import type { PluginWorkerHandle } from '../workers/plugin-host-process' +import { PluginPanelBridge } from './plugin-panel-bridge' + +const caller = { id: 'panel-a', surface: 'panel' as const, contributionId: 'todos' } + +function setup(options: { main?: string; capabilities?: PluginCapabilityKind[] } = {}) { + const worker = { + requestFromPanel: vi.fn(async (_request?: { signal?: AbortSignal }): Promise => ({ + ok: true + })), + notifyDataChanged: vi.fn() + } + const plugin = { pluginKey: 'acme.todos', manifest: { main: options.main ?? 'main.mjs' } } + const log = vi.fn() + const bridge = new PluginPanelBridge({ + findApprovedPlugin: (key) => + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the bridge reads only pluginKey and manifest.main. + key === plugin.pluginKey ? (plugin as never as ValidDiscoveredPlugin) : null, + grantedCapabilities: () => options.capabilities ?? [], + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the bridge calls only requestFromPanel and notifyDataChanged. + ensureWorker: async () => worker as never as PluginWorkerHandle, + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: as above. + runningWorker: () => worker as never as PluginWorkerHandle, + log: () => log, + now: () => 0 + }) + return { bridge, worker, log } +} + +const request = (name = 'todos.list', input: unknown = { done: false }) => ({ + pluginKey: 'acme.todos', + caller, + name, + input +}) + +describe('PluginPanelBridge requests', () => { + it("asks the plugin's own worker, with the panel, a deadline and the panel's lifetime", async () => { + const { bridge, worker } = setup() + await expect(bridge.request(request())).resolves.toEqual({ ok: true }) + expect(worker.requestFromPanel).toHaveBeenCalledWith({ + name: 'todos.list', + input: { done: false }, + panel: caller, + timeoutMs: 30_000, + signal: expect.any(AbortSignal) + }) + }) + + it('aborts in-flight requests when the panel session closes', async () => { + const { bridge, worker } = setup() + let signal: AbortSignal | undefined + worker.requestFromPanel.mockImplementation(async (sent?: { signal?: AbortSignal }) => { + signal = sent?.signal + return { ok: true } + }) + await bridge.request(request()) + bridge.close(caller.id) + expect(signal?.aborted).toBe(true) + }) + + it('keeps worker error codes, and refuses plugins without a worker', async () => { + const { bridge, worker } = setup() + worker.requestFromPanel.mockRejectedValueOnce( + Object.assign(new Error('no'), { code: 'unknown_method' }) + ) + await expect(bridge.request(request())).rejects.toMatchObject({ code: 'unknown_method' }) + await expect(setup({ main: '' }).bridge.request(request())).rejects.toMatchObject({ + code: 'unavailable' + }) + }) + + it('refuses answers over 1 MiB or that are not JSON', async () => { + const { bridge, worker } = setup() + worker.requestFromPanel.mockResolvedValueOnce({ big: 'x'.repeat(1024 * 1024 + 1) }) + await expect(bridge.request(request())).rejects.toMatchObject({ code: 'too_large' }) + worker.requestFromPanel.mockResolvedValueOnce({ when: new Date(0) }) + await expect(bridge.request(request())).rejects.toMatchObject({ code: 'action_failed' }) + worker.requestFromPanel.mockResolvedValueOnce(undefined) + await expect(bridge.request(request())).resolves.toBeNull() + }) +}) + +describe('PluginPanelBridge pushes', () => { + it('delivers worker posts to every open panel of that plugin, or the one named', () => { + const { bridge } = setup() + const a = vi.fn() + const b = vi.fn() + const other = vi.fn() + bridge.open(caller, 'acme.todos', a) + bridge.open({ ...caller, id: 'panel-b' }, 'acme.todos', b) + bridge.open({ ...caller, id: 'panel-c' }, 'acme.other', other) + bridge.onWorkerPost('acme.todos', { event: 'todos.changed', payload: { count: 1 } }) + bridge.onWorkerPost('acme.todos', { event: 'todos.changed', payload: 2, panel: 'panel-b' }) + expect(a).toHaveBeenCalledTimes(1) + expect(b).toHaveBeenLastCalledWith({ kind: 'message', event: 'todos.changed', payload: 2 }) + expect(other).not.toHaveBeenCalled() + }) + + it('drops posts past the size or rate budget, and says so in the log', () => { + const { bridge, log } = setup() + const deliver = vi.fn() + bridge.open(caller, 'acme.todos', deliver) + bridge.onWorkerPost('acme.todos', { event: 'big', payload: 'x'.repeat(300 * 1024) }) + for (let index = 0; index < 205; index += 1) { + bridge.onWorkerPost('acme.todos', { event: 'tick', payload: index }) + } + expect(deliver).toHaveBeenCalledTimes(199) + expect(log).toHaveBeenCalledWith(expect.stringContaining('256 KiB')) + expect(log).toHaveBeenCalledWith(expect.stringContaining('too many posts')) + }) + + it('sends events only to panels that subscribed and hold the read capability', () => { + const denied = setup() + expect(() => denied.bridge.subscribe('acme.todos', caller.id, 'agent.status.changed')).toThrow( + expect.objectContaining({ code: 'capability_denied' }) + ) + const { bridge } = setup({ capabilities: ['agent:read'] }) + const subscribed = vi.fn() + const quiet = vi.fn() + bridge.open(caller, 'acme.todos', subscribed) + bridge.open({ ...caller, id: 'panel-b' }, 'acme.todos', quiet) + bridge.subscribe('acme.todos', caller.id, 'agent.status.changed') + const payload = { workspaceId: null, paneKey: 'p', state: 'done', receivedAt: 1 } + bridge.publishEvent('agent.status.changed', payload) + bridge.publishEvent('agent.status.changed', { malformed: true }) + expect(subscribed).toHaveBeenCalledOnce() + expect(subscribed).toHaveBeenCalledWith({ + kind: 'event', + event: 'agent.status.changed', + payload + }) + expect(quiet).not.toHaveBeenCalled() + }) + + it('keeps a subscription made before the renderer opens the channel', () => { + const { bridge } = setup({ capabilities: ['workspace:read'] }) + bridge.subscribe('acme.todos', caller.id, 'workspace.changed') + expect(bridge.hasSubscribers('workspace.changed')).toBe(false) + const deliver = vi.fn() + bridge.open(caller, 'acme.todos', deliver) + expect(bridge.hasSubscribers('workspace.changed')).toBe(true) + bridge.publishEvent('workspace.changed', { context: null }) + expect(deliver).toHaveBeenCalledWith({ + kind: 'event', + event: 'workspace.changed', + payload: { context: null } + }) + }) + + it('tells open panels and the running worker which key changed', () => { + const { bridge, worker } = setup() + const deliver = vi.fn() + bridge.open(caller, 'acme.todos', deliver) + bridge.dataChanged('acme.todos', 'storage', 'todos') + expect(deliver).toHaveBeenCalledWith({ kind: 'changed', area: 'storage', key: 'todos' }) + expect(worker.notifyDataChanged).toHaveBeenCalledWith({ area: 'storage', key: 'todos' }) + }) + + it('stops delivering once its channel is closed or the session ends', () => { + const { bridge } = setup() + const deliver = vi.fn() + const stop = bridge.open(caller, 'acme.todos', deliver) + stop() + bridge.onWorkerPost('acme.todos', { event: 'x', payload: 1 }) + bridge.open(caller, 'acme.todos', deliver) + bridge.close(caller.id) + bridge.onWorkerPost('acme.todos', { event: 'x', payload: 1 }) + expect(deliver).not.toHaveBeenCalled() + }) +}) diff --git a/src/main/plugins/panels/plugin-panel-bridge.ts b/src/main/plugins/panels/plugin-panel-bridge.ts new file mode 100644 index 00000000000..1eb6fafdc44 --- /dev/null +++ b/src/main/plugins/panels/plugin-panel-bridge.ts @@ -0,0 +1,228 @@ +import type { PluginCapabilityKind } from '../../../shared/plugins/capabilities/plugin-capabilities' +import { PLUGIN_EVENT_CAPABILITY } from '../../../shared/plugins/contributions/plugin-event-contribution' +import type { PluginEventName } from '../../../shared/plugins/manifest/plugin-manifest' +import { PLUGIN_EVENT_PAYLOAD_SCHEMAS } from '../../../shared/plugins/events/plugin-events' +import { + createPanelMessageBudget, + structuredCloneMessageBytes, + type PanelMessageBudget +} from '../../../shared/plugins/frames/plugin-panel-message-budget' +import { + PLUGIN_PANEL_POST_MAX_BYTES, + PLUGIN_PANEL_POST_RATE_LIMIT, + PLUGIN_PANEL_REQUEST_DEFAULT_TIMEOUT_MS, + PLUGIN_PANEL_RESULT_MAX_BYTES, + type PluginDataArea, + type PluginPanelCaller, + type PluginPanelPush, + type PluginWorkerPanelPost +} from '../../../shared/plugins/workers/plugin-panel-bridge-protocol' +import { normalizePluginErrorCode } from '../../../shared/plugins/frames/plugin-protocol' +import type { PluginJsonValue } from '../../../shared/plugins/workers/plugin-host-api' +import { z } from 'zod' + +const PLUGIN_JSON_VALUE = z.json() +import type { ValidDiscoveredPlugin } from '../plugin-discovery' +import type { PluginWorkerHandle } from '../workers/plugin-host-process' +import { PluginHostCallError } from '../workers/plugin-host-call-scope' + +type PushChannel = { + pluginKey: string + deliver: (push: PluginPanelPush) => void +} + +export type PluginPanelBridgeDependencies = { + findApprovedPlugin: (pluginKey: string) => ValidDiscoveredPlugin | null + grantedCapabilities: (pluginKey: string) => readonly PluginCapabilityKind[] | null + ensureWorker: (plugin: ValidDiscoveredPlugin) => Promise + runningWorker: (pluginKey: string) => PluginWorkerHandle | null + log: (pluginKey: string) => (line: string) => void + now?: () => number +} + +export type PluginPanelRequest = { + pluginKey: string + caller: PluginPanelCaller + name: string + input: unknown + timeoutMs?: number +} + +/** + * A plugin's open panels and its own worker. Requests go panel → worker and back; pushes (worker + * posts, events, data changes) go to the panels whose renderer opened a channel. One open panel is + * one session: its id names it to the worker, and closing it aborts its requests. + */ +export class PluginPanelBridge { + private readonly channels = new Map() + private readonly lifetimes = new Map() + private readonly postBudgets = new Map() + // By panel, not channel: a frame may subscribe before its renderer opens the channel. + private readonly subscriptions = new Map>() + + constructor(private readonly deps: PluginPanelBridgeDependencies) {} + + /** A renderer listens to one open panel; the returned function stops it. */ + open(caller: PluginPanelCaller, pluginKey: string, deliver: PushChannel['deliver']): () => void { + const channel: PushChannel = { pluginKey, deliver } + this.channels.set(caller.id, channel) + return () => { + if (this.channels.get(caller.id) === channel) { + this.channels.delete(caller.id) + } + } + } + + /** The session ended: its channel goes and its in-flight requests see `signal` abort. */ + close(panelId: string): void { + this.channels.delete(panelId) + this.subscriptions.delete(panelId) + this.lifetimes.get(panelId)?.abort() + this.lifetimes.delete(panelId) + } + + subscribe(pluginKey: string, panelId: string, event: PluginEventName): void { + const required = PLUGIN_EVENT_CAPABILITY[event] + if (!this.deps.grantedCapabilities(pluginKey)?.includes(required)) { + throw new PluginHostCallError( + 'capability_denied', + `plugin does not have the "${required}" capability` + ) + } + const events = this.subscriptions.get(panelId) ?? new Set() + events.add(event) + this.subscriptions.set(panelId, events) + } + + /** Whether an open panel subscribed to `event`. */ + hasSubscribers(event: PluginEventName): boolean { + return [...this.channels.keys()].some((panelId) => this.subscriptions.get(panelId)?.has(event)) + } + + async request(request: PluginPanelRequest): Promise { + const plugin = this.deps.findApprovedPlugin(request.pluginKey) + if (!plugin?.manifest.main) { + throw new PluginHostCallError('unavailable', 'this plugin has no worker to answer requests') + } + let worker: PluginWorkerHandle + try { + worker = await this.deps.ensureWorker(plugin) + } catch (error) { + throw new PluginHostCallError('unavailable', errorText(error)) + } + let output: unknown + try { + output = await worker.requestFromPanel({ + name: request.name, + input: request.input, + panel: request.caller, + timeoutMs: request.timeoutMs ?? PLUGIN_PANEL_REQUEST_DEFAULT_TIMEOUT_MS, + signal: this.lifetime(request.caller.id).signal + }) + } catch (error) { + const code = + typeof error === 'object' && error !== null && 'code' in error ? error.code : null + throw new PluginHostCallError(normalizePluginErrorCode(code), errorText(error)) + } + if ( + structuredCloneMessageBytes(output ?? null, PLUGIN_PANEL_RESULT_MAX_BYTES) > + PLUGIN_PANEL_RESULT_MAX_BYTES + ) { + throw new PluginHostCallError('too_large', `${request.name} answered with more than 1 MiB`) + } + const json = PLUGIN_JSON_VALUE.safeParse(output ?? null) + if (!json.success) { + throw new PluginHostCallError( + 'action_failed', + `${request.name} answered with a non-JSON value` + ) + } + return json.data + } + + /** `orca.panels.post`: dropped (and logged) past the plugin's size and rate budget. */ + onWorkerPost(pluginKey: string, post: PluginWorkerPanelPost): void { + const budget = this.postBudget(pluginKey) + const bytes = structuredCloneMessageBytes(post.payload ?? null, PLUGIN_PANEL_POST_MAX_BYTES) + const refusal = budget.admit(this.deps.now?.() ?? Date.now(), bytes) + if (refusal) { + this.deps.log(pluginKey)( + `orca.panels.post("${post.event}") dropped: ${refusal === 'oversized' ? 'payload over 256 KiB' : 'too many posts'}` + ) + return + } + const push: PluginPanelPush = { + kind: 'message', + event: post.event, + payload: post.payload ?? null + } + for (const [panelId, channel] of this.channels) { + if (channel.pluginKey === pluginKey && (post.panel === undefined || post.panel === panelId)) { + channel.deliver(push) + } + } + } + + /** A projected workspace or agent event, to panels that subscribed and may read its domain. */ + publishEvent(event: PluginEventName, raw: unknown): void { + // Why: payloads are bounded projections, so a malformed one never reaches a panel. + const projected = PLUGIN_EVENT_PAYLOAD_SCHEMAS[event].safeParse(raw) + if (!projected.success) { + return + } + const payload = projected.data + const required = PLUGIN_EVENT_CAPABILITY[event] + for (const [panelId, channel] of this.channels) { + if ( + this.subscriptions.get(panelId)?.has(event) === true && + this.deps.findApprovedPlugin(channel.pluginKey) && + this.deps.grantedCapabilities(channel.pluginKey)?.includes(required) + ) { + channel.deliver({ kind: 'event', event, payload }) + } + } + } + + /** Storage or settings changed: open panels and a running worker re-read the key. */ + dataChanged(pluginKey: string, area: PluginDataArea, key: string): void { + for (const channel of this.channels.values()) { + if (channel.pluginKey === pluginKey) { + channel.deliver({ kind: 'changed', area, key }) + } + } + this.deps.runningWorker(pluginKey)?.notifyDataChanged({ area, key }) + } + + dispose(): void { + for (const id of this.lifetimes.keys()) { + this.close(id) + } + this.channels.clear() + this.postBudgets.clear() + } + + private lifetime(panelId: string): AbortController { + let controller = this.lifetimes.get(panelId) + if (!controller) { + controller = new AbortController() + this.lifetimes.set(panelId, controller) + } + return controller + } + + private postBudget(pluginKey: string): PanelMessageBudget { + let budget = this.postBudgets.get(pluginKey) + if (!budget) { + budget = createPanelMessageBudget({ + ...PLUGIN_PANEL_POST_RATE_LIMIT, + maxBytes: PLUGIN_PANEL_POST_MAX_BYTES + }) + this.postBudgets.set(pluginKey, budget) + } + return budget + } +} + +function errorText(error: unknown): string { + return error instanceof Error ? error.message : String(error) +} diff --git a/src/main/plugins/panels/plugin-panel-controller.test.ts b/src/main/plugins/panels/plugin-panel-controller.test.ts index 6b772e72b96..6a2cc9ed682 100644 --- a/src/main/plugins/panels/plugin-panel-controller.test.ts +++ b/src/main/plugins/panels/plugin-panel-controller.test.ts @@ -76,7 +76,7 @@ describe('PluginPanelController identity binding', () => { 'notifications.show', { title: 'Hello' }, 'panel', - undefined + { panel: { id: expect.any(String), surface: 'panel', contributionId: 'dashboard' } } ) await expect( controller.execute('runtime:other', { @@ -216,7 +216,10 @@ describe('PluginPanelController user-gesture methods', () => { 'files.saveAs', call.params, 'panel', - { webContentsId: 7 } + expect.objectContaining({ + webContentsId: 7, + panel: expect.objectContaining({ surface: 'panel' }) + }) ) }) }) diff --git a/src/main/plugins/panels/plugin-panel-controller.ts b/src/main/plugins/panels/plugin-panel-controller.ts index 969e74588a5..32c8311bc56 100644 --- a/src/main/plugins/panels/plugin-panel-controller.ts +++ b/src/main/plugins/panels/plugin-panel-controller.ts @@ -23,7 +23,12 @@ import { PLUGIN_PANEL_ENTRY_MAX_BYTES, readContainedPluginArtifactText } from '../plugin-artifact-validation' -import { PluginPanelSessions, type PluginPanelSessionBinding } from './plugin-panel-sessions' +import { + PluginPanelSessions, + type PluginPanelSessionBinding, + type ResolvedPluginPanelSession +} from './plugin-panel-sessions' +import type { PluginPanelCaller } from '../../../shared/plugins/workers/plugin-panel-bridge-protocol' type PluginPanelControllerOptions = { resolveApprovedPlugin: (pluginKey: string) => ValidDiscoveredPlugin | null @@ -37,6 +42,8 @@ type PluginPanelControllerOptions = { ) => Promise log: (pluginKey: string) => (line: string) => void panelAdmission?: PluginPanelCallAdmission + /** A session's public id once it can no longer be used (its panel's requests stop). */ + onSessionClosed?: (panelId: string) => void } type FrameOpenOptions = { shell?: boolean } @@ -47,12 +54,24 @@ type LoadedPluginPanel = { } export class PluginPanelController { - private readonly sessions = new PluginPanelSessions() + private readonly sessions: PluginPanelSessions private readonly boundOwnerSignals = new WeakSet() private readonly panelAdmission: PluginPanelCallAdmission constructor(private readonly options: PluginPanelControllerOptions) { this.panelAdmission = options.panelAdmission ?? createPluginPanelCallAdmission() + this.sessions = new PluginPanelSessions((panelId) => options.onSessionClosed?.(panelId)) + } + + /** The live, still-approved panel behind an owner's session: what its push channel serves. */ + sessionCaller( + ownerKey: string, + sessionToken: string + ): { pluginKey: string; caller: PluginPanelCaller } | null { + const binding = this.sessions.resolve(ownerKey, sessionToken) + return binding && this.isCurrent(binding) + ? { pluginKey: binding.pluginKey, caller: panelCaller(binding) } + : null } async readEntry(pluginKey: string, panelId: string): Promise<{ html: string } | null> { @@ -135,13 +154,7 @@ export class PluginPanelController { if (!parsed.success) { return { ok: false, code: 'invalid_request', error: 'malformed panel action call' } } - const plugin = this.options.resolveApprovedPlugin(binding.pluginKey) - if ( - !plugin || - plugin.rootDir !== binding.rootDir || - JSON.stringify(plugin.manifest) !== binding.manifestRevision || - !findFrameContribution(plugin, binding.surface, binding.contributionId) - ) { + if (!this.isCurrent(binding)) { return { ok: false, code: 'unavailable', error: 'panel session is no longer available' } } return this.options.executeHostCall( @@ -149,7 +162,20 @@ export class PluginPanelController { parsed.data.action, parsed.data.params, binding.surface, - origin.desktop ? { webContentsId: origin.callerWebContentsId } : undefined + { + ...(origin.desktop ? { webContentsId: origin.callerWebContentsId } : {}), + panel: panelCaller(binding) + } + ) + } + + private isCurrent(binding: PluginPanelSessionBinding): boolean { + const plugin = this.options.resolveApprovedPlugin(binding.pluginKey) + return ( + plugin !== null && + plugin.rootDir === binding.rootDir && + JSON.stringify(plugin.manifest) === binding.manifestRevision && + findFrameContribution(plugin, binding.surface, binding.contributionId) !== null ) } @@ -283,6 +309,10 @@ export class PluginPanelController { } } +function panelCaller(binding: ResolvedPluginPanelSession): PluginPanelCaller { + return { id: binding.publicId, surface: binding.surface, contributionId: binding.contributionId } +} + function findFrameContribution( plugin: ValidDiscoveredPlugin, surface: PluginPanelSessionBinding['surface'], diff --git a/src/main/plugins/panels/plugin-panel-sessions.test.ts b/src/main/plugins/panels/plugin-panel-sessions.test.ts index d8fdb215e13..f999efebb15 100644 --- a/src/main/plugins/panels/plugin-panel-sessions.test.ts +++ b/src/main/plugins/panels/plugin-panel-sessions.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, it } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { PluginPanelSessions } from './plugin-panel-sessions' const binding = { @@ -15,7 +15,9 @@ describe('PluginPanelSessions', () => { const token = sessions.issue('renderer:1', binding) expect(token).toHaveLength(43) - expect(sessions.resolve('renderer:1', token)).toEqual(binding) + const resolved = sessions.resolve('renderer:1', token) + expect(resolved).toEqual({ ...binding, publicId: expect.stringMatching(/^[\w-]{12}$/) }) + expect(resolved?.publicId).not.toContain(token.slice(0, 12)) expect(sessions.resolve('renderer:2', token)).toBeNull() expect(sessions.issue('renderer:1', binding)).toBe(token) expect(sessions.issue('renderer:1', { ...binding, rootDir: '/plugins/new' })).not.toBe(token) @@ -36,6 +38,18 @@ describe('PluginPanelSessions', () => { expect(sessions.resolve('connection:one', first)).toBeNull() expect(sessions.resolve('connection:one', second)).toBeNull() - expect(sessions.resolve('connection:two', other)).toEqual(binding) + expect(sessions.resolve('connection:two', other)).toMatchObject(binding) + }) + + it('reports each closed session by its public id, never the token', () => { + const onClosed = vi.fn() + const sessions = new PluginPanelSessions(onClosed) + const token = sessions.issue('renderer:1', binding) + const { publicId } = sessions.resolve('renderer:1', token)! + sessions.revoke('renderer:1', token) + expect(onClosed).toHaveBeenCalledWith(publicId) + sessions.issue('renderer:1', binding) + sessions.clear() + expect(onClosed).toHaveBeenCalledTimes(2) }) }) diff --git a/src/main/plugins/panels/plugin-panel-sessions.ts b/src/main/plugins/panels/plugin-panel-sessions.ts index 32d7f5e2e3a..1cc525ed4e9 100644 --- a/src/main/plugins/panels/plugin-panel-sessions.ts +++ b/src/main/plugins/panels/plugin-panel-sessions.ts @@ -11,8 +11,12 @@ export type PluginPanelSessionBinding = { type PluginPanelSession = PluginPanelSessionBinding & { ownerKey: string + /** Names the open panel to its worker; never authorizes anything, unlike the token. */ + publicId: string } +export type ResolvedPluginPanelSession = PluginPanelSessionBinding & { publicId: string } + const MAX_PANEL_SESSIONS = 1_024 function bindingKey(ownerKey: string, binding: PluginPanelSessionBinding): string { @@ -31,6 +35,9 @@ export class PluginPanelSessions { private readonly sessions = new Map() private readonly tokensByBinding = new Map() + /** `onClosed` hears each session's public id once it can no longer be used. */ + constructor(private readonly onClosed: (publicId: string) => void = () => undefined) {} + issue(ownerKey: string, binding: PluginPanelSessionBinding): string { const key = bindingKey(ownerKey, binding) const existing = this.tokensByBinding.get(key) @@ -47,13 +54,13 @@ export class PluginPanelSessions { this.delete(oldest[0], oldest[1]) } const token = randomBytes(32).toString('base64url') - const session = { ownerKey, ...binding } + const session = { ownerKey, ...binding, publicId: randomBytes(9).toString('base64url') } this.sessions.set(token, session) this.tokensByBinding.set(key, token) return token } - resolve(ownerKey: string, token: string): PluginPanelSessionBinding | null { + resolve(ownerKey: string, token: string): ResolvedPluginPanelSession | null { const session = this.sessions.get(token) if (!session || session.ownerKey !== ownerKey) { return null @@ -63,7 +70,8 @@ export class PluginPanelSessions { surface: session.surface, contributionId: session.contributionId, rootDir: session.rootDir, - manifestRevision: session.manifestRevision + manifestRevision: session.manifestRevision, + publicId: session.publicId } } @@ -84,12 +92,17 @@ export class PluginPanelSessions { } clear(): void { + const closed = [...this.sessions.values()] this.sessions.clear() this.tokensByBinding.clear() + for (const session of closed) { + this.onClosed(session.publicId) + } } private delete(token: string, session: PluginPanelSession): void { this.sessions.delete(token) this.tokensByBinding.delete(bindingKey(session.ownerKey, session)) + this.onClosed(session.publicId) } } diff --git a/src/main/plugins/plugin-command-invocation.ts b/src/main/plugins/plugin-command-invocation.ts index d22de82bb96..c4660fc67b6 100644 --- a/src/main/plugins/plugin-command-invocation.ts +++ b/src/main/plugins/plugin-command-invocation.ts @@ -1,4 +1,5 @@ import type { ValidDiscoveredPlugin } from './plugin-discovery' +import type { PluginWorkerController } from './workers/plugin-worker-controller' export function assertPluginWorkerCommand(plugin: ValidDiscoveredPlugin, commandId: string): void { const command = plugin.manifest.contributes.commands.find((entry) => entry.id === commandId) @@ -10,3 +11,22 @@ export function assertPluginWorkerCommand(plugin: ValidDiscoveredPlugin, command throw new Error(`plugin ${plugin.pluginKey} command ${commandId} is a built-in action alias`) } } + +/** `plugin` is the approved plugin (null when it is not): a palette or CLI run of its command. */ +export async function invokePluginWorkerCommand( + pluginKey: string, + plugin: ValidDiscoveredPlugin | null, + workers: Pick, + commandId: string, + args?: unknown +): Promise { + if (!plugin) { + throw new Error(`plugin ${pluginKey} is not enabled`) + } + assertPluginWorkerCommand(plugin, commandId) + const handle = await workers.ensure(plugin) + if (!handle.commands.includes(commandId)) { + throw new Error(`plugin ${pluginKey} registered no handler for ${commandId}`) + } + return handle.invokeCommand(commandId, args) +} diff --git a/src/main/plugins/plugin-declared-settings.test.ts b/src/main/plugins/plugin-declared-settings.test.ts new file mode 100644 index 00000000000..7e2d736a1a8 --- /dev/null +++ b/src/main/plugins/plugin-declared-settings.test.ts @@ -0,0 +1,55 @@ +import { mkdtempSync } from 'node:fs' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { describe, expect, it, vi } from 'vitest' +import type { ValidDiscoveredPlugin } from './plugin-discovery' +import { readPluginDeclaredSettings, writePluginDeclaredSetting } from './plugin-declared-settings' + +const settings = [ + { key: 'apiUrl', title: 'Server URL', type: 'string' as const, default: 'https://example.com' }, + { key: 'pageSize', title: 'Page size', type: 'integer' as const, minimum: 1 } +] + +function host() { + const plugin = { manifest: { contributes: { settings } } } + return { + findValidPlugin: (key: string) => + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: settings code reads only manifest.contributes.settings. + key === 'acme.todos' ? (plugin as never as ValidDiscoveredPlugin) : null, + userDataPath: mkdtempSync(join(tmpdir(), 'orca-declared-settings-')), + dataChanged: vi.fn() + } +} + +describe('declared plugin settings in Orca Settings', () => { + it('shows defaults until the person sets a value, then theirs, and tells the plugin', () => { + const settingsHost = host() + expect(readPluginDeclaredSettings(settingsHost, 'acme.todos')?.values).toEqual({ + apiUrl: 'https://example.com' + }) + expect(writePluginDeclaredSetting(settingsHost, 'acme.todos', 'pageSize', 50)).toEqual({ + ok: true + }) + expect(settingsHost.dataChanged).toHaveBeenCalledWith('acme.todos', 'pageSize') + expect(writePluginDeclaredSetting(settingsHost, 'acme.todos', 'apiUrl', null)).toEqual({ + ok: true + }) + expect(readPluginDeclaredSettings(settingsHost, 'acme.todos')?.values).toEqual({ + apiUrl: 'https://example.com', + pageSize: 50 + }) + }) + + it('refuses undeclared keys and values that do not fit', () => { + const settingsHost = host() + expect(writePluginDeclaredSetting(settingsHost, 'acme.todos', 'other', 1)).toMatchObject({ + ok: false + }) + expect(writePluginDeclaredSetting(settingsHost, 'acme.todos', 'pageSize', 0)).toEqual({ + ok: false, + error: 'Page size must be at least 1' + }) + expect(settingsHost.dataChanged).not.toHaveBeenCalled() + expect(readPluginDeclaredSettings(settingsHost, 'acme.none')).toBeNull() + }) +}) diff --git a/src/main/plugins/plugin-declared-settings.ts b/src/main/plugins/plugin-declared-settings.ts new file mode 100644 index 00000000000..60680bccb7e --- /dev/null +++ b/src/main/plugins/plugin-declared-settings.ts @@ -0,0 +1,68 @@ +import type { PluginJsonValue } from '../../shared/plugins/workers/plugin-host-api' +import { pluginSettingValueIssue } from '../../shared/plugins/contributions/plugin-settings-contribution' +import { + pluginSettingDefaults, + type PluginDeclaredSettingsSnapshot +} from '../../shared/plugins/contributions/plugin-settings-values' +import { getPluginsDataDir, type ValidDiscoveredPlugin } from './plugin-discovery' +import { PluginKvStore } from './plugin-storage-store' + +type SettingsHost = { + findValidPlugin: (pluginKey: string) => ValidDiscoveredPlugin | null + userDataPath: string + /** Tells open panels and a running worker that `key` changed. */ + dataChanged: (pluginKey: string, key: string) => void +} + +function store(host: SettingsHost, pluginKey: string): PluginKvStore { + return new PluginKvStore(getPluginsDataDir(host.userDataPath), pluginKey, 'settings.json') +} + +/** What Orca's Settings shows under a plugin; null when it declares none. */ +export function readPluginDeclaredSettings( + host: SettingsHost, + pluginKey: string +): PluginDeclaredSettingsSnapshot | null { + const settings = host.findValidPlugin(pluginKey)?.manifest.contributes.settings ?? [] + if (settings.length === 0) { + return null + } + const stored = store(host, pluginKey).getAll() + const values = pluginSettingDefaults(settings) + for (const setting of settings) { + if (Object.hasOwn(stored, setting.key)) { + values[setting.key] = stored[setting.key] + } + } + return { settings, values } +} + +/** The person's edit in Settings; `null` goes back to the default. Only declared keys. */ +export function writePluginDeclaredSetting( + host: SettingsHost, + pluginKey: string, + key: string, + value: PluginJsonValue +): { ok: true } | { ok: false; error: string } { + const setting = host + .findValidPlugin(pluginKey) + ?.manifest.contributes.settings.find((entry) => entry.key === key) + if (!setting) { + return { ok: false, error: `the plugin declares no setting ${key}` } + } + const settings = store(host, pluginKey) + if (value === null) { + settings.delete(key) + } else { + const issue = pluginSettingValueIssue(setting, value) + if (issue) { + return { ok: false, error: `${setting.title} ${issue}` } + } + const written = settings.set(key, value) + if (!written.ok) { + return written + } + } + host.dataChanged(pluginKey, key) + return { ok: true } +} diff --git a/src/main/plugins/plugin-event-delivery.ts b/src/main/plugins/plugin-event-delivery.ts index bebcfde950d..3a92653cad4 100644 --- a/src/main/plugins/plugin-event-delivery.ts +++ b/src/main/plugins/plugin-event-delivery.ts @@ -9,6 +9,21 @@ import { } from './plugin-discovery' import type { PluginWorkerController } from './workers/plugin-worker-controller' +/** Whether an approved worker subscribes to `event` (open panels are asked separately). */ +export function pluginWorkersWantEvent( + event: PluginEventName, + plugins: readonly DiscoveredPlugin[], + isRuntimeApproved: (plugin: ValidDiscoveredPlugin) => boolean +): boolean { + return plugins.some( + (plugin) => + !isInvalidDiscoveredPlugin(plugin) && + plugin.manifest.main !== undefined && + plugin.manifest.contributes.events.some((subscription) => subscription.on === event) && + isRuntimeApproved(plugin) + ) +} + /** Delivers only to plugins whose manifest subscribes and whose grant covers the event's domain. */ export function deliverPluginEvent(options: { event: PluginEventName diff --git a/src/main/plugins/plugin-host-call-revocation.test.ts b/src/main/plugins/plugin-host-call-revocation.test.ts index d8104036151..65afa97737f 100644 --- a/src/main/plugins/plugin-host-call-revocation.test.ts +++ b/src/main/plugins/plugin-host-call-revocation.test.ts @@ -36,7 +36,7 @@ async function createSavingPlugin() { const dialog = gate() const writes: string[] = [] const desktop: PluginDesktopFrameServices = { - openExternal: async () => true, + openExternal: async () => ({ opened: true }), async saveFile(pluginId, _input, scope) { await dialog.opened scope.assertActive() @@ -171,6 +171,7 @@ describe('revocation checks inside executePluginHostCall', () => { return [{ id: 't1' }] }, sendTerminalText, + listAgentStatuses: () => [], dispatchPluginNotification: vi.fn(), storage: { get: vi.fn(), set: vi.fn(), delete: vi.fn(), keys: vi.fn() }, secrets: { get: vi.fn(), set: vi.fn(), delete: vi.fn(), protection: vi.fn() }, diff --git a/src/main/plugins/plugin-runtime-binding.test.ts b/src/main/plugins/plugin-runtime-binding.test.ts new file mode 100644 index 00000000000..254605b3e92 --- /dev/null +++ b/src/main/plugins/plugin-runtime-binding.test.ts @@ -0,0 +1,126 @@ +import { describe, expect, it, vi } from 'vitest' +import { + createPluginAgentStatusForwarder, + pluginRuntimeDelegate, + watchPluginWorkspaceContext +} from './plugin-runtime-binding' +import { projectPluginWorkspaceAgents } from './workers/plugin-workspace-projection' + +const LEAF = '11111111-1111-4111-8111-111111111111' + +function runtime(terminals: { handle: string; title: string | null; paneTitle?: string }[]) { + return { + resolveActiveWorktreeContext: vi.fn(async () => ({ + worktreeId: 'repo::/w', + path: '/w', + branch: 'refs/heads/main', + displayName: 'w' + })), + listTerminals: vi.fn(async () => ({ + terminals: terminals.map((terminal, index) => ({ + ...terminal, + tabId: `tab${index}`, + leafId: LEAF + })) + })), + sendTerminal: vi.fn(), + dispatchPluginNotification: vi.fn() + } +} + +describe('agent.status.changed for plugins', () => { + it('names the terminal and its title, in arrival order, only while someone listens', async () => { + const delegate = pluginRuntimeDelegate( + runtime([ + { handle: 'term_a', title: 'zsh' }, + { handle: 'term_b', title: 'codex', paneTitle: 'Reviewer' } + ]), + () => [] + ) + const events = { wantsEvent: vi.fn(() => true), emitEvent: vi.fn() } + const forward = createPluginAgentStatusForwarder(delegate, events) + const base = { workspaceId: 'repo::/w', state: 'working' as const, receivedAt: 1 } + forward({ ...base, paneKey: `tab1:${LEAF}` }) + forward({ ...base, paneKey: 'tab9:unknown', state: 'done' }) + await vi.waitFor(() => expect(events.emitEvent).toHaveBeenCalledTimes(2)) + expect(events.emitEvent.mock.calls).toEqual([ + [ + 'agent.status.changed', + { ...base, paneKey: `tab1:${LEAF}`, terminalId: 'term_b', title: 'Reviewer' } + ], + ['agent.status.changed', { ...base, paneKey: 'tab9:unknown', state: 'done' }] + ]) + events.wantsEvent.mockReturnValue(false) + forward({ ...base, paneKey: `tab0:${LEAF}` }) + await Promise.resolve() + expect(events.emitEvent).toHaveBeenCalledTimes(2) + }) +}) + +describe('agents.list projection', () => { + it("lists the focused workspace's agents with their terminal, newest first", () => { + const terminals = [{ id: 'term_a', title: 'codex', paneKey: `tab0:${LEAF}` }] + expect( + projectPluginWorkspaceAgents('w1', terminals, [ + { + paneKey: `tab0:${LEAF}`, + worktreeId: 'w1', + state: 'working', + stateStartedAt: 5, + agentType: 'codex' + }, + { paneKey: 'gone', worktreeId: 'w1', state: 'done', stateStartedAt: 9 }, + { paneKey: 'x', worktreeId: 'w2', state: 'done', stateStartedAt: 7 }, + { + paneKey: 'y', + worktreeId: 'w1', + state: 'done', + stateStartedAt: 8, + providerSessionOnly: true + } + ]) + ).toEqual([ + { terminalId: null, title: null, agent: null, state: 'done', stateStartedAt: 9 }, + { terminalId: 'term_a', title: 'codex', agent: 'codex', state: 'working', stateStartedAt: 5 } + ]) + }) +}) + +describe('workspace.changed', () => { + it('re-reads the context after session writes settle and emits only real changes', async () => { + vi.useFakeTimers() + try { + const source = runtime([{ handle: 'term_a', title: 'zsh' }]) + const delegate = pluginRuntimeDelegate(source, () => []) + const events = { wantsEvent: vi.fn(() => true), emitEvent: vi.fn() } + let written: () => void = () => undefined + const stop = watchPluginWorkspaceContext({ + delegate, + events, + onSessionWritten: (listener) => { + written = listener + return () => undefined + }, + delayMs: 10 + }) + written() + written() + await vi.advanceTimersByTimeAsync(20) + expect(events.emitEvent).toHaveBeenCalledWith('workspace.changed', { + context: { branch: 'main', displayName: 'w', terminals: [{ id: 'term_a', title: 'zsh' }] } + }) + written() + await vi.advanceTimersByTimeAsync(20) + expect(events.emitEvent).toHaveBeenCalledOnce() + source.listTerminals.mockResolvedValueOnce({ terminals: [] }) + written() + await vi.advanceTimersByTimeAsync(20) + expect(events.emitEvent).toHaveBeenLastCalledWith('workspace.changed', { + context: { branch: 'main', displayName: 'w', terminals: [] } + }) + stop() + } finally { + vi.useRealTimers() + } + }) +}) diff --git a/src/main/plugins/plugin-runtime-binding.ts b/src/main/plugins/plugin-runtime-binding.ts new file mode 100644 index 00000000000..263402a434c --- /dev/null +++ b/src/main/plugins/plugin-runtime-binding.ts @@ -0,0 +1,121 @@ +import type { PluginEventName } from '../../shared/plugins/manifest/plugin-manifest' +import type { PluginAgentStatusChangedPayload } from '../../shared/plugins/events/plugin-events' +import { PLUGIN_WORKSPACE_TERMINAL_LIMIT } from '../../shared/plugins/workers/plugin-host-api' +import type { PluginRuntimeDelegate } from './workers/plugin-host-service-bindings' +import { + pluginTerminalTitle, + projectPluginWorkspaceContext, + terminalForPane, + type PluginAgentStatusRow, + type PluginWorkspaceTerminal +} from './workers/plugin-workspace-projection' + +type PluginEvents = { + emitEvent(event: PluginEventName, payload: unknown): void + /** Whether any approved worker or open panel listens, so unheard events cost nothing. */ + wantsEvent(event: PluginEventName): boolean +} + +type RuntimeDelegateSource = Omit + +const WORKSPACE_CHANGE_DEBOUNCE_MS = 150 + +/** Main's runtime, plus the hook server's agent rows, as the plugin host's delegate. */ +export function pluginRuntimeDelegate( + runtime: RuntimeDelegateSource, + agentStatuses: () => readonly PluginAgentStatusRow[] +): PluginRuntimeDelegate { + return { + resolveActiveWorktreeContext: () => runtime.resolveActiveWorktreeContext(), + listTerminals: (...args) => runtime.listTerminals(...args), + sendTerminal: (...args) => runtime.sendTerminal(...args), + dispatchPluginNotification: (input) => runtime.dispatchPluginNotification(input), + listAgentStatuses: agentStatuses + } +} + +async function listWorkspaceTerminals( + delegate: PluginRuntimeDelegate, + worktreeId: string +): Promise { + const { terminals } = await delegate.listTerminals( + `id:${worktreeId}`, + PLUGIN_WORKSPACE_TERMINAL_LIMIT, + { includeVisualLayouts: false } + ) + return terminals.map((terminal) => ({ + id: terminal.handle, + title: pluginTerminalTitle(terminal), + ...(terminal.tabId && terminal.leafId + ? { paneKey: `${terminal.tabId}:${terminal.leafId}` } + : {}) + })) +} + +/** + * `agent.status.changed` with the pane's `terminalId` and title, in arrival order. The lookup runs + * only while some plugin listens. + */ +export function createPluginAgentStatusForwarder( + delegate: PluginRuntimeDelegate, + events: PluginEvents +): (payload: PluginAgentStatusChangedPayload, terminalHandle?: string) => void { + let chain: Promise = Promise.resolve() + return (payload, terminalHandle) => { + if (!events.wantsEvent('agent.status.changed')) { + return + } + chain = chain.then(async () => { + const { workspaceId } = payload + const terminals = workspaceId + ? await listWorkspaceTerminals(delegate, workspaceId).catch(() => []) + : [] + const terminal = terminalForPane(terminals, { paneKey: payload.paneKey, terminalHandle }) + events.emitEvent('agent.status.changed', { + ...payload, + ...(terminal ? { terminalId: terminal.id } : {}), + ...(terminal?.title ? { title: terminal.title } : {}) + }) + }) + } +} + +/** + * `workspace.changed`: after workspace session writes settle (focus moves, terminals open, close + * or are renamed), re-read the context and emit when it differs from the last one sent. + */ +export function watchPluginWorkspaceContext(input: { + delegate: PluginRuntimeDelegate + events: PluginEvents + onSessionWritten: (listener: () => void) => () => void + delayMs?: number +}): () => void { + let timer: ReturnType | null = null + let last: string | null = null + const check = async (): Promise => { + timer = null + if (!input.events.wantsEvent('workspace.changed')) { + last = null + return + } + const context = await input.delegate.resolveActiveWorktreeContext().catch(() => null) + const terminals = context + ? await listWorkspaceTerminals(input.delegate, context.worktreeId).catch(() => []) + : [] + const projected = projectPluginWorkspaceContext(context, terminals) + const signature = JSON.stringify(projected) + if (signature !== last) { + last = signature + input.events.emitEvent('workspace.changed', { context: projected }) + } + } + const stop = input.onSessionWritten(() => { + timer ??= setTimeout(() => void check(), input.delayMs ?? WORKSPACE_CHANGE_DEBOUNCE_MS) + }) + return () => { + stop() + if (timer) { + clearTimeout(timer) + } + } +} diff --git a/src/main/plugins/plugin-service-host-call.ts b/src/main/plugins/plugin-service-host-call.ts index 0f0065dfe58..29f76ddb053 100644 --- a/src/main/plugins/plugin-service-host-call.ts +++ b/src/main/plugins/plugin-service-host-call.ts @@ -8,9 +8,18 @@ import { } from './workers/plugin-host-service-bindings' import type { PluginDesktopFrameServices } from './workers/plugin-host-method-bindings' import { pluginHostCallRevoked, type PluginHostCallScope } from './workers/plugin-host-call-scope' +import type { PluginPanelCaller } from '../../shared/plugins/workers/plugin-panel-bridge-protocol' +import type { PluginPanelBridgeServices } from './workers/plugin-host-panel-method-bindings' +import type { PluginPanelBridge } from './panels/plugin-panel-bridge' +import type { + PluginHostCallOutcome, + PluginSurface +} from '../../shared/plugins/frames/plugin-protocol' +import { executePluginHostCallRequest } from './workers/plugin-host-call-adapter' -/** Who made a call: the WebContents of the frame's host window, for desktop IPC calls only. */ -export type PluginHostCaller = { webContentsId?: number } +/** Who made a call: the open panel (frames only), and its host window's WebContents for desktop + * IPC calls. */ +export type PluginHostCaller = { webContentsId?: number; panel?: PluginPanelCaller } type FindApprovedPlugin = ( pluginKey: string, @@ -21,11 +30,14 @@ type FindApprovedPlugin = ( export function createPluginHostCallScope( admitted: ValidDiscoveredPlugin, findApprovedPlugin: FindApprovedPlugin, - caller: PluginHostCaller | undefined + caller: PluginHostCaller | undefined, + log?: (line: string) => void ): PluginHostCallScope { const manifestRevision = JSON.stringify(admitted.manifest) return { callerWebContentsId: caller?.webContentsId, + log, + panel: caller?.panel, pluginName: admitted.manifest.name, assertActive() { // A refresh in flight is not a revocation; disable, consent, kill list and removal are. @@ -48,7 +60,9 @@ export function resolvePluginServiceHostCallPolicy(input: { runtimeDelegate: PluginRuntimeDelegate | null pluginsDataDir: string desktop: PluginDesktopFrameServices | null | undefined + panels: PluginPanelBridgeServices | null audit: PluginAuditLog + log?: (pluginKey: string) => (line: string) => void }): PluginHostCallPolicy { const plugin = input.findApprovedPlugin(input.pluginKey) return { @@ -57,12 +71,49 @@ export function resolvePluginServiceHostCallPolicy(input: { ? bindPluginHostServices({ delegate: input.runtimeDelegate, pluginsDataDir: input.pluginsDataDir, - desktop: input.desktop + desktop: input.desktop, + panels: input.panels, + declaredSettings: plugin?.manifest.contributes.settings }) : null, audit: input.audit, scope: plugin - ? createPluginHostCallScope(plugin, input.findApprovedPlugin, input.caller) + ? createPluginHostCallScope( + plugin, + input.findApprovedPlugin, + input.caller, + input.log?.(plugin.pluginKey) + ) : undefined } } + +/** The bridge as host services: the request carries the calling panel. */ +export function pluginPanelBridgeServices(bridge: PluginPanelBridge): PluginPanelBridgeServices { + return { + request: (pluginKey, request, caller) => bridge.request({ pluginKey, caller, ...request }), + subscribe: (pluginKey, panelId, event) => bridge.subscribe(pluginKey, panelId, event), + dataChanged: (pluginKey, area, key) => bridge.dataChanged(pluginKey, area, key) + } +} + +export type PluginServiceHostCall = ( + pluginKey: string, + method: string, + params: unknown, + surface: PluginSurface, + caller?: PluginHostCaller +) => Promise + +/** PluginService's one host-call entry: authenticate the request, then bind policy per call. */ +export function createPluginServiceHostCall( + policy: (pluginKey: string, caller: PluginHostCaller | undefined) => PluginHostCallPolicy +): PluginServiceHostCall { + return (pluginKey, method, params, surface, caller) => + executePluginHostCallRequest({ + pluginKey, + request: { method, params }, + surface, + resolvePolicy: (boundPluginKey) => policy(boundPluginKey, caller) + }) +} diff --git a/src/main/plugins/plugin-service-reconciliation.test.ts b/src/main/plugins/plugin-service-reconciliation.test.ts index 24432245a56..d63dcd5fa6a 100644 --- a/src/main/plugins/plugin-service-reconciliation.test.ts +++ b/src/main/plugins/plugin-service-reconciliation.test.ts @@ -52,6 +52,8 @@ function testWorker(): PluginWorkerHandle & { dispose: ReturnType commands: ['run'], invokeCommand: vi.fn(async () => null), deliverEvent: vi.fn(), + requestFromPanel: vi.fn(), + notifyDataChanged: vi.fn(), lastActivityAt: () => Date.now(), inFlightCount: () => 0, dispose: vi.fn(async () => undefined), diff --git a/src/main/plugins/plugin-service.ts b/src/main/plugins/plugin-service.ts index 5a3c63c677d..5aa0347a388 100644 --- a/src/main/plugins/plugin-service.ts +++ b/src/main/plugins/plugin-service.ts @@ -7,10 +7,6 @@ import type { PluginActivationState, PluginConsentLists } from '../../shared/plugins/approval/plugin-consent-state' -import type { - PluginHostCallOutcome, - PluginSurface -} from '../../shared/plugins/frames/plugin-protocol' import { discoverPlugins, getPluginsDataDir, @@ -19,13 +15,15 @@ import { type ValidDiscoveredPlugin } from './plugin-discovery' import { PluginAuditLog, type PluginAuditEntry } from './plugin-audit-log' -import { executePluginHostCallRequest } from './workers/plugin-host-call-adapter' import { PluginContentVerifier } from './plugin-content-integrity' import type { PluginRuntimeDelegate } from './workers/plugin-host-service-bindings' import { + createPluginServiceHostCall, + pluginPanelBridgeServices, resolvePluginServiceHostCallPolicy, - type PluginHostCaller + type PluginServiceHostCall } from './plugin-service-host-call' +import { PluginPanelBridge } from './panels/plugin-panel-bridge' import { PluginPanelController } from './panels/plugin-panel-controller' import { PluginWorkerController } from './workers/plugin-worker-controller' import { PluginServiceHousekeeping } from './plugin-service-housekeeping' @@ -44,8 +42,8 @@ import { PluginContentPackRegistry } from './contributions/plugin-content-pack-r import type { PluginServiceOptions } from './plugin-service-options' import type { PluginChangeEvent } from '../../shared/plugins/events/plugin-change-event' import { waitForPluginRefreshSettlement } from './plugin-refresh-settlement' -import { assertPluginWorkerCommand } from './plugin-command-invocation' -import { deliverPluginEvent } from './plugin-event-delivery' +import { invokePluginWorkerCommand } from './plugin-command-invocation' +import { deliverPluginEvent, pluginWorkersWantEvent } from './plugin-event-delivery' import { PluginInstallationState } from './installation/plugin-installation-state' export class PluginService { @@ -55,6 +53,8 @@ export class PluginService { private readonly contentVerifier = new PluginContentVerifier() readonly contentPacks: PluginContentPackRegistry readonly panels: PluginPanelController + readonly panelBridge: PluginPanelBridge + private readonly hostCall: PluginServiceHostCall private readonly changeListeners = new Set<(event: PluginChangeEvent) => void>() private readonly housekeeping = new PluginServiceHousekeeping() private runtimeDelegate: PluginRuntimeDelegate | null = null @@ -76,12 +76,33 @@ export class PluginService { this.audit = new PluginAuditLog(getPluginsDataDir(options.userDataPath)) const resolveApproved = (pluginKey: string, allowRefreshPause = false) => this.findApprovedPlugin(pluginKey, allowRefreshPause) + this.panelBridge = new PluginPanelBridge({ + findApprovedPlugin: (pluginKey) => resolveApproved(pluginKey), + grantedCapabilities: (pluginKey) => this.getGrantedCapabilities(pluginKey), + ensureWorker: (plugin) => this.workerController.ensure(plugin), + runningWorker: (pluginKey) => this.workerController.runningHandle(pluginKey), + log: (pluginKey) => this.installed.captureLog(pluginKey, 'warn') + }) + this.hostCall = createPluginServiceHostCall((pluginKey, caller) => + resolvePluginServiceHostCallPolicy({ + pluginKey, + caller, + findApprovedPlugin: resolveApproved, + runtimeDelegate: this.runtimeDelegate, + pluginsDataDir: getPluginsDataDir(this.options.userDataPath), + desktop: this.options.getDesktopFrameServices?.(), + panels: pluginPanelBridgeServices(this.panelBridge), + audit: this.audit, + log: (pluginKey) => this.installed.captureLog(pluginKey, 'info') + }) + ) this.panels = new PluginPanelController({ resolveApprovedPlugin: resolveApproved, contentVerifier: this.contentVerifier, executeHostCall: (pluginKey, method, params, surface, caller) => this.executeHostCall(pluginKey, method, params, surface, caller), - log: (pluginKey) => this.installed.captureLog(pluginKey, 'error') + log: (pluginKey) => this.installed.captureLog(pluginKey, 'error'), + onSessionClosed: (panelId) => this.panelBridge.close(panelId) }) this.workerController = new PluginWorkerController({ entryPath: options.hostEntryPath ?? '', @@ -94,6 +115,7 @@ export class PluginService { isApprovalKept: (spec) => isApprovedWorkerSpec(spec, resolveApproved(spec.pluginKey, true)), executeHostCall: (pluginKey, method, params) => this.executeHostCall(pluginKey, method, params, 'worker'), + onPanelPost: (pluginKey, post) => this.panelBridge.onWorkerPost(pluginKey, post), log: (pluginKey) => this.installed.logs.capture(pluginKey), onStateChanged: () => this.notifyChanged(false) }) @@ -247,42 +269,20 @@ export class PluginService { return plugin ? capabilityKinds(plugin.manifest.capabilities) : null } - async executeHostCall( - pluginKey: string, - method: string, - params: unknown, - surface: PluginSurface, - caller?: PluginHostCaller - ): Promise { - return executePluginHostCallRequest({ - pluginKey, - request: { method, params }, - surface, - resolvePolicy: (boundPluginKey) => - resolvePluginServiceHostCallPolicy({ - pluginKey: boundPluginKey, - caller, - findApprovedPlugin: (key, allowRefreshPause) => - this.findApprovedPlugin(key, allowRefreshPause), - runtimeDelegate: this.runtimeDelegate, - pluginsDataDir: getPluginsDataDir(this.options.userDataPath), - desktop: this.options.getDesktopFrameServices?.(), - audit: this.audit - }) - }) + executeHostCall(...args: Parameters): ReturnType { + return this.hostCall(...args) } - async invokeCommand(pluginKey: string, commandId: string, args?: unknown): Promise { - const plugin = this.findValidPlugin(pluginKey) - if (!plugin || !this.canStartPluginWork(plugin)) { - throw new Error(`plugin ${pluginKey} is not enabled`) - } - assertPluginWorkerCommand(plugin, commandId) - const handle = await this.workerController.ensure(plugin) - if (!handle.commands.includes(commandId)) { - throw new Error(`plugin ${pluginKey} registered no handler for ${commandId}`) - } - return handle.invokeCommand(commandId, args) + invokeCommand(pluginKey: string, commandId: string, args?: unknown): Promise { + const plugin = this.findApprovedPlugin(pluginKey) + return invokePluginWorkerCommand(pluginKey, plugin, this.workerController, commandId, args) + } + + wantsEvent(event: PluginEventName): boolean { + return ( + this.panelBridge.hasSubscribers(event) || + pluginWorkersWantEvent(event, this.installed.discovered, (p) => this.canStartPluginWork(p)) + ) } emitEvent(event: PluginEventName, payload: unknown): void { @@ -298,6 +298,7 @@ export class PluginService { grantedCapabilities: (pluginKey) => this.getGrantedCapabilities(pluginKey), logWarning: (pluginKey) => this.installed.captureLog(pluginKey, 'warn') }) + this.panelBridge.publishEvent(event, payload) } removePlugin(pluginKey: string, remove: () => Promise): Promise { @@ -333,6 +334,7 @@ export class PluginService { this.disposed = true this.housekeeping.dispose() this.panels.dispose() + this.panelBridge.dispose() // Why stop workers first: a refresh may be waiting on a worker slot only shutdown releases. await Promise.all([this.workerController.dispose(), this.refreshChain.catch(() => undefined)]) await this.audit.flush() diff --git a/src/main/plugins/workers/plugin-host-call-scope.ts b/src/main/plugins/workers/plugin-host-call-scope.ts index 760f50628ba..93f5892aa5a 100644 --- a/src/main/plugins/workers/plugin-host-call-scope.ts +++ b/src/main/plugins/workers/plugin-host-call-scope.ts @@ -1,4 +1,5 @@ import type { PluginErrorCode } from '../../../shared/plugins/frames/plugin-protocol' +import type { PluginPanelCaller } from '../../../shared/plugins/workers/plugin-panel-bridge-protocol' /** * What one admitted call carries to its side effect. `assertActive` throws once the plugin was @@ -11,6 +12,10 @@ export type PluginHostCallScope = { callerWebContentsId?: number /** The plugin's display name, for prompts Orca shows on its behalf. */ pluginName?: string + /** The open panel or editor that made the call; absent for workers. */ + panel?: PluginPanelCaller + /** Writes to the plugin's log (`orca plugin logs`). */ + log?: (line: string) => void } export const UNSCOPED_PLUGIN_HOST_CALL: PluginHostCallScope = { assertActive: () => {} } diff --git a/src/main/plugins/workers/plugin-host-method-bind.ts b/src/main/plugins/workers/plugin-host-method-bind.ts new file mode 100644 index 00000000000..cf618f2f961 --- /dev/null +++ b/src/main/plugins/workers/plugin-host-method-bind.ts @@ -0,0 +1,49 @@ +import type { z } from 'zod' +import type { PluginHostMethodSpec } from '../../../shared/plugins/workers/plugin-host-api' +import type { PluginHostCallScope } from './plugin-host-call-scope' +import type { PluginHostServices } from './plugin-host-method-bindings' + +export type PluginHostMethodContext = { + pluginId: string + services: PluginHostServices + scope: PluginHostCallScope +} + +export type PreparedPluginHostCall = + | { ok: false; issue: string } + | { + ok: true + params: unknown + /** Runs the handler; `value` is null when the result failed its schema. */ + execute: (ctx: PluginHostMethodContext) => Promise<{ value: unknown } | null> + } + +export type BoundPluginHostMethod = { + spec: PluginHostMethodSpec + prepare: (params: unknown) => PreparedPluginHostCall +} + +export function bind

( + spec: PluginHostMethodSpec, + handler: (params: z.output

, ctx: PluginHostMethodContext) => Promise> +): BoundPluginHostMethod { + return { + spec, + prepare(raw) { + const parsed = spec.params.safeParse(raw) + if (!parsed.success) { + const issue = parsed.error.issues[0] + const path = issue?.path.join('.') || '(root)' + return { ok: false, issue: `${path}: ${issue?.message ?? 'invalid params'}` } + } + return { + ok: true, + params: parsed.data, + async execute(ctx) { + const result = spec.result.safeParse(await handler(parsed.data, ctx)) + return result.success ? { value: result.data } : null + } + } + } + } +} diff --git a/src/main/plugins/workers/plugin-host-method-bindings.ts b/src/main/plugins/workers/plugin-host-method-bindings.ts index 8cec8e81a87..dab17f4fbe7 100644 --- a/src/main/plugins/workers/plugin-host-method-bindings.ts +++ b/src/main/plugins/workers/plugin-host-method-bindings.ts @@ -1,17 +1,23 @@ -import type { z } from 'zod' import { isPluginHostMethodName, PLUGIN_HOST_API, PLUGIN_HOST_METHOD_NAMES, - PLUGIN_TERMINAL_ID_MAX_LENGTH, - PLUGIN_WORKSPACE_LABEL_MAX_LENGTH, - PLUGIN_WORKSPACE_TERMINAL_LIMIT, type PluginHostMethodName, - type PluginHostMethodSpec, type PluginJsonValue } from '../../../shared/plugins/workers/plugin-host-api' -import { shortPluginBranchName } from '../../../shared/plugins/events/plugin-events' +import { + projectPluginWorkspaceAgents, + projectPluginWorkspaceContext, + type PluginAgentStatusRow, + type PluginWorkspaceTerminal +} from './plugin-workspace-projection' import type { PluginHostCallScope } from './plugin-host-call-scope' +import type { PluginDataArea } from '../../../shared/plugins/workers/plugin-panel-bridge-protocol' +import { + PLUGIN_PANEL_BRIDGE_HANDLERS, + type PluginPanelBridgeServices +} from './plugin-host-panel-method-bindings' +import { bind, type BoundPluginHostMethod } from './plugin-host-method-bind' export type { PluginHostCallScope } from './plugin-host-call-scope' @@ -23,7 +29,11 @@ export type PluginWorktreeContext = { /** Desktop-only sinks for frame methods; absent in headless serve. */ export type PluginDesktopFrameServices = { - openExternal(pluginId: string, url: string, scope: PluginHostCallScope): Promise + openExternal( + pluginId: string, + url: string, + scope: PluginHostCallScope + ): Promise<{ opened: boolean; reason?: 'cancelled' | 'consent-unavailable' }> /** False when the person cancelled the dialog. */ saveFile( pluginId: string, @@ -34,7 +44,8 @@ export type PluginDesktopFrameServices = { export type PluginHostServices = { resolveActiveWorktreeContext(): Promise - listWorktreeTerminals(worktreeId: string): Promise<{ id: string }[]> + listWorktreeTerminals(worktreeId: string): Promise + listAgentStatuses(): readonly PluginAgentStatusRow[] sendTerminalText( terminalId: string, action: { text: string; enter: boolean } @@ -64,6 +75,8 @@ export type PluginHostServices = { protection(): 'os-keyring' | 'unavailable' } desktop?: PluginDesktopFrameServices | null + /** The plugin's open panels and its worker; absent where no panel host runs. */ + panels?: PluginPanelBridgeServices | null settings: { getAll(pluginId: string): Record set( @@ -74,72 +87,33 @@ export type PluginHostServices = { } } -type PluginHostMethodContext = { - pluginId: string - services: PluginHostServices - scope: PluginHostCallScope -} - -export type PreparedPluginHostCall = - | { ok: false; issue: string } - | { - ok: true - params: unknown - /** Runs the handler; `value` is null when the result failed its schema. */ - execute: (ctx: PluginHostMethodContext) => Promise<{ value: unknown } | null> - } - -export type BoundPluginHostMethod = { - spec: PluginHostMethodSpec - prepare: (params: unknown) => PreparedPluginHostCall -} - -function bind

( - spec: PluginHostMethodSpec, - handler: (params: z.output

, ctx: PluginHostMethodContext) => Promise> -): BoundPluginHostMethod { - return { - spec, - prepare(raw) { - const parsed = spec.params.safeParse(raw) - if (!parsed.success) { - const issue = parsed.error.issues[0] - const path = issue?.path.join('.') || '(root)' - return { ok: false, issue: `${path}: ${issue?.message ?? 'invalid params'}` } - } - return { - ok: true, - params: parsed.data, - async execute(ctx) { - const result = spec.result.safeParse(await handler(parsed.data, ctx)) - return result.success ? { value: result.data } : null - } - } - } - } -} +export type { + BoundPluginHostMethod, + PluginHostMethodContext, + PreparedPluginHostCall +} from './plugin-host-method-bind' const api = PLUGIN_HOST_API const OK = { ok: true } as const const HANDLERS: Record = { 'workspace.readContext': bind(api['workspace.readContext'], async (_params, { services }) => { + const context = await services.resolveActiveWorktreeContext() + const terminals = context ? await services.listWorktreeTerminals(context.worktreeId) : [] + return projectPluginWorkspaceContext(context, terminals) + }), + 'agents.list': bind(api['agents.list'], async (_params, { services }) => { const context = await services.resolveActiveWorktreeContext() if (!context) { - return null + return { agents: [] } } const terminals = await services.listWorktreeTerminals(context.worktreeId) - // Worktree IDs embed provider paths; explicitly project safe public fields. return { - branch: shortPluginBranchName(context.branch).slice(0, PLUGIN_WORKSPACE_LABEL_MAX_LENGTH), - displayName: context.displayName.slice(0, PLUGIN_WORKSPACE_LABEL_MAX_LENGTH), - terminals: terminals - .filter( - (terminal) => - terminal.id.length > 0 && terminal.id.length <= PLUGIN_TERMINAL_ID_MAX_LENGTH - ) - .slice(0, PLUGIN_WORKSPACE_TERMINAL_LIMIT) - .map((terminal) => ({ id: terminal.id })) + agents: projectPluginWorkspaceAgents( + context.worktreeId, + terminals, + services.listAgentStatuses() + ) } }), 'terminal.sendText': bind(api['terminal.sendText'], async (params, { services, scope }) => { @@ -164,11 +138,17 @@ const HANDLERS: Record = { value: services.storage.get(pluginId, key) ?? null })), 'storage.set': bind(api['storage.set'], async ({ key, value }, { pluginId, services }) => - okOrThrow(services.storage.set(pluginId, key, value)) + changed( + services, + pluginId, + 'storage', + key, + okOrThrow(services.storage.set(pluginId, key, value)) + ) ), 'storage.delete': bind(api['storage.delete'], async ({ key }, { pluginId, services }) => { services.storage.delete(pluginId, key) - return OK + return changed(services, pluginId, 'storage', key, OK) }), 'storage.keys': bind(api['storage.keys'], async (_params, { pluginId, services }) => ({ keys: services.storage.keys(pluginId) @@ -194,18 +174,24 @@ const HANDLERS: Record = { settings: services.settings.getAll(pluginId) })), 'settings.set': bind(api['settings.set'], async ({ key, value }, { pluginId, services }) => - okOrThrow(services.settings.set(pluginId, key, value)) + changed( + services, + pluginId, + 'settings', + key, + okOrThrow(services.settings.set(pluginId, key, value)) + ) ), 'shell.openExternal': bind( api['shell.openExternal'], - async ({ url }, { pluginId, services, scope }) => ({ - opened: await requireDesktop(services).openExternal(pluginId, url, scope) - }) + async ({ url }, { pluginId, services, scope }) => + requireDesktop(services).openExternal(pluginId, url, scope) ), 'files.saveAs': bind(api['files.saveAs'], async (params, { pluginId, services, scope }) => { const saved = await requireDesktop(services).saveFile(pluginId, params, scope) return { status: saved ? ('saved' as const) : ('cancelled' as const) } - }) + }), + ...PLUGIN_PANEL_BRIDGE_HANDLERS } function requireDesktop(services: PluginHostServices): PluginDesktopFrameServices { @@ -215,6 +201,18 @@ function requireDesktop(services: PluginHostServices): PluginDesktopFrameService return services.desktop } +/** Tells the plugin's panels and worker after a write lands. */ +function changed( + services: PluginHostServices, + pluginId: string, + area: PluginDataArea, + key: string, + result: T +): T { + services.panels?.dataChanged(pluginId, area, key) + return result +} + function okOrThrow(result: { ok: true } | { ok: false; error: string }): typeof OK { if (!result.ok) { throw new Error(result.error) diff --git a/src/main/plugins/workers/plugin-host-methods.test.ts b/src/main/plugins/workers/plugin-host-methods.test.ts index 4701ed30630..ffbb5e24ab8 100644 --- a/src/main/plugins/workers/plugin-host-methods.test.ts +++ b/src/main/plugins/workers/plugin-host-methods.test.ts @@ -10,6 +10,7 @@ function createServices(storageSet: PluginHostServices['storage']['set']): Plugi resolveActiveWorktreeContext: vi.fn().mockResolvedValue(null), listWorktreeTerminals: vi.fn().mockResolvedValue([]), sendTerminalText: vi.fn().mockResolvedValue({ accepted: true }), + listAgentStatuses: () => [], dispatchPluginNotification: vi.fn().mockResolvedValue({ delivered: true }), storage: { get: vi.fn(), @@ -190,10 +191,17 @@ describe('host API surfaces and strict params', () => { }) it('lets each surface call only the methods that list it', async () => { - await expect(call('storage.keys', {}, 'editor')).resolves.toMatchObject({ + await expect( + call('terminal.sendText', { terminalId: 't', text: 'x' }, 'editor') + ).resolves.toMatchObject({ ok: false, code: 'not_permitted' }) + // Panels and editors share the plugin's own storage, behind the same capability. + await expect(call('storage.keys', {}, 'editor')).resolves.toEqual({ + ok: true, + value: { keys: [] } + }) await expect(call('storage.keys', {}, 'worker')).resolves.toEqual({ ok: true, value: { keys: [] } @@ -321,7 +329,7 @@ describe('executePluginHostCall frame desktop methods', () => { const audit = () => ({ record: vi.fn().mockResolvedValue(undefined) }) it('need no capability but still consent, and stay off workers', async () => { - const desktop = { openExternal: vi.fn().mockResolvedValue(true), saveFile: vi.fn() } + const desktop = { openExternal: vi.fn().mockResolvedValue({ opened: true }), saveFile: vi.fn() } const services = { ...createServices(vi.fn()), desktop } const call = (overrides: Partial[0]>) => executePluginHostCall({ diff --git a/src/main/plugins/workers/plugin-host-panel-method-bindings.ts b/src/main/plugins/workers/plugin-host-panel-method-bindings.ts new file mode 100644 index 00000000000..b0362b5ca09 --- /dev/null +++ b/src/main/plugins/workers/plugin-host-panel-method-bindings.ts @@ -0,0 +1,62 @@ +import { + PLUGIN_HOST_API, + type PluginJsonValue +} from '../../../shared/plugins/workers/plugin-host-api' +import type { PluginEventName } from '../../../shared/plugins/manifest/plugin-manifest' +import type { + PluginDataArea, + PluginPanelCaller +} from '../../../shared/plugins/workers/plugin-panel-bridge-protocol' +import { bind, type BoundPluginHostMethod } from './plugin-host-method-bind' +import { PluginHostCallError } from './plugin-host-call-scope' + +/** What `plugin.request`, `events.subscribe` and data-change notices reach (PluginPanelBridge). */ +export type PluginPanelBridgeServices = { + request( + pluginId: string, + request: { name: string; input: unknown; timeoutMs?: number }, + caller: PluginPanelCaller + ): Promise + subscribe(pluginId: string, panelId: string, event: PluginEventName): void + dataChanged(pluginId: string, area: PluginDataArea, key: string): void +} + +function requirePanel(caller: PluginPanelCaller | undefined): PluginPanelCaller { + if (!caller) { + throw new PluginHostCallError('not_permitted', 'only an open panel or editor can call this') + } + return caller +} + +function requireBridge( + bridge: PluginPanelBridgeServices | null | undefined +): PluginPanelBridgeServices { + if (!bridge) { + throw new PluginHostCallError('unavailable', 'panels cannot reach their worker in this Orca') + } + return bridge +} + +const api = PLUGIN_HOST_API + +export const PLUGIN_PANEL_BRIDGE_HANDLERS = { + 'plugin.request': bind( + api['plugin.request'], + async ({ name, input, timeoutMs }, { pluginId, services, scope }) => { + const caller = requirePanel(scope.panel) + const output = await requireBridge(services.panels).request( + pluginId, + { name, input: input ?? null, timeoutMs }, + caller + ) + return { output } + } + ), + 'events.subscribe': bind( + api['events.subscribe'], + async ({ event }, { pluginId, services, scope }) => { + requireBridge(services.panels).subscribe(pluginId, requirePanel(scope.panel).id, event) + return { ok: true as const } + } + ) +} satisfies Record diff --git a/src/main/plugins/workers/plugin-host-panel-methods.test.ts b/src/main/plugins/workers/plugin-host-panel-methods.test.ts new file mode 100644 index 00000000000..a997a331661 --- /dev/null +++ b/src/main/plugins/workers/plugin-host-panel-methods.test.ts @@ -0,0 +1,120 @@ +import { mkdtempSync } from 'node:fs' +import { tmpdir } from 'node:os' +import { join } from 'node:path' +import { describe, expect, it, vi } from 'vitest' +import { executePluginHostCall } from './plugin-host-methods' +import { bindPluginHostServices, type PluginRuntimeDelegate } from './plugin-host-service-bindings' +import type { PluginPanelBridgeServices } from './plugin-host-panel-method-bindings' +import type { PluginCapabilityKind } from '../../../shared/plugins/capabilities/plugin-capabilities' + +const panel = { id: 'panel-1', surface: 'panel' as const, contributionId: 'todos' } + +function services(panels: PluginPanelBridgeServices | null = null) { + return bindPluginHostServices({ + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: these methods never reach the runtime delegate. + delegate: {} as PluginRuntimeDelegate, + pluginsDataDir: mkdtempSync(join(tmpdir(), 'orca-panel-methods-')), + panels, + declaredSettings: [ + { key: 'pageSize', title: 'Page size', type: 'integer', default: 20, minimum: 1 } + ] + }) +} + +function bridge() { + return { + request: vi.fn(async (..._args: unknown[]) => ['todo']), + subscribe: vi.fn(), + dataChanged: vi.fn() + } satisfies PluginPanelBridgeServices +} + +const call = ( + method: string, + params: unknown, + options: { + surface?: 'panel' | 'worker' + panels?: PluginPanelBridgeServices + grants?: PluginCapabilityKind[] + withPanel?: boolean + } +) => { + const bound = services(options.panels ?? null) + return executePluginHostCall({ + pluginId: 'acme.todos', + method, + params, + surface: options.surface ?? 'panel', + grantedCapabilities: options.grants ?? ['settings:own', 'storage:own'], + services: bound, + audit: { record: vi.fn().mockResolvedValue(undefined) }, + scope: { assertActive: () => undefined, panel: options.withPanel === false ? undefined : panel } + }) +} + +describe('plugin.request', () => { + it("routes to the plugin's own worker with the calling panel", async () => { + const panels = bridge() + await expect( + call( + 'plugin.request', + { name: 'todos.list', input: { done: true }, timeoutMs: 500 }, + { panels } + ) + ).resolves.toEqual({ ok: true, value: { output: ['todo'] } }) + expect(panels.request).toHaveBeenCalledWith( + 'acme.todos', + { name: 'todos.list', input: { done: true }, timeoutMs: 500 }, + panel + ) + }) + + it('is for open frames only', async () => { + await expect( + call('plugin.request', { name: 'x' }, { surface: 'worker', panels: bridge() }) + ).resolves.toMatchObject({ + code: 'not_permitted' + }) + await expect( + call('plugin.request', { name: 'x' }, { panels: bridge(), withPanel: false }) + ).resolves.toMatchObject({ + code: 'not_permitted' + }) + await expect( + call('plugin.request', { name: 'has space' }, { panels: bridge() }) + ).resolves.toMatchObject({ + code: 'invalid_params' + }) + }) +}) + +describe('panel storage and settings', () => { + it('reads declared settings with their default and refuses values of the wrong type', async () => { + const panels = bridge() + await expect(call('settings.get', {}, { panels })).resolves.toEqual({ + ok: true, + value: { settings: { pageSize: 20 } } + }) + await expect( + call('settings.set', { key: 'pageSize', value: 0 }, { panels }) + ).resolves.toMatchObject({ + ok: false, + error: 'pageSize must be at least 1' + }) + expect(panels.dataChanged).not.toHaveBeenCalled() + }) + + it('tells panels and the worker after a write lands', async () => { + const panels = bridge() + await expect( + call('storage.set', { key: 'todos', value: [1] }, { panels }) + ).resolves.toMatchObject({ ok: true }) + expect(panels.dataChanged).toHaveBeenCalledWith('acme.todos', 'storage', 'todos') + }) + + it('keeps the capability gate for panels', async () => { + await expect(call('storage.get', { key: 'todos' }, { grants: [] })).resolves.toMatchObject({ + code: 'capability_denied' + }) + }) +}) diff --git a/src/main/plugins/workers/plugin-host-process-types.ts b/src/main/plugins/workers/plugin-host-process-types.ts new file mode 100644 index 00000000000..b4e88f11f57 --- /dev/null +++ b/src/main/plugins/workers/plugin-host-process-types.ts @@ -0,0 +1,63 @@ +import type { PluginCapabilityKind } from '../../../shared/plugins/capabilities/plugin-capabilities' +import type { PluginEventName } from '../../../shared/plugins/manifest/plugin-manifest' +import type { + PluginErrorCode, + PluginHostCallOutcome +} from '../../../shared/plugins/frames/plugin-protocol' +import type { + PluginDataChanged, + PluginPanelCaller, + PluginWorkerPanelPost +} from '../../../shared/plugins/workers/plugin-panel-bridge-protocol' + +/** A worker answer that failed, with the code the worker (or the host) gave. */ +export type PluginWorkerRequestError = Error & { code: PluginErrorCode } + +export type PluginWorkerPanelRequest = { + name: string + input: unknown + panel: PluginPanelCaller + timeoutMs: number + signal?: AbortSignal +} + +export type PluginWorkerLogSink = (level: 'info' | 'warn' | 'error', line: string) => void + +export type PluginWorkerHostCallExecutor = ( + method: string, + params: unknown +) => Promise + +export type PluginWorkerHandle = { + /** Command ids the worker registered on activate (⊆ manifest commands). */ + commands: readonly string[] + invokeCommand(commandId: string, args?: unknown): Promise + deliverEvent(event: PluginEventName, payload: unknown): void + /** A panel's `plugin.request`; rejects with a {@link PluginWorkerRequestError}. */ + requestFromPanel(request: PluginWorkerPanelRequest): Promise + /** Fire-and-forget: the worker's `storage`/`settings` `onDidChange` listeners. */ + notifyDataChanged(change: PluginDataChanged): void + /** Last completed work timestamp, in milliseconds, for idle reaping. */ + lastActivityAt(): number + inFlightCount(): number + dispose(): Promise + kill(): void + onExit(callback: (code: number | null) => void): void +} + +export type StartPluginWorkerOptions = { + pluginId: string + rootDir: string + mainEntry: string + /** Caller-resolved compiled entry path. */ + entryPath: string + grantedCapabilities: readonly PluginCapabilityKind[] + executeHostCall: PluginWorkerHostCallExecutor + /** `orca.panels.post` from this worker, already shape-checked. */ + onPanelPost?: (post: PluginWorkerPanelPost) => void + log: PluginWorkerLogSink + readyTimeoutMs?: number + invokeTimeoutMs?: number + eventTimeoutMs?: number + signal?: AbortSignal +} diff --git a/src/main/plugins/workers/plugin-host-process.ts b/src/main/plugins/workers/plugin-host-process.ts index 4987a383d10..b8ec1d9eeca 100644 --- a/src/main/plugins/workers/plugin-host-process.ts +++ b/src/main/plugins/workers/plugin-host-process.ts @@ -8,17 +8,21 @@ import { WORKER_EVENTS, WORKER_METHODS } from '../../../shared/plugins/workers/plugin-host-protocol' -import type { PluginCapabilityKind } from '../../../shared/plugins/capabilities/plugin-capabilities' -import type { PluginEventName } from '../../../shared/plugins/manifest/plugin-manifest' import { - pluginCancel, pluginEvent, pluginOutcomeResponse, pluginRequest, + normalizePluginErrorCode, readPluginEnvelope, - type PluginEnvelope, - type PluginHostCallOutcome + type PluginEnvelope } from '../../../shared/plugins/frames/plugin-protocol' +import type { PluginWorkerHandle, StartPluginWorkerOptions } from './plugin-host-process-types' +import { + requestError, + sendPluginWorkerRequest, + type PendingCall, + type PluginWorkerRequestChannel +} from './plugin-worker-requests' import { buildPluginWorkerEnv } from './plugin-worker-env' import { pipePluginWorkerOutput } from './plugin-worker-output-buffer' @@ -26,40 +30,12 @@ const PLUGIN_WORKER_SHUTDOWN_GRACE_MS = 2_000 const PLUGIN_WORKER_EVENT_TIMEOUT_MS = 5 * 60_000 const PLUGIN_WORKER_MAX_PENDING_EVENTS = 64 -export type PluginWorkerLogSink = (level: 'info' | 'warn' | 'error', line: string) => void - -export type PluginWorkerHostCallExecutor = ( - method: string, - params: unknown -) => Promise - -export type PluginWorkerHandle = { - /** Command ids the worker registered on activate (⊆ manifest commands). */ - commands: readonly string[] - invokeCommand(commandId: string, args?: unknown): Promise - deliverEvent(event: PluginEventName, payload: unknown): void - /** Last completed work timestamp, in milliseconds, for idle reaping. */ - lastActivityAt(): number - inFlightCount(): number - dispose(): Promise - kill(): void - onExit(callback: (code: number | null) => void): void -} - -export type StartPluginWorkerOptions = { - pluginId: string - rootDir: string - mainEntry: string - /** Caller-resolved compiled entry path. */ - entryPath: string - grantedCapabilities: readonly PluginCapabilityKind[] - executeHostCall: PluginWorkerHostCallExecutor - log: PluginWorkerLogSink - readyTimeoutMs?: number - invokeTimeoutMs?: number - eventTimeoutMs?: number - signal?: AbortSignal -} +export type { + PluginWorkerHandle, + PluginWorkerHostCallExecutor, + PluginWorkerLogSink, + StartPluginWorkerOptions +} from './plugin-host-process-types' /** Fork the unpacked entry because Node cannot execute inside app.asar. */ export function resolvePluginHostEntryPath(appPath: string, isPackaged: boolean): string { @@ -71,12 +47,6 @@ export function resolvePluginHostEntryPath(appPath: string, isPackaged: boolean) return join(basePath, 'out', 'main', 'plugin-host-entry.js') } -type PendingCall = { - resolve: (value: unknown) => void - reject: (error: Error) => void - timer: ReturnType -} - export async function startPluginWorker( options: StartPluginWorkerOptions ): Promise { @@ -118,7 +88,7 @@ export async function startPluginWorker( for (const [callId, entry] of pendingCommands) { clearTimeout(entry.timer) pendingCommands.delete(callId) - entry.reject(new Error(reason)) + entry.reject(requestError('unavailable', reason)) } for (const timer of pendingEvents.values()) { clearTimeout(timer) @@ -188,7 +158,8 @@ export async function startPluginWorker( clearTimeout(entry.timer) pendingCommands.delete(message.id) if (message.error) { - entry.reject(new Error(message.error.message || 'plugin command failed')) + const code = normalizePluginErrorCode(message.error.code) + entry.reject(requestError(code, message.error.message || 'plugin command failed')) } else { entry.resolve(message.result) } @@ -218,6 +189,9 @@ export async function startPluginWorker( clearTimeout(timer) options.signal?.removeEventListener('abort', onAbort) resolve(event.payload.commands) + } else if (event?.event === WORKER_EVENTS.panelPost) { + lastActivityAt = Date.now() + options.onPanelPost?.(event.payload) } else if (event?.event === WORKER_EVENTS.log) { log(event.payload.level, event.payload.message) } else if (event?.event === WORKER_EVENTS.fatal) { @@ -239,23 +213,39 @@ export async function startPluginWorker( } }) + const requests: PluginWorkerRequestChannel = { + pending: pendingCommands, + send: sendToChild, + nextId: () => nextId++, + isRunning: () => !exited && !disposed, + tag + } + return { commands, invokeCommand(commandId, args) { - if (exited || disposed) { - return Promise.reject(new Error(`${tag} worker is not running`)) + return sendPluginWorkerRequest( + requests, + WORKER_METHODS.invokeCommand, + { commandId, args }, + invokeTimeoutMs, + commandId + ) + }, + requestFromPanel({ name, input, panel, timeoutMs, signal }) { + return sendPluginWorkerRequest( + requests, + WORKER_METHODS.panelRequest, + { name, input, panel }, + timeoutMs, + name, + signal + ) + }, + notifyDataChanged(change) { + if (!exited && !disposed) { + sendToChild(pluginEvent(WORKER_EVENTS.dataChanged, change)) } - const callId = nextId++ - return new Promise((resolve, reject) => { - const timer = setTimeout(() => { - pendingCommands.delete(callId) - // Tell the handler too, so it stops instead of running on unobserved. - sendToChild(pluginCancel(callId)) - reject(new Error(`${tag} ${commandId} timed out after ${invokeTimeoutMs}ms`)) - }, invokeTimeoutMs) - pendingCommands.set(callId, { resolve, reject, timer }) - sendToChild(pluginRequest(callId, WORKER_METHODS.invokeCommand, { commandId, args })) - }) }, deliverEvent(event, payload) { if (exited || disposed) { diff --git a/src/main/plugins/workers/plugin-host-runtime.ts b/src/main/plugins/workers/plugin-host-runtime.ts index 36c1a613a9d..a33b81d0ae0 100644 --- a/src/main/plugins/workers/plugin-host-runtime.ts +++ b/src/main/plugins/workers/plugin-host-runtime.ts @@ -24,22 +24,17 @@ import { type PluginRequest, type PluginResponse } from '../../../shared/plugins/frames/plugin-protocol' -import type { PluginEventName } from '../../../shared/plugins/manifest/plugin-manifest' -import { PLUGIN_V1_EVENT_ALIASES } from '../../../shared/plugins/contributions/plugin-event-contribution' import { - PLUGIN_HOST_API_MINOR, - pluginHostMethodsFor -} from '../../../shared/plugins/workers/plugin-host-api' -import { PLUGIN_HOST_API_MAJOR } from '../../../shared/plugins/workers/plugin-host-api-major' + pluginDataChangedSchema, + pluginWorkerPanelRequestParamsSchema +} from '../../../shared/plugins/workers/plugin-panel-bridge-protocol' +import { + createPluginWorkerApiTables, + createPluginWorkerOrcaApi, + type PluginWorkerOrcaApi +} from './plugin-worker-orca-api' -/** A failed host call or command: the same `{ code, message, retryable }` frames get. */ -// Why: format 1 handlers read `worktreeId`; newer payloads name it `workspaceId`. -function withV1WorktreeId(payload: unknown): unknown { - if (typeof payload !== 'object' || payload === null || !('workspaceId' in payload)) { - return payload - } - return 'worktreeId' in payload ? payload : { ...payload, worktreeId: payload.workspaceId } -} +export type { PluginDisposable, PluginWorkerOrcaApi } from './plugin-worker-orca-api' export type PluginHostCallError = Error & { code: PluginErrorCode @@ -47,33 +42,6 @@ export type PluginHostCallError = Error & { retryAfterMs?: number } -export type PluginDisposable = { dispose(): void } - -/** API surface handed to a plugin's `activate(orca)` export (host API 1). */ -export type PluginWorkerOrcaApi = { - api: { readonly major: number; readonly minor: number } - commands: { - register( - commandId: string, - handler: (args: unknown, context: { signal: AbortSignal }) => unknown - ): PluginDisposable - } - events: { - on( - event: PluginEventName, - handler: (payload: unknown) => void | Promise - ): PluginDisposable - } - host: { - call(method: string, params?: unknown, options?: { signal?: AbortSignal }): Promise - /** Whether this host implements `method` for workers. */ - has(method: string): boolean - } - /** Consented capability kinds (informational — the host re-gates). */ - grantedCapabilities: readonly string[] - log(message: string): void -} - export type PluginWorkerRuntimeOptions = { send: (message: PluginEnvelope) => void importModule?: (specifier: string) => Promise @@ -100,7 +68,14 @@ function hostCallError(error: PluginResponse['error']): PluginHostCallError { const CANCELLED = pluginError('cancelled', 'cancelled') -const WORKER_METHOD_NAMES: ReadonlySet = new Set(pluginHostMethodsFor('worker')) +/** A handler's own `{ code }` (a known one) reaches the panel; anything else is `action_failed`. */ +function handlerFailure(error: unknown) { + const code = typeof error === 'object' && error !== null && 'code' in error ? error.code : null + return pluginError( + normalizePluginErrorCode(code), + error instanceof Error ? error.message : String(error) + ) +} export function createPluginWorkerRuntime( options: PluginWorkerRuntimeOptions @@ -108,11 +83,9 @@ export function createPluginWorkerRuntime( const send = options.send const importModule = options.importModule ?? ((specifier: string) => import(specifier)) const exit = options.exit ?? ((code: number) => process.exit(code)) - const commandHandlers = new Map< - string, - (args: unknown, context: { signal: AbortSignal }) => unknown - >() - const eventHandlers = new Map void | Promise>>() + const tables = createPluginWorkerApiTables() + const commandHandlers = tables.commands + const eventHandlers = tables.events const pendingHostCalls = new Map void>() const runningCommands = new Map() let nextHostCallId = 0 @@ -156,54 +129,24 @@ export function createPluginWorkerRuntime( const module: unknown = await importModule(entryUrl) const activate = readExport(module, 'default') if (typeof activate !== 'function') { - throw new Error(`plugin entry ${input.mainEntry} has no default-exported activate function`) + // Why name it: `export function activate` is the usual slip, and Orca never calls it. + throw new Error( + typeof readExport(module, 'activate') === 'function' + ? `plugin entry ${input.mainEntry} exports activate by name, but Orca calls the default export: write \`export default function activate(orca)\`` + : `plugin entry ${input.mainEntry} has no default-exported activate function` + ) } const deactivateExport = readExport(module, 'deactivate') if (deactivateExport !== undefined && typeof deactivateExport !== 'function') { throw new Error(`plugin entry ${input.mainEntry} has a non-function deactivate export`) } deactivate = deactivateExport === undefined ? null : () => deactivateExport() - const orca: PluginWorkerOrcaApi = Object.freeze({ - api: Object.freeze({ major: PLUGIN_HOST_API_MAJOR, minor: PLUGIN_HOST_API_MINOR }), - commands: Object.freeze({ - register( - commandId: string, - handler: Parameters[1] - ) { - commandHandlers.set(commandId, handler) - return { - dispose: () => { - commandHandlers.delete(commandId) - } - } - } - }), - events: Object.freeze({ - on(event: PluginEventName, handler: (payload: unknown) => void | Promise) { - // Why: format 1 workers still listen under the old worktree.* names. - const name = PLUGIN_V1_EVENT_ALIASES.get(event) ?? event - const handlers = eventHandlers.get(name) ?? new Set() - eventHandlers.set(name, handlers) - const v1Payload = name !== event || event === 'agent.status.changed' - const entry = (payload: unknown): void | Promise => - handler(v1Payload ? withV1WorktreeId(payload) : payload) - handlers.add(entry) - return { - dispose: () => { - handlers.delete(entry) - } - } - } - }), - host: Object.freeze({ - call: (method: string, params?: unknown, callOptions?: { signal?: AbortSignal }) => - hostCall(method, params, callOptions?.signal), - has: (method: string) => WORKER_METHOD_NAMES.has(method) - }), - grantedCapabilities: Object.freeze([...input.grantedCapabilities]), - log(message: string) { - send(pluginWorkerLog('info', String(message))) - } + const orca: PluginWorkerOrcaApi = createPluginWorkerOrcaApi({ + tables, + hostCall: (method, params, callOptions) => hostCall(method, params, callOptions?.signal), + postToPanels: (post) => send(pluginEvent(WORKER_EVENTS.panelPost, post)), + log: (message) => send(pluginWorkerLog('info', message)), + grantedCapabilities: input.grantedCapabilities }) await activate(orca) send(pluginEvent(WORKER_EVENTS.ready, { commands: [...commandHandlers.keys()] })) @@ -235,6 +178,10 @@ export function createPluginWorkerRuntime( } return } + if (request.method === WORKER_METHODS.panelRequest) { + await answerPanelRequest(request) + return + } if (request.method === WORKER_METHODS.deliverEvent) { const parsed = pluginWorkerDeliverParamsSchema.safeParse(request.params) for (const handler of parsed.success ? (eventHandlers.get(parsed.data.event) ?? []) : []) { @@ -252,6 +199,39 @@ export function createPluginWorkerRuntime( ) } + async function answerPanelRequest(request: PluginRequest): Promise { + const parsed = pluginWorkerPanelRequestParamsSchema.safeParse(request.params) + const handler = parsed.success ? tables.panelRequests.get(parsed.data.name) : undefined + if (!parsed.success || !handler) { + const name = parsed.success ? parsed.data.name : '(invalid)' + send( + pluginFailure(request.id, pluginError('unknown_method', `no panel handler named ${name}`)) + ) + return + } + const controller = new AbortController() + runningCommands.set(request.id, controller) + try { + const { input, panel } = parsed.data + send(pluginResult(request.id, await handler(input, { panel, signal: controller.signal }))) + } catch (error) { + send(pluginFailure(request.id, handlerFailure(error))) + } finally { + runningCommands.delete(request.id) + } + } + + function notifyDataChanged(payload: unknown): void { + const change = pluginDataChangedSchema.safeParse(payload) + for (const listener of change.success ? tables.dataListeners[change.data.area] : []) { + try { + listener({ key: change.success ? change.data.key : '' }) + } catch (error) { + send(pluginWorkerLog('error', toErrorMessage(error))) + } + } + } + async function shutdown(): Promise { if (shuttingDown) { return @@ -279,6 +259,10 @@ export function createPluginWorkerRuntime( await shutdown() return } + if (message.event === WORKER_EVENTS.dataChanged) { + notifyDataChanged(message.payload) + return + } const init = message.event === WORKER_EVENTS.init ? pluginWorkerInitSchema.safeParse(message.payload) @@ -311,6 +295,6 @@ export function createPluginWorkerRuntime( } } -function readExport(module: unknown, name: 'default' | 'deactivate'): unknown { +function readExport(module: unknown, name: 'default' | 'activate' | 'deactivate'): unknown { return typeof module === 'object' && module !== null && name in module ? module[name] : undefined } diff --git a/src/main/plugins/workers/plugin-host-service-bindings.ts b/src/main/plugins/workers/plugin-host-service-bindings.ts index 8dc6f4c79d5..3770f5cf3d1 100644 --- a/src/main/plugins/workers/plugin-host-service-bindings.ts +++ b/src/main/plugins/workers/plugin-host-service-bindings.ts @@ -1,9 +1,16 @@ import { PLUGIN_WORKSPACE_TERMINAL_LIMIT } from '../../../shared/plugins/workers/plugin-host-api' import type { PluginHostServices } from './plugin-host-methods' import type { PluginDesktopFrameServices } from './plugin-host-method-bindings' +import type { PluginPanelBridgeServices } from './plugin-host-panel-method-bindings' +import { + pluginSettingValueIssue, + type PluginSettingContribution +} from '../../../shared/plugins/contributions/plugin-settings-contribution' +import { pluginSettingDefaults } from '../../../shared/plugins/contributions/plugin-settings-values' import { PluginSecretsStore, pluginSecretsProtection } from '../plugin-secrets-store' import { PluginKvStore } from '../plugin-storage-store' import type { TerminalInputKind } from '../../../shared/terminal-input-kind' +import { pluginTerminalTitle, type PluginAgentStatusRow } from './plugin-workspace-projection' export type PluginRuntimeDelegate = { resolveActiveWorktreeContext(): Promise<{ @@ -16,7 +23,15 @@ export type PluginRuntimeDelegate = { worktreeSelector?: string, limit?: number, opts?: { includeVisualLayouts?: boolean } - ): Promise<{ terminals: { handle: string; title: string | null }[] }> + ): Promise<{ + terminals: { + handle: string + title: string | null + paneTitle?: string + tabId?: string + leafId?: string + }[] + }> sendTerminal( handle: string, action: { text?: string; enter?: boolean }, @@ -27,16 +42,23 @@ export type PluginRuntimeDelegate = { title: string body?: string }): Promise<{ delivered: boolean }> + /** The hook server's agent rows; absent where no hook server runs. */ + listAgentStatuses?(): readonly PluginAgentStatusRow[] } export function bindPluginHostServices(input: { delegate: PluginRuntimeDelegate pluginsDataDir: string desktop?: PluginDesktopFrameServices | null + panels?: PluginPanelBridgeServices | null + /** The calling plugin's `contributes.settings`: defaults and value checks. */ + declaredSettings?: readonly PluginSettingContribution[] }): PluginHostServices { + const declared = new Map((input.declaredSettings ?? []).map((setting) => [setting.key, setting])) const { delegate, pluginsDataDir } = input return { desktop: input.desktop ?? null, + panels: input.panels ?? null, resolveActiveWorktreeContext: async () => { const context = await delegate.resolveActiveWorktreeContext() if (!context) { @@ -55,10 +77,15 @@ export function bindPluginHostServices(input: { PLUGIN_WORKSPACE_TERMINAL_LIMIT, { includeVisualLayouts: false } ) - return result.terminals - .slice(0, PLUGIN_WORKSPACE_TERMINAL_LIMIT) - .map((terminal) => ({ id: terminal.handle })) + return result.terminals.slice(0, PLUGIN_WORKSPACE_TERMINAL_LIMIT).map((terminal) => ({ + id: terminal.handle, + title: pluginTerminalTitle(terminal), + ...(terminal.tabId && terminal.leafId + ? { paneKey: `${terminal.tabId}:${terminal.leafId}` } + : {}) + })) }, + listAgentStatuses: () => delegate.listAgentStatuses?.() ?? [], sendTerminalText: async (terminalId, action) => { const result = await delegate.sendTerminal(terminalId, action, { inputKind: 'driving' }) return { accepted: result.accepted } @@ -79,9 +106,17 @@ export function bindPluginHostServices(input: { protection: () => (pluginSecretsProtection().level === 'os' ? 'os-keyring' : 'unavailable') }, settings: { - getAll: (key) => new PluginKvStore(pluginsDataDir, key, 'settings.json').getAll(), - set: (key, itemKey, value) => - new PluginKvStore(pluginsDataDir, key, 'settings.json').set(itemKey, value) + getAll: (key) => ({ + ...pluginSettingDefaults(declared.values()), + ...new PluginKvStore(pluginsDataDir, key, 'settings.json').getAll() + }), + set: (key, itemKey, value) => { + const setting = declared.get(itemKey) + const issue = setting ? pluginSettingValueIssue(setting, value) : null + return issue + ? { ok: false, error: `${itemKey} ${issue}` } + : new PluginKvStore(pluginsDataDir, key, 'settings.json').set(itemKey, value) + } } } } diff --git a/src/main/plugins/workers/plugin-worker-controller.test.ts b/src/main/plugins/workers/plugin-worker-controller.test.ts index b0cab2e9e46..52c68b058b7 100644 --- a/src/main/plugins/workers/plugin-worker-controller.test.ts +++ b/src/main/plugins/workers/plugin-worker-controller.test.ts @@ -52,6 +52,8 @@ function worker(commands: string[]): PluginWorkerHandle & { dispose: ReturnType< commands, invokeCommand: vi.fn(async () => null), deliverEvent: vi.fn(), + requestFromPanel: vi.fn(), + notifyDataChanged: vi.fn(), lastActivityAt: () => Date.now(), inFlightCount: () => 0, dispose: vi.fn(async () => undefined), diff --git a/src/main/plugins/workers/plugin-worker-controller.ts b/src/main/plugins/workers/plugin-worker-controller.ts index da17e9bb763..5a145db8161 100644 --- a/src/main/plugins/workers/plugin-worker-controller.ts +++ b/src/main/plugins/workers/plugin-worker-controller.ts @@ -11,6 +11,7 @@ import { import { buildPluginWorkerSpawnSpec, pluginWorkerSpawnSpecsEqual } from './plugin-worker-spawn-spec' import type { PluginWorkerHandle } from './plugin-host-process' import type { PluginRunState } from './plugin-supervisor' +import type { PluginWorkerPanelPost } from '../../../shared/plugins/workers/plugin-panel-bridge-protocol' export type PluginWorkerControllerOptions = { entryPath: string @@ -27,6 +28,7 @@ export type PluginWorkerControllerOptions = { method: string, params: unknown ) => Promise + onPanelPost?: (pluginKey: string, post: PluginWorkerPanelPost) => void log: (pluginKey: string) => (level: 'info' | 'warn' | 'error', line: string) => void onStateChanged: (pluginKey: string) => void } @@ -44,11 +46,16 @@ export class PluginWorkerController { idleReapMs: options.idleReapMs, workerFactory: options.workerFactory, executeHostCall: options.executeHostCall, + onPanelPost: options.onPanelPost, log: options.log, onWorkerStateChange: options.onStateChanged }) } + runningHandle(pluginKey: string): PluginWorkerHandle | null { + return this.manager.runningHandle(pluginKey) + } + state(pluginKey: string): { state: PluginRunState; restarts: number } { return { state: this.manager.runState(pluginKey), diff --git a/src/main/plugins/workers/plugin-worker-manager.test.ts b/src/main/plugins/workers/plugin-worker-manager.test.ts index 77ad829d845..a9de12048a8 100644 --- a/src/main/plugins/workers/plugin-worker-manager.test.ts +++ b/src/main/plugins/workers/plugin-worker-manager.test.ts @@ -17,6 +17,8 @@ function worker(lastActivity = Date.now()): TestWorker { commands: ['run'], invokeCommand: vi.fn(async () => null), deliverEvent: vi.fn(), + requestFromPanel: vi.fn(), + notifyDataChanged: vi.fn(), lastActivityAt: () => lastActivity, inFlightCount: () => 0, dispose: vi.fn(async () => undefined), diff --git a/src/main/plugins/workers/plugin-worker-manager.ts b/src/main/plugins/workers/plugin-worker-manager.ts index 0516b449997..20b207ec7ba 100644 --- a/src/main/plugins/workers/plugin-worker-manager.ts +++ b/src/main/plugins/workers/plugin-worker-manager.ts @@ -8,6 +8,7 @@ import { type PluginRunState } from './plugin-supervisor' import type { PluginWorkerHandle, PluginWorkerHostCallExecutor } from './plugin-host-process' +import type { PluginWorkerPanelPost } from '../../../shared/plugins/workers/plugin-panel-bridge-protocol' import { PluginWorkerSlotPool } from './plugin-worker-slot-pool' import { startPluginWorkerAttempt, @@ -36,6 +37,7 @@ export type PluginWorkerManagerOptions = { method: string, params: unknown ) => ReturnType + onPanelPost?: (pluginKey: string, post: PluginWorkerPanelPost) => void log: (pluginKey: string) => (level: 'info' | 'warn' | 'error', line: string) => void onWorkerStateChange: (pluginKey: string) => void } @@ -63,6 +65,11 @@ export class PluginWorkerManager { this.idleReapMs = options.idleReapMs ?? PLUGIN_WORKER_IDLE_REAP_MS } + /** The live worker, without starting one. */ + runningHandle(pluginKey: string): PluginWorkerHandle | null { + return this.workers.get(pluginKey)?.handle ?? null + } + runState(pluginKey: string): PluginRunState { return this.supervisor.getState(pluginKey) } @@ -151,6 +158,7 @@ export class PluginWorkerManager { factory: this.options.workerFactory, executeHostCall: (method, params) => this.options.executeHostCall(spec.pluginKey, method, params), + onPanelPost: (post) => this.options.onPanelPost?.(spec.pluginKey, post), log, assertActive: () => this.throwIfCancelled(spec.pluginKey, generation, signal), verifyBeforeSpawn: this.known.get(spec.pluginKey)?.verifyBeforeSpawn, diff --git a/src/main/plugins/workers/plugin-worker-orca-api.ts b/src/main/plugins/workers/plugin-worker-orca-api.ts new file mode 100644 index 00000000000..31b1382c2d4 --- /dev/null +++ b/src/main/plugins/workers/plugin-worker-orca-api.ts @@ -0,0 +1,204 @@ +import type { PluginEventName } from '../../../shared/plugins/manifest/plugin-manifest' +import { PLUGIN_V1_EVENT_ALIASES } from '../../../shared/plugins/contributions/plugin-event-contribution' +import { + PLUGIN_HOST_API_MINOR, + pluginHostMethodsFor +} from '../../../shared/plugins/workers/plugin-host-api' +import { PLUGIN_HOST_API_MAJOR } from '../../../shared/plugins/workers/plugin-host-api-major' +import { + pluginBridgeNameSchema, + type PluginDataChanged, + type PluginPanelCaller, + type PluginWorkerPanelPost +} from '../../../shared/plugins/workers/plugin-panel-bridge-protocol' + +export type PluginDisposable = { dispose(): void } + +export type PluginPanelRequestHandler = ( + input: unknown, + context: { panel: PluginPanelCaller; signal: AbortSignal } +) => unknown + +type HostCall = ( + method: string, + params?: unknown, + options?: { signal?: AbortSignal } +) => Promise +type DataListener = (change: { key: string }) => void + +/** API surface handed to a plugin's `activate(orca)` export (host API 1). */ +export type PluginWorkerOrcaApi = { + api: { readonly major: number; readonly minor: number } + commands: { + register( + commandId: string, + handler: (args: unknown, context: { signal: AbortSignal }) => unknown + ): PluginDisposable + } + events: { + on( + event: PluginEventName, + handler: (payload: unknown) => void | Promise + ): PluginDisposable + } + host: { + call: HostCall + /** Whether this host implements `method` for workers. */ + has(method: string): boolean + } + /** The plugin's own panels and custom editors. */ + panels: { + handle(name: string, handler: PluginPanelRequestHandler): PluginDisposable + post(event: string, payload?: unknown, options?: { panel?: string }): void + } + storage: { + get(key: string): Promise + set(key: string, value: unknown): Promise + delete(key: string): Promise + keys(): Promise + onDidChange(listener: DataListener): PluginDisposable + } + settings: { + /** Every setting, or one; declared settings read as their default until set. */ + get(key?: string): Promise + set(key: string, value: unknown): Promise + onDidChange(listener: DataListener): PluginDisposable + } + secrets: { + get(key: string): Promise + set(key: string, value: string): Promise + delete(key: string): Promise + } + /** Consented capability kinds (informational — the host re-gates). */ + grantedCapabilities: readonly string[] + log(message: string): void +} + +// Why: format 1 handlers read `worktreeId`; newer payloads name it `workspaceId`. +function withV1WorktreeId(payload: unknown): unknown { + if (typeof payload !== 'object' || payload === null || !('workspaceId' in payload)) { + return payload + } + return 'worktreeId' in payload ? payload : { ...payload, worktreeId: payload.workspaceId } +} + +function field(result: unknown, name: string): unknown { + return typeof result === 'object' && result !== null && name in result + ? Object.getOwnPropertyDescriptor(result, name)?.value + : undefined +} + +function addTo(set: Set, entry: T): PluginDisposable { + set.add(entry) + return { dispose: () => void set.delete(entry) } +} + +const WORKER_METHOD_NAMES: ReadonlySet = new Set(pluginHostMethodsFor('worker')) + +/** The tables the runtime dispatches from; this module only fills them. */ +export type PluginWorkerApiTables = { + commands: Map unknown> + events: Map void | Promise>> + panelRequests: Map + dataListeners: Record> +} + +export function createPluginWorkerApiTables(): PluginWorkerApiTables { + return { + commands: new Map(), + events: new Map(), + panelRequests: new Map(), + dataListeners: { storage: new Set(), settings: new Set() } + } +} + +export function createPluginWorkerOrcaApi(input: { + tables: PluginWorkerApiTables + hostCall: HostCall + postToPanels: (post: PluginWorkerPanelPost) => void + log: (message: string) => void + grantedCapabilities: readonly string[] +}): PluginWorkerOrcaApi { + const { tables, hostCall } = input + const ok = async (method: string, params: unknown): Promise => { + await hostCall(method, params) + } + return Object.freeze({ + api: Object.freeze({ major: PLUGIN_HOST_API_MAJOR, minor: PLUGIN_HOST_API_MINOR }), + commands: Object.freeze({ + register( + commandId: string, + handler: Parameters[1] + ) { + tables.commands.set(commandId, handler) + return { dispose: () => void tables.commands.delete(commandId) } + } + }), + events: Object.freeze({ + on(event: PluginEventName, handler: (payload: unknown) => void | Promise) { + // Why: format 1 workers still listen under the old worktree.* names. + const name = PLUGIN_V1_EVENT_ALIASES.get(event) ?? event + const handlers = tables.events.get(name) ?? new Set() + tables.events.set(name, handlers) + const v1Payload = name !== event || event === 'agent.status.changed' + return addTo(handlers, (payload: unknown) => + handler(v1Payload ? withV1WorktreeId(payload) : payload) + ) + } + }), + host: Object.freeze({ + call: (method: string, params?: unknown, options?: { signal?: AbortSignal }) => + hostCall(method, params, options), + has: (method: string) => WORKER_METHOD_NAMES.has(method) + }), + panels: Object.freeze({ + handle(name: string, handler: PluginPanelRequestHandler) { + pluginBridgeNameSchema.parse(name) + if (typeof handler !== 'function') { + throw new TypeError('orca.panels.handle needs a handler function') + } + tables.panelRequests.set(name, handler) + return { + dispose: () => { + if (tables.panelRequests.get(name) === handler) { + tables.panelRequests.delete(name) + } + } + } + }, + post(event: string, payload?: unknown, options?: { panel?: string }) { + pluginBridgeNameSchema.parse(event) + input.postToPanels({ event, payload, ...(options?.panel ? { panel: options.panel } : {}) }) + } + }), + storage: Object.freeze({ + get: async (key: string) => field(await hostCall('storage.get', { key }), 'value') ?? null, + set: (key: string, value: unknown) => ok('storage.set', { key, value }), + delete: (key: string) => ok('storage.delete', { key }), + keys: async () => { + const keys = field(await hostCall('storage.keys'), 'keys') + return Array.isArray(keys) ? keys.filter((key) => typeof key === 'string') : [] + }, + onDidChange: (listener: DataListener) => addTo(tables.dataListeners.storage, listener) + }), + settings: Object.freeze({ + get: async (key?: string) => { + const raw = field(await hostCall('settings.get'), 'settings') + const settings = typeof raw === 'object' && raw !== null ? { ...raw } : {} + return key === undefined ? settings : field(settings, key) + }, + set: (key: string, value: unknown) => ok('settings.set', { key, value }), + onDidChange: (listener: DataListener) => addTo(tables.dataListeners.settings, listener) + }), + secrets: Object.freeze({ + get: async (key: string) => { + const value = field(await hostCall('secrets.get', { key }), 'value') + return typeof value === 'string' ? value : null + }, + set: (key: string, value: string) => ok('secrets.set', { key, value }), + delete: (key: string) => ok('secrets.delete', { key }) + }), + grantedCapabilities: Object.freeze([...input.grantedCapabilities]), + log: (message: string) => input.log(String(message)) + }) +} diff --git a/src/main/plugins/workers/plugin-worker-panel-requests.test.ts b/src/main/plugins/workers/plugin-worker-panel-requests.test.ts new file mode 100644 index 00000000000..5fdb8e110bd --- /dev/null +++ b/src/main/plugins/workers/plugin-worker-panel-requests.test.ts @@ -0,0 +1,162 @@ +import { describe, expect, it, vi } from 'vitest' +import { createPluginWorkerRuntime, type PluginWorkerOrcaApi } from './plugin-host-runtime' + +const panel = { id: 'panel-1', surface: 'panel', contributionId: 'todos' } + +async function activate(setup: (orca: PluginWorkerOrcaApi) => void) { + const send = vi.fn() + const runtime = createPluginWorkerRuntime({ + send, + exit: vi.fn(), + importModule: async () => ({ default: setup }) + }) + await runtime.handleMessage({ + orca: 1, + kind: 'evt', + event: 'init', + payload: { + pluginId: 'samples.demo', + pluginRoot: '/p', + mainEntry: 'm.js', + grantedCapabilities: [] + } + }) + send.mockClear() + const request = (id: number, name: string, input: unknown) => + runtime.handleMessage({ + orca: 1, + kind: 'req', + id, + method: 'panel.request', + params: { name, input, panel } + }) + return { send, runtime, request } +} + +describe('worker panel requests', () => { + it('answers with the handler result and hands it the calling panel', async () => { + const handler = vi.fn(async (input: unknown) => ({ echoed: input })) + const { send, request } = await activate((orca) => orca.panels.handle('todos.list', handler)) + await request(4, 'todos.list', { done: true }) + expect(handler).toHaveBeenCalledWith({ done: true }, { panel, signal: expect.any(AbortSignal) }) + expect(send).toHaveBeenCalledWith({ + orca: 1, + kind: 'res', + id: 4, + result: { echoed: { done: true } } + }) + }) + + it('keeps a known error code the handler threw, and refuses unknown names', async () => { + const { send, request } = await activate((orca) => { + orca.panels.handle('todos.add', () => { + throw Object.assign(new Error('title is taken'), { code: 'conflict' }) + }) + orca.panels.handle('todos.bad', () => { + throw Object.assign(new Error('nope'), { code: 'made_up' }) + }) + }) + await request(1, 'todos.add', {}) + await request(2, 'todos.bad', {}) + await request(3, 'todos.missing', {}) + const errors = send.mock.calls.map(([message]) => message.error?.code) + expect(errors).toEqual(['conflict', 'action_failed', 'unknown_method']) + }) + + it('aborts the handler signal when the host cancels the request', async () => { + let seen: AbortSignal | undefined + let release!: () => void + const { runtime, request } = await activate((orca) => + orca.panels.handle('slow', (_input, { signal }) => { + seen = signal + return new Promise((resolve) => (release = () => resolve(null))) + }) + ) + const pending = request(9, 'slow', null) + await vi.waitFor(() => expect(seen).toBeDefined()) + await runtime.handleMessage({ orca: 1, kind: 'cancel', id: 9 }) + expect(seen?.aborted).toBe(true) + release() + await pending + }) + + it('posts to panels, and validates names on both sides', async () => { + let orca!: PluginWorkerOrcaApi + const { send } = await activate((api) => (orca = api)) + orca.panels.post('todos.changed', { count: 2 }, { panel: 'panel-1' }) + expect(send).toHaveBeenCalledWith({ + orca: 1, + kind: 'evt', + event: 'panel.post', + payload: { event: 'todos.changed', payload: { count: 2 }, panel: 'panel-1' } + }) + expect(() => orca.panels.post('has spaces')).toThrow() + expect(() => orca.panels.handle('', () => null)).toThrow() + }) + + it('tells storage and settings listeners which key changed', async () => { + const storage = vi.fn() + const settings = vi.fn() + const { runtime } = await activate((orca) => { + orca.storage.onDidChange(storage) + orca.settings.onDidChange(settings) + }) + await runtime.handleMessage({ + orca: 1, + kind: 'evt', + event: 'data.changed', + payload: { area: 'settings', key: 'apiUrl' } + }) + expect(settings).toHaveBeenCalledWith({ key: 'apiUrl' }) + expect(storage).not.toHaveBeenCalled() + }) + + it('reads storage and settings through host calls', async () => { + let orca!: PluginWorkerOrcaApi + const { send, runtime } = await activate((api) => (orca = api)) + const value = orca.storage.get('todos') + const setting = orca.settings.get('apiUrl') + const [get, settingsGet] = send.mock.calls.map(([message]) => message) + expect(get).toMatchObject({ method: 'storage.get', params: { key: 'todos' } }) + expect(settingsGet).toMatchObject({ method: 'settings.get' }) + await runtime.handleMessage({ orca: 1, kind: 'res', id: get.id, result: { value: [1] } }) + await runtime.handleMessage({ + orca: 1, + kind: 'res', + id: settingsGet.id, + result: { settings: { apiUrl: 'https://x' } } + }) + await expect(value).resolves.toEqual([1]) + await expect(setting).resolves.toBe('https://x') + }) +}) + +describe('worker entry', () => { + it('names the fix when activate is exported by name instead of as the default', async () => { + const activate = vi.fn() + const send = vi.fn() + const runtime = createPluginWorkerRuntime({ + send, + exit: vi.fn(), + importModule: async () => ({ activate }) + }) + await runtime.handleMessage({ + orca: 1, + kind: 'evt', + event: 'init', + payload: { + pluginId: 'samples.demo', + pluginRoot: '/p', + mainEntry: 'm.js', + grantedCapabilities: [] + } + }) + expect(activate).not.toHaveBeenCalled() + expect(send).toHaveBeenCalledWith( + expect.objectContaining({ + event: 'fatal', + payload: { error: expect.stringContaining('export default function activate(orca)') } + }) + ) + }) +}) diff --git a/src/main/plugins/workers/plugin-worker-refresh-admission.test.ts b/src/main/plugins/workers/plugin-worker-refresh-admission.test.ts index 8471dbf56ba..9fa373854ad 100644 --- a/src/main/plugins/workers/plugin-worker-refresh-admission.test.ts +++ b/src/main/plugins/workers/plugin-worker-refresh-admission.test.ts @@ -25,6 +25,8 @@ function worker(): PluginWorkerHandle & { exit: () => void } { commands: ['run'], invokeCommand: vi.fn(async () => null), deliverEvent: vi.fn(), + requestFromPanel: vi.fn(), + notifyDataChanged: vi.fn(), // ast-grep-ignore: test-no-wall-clock -- idle checks compare against the real clock, so "now" keeps the worker active lastActivityAt: () => Date.now(), inFlightCount: () => 0, diff --git a/src/main/plugins/workers/plugin-worker-requests.ts b/src/main/plugins/workers/plugin-worker-requests.ts new file mode 100644 index 00000000000..07c2896c810 --- /dev/null +++ b/src/main/plugins/workers/plugin-worker-requests.ts @@ -0,0 +1,69 @@ +import { + pluginCancel, + pluginRequest, + type PluginEnvelope, + type PluginErrorCode +} from '../../../shared/plugins/frames/plugin-protocol' +import type { PluginWorkerRequestError } from './plugin-host-process-types' + +export type PendingCall = { + resolve: (value: unknown) => void + reject: (error: Error) => void + timer: ReturnType +} + +export function requestError(code: PluginErrorCode, message: string): PluginWorkerRequestError { + return Object.assign(new Error(message), { code }) +} + +export type PluginWorkerRequestChannel = { + pending: Map + send: (message: PluginEnvelope) => void + nextId: () => number + isRunning: () => boolean + tag: string +} + +/** One host → worker request; a timeout or abort also cancels the worker's handler. */ +export function sendPluginWorkerRequest( + channel: PluginWorkerRequestChannel, + method: string, + params: unknown, + timeoutMs: number, + label: string, + signal?: AbortSignal +): Promise { + const { pending, send, tag } = channel + if (!channel.isRunning()) { + return Promise.reject(requestError('unavailable', `${tag} worker is not running`)) + } + if (signal?.aborted) { + return Promise.reject(requestError('cancelled', `${tag} ${label} was cancelled`)) + } + const callId = channel.nextId() + return new Promise((resolve, reject) => { + const stop = (error: PluginWorkerRequestError): void => { + clearTimeout(timer) + signal?.removeEventListener('abort', onAbort) + if (pending.delete(callId)) { + // Tell the handler too, so it stops instead of running on unobserved. + send(pluginCancel(callId)) + reject(error) + } + } + const onAbort = (): void => stop(requestError('cancelled', `${tag} ${label} was cancelled`)) + const timer = setTimeout( + () => stop(requestError('timeout', `${tag} ${label} timed out after ${timeoutMs}ms`)), + timeoutMs + ) + signal?.addEventListener('abort', onAbort, { once: true }) + const settle = + (next: (value: T) => void) => + (value: T): void => { + signal?.removeEventListener('abort', onAbort) + next(value) + } + pending.set(callId, { resolve: settle(resolve), reject: settle(reject), timer }) + send(pluginRequest(callId, method, params)) + }) +} diff --git a/src/main/plugins/workers/plugin-worker-reviewed-content.test.ts b/src/main/plugins/workers/plugin-worker-reviewed-content.test.ts index 34573b3f157..dd0cc5e02eb 100644 --- a/src/main/plugins/workers/plugin-worker-reviewed-content.test.ts +++ b/src/main/plugins/workers/plugin-worker-reviewed-content.test.ts @@ -18,6 +18,8 @@ function worker(): PluginWorkerHandle & { exit: (code: number) => void } { commands: [], invokeCommand: vi.fn(async () => null), deliverEvent: vi.fn(), + requestFromPanel: vi.fn(), + notifyDataChanged: vi.fn(), // ast-grep-ignore: test-no-wall-clock -- idle checks compare against the real clock, so "now" keeps the worker active lastActivityAt: () => Date.now(), inFlightCount: () => 0, diff --git a/src/main/plugins/workers/plugin-worker-startup.ts b/src/main/plugins/workers/plugin-worker-startup.ts index 0b657afb291..2f94c41258d 100644 --- a/src/main/plugins/workers/plugin-worker-startup.ts +++ b/src/main/plugins/workers/plugin-worker-startup.ts @@ -1,4 +1,5 @@ import type { PluginCapabilityKind } from '../../../shared/plugins/capabilities/plugin-capabilities' +import type { PluginWorkerPanelPost } from '../../../shared/plugins/workers/plugin-panel-bridge-protocol' import { startPluginWorker, type PluginWorkerHandle, @@ -33,6 +34,7 @@ export type PluginWorkerFactory = (options: { entryPath: string grantedCapabilities: readonly PluginCapabilityKind[] executeHostCall: PluginWorkerHostCallExecutor + onPanelPost?: (post: PluginWorkerPanelPost) => void log: PluginWorkerLogSink signal: AbortSignal }) => Promise @@ -53,6 +55,7 @@ export async function startPluginWorkerAttempt(options: { entryPath: string factory?: PluginWorkerFactory executeHostCall: PluginWorkerHostCallExecutor + onPanelPost?: (post: PluginWorkerPanelPost) => void log: PluginWorkerLogSink assertActive: () => void verifyBeforeSpawn?: () => Promise @@ -75,6 +78,7 @@ export async function startPluginWorkerAttempt(options: { entryPath: options.entryPath, grantedCapabilities: options.spec.grantedCapabilities, executeHostCall: options.executeHostCall, + onPanelPost: options.onPanelPost, log: options.log, signal: options.signal }) diff --git a/src/main/plugins/workers/plugin-workspace-projection.ts b/src/main/plugins/workers/plugin-workspace-projection.ts new file mode 100644 index 00000000000..79b55cbabc8 --- /dev/null +++ b/src/main/plugins/workers/plugin-workspace-projection.ts @@ -0,0 +1,94 @@ +import type { z } from 'zod' +import { shortPluginBranchName } from '../../../shared/plugins/events/plugin-events' +import { + PLUGIN_TERMINAL_ID_MAX_LENGTH, + PLUGIN_WORKSPACE_LABEL_MAX_LENGTH, + PLUGIN_WORKSPACE_TERMINAL_LIMIT, + type pluginWorkspaceContextSchema +} from '../../../shared/plugins/workers/plugin-host-api' +import { PLUGIN_AGENT_LIST_LIMIT } from '../../../shared/plugins/workers/plugin-host-api-panel-methods' +import type { AgentStatusState } from '../../../shared/agent-status-types' + +/** One terminal of a workspace, as main's runtime lists it. */ +export type PluginWorkspaceTerminal = { + /** The terminal handle plugins call `terminalId`. */ + id: string + title?: string + /** `tabId:leafId`, which agent statuses carry. */ + paneKey?: string +} + +/** One agent row from the hook server's status store (the fields plugins may see). */ +export type PluginAgentStatusRow = { + paneKey: string + worktreeId?: string + terminalHandle?: string + state: AgentStatusState + agentType?: string + stateStartedAt: number + providerSessionOnly?: boolean +} + +export type PluginWorkspaceContext = z.output + +type Context = { worktreeId: string; branch: string; displayName: string } + +/** A pane's own name wins over the title its program sets. */ +export function pluginTerminalTitle(terminal: { + title: string | null + paneTitle?: string +}): string | undefined { + const title = (terminal.paneTitle ?? terminal.title ?? '').trim() + return title ? title.slice(0, PLUGIN_WORKSPACE_LABEL_MAX_LENGTH) : undefined +} + +/** Worktree ids embed provider paths: only these public fields reach plugins. */ +export function projectPluginWorkspaceContext( + context: Context | null, + terminals: readonly PluginWorkspaceTerminal[] +): PluginWorkspaceContext { + if (!context) { + return null + } + return { + branch: shortPluginBranchName(context.branch).slice(0, PLUGIN_WORKSPACE_LABEL_MAX_LENGTH), + displayName: context.displayName.slice(0, PLUGIN_WORKSPACE_LABEL_MAX_LENGTH), + terminals: terminals + .filter(({ id }) => id.length > 0 && id.length <= PLUGIN_TERMINAL_ID_MAX_LENGTH) + .slice(0, PLUGIN_WORKSPACE_TERMINAL_LIMIT) + .map(({ id, title }) => (title ? { id, title } : { id })) + } +} + +/** The terminal an agent's pane is: by the handle its status names, else by pane key. */ +export function terminalForPane( + terminals: readonly PluginWorkspaceTerminal[], + row: Pick +): PluginWorkspaceTerminal | undefined { + return ( + terminals.find((terminal) => terminal.id === row.terminalHandle) ?? + terminals.find((terminal) => terminal.paneKey === row.paneKey) + ) +} + +/** `agents.list`: the focused workspace's agents, newest state first. */ +export function projectPluginWorkspaceAgents( + worktreeId: string, + terminals: readonly PluginWorkspaceTerminal[], + rows: readonly PluginAgentStatusRow[] +) { + return rows + .filter((row) => row.worktreeId === worktreeId && row.providerSessionOnly !== true) + .toSorted((a, b) => b.stateStartedAt - a.stateStartedAt) + .slice(0, PLUGIN_AGENT_LIST_LIMIT) + .map((row) => { + const terminal = terminalForPane(terminals, row) + return { + terminalId: terminal?.id ?? null, + title: terminal?.title ?? null, + agent: row.agentType?.slice(0, 128) ?? null, + state: row.state, + stateStartedAt: row.stateStartedAt + } + }) +} diff --git a/src/main/startup/configure-process.test.ts b/src/main/startup/configure-process.test.ts index feb4c7fe9e5..1e45c98b8dc 100644 --- a/src/main/startup/configure-process.test.ts +++ b/src/main/startup/configure-process.test.ts @@ -19,7 +19,8 @@ vi.mock('electron', () => { appendSwitch: vi.fn(), getSwitchValue: vi.fn(() => '') } - } + }, + shell: { openExternal: vi.fn() } } }) diff --git a/src/main/startup/configure-process.ts b/src/main/startup/configure-process.ts index 4d811c41baf..b38c992b74e 100644 --- a/src/main/startup/configure-process.ts +++ b/src/main/startup/configure-process.ts @@ -1,4 +1,5 @@ import { app } from 'electron' +import { guardExternalOpensInE2E } from './e2e-external-open-guard' import { quitProcess } from './process-quit-request' import { existsSync, mkdirSync } from 'node:fs' import { homedir } from 'node:os' @@ -198,6 +199,7 @@ export function configureDevUserDataPath(isDev: boolean): void { mkdirSync(e2eHomeDir, { recursive: true, mode: 0o700 }) app.setPath('home', e2eHomeDir) app.setPath('userData', e2eConfig.userDataDir) + guardExternalOpensInE2E() return } diff --git a/src/main/startup/e2e-external-open-guard.test.ts b/src/main/startup/e2e-external-open-guard.test.ts new file mode 100644 index 00000000000..8a1d224bd74 --- /dev/null +++ b/src/main/startup/e2e-external-open-guard.test.ts @@ -0,0 +1,15 @@ +import { expect, it, vi } from 'vitest' + +const openExternal = vi.hoisted(() => vi.fn()) +vi.mock('electron', () => ({ shell: { openExternal } })) + +const { shell } = await import('electron') +const { guardExternalOpensInE2E } = await import('./e2e-external-open-guard') + +it("never opens the tester's browser or mail client in an e2e launch", async () => { + vi.spyOn(console, 'info').mockImplementation(() => undefined) + guardExternalOpensInE2E() + await shell.openExternal('mailto:a@example.com') + await shell.openExternal('https://example.com') + expect(openExternal).not.toHaveBeenCalled() +}) diff --git a/src/main/startup/e2e-external-open-guard.ts b/src/main/startup/e2e-external-open-guard.ts new file mode 100644 index 00000000000..b11c98f6a08 --- /dev/null +++ b/src/main/startup/e2e-external-open-guard.ts @@ -0,0 +1,11 @@ +import { shell } from 'electron' + +/** + * An e2e launch must never open the tester's browser or mail client: `shell.openExternal` only + * logs there. Specs that observe opens replace it themselves, and restore this guard after. + */ +export function guardExternalOpensInE2E(): void { + shell.openExternal = async (url: string): Promise => { + console.info(`[e2e] shell.openExternal suppressed: ${url.split(':', 1)[0]}:`) + } +} diff --git a/src/main/startup/main-process-plugins.test.ts b/src/main/startup/main-process-plugins.test.ts index 4887e4ce185..b57da5d31da 100644 --- a/src/main/startup/main-process-plugins.test.ts +++ b/src/main/startup/main-process-plugins.test.ts @@ -41,13 +41,14 @@ afterEach(async () => { it('binds the runtime and exactly one settings→refresh listener without any window', async () => { fixture.userData = await mkdtemp(join(tmpdir(), 'orca-main-plugins-')) const settingsListeners: ((updates: Record) => void)[] = [] - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: plugin startup reads settings and subscribes to changes only. + // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: plugin startup reads settings and subscribes to settings changes and session writes only. state.store = { getSettings: () => ({ pluginSystemEnabled: false }), onSettingsChanged: (listener: (updates: Record) => void) => { settingsListeners.push(listener) return () => {} - } + }, + onWorkspaceSessionWritten: () => () => {} } as never // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: plugin startup reads only keybinding overrides. state.keybindings = { getOverrides: () => ({}) } as never @@ -60,7 +61,10 @@ it('binds the runtime and exactly one settings→refresh listener without any wi await state.pluginService?.whenReady() refresh.mockClear() - expect(setRuntimeDelegate).toHaveBeenCalledWith(runtime) + // The runtime, plus the hook server's agent rows for agents.list. + expect(setRuntimeDelegate).toHaveBeenCalledWith( + expect.objectContaining({ listAgentStatuses: expect.any(Function) }) + ) for (const listener of settingsListeners) { listener({ devPluginPaths: [] }) } diff --git a/src/main/startup/main-process-plugins.ts b/src/main/startup/main-process-plugins.ts index aa8d4f0e981..bbc8290f612 100644 --- a/src/main/startup/main-process-plugins.ts +++ b/src/main/startup/main-process-plugins.ts @@ -37,6 +37,11 @@ import { rebuildAppMenu } from '../menu/register-app-menu' import { rebuildSystemTrayMenu } from '../tray/system-tray' import { logStartupMilestone } from './startup-diagnostics' import { agentHookServer } from '../agent-hooks/server' +import { + createPluginAgentStatusForwarder, + pluginRuntimeDelegate, + watchPluginWorkspaceContext +} from '../plugins/plugin-runtime-binding' import { emitPluginWorktreeLifecycle } from './main-process-pty-startup' import { mainProcessState as state } from './main-process-state' import type { OrcaRuntimeService } from '../runtime/orca-runtime' @@ -229,7 +234,8 @@ export async function initializeMainProcessPlugins(runtime: OrcaRuntimeService): } }) // Bound here, not in the IPC handlers: a headless serve never opens a window to register them. - pluginService.setRuntimeDelegate(runtime) + const pluginDelegate = pluginRuntimeDelegate(runtime, () => agentHookServer.getStatusSnapshot()) + pluginService.setRuntimeDelegate(pluginDelegate) // Headless RPC resolves this service too; consent shares the desktop hash-keyed write path. setPluginServiceForRpc(state.pluginService, { applyConsent: (request) => @@ -290,11 +296,17 @@ export async function initializeMainProcessPlugins(runtime: OrcaRuntimeService): } }, PLUGIN_MARKETPLACE_SEED_STARTUP_DELAY_MS).unref?.() // Filter hook/worktree events server-side by each plugin subscription. + const forwardAgentStatus = createPluginAgentStatusForwarder(pluginDelegate, pluginService) agentHookServer.subscribeEnrichedStatus((enriched) => { const payload = projectPluginAgentStatusChangedPayload(enriched) if (payload) { - state.pluginService?.emitEvent('agent.status.changed', payload) + forwardAgentStatus(payload, enriched.terminalHandle) } }) + watchPluginWorkspaceContext({ + delegate: pluginDelegate, + events: pluginService, + onSessionWritten: (listener) => store.onWorkspaceSessionWritten(listener) + }) runtime.onWorktreeLifecycle(emitPluginWorktreeLifecycle) } diff --git a/src/preload/api/plugin-host-api.ts b/src/preload/api/plugin-host-api.ts index 713371cfcbd..e47fabfea3c 100644 --- a/src/preload/api/plugin-host-api.ts +++ b/src/preload/api/plugin-host-api.ts @@ -42,6 +42,8 @@ export type { PluginHostStatus } from '../../shared/plugins/plugin-list-entry' import type { PluginHostListEntry } from '../../shared/plugins/plugin-list-entry' +import type { PluginDeclaredSettingsSnapshot } from '../../shared/plugins/contributions/plugin-settings-values' +import type { PluginJsonValue } from '../../shared/plugins/workers/plugin-host-api' export type PluginHostLogLine = { ts: number @@ -181,6 +183,16 @@ export type PluginsApi = { }) => Promise /** A components panel's persisted atoms (desktop only); see plugin-panel-state.ts. */ panelState?: (args: PluginPanelStateRequest) => Promise + /** One open panel's pushes (`PluginPanelPush`, unvalidated); desktop only. Returns unsubscribe. */ + subscribePanelPush?: (sessionToken: string, listener: (push: unknown) => void) => () => void + /** The settings a plugin declares and their current values; null when it declares none. */ + getSettings?: (args: { pluginKey: string }) => Promise + /** The person's edit; `null` restores the default. */ + setSetting?: (args: { + pluginKey: string + key: string + value: PluginJsonValue + }) => Promise<{ ok: true } | { ok: false; error: string }> /** Pins a Git install input to an exact commit without downloading it. */ resolveGitSource: (args: { url: string; ref: string }) => Promise install: (source: PluginHostInstallSource) => Promise diff --git a/src/preload/api/plugin-panel-push-bridge.ts b/src/preload/api/plugin-panel-push-bridge.ts new file mode 100644 index 00000000000..183b26c8c4c --- /dev/null +++ b/src/preload/api/plugin-panel-push-bridge.ts @@ -0,0 +1,48 @@ +import { ipcRenderer } from 'electron' + +type PanelPushListener = (push: unknown) => void + +const PANEL_PUSH_CHANNEL = 'plugins:panelPush' +const listenersByToken = new Map>() +let routing = false + +function route(): void { + if (routing) { + return + } + routing = true + ipcRenderer.on(PANEL_PUSH_CHANNEL, (_event, message: unknown) => { + const token = + typeof message === 'object' && message !== null && 'sessionToken' in message + ? message.sessionToken + : null + const push = + typeof message === 'object' && message !== null && 'push' in message ? message.push : null + for (const listener of typeof token === 'string' ? (listenersByToken.get(token) ?? []) : []) { + listener(push) + } + }) +} + +/** Frames of one session share its channel; it opens with the first and closes with the last. */ +export function subscribePluginPanelPush( + sessionToken: string, + listener: PanelPushListener +): () => void { + route() + let listeners = listenersByToken.get(sessionToken) + if (!listeners) { + listeners = new Set() + listenersByToken.set(sessionToken, listeners) + void ipcRenderer.invoke('plugins:openPanelPush', { sessionToken }).catch(() => undefined) + } + listeners.add(listener) + return () => { + const current = listenersByToken.get(sessionToken) + if (!current?.delete(listener) || current.size > 0) { + return + } + listenersByToken.delete(sessionToken) + void ipcRenderer.invoke('plugins:closePanelPush', { sessionToken }).catch(() => undefined) + } +} diff --git a/src/preload/api/plugins-bridge.ts b/src/preload/api/plugins-bridge.ts index b69c1e635b1..3db7fc4b2d2 100644 --- a/src/preload/api/plugins-bridge.ts +++ b/src/preload/api/plugins-bridge.ts @@ -1,4 +1,5 @@ import { ipcRenderer } from 'electron' +import { subscribePluginPanelPush } from './plugin-panel-push-bridge' import type { PluginFrameEntry, PluginFrameTheme @@ -48,6 +49,9 @@ export const pluginsApi = { params?: unknown }): Promise => ipcRenderer.invoke('plugins:panelAction', args), panelState: (args) => ipcRenderer.invoke('plugins:panelState', args), + subscribePanelPush: subscribePluginPanelPush, + getSettings: (args) => ipcRenderer.invoke('plugins:getSettings', args), + setSetting: (args) => ipcRenderer.invoke('plugins:setSetting', args), resolveGitSource: (args) => ipcRenderer.invoke('plugins:resolveGitSource', args), install: (source: PluginHostInstallSource): Promise => ipcRenderer.invoke('plugins:install', source), diff --git a/src/renderer/src/components/plugins/list/PluginManager.catalog.test.tsx b/src/renderer/src/components/plugins/list/PluginManager.catalog.test.tsx index 43f41c1f95b..544d6a10418 100644 --- a/src/renderer/src/components/plugins/list/PluginManager.catalog.test.tsx +++ b/src/renderer/src/components/plugins/list/PluginManager.catalog.test.tsx @@ -107,7 +107,8 @@ const preview: PluginMarketplaceHostInstallPreview = { iconThemes: [], syntaxes: [], customEditors: [], - newFiles: [] + newFiles: [], + settings: [] }, capabilities: [{ kind: 'workspace:read' }] } diff --git a/src/renderer/src/components/plugins/page/PluginContributionActionEvents.tsx b/src/renderer/src/components/plugins/page/PluginContributionActionEvents.tsx index ab2ea8ca59c..74da1de9f72 100644 --- a/src/renderer/src/components/plugins/page/PluginContributionActionEvents.tsx +++ b/src/renderer/src/components/plugins/page/PluginContributionActionEvents.tsx @@ -29,6 +29,11 @@ function eventTitle(event: PluginEventName): string { 'auto.components.settings.PluginContributionActionEvents.agentStatusChanged', 'When an agent’s status changes' ) + case 'workspace.changed': + return translate( + 'auto.components.settings.PluginContributionActionEvents.workspaceChanged', + 'When you switch workspace or its terminals change' + ) } } diff --git a/src/renderer/src/components/plugins/page/PluginDetailPage.tsx b/src/renderer/src/components/plugins/page/PluginDetailPage.tsx index e6e68e9d380..2b92ebe9fdc 100644 --- a/src/renderer/src/components/plugins/page/PluginDetailPage.tsx +++ b/src/renderer/src/components/plugins/page/PluginDetailPage.tsx @@ -13,6 +13,7 @@ import type { usePluginInstallAction } from '../state/use-plugin-install-action' import { PluginDetailInfo, PluginReleaseNotes } from './PluginDetailInfo' import { PluginAddsSection } from './PluginAddsSection' import { PluginAccessSection, PluginLogsSection } from './PluginDetailSections' +import { PluginSettingsSection } from './PluginSettingsSection' import { installedPluginControls, type InstalledRowHandlers } from '../list/PluginManagerRows' import { PluginChips } from '../list/PluginChips' import type { PluginPagePreview } from '../state/use-plugin-catalog' @@ -297,6 +298,12 @@ export function PluginDetailPage({ {plugin && controls?.kind !== 'review' ? ( ) : null} + {plugin ? ( + + ) : null} {plugin?.hasWorker ? : null} diff --git a/src/renderer/src/components/plugins/page/PluginSettingsSection.test.tsx b/src/renderer/src/components/plugins/page/PluginSettingsSection.test.tsx new file mode 100644 index 00000000000..46d682b1a97 --- /dev/null +++ b/src/renderer/src/components/plugins/page/PluginSettingsSection.test.tsx @@ -0,0 +1,55 @@ +// @vitest-environment happy-dom +import { act, cleanup, fireEvent, render, screen } from '@testing-library/react' +import { afterEach, beforeEach, expect, it, vi } from 'vitest' +import { PluginSettingsSection } from './PluginSettingsSection' + +const values: Record = { verbose: false } +const setSetting = vi.fn(async ({ key, value }: { key: string; value: unknown }) => { + values[key] = value + return { ok: true as const } +}) + +beforeEach(() => { + Object.defineProperty(window, 'api', { + configurable: true, + value: { + plugins: { + getSettings: vi.fn(async () => ({ + settings: [ + { key: 'verbose', title: 'Verbose logs', type: 'boolean', default: false }, + { key: 'apiUrl', title: 'Server URL', type: 'string', description: 'Where todos sync' } + ], + values: { ...values } + })), + setSetting + } + } + }) +}) + +afterEach(() => { + cleanup() + setSetting.mockClear() +}) + +it('shows declared settings and writes what the person changes', async () => { + render() + expect(await screen.findByText('Verbose logs')).toBeTruthy() + expect(screen.getByText('Where todos sync')).toBeTruthy() + await act(async () => { + fireEvent.click(screen.getByRole('switch')) + }) + expect(setSetting).toHaveBeenCalledWith({ pluginKey: 'acme.todos', key: 'verbose', value: true }) + const url = screen.getByLabelText('Server URL') + fireEvent.change(url, { target: { value: 'https://todo.example' } }) + // Typing alone writes nothing; leaving the field does. + expect(setSetting).toHaveBeenCalledTimes(1) + await act(async () => { + fireEvent.blur(url) + }) + expect(setSetting).toHaveBeenLastCalledWith({ + pluginKey: 'acme.todos', + key: 'apiUrl', + value: 'https://todo.example' + }) +}) diff --git a/src/renderer/src/components/plugins/page/PluginSettingsSection.tsx b/src/renderer/src/components/plugins/page/PluginSettingsSection.tsx new file mode 100644 index 00000000000..2b01c124523 --- /dev/null +++ b/src/renderer/src/components/plugins/page/PluginSettingsSection.tsx @@ -0,0 +1,170 @@ +import { useId, useState } from 'react' +import { translate } from '@/i18n/i18n' +import { Button } from '../../ui/button' +import { Input } from '../../ui/input' +import { Label } from '../../ui/label' +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../ui/select' +import { Switch } from '../../ui/switch' +import { Textarea } from '../../ui/textarea' +import type { PluginSettingContribution } from '../../../../../shared/plugins/contributions/plugin-settings-contribution' +import type { PluginJsonValue } from '../../../../../shared/plugins/workers/plugin-host-api' +import { DetailSection } from './PluginDetailSections' +import { usePluginDeclaredSettings } from '../state/use-plugin-declared-settings' + +type SettingControlProps = { + id: string + setting: PluginSettingContribution + value: PluginJsonValue | undefined + onCommit: (value: PluginJsonValue) => void +} + +/** Text and numbers commit on blur or Enter, so a half-typed value is never written. */ +function TextSetting({ id, setting, value, onCommit }: SettingControlProps): React.JSX.Element { + const shown = value === undefined || value === null ? '' : String(value) + const [draft, setDraft] = useState(null) + const numeric = setting.type === 'number' || setting.type === 'integer' + const commit = (): void => { + if (draft === null || draft === shown) { + setDraft(null) + return + } + // An emptied field goes back to the default. + onCommit(draft === '' ? null : numeric ? Number(draft) : draft) + setDraft(null) + } + const shared = { + id, + value: draft ?? shown, + placeholder: setting.placeholder, + onChange: (event: { target: { value: string } }) => setDraft(event.target.value), + onBlur: commit + } + return setting.multiline ? ( +